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
path: root/test
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-03-17 01:24:42 +0300
committerRebecca Turner <me@re-becca.org>2017-03-17 02:33:51 +0300
commit2a7409fcba6a8fab716c80f56987b255983e048e (patch)
tree203979e47584970ef497140fd63b61b567cecfb0 /test
parenta339311edd8c40c75e5b5ce3415c5db7e1f716e8 (diff)
test: Ensure we aren't using any scoped modules
Because npms prior 4.4.3 can't install dependencies that have bundled scoped modules. This didn't show up sooner because they ALSO had a bug that caused bundled scoped modules to not be included in the bundle. Credit: @iarna PR-URL: https://github.com/npm/npm/pull/16066
Diffstat (limited to 'test')
-rw-r--r--test/tap/00-verify-no-scoped.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/tap/00-verify-no-scoped.js b/test/tap/00-verify-no-scoped.js
new file mode 100644
index 000000000..4f14dea04
--- /dev/null
+++ b/test/tap/00-verify-no-scoped.js
@@ -0,0 +1,30 @@
+'use strict'
+var common = require('../common-tap')
+var test = require('tap').test
+var path = require('path')
+var cwd = path.resolve(__dirname, '..', '..')
+var fs = require('fs')
+
+/*
+We can't include any scoped modules in bundled dependencies due to a bug in
+npm@<4.4.3 that made any module that bundled scoped dependencies
+uninstallable. While this is fixed, we can't have them in ourselves without
+making it impossible to upgrade, thus this test.
+*/
+
+test('no scoped transitive deps', function (t) {
+ t.ok(fs.existsSync(cwd), 'ensure that the path we are calling ls within exists')
+
+ var opt = { cwd: cwd, stdio: [ 'ignore', 'pipe', 2 ] }
+ common.npm(['ls', '--parseable', '--production'], opt, function (err, code, stdout) {
+ t.ifError(err, 'error should not exist')
+ t.equal(code, 0, 'npm ls exited with code')
+ var matchScoped = new RegExp(path.join(cwd, 'node_modules', '.*@').replace(/\\/g, '\\\\'))
+ stdout.split(/\n/).forEach(function (line) {
+ if (matchScoped.test(line)) {
+ t.notLike(line, matchScoped, 'prod deps do not contain scoped modules')
+ }
+ })
+ t.end()
+ })
+})