forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_runner: skip each hooks for skipped tests
When a test is skipped, the corresponding beforeEach and afterEach hooks should also be skipped. Fixes: nodejs#52112
- Loading branch information
Showing
4 changed files
with
35 additions
and
2 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,21 @@ | ||
// Flags: --test-reporter=spec | ||
'use strict'; | ||
const { after, afterEach, before, beforeEach, test } = require('node:test'); | ||
|
||
before(() => { | ||
console.log('BEFORE'); | ||
}); | ||
|
||
beforeEach(() => { | ||
console.log('BEFORE EACH'); | ||
}); | ||
|
||
after(() => { | ||
console.log('AFTER'); | ||
}); | ||
|
||
afterEach(() => { | ||
console.log('AFTER EACH'); | ||
}); | ||
|
||
test('skipped test', { skip: true }); |
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,11 @@ | ||
BEFORE | ||
AFTER | ||
﹣ skipped test (*ms) # SKIP | ||
ℹ tests 1 | ||
ℹ suites 0 | ||
ℹ pass 0 | ||
ℹ fail 0 | ||
ℹ cancelled 0 | ||
ℹ skipped 1 | ||
ℹ 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