|
@@ -57,10 +57,20 @@ describe('utilityProcess module', () => {
|
|
|
await once(child, 'spawn');
|
|
|
});
|
|
|
|
|
|
- it('emits \'exit\' when child process exits gracefully', async () => {
|
|
|
+ it('emits \'exit\' when child process exits gracefully', (done) => {
|
|
|
const child = utilityProcess.fork(path.join(fixturesPath, 'empty.js'));
|
|
|
- const [code] = await once(child, 'exit');
|
|
|
- expect(code).to.equal(0);
|
|
|
+ child.on('exit', (code) => {
|
|
|
+ expect(code).to.equal(0);
|
|
|
+ done();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('emits \'exit\' when the child process file does not exist', (done) => {
|
|
|
+ const child = utilityProcess.fork('nonexistent');
|
|
|
+ child.on('exit', (code) => {
|
|
|
+ expect(code).to.equal(1);
|
|
|
+ done();
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
ifit(!isWindows32Bit)('emits the correct error code when child process exits nonzero', async () => {
|