node/deps/npm/test/tap/lifecycle-signal.js

28 lines
752 B
JavaScript
Raw Normal View History

2013-11-21 03:08:52 +08:00
var test = require("tap").test
var npm = require.resolve("../../bin/npm-cli.js")
var node = process.execPath
var spawn = require("child_process").spawn
var path = require("path")
var pkg = path.resolve(__dirname, "lifecycle-signal")
test("lifecycle signal abort", function (t) {
2013-12-12 02:20:26 +08:00
// windows does not use lifecycle signals, abort
if (process.platform === "win32" || process.env.TRAVIS) return t.end()
2013-11-21 03:08:52 +08:00
var child = spawn(node, [npm, "install"], {
cwd: pkg
})
child.on("close", function (code, signal) {
// GNU shell returns a code, no signal
if (process.platform === "linux") {
t.equal(code, 1)
t.equal(signal, null)
return t.end()
}
2013-11-21 03:08:52 +08:00
t.equal(code, null)
t.equal(signal, "SIGSEGV")
t.end()
})
})