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

Commit 75ab216

Browse files
committed
test: give a little more info with registry test failure
PR-URL: #10903 Credit: @zkat
1 parent a9f6fe9 commit 75ab216

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

test/tap/registry.js

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ function runTests () {
3838
cwd: ca,
3939
stdio: "inherit"
4040
}
41-
common.npm(["install"], opts, function (err, code) {
41+
common.npm(["install"], opts, function (err, code, stdout, stderr) {
4242
if (err) { throw err }
4343
if (code) {
4444
return test("need install to work", function (t) {
45-
t.fail("install failed with: " + code)
45+
t.fail(
46+
"install failed with: " + code +
47+
'\nstdout: ' + stdout +
48+
'\nstderr: ' + stderr)
4649
t.end()
4750
})
4851

@@ -52,24 +55,32 @@ function runTests () {
5255
env: env,
5356
stdio: "inherit"
5457
}
55-
common.npm(["test", "--", "-Rtap"], opts, function (err, code) {
56-
if (err) { throw err }
57-
if (code) {
58-
return test("need test to work", function (t) {
59-
t.fail("test failed with: " + code)
60-
t.end()
58+
common.npm(
59+
[
60+
"test", "--", "-Rtap"
61+
],
62+
opts,
63+
function (err, code, stdout, stderr) {
64+
if (err) { throw err }
65+
if (code) {
66+
return test("need test to work", function (t) {
67+
t.fail(
68+
"test failed with: " + code +
69+
'\nstdout: ' + stdout +
70+
'\nstderr: ' + stderr)
71+
t.end()
72+
})
73+
}
74+
opts = {
75+
cwd: ca,
76+
env: env,
77+
stdio: "inherit"
78+
}
79+
common.npm(["prune", "--production"], opts, function (err, code) {
80+
if (err) { throw err }
81+
process.exit(code || 0)
82+
})
6183
})
6284
}
63-
opts = {
64-
cwd: ca,
65-
env: env,
66-
stdio: "inherit"
67-
}
68-
common.npm(["prune", "--production"], opts, function (err, code) {
69-
if (err) { throw err }
70-
process.exit(code || 0)
71-
})
72-
})
73-
}
7485
})
7586
}

0 commit comments

Comments
 (0)