How can I make tests on my node module when is required to pass a personal token as parameter?
It is causing errors with Travis CI building process:
e.g.: No 'your_personal_access_token' specified.
test.js
e.g.:
var expect = require('chai').expect;
var module = require('../index')({
'your_personal_access_token': <token>
});
And on module, I verify if the parameter was passed to the class when initialized, like below:
index.js
e.g.:
function Module(config) {
if(!config) {
console.error(`No 'config' parameter specified.`);
} else if (!config.your_personal_access_token) {
console.error(`No 'your_personal_access_token' specified.`);
}
...
}
I don't want to expose the token to public. I already tried to use process.env.TOKEN
but it causes same error on Travis CI.
via gcfabri
No comments:
Post a Comment