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>2015-09-24 01:14:52 +0300
committerRebecca Turner <me@re-becca.org>2015-09-25 01:53:12 +0300
commitf3fd722d9fcafe4c58964a7301f02763491ed8e4 (patch)
treecd98b33c3a816e41cc36691991611d2d2370629c /test
parent4d6018a712e1e8c3780cd3d02e5dda7d2da85fb9 (diff)
test: Cleanup bundled dependencies test
PR-URL: https://github.com/npm/npm/pull/9667
Diffstat (limited to 'test')
-rw-r--r--test/tap/bundled-dependencies-nonarray.js34
1 files changed, 14 insertions, 20 deletions
diff --git a/test/tap/bundled-dependencies-nonarray.js b/test/tap/bundled-dependencies-nonarray.js
index bff0522d0..2a0827200 100644
--- a/test/tap/bundled-dependencies-nonarray.js
+++ b/test/tap/bundled-dependencies-nonarray.js
@@ -1,12 +1,10 @@
var fs = require('graceful-fs')
var path = require('path')
-var osenv = require('osenv')
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var test = require('tap').test
-var npm = require('../../lib/npm.js')
var common = require('../common-tap.js')
var dir = path.resolve(__dirname, 'bundleddependencies')
@@ -36,24 +34,19 @@ test('setup', function (t) {
test('errors on non-array bundleddependencies', function (t) {
t.plan(6)
- process.chdir(pkg)
- npm.load({},
- function () {
- common.npm(['install'], { cwd: pkg }, function (err, code, stdout, stderr) {
- t.ifError(err, 'npm install ran without issue')
- t.notOk(code, 'exited with a non-error code')
- t.notOk(stderr, 'no error output')
+ common.npm(['install'], { cwd: pkg }, function (err, code, stdout, stderr) {
+ t.ifError(err, 'npm install ran without issue')
+ t.is(code, 0, 'exited with a non-error code')
+ t.is(stderr, '', 'no error output')
- common.npm(['install', './pkg-with-bundled'], { cwd: dir },
- function (err, code, stdout, stderr) {
- t.ifError(err, 'npm install ran without issue')
- t.ok(code, 'exited with a error code')
- t.ok(stderr.indexOf('be an array') > -1, 'nice error output')
- }
- )
- })
- }
- )
+ common.npm(['install', './pkg-with-bundled'], { cwd: dir },
+ function (err, code, stdout, stderr) {
+ t.ifError(err, 'npm install ran without issue')
+ t.notEqual(code, 0, 'exited with a error code')
+ t.like(stderr, /be an array/, 'nice error output')
+ }
+ )
+ })
})
test('cleanup', function (t) {
@@ -62,7 +55,9 @@ test('cleanup', function (t) {
})
function bootstrap () {
+ cleanup()
mkdirp.sync(dir)
+ mkdirp.sync(path.join(dir, 'node_modules'))
mkdirp.sync(pkg)
fs.writeFileSync(path.resolve(pkg, 'package.json'), pj)
@@ -72,6 +67,5 @@ function bootstrap () {
}
function cleanup () {
- process.chdir(osenv.tmpdir())
rimraf.sync(dir)
}