1'use strict' 2var common = require('../common-tap') 3var test = require('tap').test 4var path = require('path') 5var cwd = path.resolve(__dirname, '..', '..') 6var fs = require('fs') 7 8/* 9We can't include any scoped modules in bundled dependencies due to a bug in 10npm@<4.4.3 that made any module that bundled scoped dependencies 11uninstallable. While this is fixed, we can't have them in ourselves without 12making it impossible to upgrade, thus this test. 13*/ 14 15test('no scoped transitive deps', function (t) { 16 t.ok(fs.existsSync(cwd), 'ensure that the path we are calling ls within exists') 17 18 var opt = { cwd: cwd, stdio: [ 'ignore', 'pipe', 2 ] } 19 common.npm(['ls', '--parseable', '--production'], opt, function (err, code, stdout) { 20 t.ifError(err, 'error should not exist') 21 t.equal(code, 0, 'npm ls exited with code') 22 var matchScoped = new RegExp(path.join(cwd, 'node_modules', '.*@').replace(/\\/g, '\\\\')) 23 stdout.split(/\n/).forEach(function (line) { 24 if (matchScoped.test(line)) { 25 t.notLike(line, matchScoped, 'prod deps do not contain scoped modules') 26 } 27 }) 28 t.end() 29 }) 30}) 31