aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBen Petty <[email protected]>2020-03-19 10:06:13 -0700
committerGitHub <[email protected]>2020-03-19 10:06:13 -0700
commit3d83b4f29f2dbf6f4a642ba24976d4ecbd5d56b1 (patch)
tree8f44a790f35e34c1145664001217976bf0e08b3a /test
parent710c50448f79d7145f524948ddd7a5e9f548fa42 (diff)
downloadnode-coveralls-3d83b4f29f2dbf6f4a642ba24976d4ecbd5d56b1.tar.xz
node-coveralls-3d83b4f29f2dbf6f4a642ba24976d4ecbd5d56b1.zip
Set service_name and/or repo_token from .coveralls.yml regardless of if $COVERALLS_REPO_TOKEN is set (#272)
* using TRAVIS_COMMIT environment variable for git_commit * Setting repo token and service name from .coveralls.yml regardless of if $COVERALLS_REPO_TOKEN * only set options.repo_token from coveralls_yaml_conf if set in .coveralls.yml * Update lib/getOptions.js Co-Authored-By: Derek Herman <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/getOptions.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/getOptions.js b/test/getOptions.js
index becb31f..5850dc2 100644
--- a/test/getOptions.js
+++ b/test/getOptions.js
@@ -45,6 +45,9 @@ describe('getBaseOptions', () => {
it('should set service_name and service_job_id if it\'s running on travis-ci', done => {
testTravisCi(getBaseOptions, done);
});
+ it('should set service_name and service_job_id if it\'s running on travis-pro', done => {
+ testTravisPro(getBaseOptions, done);
+ });
it('should set service_name and service_job_id if it\'s running on jenkins', done => {
testJenkins(getBaseOptions, done);
});
@@ -137,6 +140,9 @@ describe('getOptions', () => {
it('should set service_name and service_job_id if it\'s running on travis-ci', done => {
testTravisCi(getOptions, done);
});
+ it('should set service_name and service_job_id if it\'s running on travis-pro', done => {
+ testTravisPro(getOptions, done);
+ });
it('should set service_name and service_job_id if it\'s running on jenkins', done => {
testJenkins(getOptions, done);
});
@@ -350,6 +356,23 @@ const testTravisCi = (sut, done) => {
});
};
+const testTravisPro = (sut, done) => {
+ const file = path.join(process.cwd(), '.coveralls.yml');
+ const service_name = 'travis-pro';
+ fs.writeFileSync(file, `service_name: ${service_name}`);
+ process.env.TRAVIS = 'TRUE';
+ process.env.TRAVIS_JOB_ID = '1234';
+ process.env.TRAVIS_COMMIT = 'a12s2d3df4f435g45g45g67h5g6';
+ sut((err, options) => {
+ should.not.exist(err);
+ options.service_name.should.equal(service_name);
+ options.service_job_id.should.equal('1234');
+ options.git.head.id.should.equal('a12s2d3df4f435g45g45g67h5g6');
+ fs.unlinkSync(file);
+ done();
+ });
+};
+
const testJenkins = (sut, done) => {
process.env.JENKINS_URL = 'something';
process.env.BUILD_ID = '1234';