Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Terser test failure output

Inspired by mochajs/mocha#457
  • Loading branch information...
commit 0844b888351dd5c49737b3db4c2684829b8dece8 1 parent 34d19e2
@isaacs isaacs authored
View
12 lib/test.js
@@ -1 +1,11 @@
-module.exports = require("./utils/lifecycle.js").cmd("test")
+module.exports = test
+
+var testCmd = require("./utils/lifecycle.js").cmd("test")
+ , log = require("npmlog")
+
+function test (args, cb) {
+ testCmd(args, function (er) {
+ if (!er) return cb()
+ return cb("Test failed. See above for more details.")
+ })
+}
View
5 lib/utils/error-handler.js
@@ -82,7 +82,10 @@ function errorHandler (er) {
cbCalled = true
if (!er) return exit(0)
- if (!(er instanceof Error)) {
+ if (typeof er === "string") {
+ log.error("", er)
+ return exit(1, true)
+ } else if (!(er instanceof Error)) {
log.error("weird error", er)
return exit(1, true)
}
View
2  test/disabled/failer/package.json
@@ -1,5 +1,5 @@
{ "name" : "npm-test-failer"
, "version" : "9999.999.99"
, "dependencies" : { "base64" : "*" }
-, "scripts" : { "install" : "exit 1" }
+, "scripts" : { "install" : "exit 1", "test": "echo 'This is where the test output would go'; echo 'more test output'; echo 'MOAR MOAR MoAR'; exit 1" }
}
Please sign in to comment.
Something went wrong with that request. Please try again.