Skip to content

Commit cc8b839

Browse files
committed
Ensure AVA exits with code 1 after an unexpected process.exit() in a test worker
It prints the error, so it should fail as such.
1 parent 35f6c86 commit cc8b839

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/run-status.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default class RunStatus extends Emittery {
3838
timeouts: 0,
3939
todoTests: 0,
4040
uncaughtExceptions: 0,
41+
unexpectedProcessExits: 0,
4142
unhandledRejections: 0,
4243
};
4344
}
@@ -56,6 +57,7 @@ export default class RunStatus extends Emittery {
5657
skippedTests: 0,
5758
todoTests: 0,
5859
uncaughtExceptions: 0,
60+
unexpectedProcessExits: 0,
5961
unhandledRejections: 0,
6062
...stats,
6163
});
@@ -167,6 +169,8 @@ export default class RunStatus extends Emittery {
167169
}
168170

169171
case 'process-exit': {
172+
stats.unexpectedProcessExits++;
173+
fileStats.unexpectedProcessExits++;
170174
event.pendingTests = this.pendingTests;
171175
event.pendingTestsLogs = this.pendingTestsLogs;
172176
this.pendingTests = new Map();
@@ -237,6 +241,7 @@ export default class RunStatus extends Emittery {
237241
|| this.stats.sharedWorkerErrors > 0
238242
|| this.stats.timeouts > 0
239243
|| this.stats.uncaughtExceptions > 0
244+
|| this.stats.unexpectedProcessExits > 0
240245
|| this.stats.unhandledRejections > 0
241246
) {
242247
return 1;

0 commit comments

Comments
 (0)