diff options
author | Dmitry Litvinchenko <karaliti@gmail.com> | 2017-01-25 17:10:49 +0300 |
---|---|---|
committer | Kat Marchán <kzm@sykosomatic.org> | 2017-01-25 17:10:49 +0300 |
commit | d75fc03eda5364f12ac266fa4f66e31c2e44e864 (patch) | |
tree | 76bd1299a5e24be57c9d69fe6b7ecdc6518eff43 /test | |
parent | ae8e71c2b7d64d782af287a21e146d7cea6e5273 (diff) |
run-script: keep exit code (#15413)
PR-URL: https://github.com/npm/npm/pull/15413
Credit: @kapals
Reviewed-By: @iarna
Diffstat (limited to 'test')
-rw-r--r-- | test/tap/run-script.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/tap/run-script.js b/test/tap/run-script.js index 3892337ce..4dea9b836 100644 --- a/test/tap/run-script.js +++ b/test/tap/run-script.js @@ -67,6 +67,14 @@ var preversionOnly = { } } +var exitCode = { + name: 'scripted', + version: '1.2.3', + scripts: { + 'start': 'node -e "process.exit(7)"' + } +} + function testOutput (t, command, er, code, stdout, stderr) { var lines @@ -323,6 +331,17 @@ test('npm run-script no-params (direct only)', function (t) { }) }) +test('npm run-script keep non-zero exit code', function (t) { + writeMetadata(exitCode) + + common.npm(['run-script', 'start'], opts, function (err, code, stdout, stderr) { + t.ifError(err, 'ran run-script without parameters without crashing') + t.equal(code, 7, 'got expected exit code') + t.ok(stderr, 'should generate errors') + t.end() + }) +}) + test('cleanup', function (t) { cleanup() t.end() |