diff options
author | Rebecca Turner <me@re-becca.org> | 2015-08-15 11:36:43 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-08-21 04:59:55 +0300 |
commit | ad3714c2e52778c99c69c4be8e3beb350396708b (patch) | |
tree | e9de5578749ee4e542274104ce2238337f711c20 /test | |
parent | 1cd19c2c12b161bff6f755cb93d5501323b682e1 (diff) |
test: Fix the progress-config test when run from travis or other CI
We have special code to disable the progress bar on travis (and other CI) to
save ourselves and our users a lot of unhelpful output. Unfortunately as
this test didn't take that into account, it immediately exploded in this
envs.
So we fix that up, PLUS we add tests for the various env options for
suppressing progress bars.
PR-URL: https://github.com/npm/npm/pull/9304
Diffstat (limited to 'test')
-rw-r--r-- | test/tap/progress-config.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/tap/progress-config.js b/test/tap/progress-config.js index ce6f4faa1..4b6f806dd 100644 --- a/test/tap/progress-config.js +++ b/test/tap/progress-config.js @@ -8,6 +8,9 @@ var log = require('npmlog') // these various tests. var requireInject = require('require-inject') +// Make sure existing environment vars don't muck up the test +process.env = {} + test('disabled', function (t) { t.plan(1) var npm = requireInject('../../lib/npm.js', {}) @@ -31,3 +34,23 @@ test('default', function (t) { t.is(log.progressEnabled, true, 'should be enabled') }) }) + +test('default-travis', function (t) { + t.plan(1) + global.process.env.TRAVIS = 'true' + var npm = requireInject('../../lib/npm.js', {}) + npm.load({}, function () { + t.is(log.progressEnabled, false, 'should be disabled') + delete global.process.env.TRAVIS + }) +}) + +test('default-ci', function (t) { + t.plan(1) + global.process.env.CI = 'true' + var npm = requireInject('../../lib/npm.js', {}) + npm.load({}, function () { + t.is(log.progressEnabled, false, 'should be disabled') + delete global.process.env.CI + }) +}) |