diff options
author | Rebecca Turner <me@re-becca.org> | 2017-05-10 02:20:44 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-05-26 04:55:08 +0300 |
commit | c71b4806f83405e14cad408748492ba26fdefd32 (patch) | |
tree | 761831a3ea0e3b8cb1a8245cc0c13b6513a8d554 /test | |
parent | 6c8f95c9478c5c93e64c55a99c10ab5d39fdfb60 (diff) |
test: rewrite bundled-dependencies-nonarray to not use link deps
Diffstat (limited to 'test')
-rw-r--r-- | test/tap/bundled-dependencies-nonarray.js (renamed from test/need-npm5-update/bundled-dependencies-nonarray.js) | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/test/need-npm5-update/bundled-dependencies-nonarray.js b/test/tap/bundled-dependencies-nonarray.js index 2a0827200..04bcfc7d8 100644 --- a/test/need-npm5-update/bundled-dependencies-nonarray.js +++ b/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,24 +35,22 @@ 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') }) }) test('cleanup', function (t) { - cleanup() +// cleanup() t.end() }) |