diff --git a/src/environment.js b/src/environment.js index e01471c..3a95eae 100644 --- a/src/environment.js +++ b/src/environment.js @@ -49,6 +49,9 @@ class Environment { return 'probo'; } else if (this._env.BITBUCKET_BUILD_NUMBER) { return 'bitbucket'; + } else if (this._env.CI) { + // this should always be the last branch + return 'CI/unknown'; } return null; diff --git a/test/environment-test.js b/test/environment-test.js index 8d327ed..c7770c2 100644 --- a/test/environment-test.js +++ b/test/environment-test.js @@ -186,6 +186,32 @@ COMMIT_MESSAGE:A shiny new feature`); }); }); + context('in an unknown CI', function() { + beforeEach(function() { + environment = new Environment({ + CI: 'true', + }); + }); + + it('returns the right CI value', function() { + assert.strictEqual(environment.ci, 'CI/unknown'); + }); + }); + + context('in a known CI env with CI = true', function() { + beforeEach(function() { + environment = new Environment({ + TRAVIS_BUILD_ID: '1234`', + CI: 'true', + }); + }); + + it('returns the right CI value', function() { + assert.notEqual(environment.ci, 'CI/unknown'); + assert.strictEqual(environment.ci, 'travis'); + }); + }); + context('in Travis CI', function() { beforeEach(function() { environment = new Environment({