mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fixes #6673 The Meteor "dev bundle bin commands" which proxy through to the meteor version of npm/node was not returning the exit code from the command which it executed. This creates problems for things like `meteor npm run script-name` when the exit code is important. This comes into play when you run npm scripts which run tests, lint code, etc. This fix causes the meteor-tool to process.exit with the spawned process exit code. Windows Disclaimer: I used the same flush-buffers-on-exit-in-windows that the tool/cli/main.js uses because I would assume the same problem exists, however, I don't have the Windows environment to test or confirm that this code works at all. Also, couldn't find any tests that directly tested this dev bundle bin-command passing scenario (though hard to search through them all), so I created a barebones test app and tests.
24 lines
741 B
JavaScript
24 lines
741 B
JavaScript
var selftest = require('../tool-testing/selftest.js');
|
|
var Sandbox = selftest.Sandbox;
|
|
|
|
selftest.define("meteor npm run some-script-name - error returns exit status to shell", function () {
|
|
var s = new Sandbox();
|
|
var run;
|
|
|
|
s.createApp("myapp", "dev-bundle-bin-commands");
|
|
s.cd("myapp");
|
|
run = s.run("npm", "run", "exit-with-status");
|
|
run.matchErr("This script has an exit status");
|
|
run.expectExit(1);
|
|
});
|
|
|
|
selftest.define("meteor npm some-script-name - normal exit returns normal to shell", function () {
|
|
var s = new Sandbox();
|
|
var run;
|
|
|
|
s.createApp("myapp", "dev-bundle-bin-commands");
|
|
s.cd("myapp");
|
|
run = s.run("npm", "run", "exit-normally");
|
|
run.match("This script will exit normally");
|
|
run.expectExit(0);
|
|
}); |