Skip to content

Commit df64c8c

Browse files
committed
Fix null exitCode error in tests
1 parent 11aad4a commit df64c8c

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

lib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ async function buildRoutine(job) {
354354
const sha = data['sha'];
355355
const logDir = path.join(config.dataPath, 'reports', sha);
356356
const logName = path.join(logDir, `std_output-${shortID(sha)}.log`);
357-
await fs.promises.mkdir(logDir, {recursive: true});
357+
await fs.promises.mkdir(logDir, { recursive: true });
358358
const logDump = fs.createWriteStream(logName, {flags: 'w'});
359359
logDump.on('close', () => debug('Closing log file'));
360360
const ops = config.shell ? {'shell': config.shell} : {};

test/lib.test.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ describe('running tests', () => {
366366
execEvent.stderr.emit('data', errmsg);
367367
});
368368
setImmediate(() => {
369-
execEvent.emit('exit', 1, null);
369+
execEvent.exitCode = 1;
370+
execEvent.emit('exit', execEvent.exitCode, null);
370371
});
371372
setImmediate(() => {
372373
execEvent.emit('close', 1, null);
@@ -376,7 +377,8 @@ describe('running tests', () => {
376377
} else {
377378
return () => { // Return function to successfully execute
378379
setImmediate(() => {
379-
execEvent.emit('exit', 0, null);
380+
execEvent.exitCode = 0;
381+
execEvent.emit('exit', execEvent.exitCode, null);
380382
});
381383
setImmediate(() => {
382384
execEvent.emit('close', 0, null);
@@ -569,16 +571,7 @@ describe('running tests', () => {
569571
}
570572

571573
sandbox.stub(queue._events, 'finish').value([validate]);
572-
spawnStub.callsFake(() => {
573-
setImmediate(() => {
574-
execEvent.emit('exit', 0, null);
575-
execEvent.exitCode = 0;
576-
});
577-
setImmediate(() => {
578-
execEvent.emit('close', 0, null);
579-
});
580-
return execEvent;
581-
});
574+
spawnStub.callsFake(childProcessStub());
582575
queue.add({sha: ids[0]});
583576
});
584577

0 commit comments

Comments
 (0)