diff options
Diffstat (limited to 'deps/npm/test/tap/bundled-dependencies-nonarray.js')
-rw-r--r-- | deps/npm/test/tap/bundled-dependencies-nonarray.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/deps/npm/test/tap/bundled-dependencies-nonarray.js b/deps/npm/test/tap/bundled-dependencies-nonarray.js index 2a08272008..8f8eeb358f 100644 --- a/deps/npm/test/tap/bundled-dependencies-nonarray.js +++ b/deps/npm/test/tap/bundled-dependencies-nonarray.js @@ -1,3 +1,5 @@ +'use strict' +var Bluebird = require('bluebird') var fs = require('graceful-fs') var path = require('path') @@ -7,7 +9,7 @@ var test = require('tap').test var common = require('../common-tap.js') -var dir = path.resolve(__dirname, 'bundleddependencies') +var dir = path.resolve(__dirname, path.basename(__filename, '.js')) var pkg = path.resolve(dir, 'pkg-with-bundled') var dep = path.resolve(dir, 'a-bundled-dep') @@ -15,10 +17,10 @@ var pj = JSON.stringify({ name: 'pkg-with-bundled', version: '1.0.0', dependencies: { - 'a-bundled-dep': 'file:../a-bundled-dep' + 'a-bundled-dep': 'file:../a-bundled-dep-2.0.0.tgz' }, bundledDependencies: { - 'a-bundled-dep': 'file:../a-bundled-dep' + 'a-bundled-dep': 'file:../a-bundled-dep-2.0.0.tgz' } }, null, 2) + '\n' @@ -33,19 +35,17 @@ test('setup', function (t) { }) test('errors on non-array bundleddependencies', function (t) { - t.plan(6) - 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.notEqual(code, 0, 'exited with a error code') - t.like(stderr, /be an array/, 'nice error output') - } - ) + return Bluebird.try(() => { + return common.npm(['pack', 'a-bundled-dep/'], {cwd: dir, stdio: [0, 1, 2]}) + }).spread((code) => { + t.is(code, 0, 'built a-bundled-dep') + return common.npm(['install'], {cwd: pkg, stdio: [0, 1, 2]}) + }).spread((code) => { + t.is(code, 0, 'prepared pkg-with-bundled') + return common.npm(['pack', 'pkg-with-bundled/'], {cwd: dir, stdio: [0, 1, 'pipe']}) + }).spread((code, _, stderr) => { + t.notEqual(code, 0, 'exited with a error code') + t.like(stderr, /be an array/, 'nice error output') }) }) |