Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Commit 3bc4a8e

Browse files
iarnazkat
authored andcommitted
test: cleanup rm-linked
Reviewed-By: @zkat Credit: @iarna PR-URL: #12851
1 parent bf7f7f2 commit 3bc4a8e

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

test/tap/rm-linked.js

+28-16
Original file line numberDiff line numberDiff line change
@@ -65,37 +65,49 @@ var installJSON = {
6565

6666
test('setup', function (t) {
6767
setup()
68-
common.npm(['ls', '-g', '--depth=0'], OPTS, function (err, c, out) {
69-
t.ifError(err)
70-
t.equal(c, 0, 'set up ok')
71-
t.notOk(out.match(/UNMET DEPENDENCY foo@/), "foo isn't in global")
68+
common.npm(['ls', '-g', '--depth=0'], OPTS, function (err, code, stdout, stderr) {
69+
if (err) throw err
70+
t.comment(stdout)
71+
t.comment(stderr)
72+
t.is(code, 0, 'ls -g')
73+
t.notMatch(stdout, /UNMET DEPENDENCY foo@/, "foo isn't in global")
7274
t.end()
7375
})
7476
})
7577

7678
test('creates global link', function (t) {
7779
process.chdir(link)
78-
common.npm(['link'], OPTS, function (err, c, out) {
79-
t.ifError(err, 'link has no error')
80-
common.npm(['ls', '-g'], OPTS, function (err, c, out, stderr) {
81-
t.ifError(err)
82-
t.equal(c, 0)
80+
common.npm(['link'], OPTS, function (err, code, stdout, stderr) {
81+
if (err) throw err
82+
t.is(code, 0, 'link')
83+
t.comment(stdout)
84+
t.comment(stderr)
85+
common.npm(['ls', '-g'], OPTS, function (err, code, stdout, stderr) {
86+
if (err) throw err
87+
t.comment(stdout)
88+
t.comment(stderr)
89+
t.is(code, 0, 'ls -g')
8390
t.equal(stderr, '', 'got expected stderr')
84-
t.has(out, /foo@1.0.0/, 'creates global link ok')
91+
t.match(stdout, /foo@1.0.0/, 'creates global link ok')
8592
t.end()
8693
})
8794
})
8895
})
8996

9097
test('uninstall the global linked package', function (t) {
9198
process.chdir(osenv.tmpdir())
92-
common.npm(['uninstall', '-g', 'foo'], OPTS, function (err) {
93-
t.ifError(err, 'uninstall has no error')
99+
common.npm(['uninstall', '-g', 'foo'], OPTS, function (err, code, stdout, stderr) {
100+
if (err) throw err
101+
t.is(code, 0, 'uninstall -g foo')
102+
t.comment(stdout)
103+
t.comment(stderr)
94104
process.chdir(link)
95-
common.npm(['ls'], OPTS, function (err, c, out) {
96-
t.ifError(err)
97-
t.equal(c, 0)
98-
t.has(out, /baz@1.0.0/, "uninstall didn't remove dep")
105+
common.npm(['ls'], OPTS, function (err, code, stdout) {
106+
if (err) throw err
107+
t.is(code, 0, 'ls')
108+
t.comment(stdout)
109+
t.comment(stderr)
110+
t.match(stdout, /baz@1.0.0/, "uninstall didn't remove dep")
99111
t.end()
100112
})
101113
})

0 commit comments

Comments
 (0)