Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2017-05-30 23:30:40 +0300
committerRebecca Turner <me@re-becca.org>2017-08-23 02:17:30 +0300
commit761577ef3bd60101abdb0e20691e4e675ed2f813 (patch)
tree1fc9294752325fc4389a680f90f8982a90b9d9b1
parentba69f9e832d186a034f0c2599a02828e9b252a51 (diff)
test: test no-global-warns: Use clean env, allow prerelease node warning
Credit: @isaacs Reviewed-By: @iarna PR-URL: https://github.com/npm/npm/pull/16804
-rw-r--r--test/tap/no-global-warns.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/tap/no-global-warns.js b/test/tap/no-global-warns.js
index cae62fff9..577b39312 100644
--- a/test/tap/no-global-warns.js
+++ b/test/tap/no-global-warns.js
@@ -14,7 +14,16 @@ var toInstall = path.join(base, 'to-install')
var config = 'prefix = ' + base
var configPath = path.join(base, '_npmrc')
-var OPTS = { }
+// use a clean environment for this test
+// otherwise local dev-time npm settings can throw it off
+var OPTS = {
+ env: Object.keys(process.env).filter(function (k) {
+ return !/^npm_config_/i.test(k)
+ }).reduce(function (set, k) {
+ set[k] = process.env[k]
+ return set
+ }, {})
+}
var installJSON = {
name: 'to-install',
@@ -43,6 +52,9 @@ test('no-global-warns', function (t) {
OPTS,
function (err, code, stdout, stderr) {
t.ifError(err, 'installed w/o error')
+ const preWarn = 'npm WARN You are using a pre-release version ' +
+ 'of node and things may not work as expected'
+ stderr = stderr.trim().replace(preWarn, '')
t.is(stderr, '', 'no warnings printed to stderr')
t.end()
})