-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: abort unfinished tests on async error
This commit updates the test runner's uncaughtException handler to abort tests instead of assuming they finished running. Fixes: #51381 PR-URL: #51996 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
- Loading branch information
Showing
10 changed files
with
60 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/fixtures/test-runner/output/unfinished-suite-async-error.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
const { describe, it } = require('node:test'); | ||
|
||
describe('unfinished suite with asynchronous error', () => { | ||
it('uses callback', (t, done) => { | ||
setImmediate(() => { | ||
throw new Error('callback test does not complete'); | ||
}); | ||
}); | ||
|
||
it('should pass 1'); | ||
}); | ||
|
||
it('should pass 2'); |
43 changes: 43 additions & 0 deletions
43
test/fixtures/test-runner/output/unfinished-suite-async-error.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
TAP version 13 | ||
# Subtest: unfinished suite with asynchronous error | ||
# Subtest: uses callback | ||
not ok 1 - uses callback | ||
--- | ||
duration_ms: * | ||
location: '/test/fixtures/test-runner/output/unfinished-suite-async-error.js:(LINE):3' | ||
failureType: 'uncaughtException' | ||
error: 'callback test does not complete' | ||
code: 'ERR_TEST_FAILURE' | ||
stack: |- | ||
* | ||
* | ||
... | ||
# Subtest: should pass 1 | ||
ok 2 - should pass 1 | ||
--- | ||
duration_ms: * | ||
... | ||
1..2 | ||
not ok 1 - unfinished suite with asynchronous error | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
location: '/test/fixtures/test-runner/output/unfinished-suite-async-error.js:(LINE):1' | ||
failureType: 'subtestsFailed' | ||
error: '1 subtest failed' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
# Subtest: should pass 2 | ||
ok 2 - should pass 2 | ||
--- | ||
duration_ms: * | ||
... | ||
1..2 | ||
# tests 3 | ||
# suites 1 | ||
# pass 2 | ||
# fail 1 | ||
# cancelled 0 | ||
# skipped 0 | ||
# todo 0 | ||
# duration_ms * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters