-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: fix timeout in *Each hook failing further tests
PR-URL: #48925 Backport-PR-URL: #49225 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
- Loading branch information
1 parent
c2f1830
commit 08738b2
Showing
7 changed files
with
385 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Flags: --no-warnings | ||
'use strict'; | ||
const { before, beforeEach, describe, it, after, afterEach } = require('node:test'); | ||
|
||
describe('1 before describe', () => { | ||
const ac = new AbortController(); | ||
before(() => { | ||
console.log('before'); | ||
ac.abort() | ||
}, {signal: ac.signal}); | ||
|
||
it('test 1', () => { | ||
console.log('1.1'); | ||
}); | ||
it('test 2', () => { | ||
console.log('1.2'); | ||
}); | ||
}); | ||
|
||
describe('2 after describe', () => { | ||
const ac = new AbortController(); | ||
after(() => { | ||
console.log('after'); | ||
ac.abort() | ||
}, {signal: ac.signal}); | ||
|
||
it('test 1', () => { | ||
console.log('2.1'); | ||
}); | ||
it('test 2', () => { | ||
console.log('2.2'); | ||
}); | ||
}); | ||
|
||
describe('3 beforeEach describe', () => { | ||
const ac = new AbortController(); | ||
beforeEach(() => { | ||
console.log('beforeEach'); | ||
ac.abort() | ||
}, {signal: ac.signal}); | ||
|
||
it('test 1', () => { | ||
console.log('3.1'); | ||
}); | ||
it('test 2', () => { | ||
console.log('3.2'); | ||
}); | ||
}); | ||
|
||
describe('4 afterEach describe', () => { | ||
const ac = new AbortController(); | ||
afterEach(() => { | ||
console.log('afterEach'); | ||
ac.abort() | ||
}, {signal: ac.signal}); | ||
|
||
it('test 1', () => { | ||
console.log('4.1'); | ||
}); | ||
it('test 2', () => { | ||
console.log('4.2'); | ||
}); | ||
}); |
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,188 @@ | ||
before | ||
2.1 | ||
2.2 | ||
after | ||
beforeEach | ||
4.1 | ||
afterEach | ||
4.2 | ||
TAP version 13 | ||
# Subtest: 1 before describe | ||
# Subtest: test 1 | ||
not ok 1 - test 1 | ||
--- | ||
duration_ms: ZERO | ||
failureType: 'cancelledByParent' | ||
error: 'test did not finish before its parent and was cancelled' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
# Subtest: test 2 | ||
not ok 2 - test 2 | ||
--- | ||
duration_ms: ZERO | ||
failureType: 'cancelledByParent' | ||
error: 'test did not finish before its parent and was cancelled' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
1..2 | ||
not ok 1 - 1 before describe | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
failureType: 'hookFailed' | ||
error: 'This operation was aborted' | ||
code: 20 | ||
name: 'AbortError' | ||
stack: |- | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
... | ||
# Subtest: 2 after describe | ||
# Subtest: test 1 | ||
ok 1 - test 1 | ||
--- | ||
duration_ms: * | ||
... | ||
# Subtest: test 2 | ||
ok 2 - test 2 | ||
--- | ||
duration_ms: * | ||
... | ||
1..2 | ||
not ok 2 - 2 after describe | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
failureType: 'hookFailed' | ||
error: 'This operation was aborted' | ||
code: 20 | ||
name: 'AbortError' | ||
stack: |- | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
... | ||
# Subtest: 3 beforeEach describe | ||
# Subtest: test 1 | ||
not ok 1 - test 1 | ||
--- | ||
duration_ms: * | ||
failureType: 'hookFailed' | ||
error: 'This operation was aborted' | ||
code: 20 | ||
name: 'AbortError' | ||
stack: |- | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
async Promise.all (index 0) | ||
... | ||
# Subtest: test 2 | ||
not ok 2 - test 2 | ||
--- | ||
duration_ms: * | ||
failureType: 'hookFailed' | ||
error: 'This operation was aborted' | ||
code: 20 | ||
name: 'AbortError' | ||
stack: |- | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
async Promise.all (index 0) | ||
... | ||
1..2 | ||
not ok 3 - 3 beforeEach describe | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
failureType: 'subtestsFailed' | ||
error: '2 subtests failed' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
# Subtest: 4 afterEach describe | ||
# Subtest: test 1 | ||
not ok 1 - test 1 | ||
--- | ||
duration_ms: * | ||
failureType: 'hookFailed' | ||
error: 'This operation was aborted' | ||
code: 20 | ||
name: 'AbortError' | ||
stack: |- | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
... | ||
# Subtest: test 2 | ||
not ok 2 - test 2 | ||
--- | ||
duration_ms: * | ||
failureType: 'hookFailed' | ||
error: 'This operation was aborted' | ||
code: 20 | ||
name: 'AbortError' | ||
stack: |- | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
* | ||
... | ||
1..2 | ||
not ok 4 - 4 afterEach describe | ||
--- | ||
duration_ms: * | ||
type: 'suite' | ||
failureType: 'subtestsFailed' | ||
error: '2 subtests failed' | ||
code: 'ERR_TEST_FAILURE' | ||
... | ||
1..4 | ||
# tests 8 | ||
# suites 4 | ||
# pass 2 | ||
# fail 4 | ||
# cancelled 2 | ||
# 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
Oops, something went wrong.