Skip to content

Commit e43458e

Browse files
authored
fix(expect): preserve currentTestName in extended matchers (#9106)
1 parent deee83e commit e43458e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/expect/src/jest-extend.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function getMatcherState(
3535
subsetEquality,
3636
}
3737
let task: Test | undefined = util.flag(assertion, 'vitest-test')
38+
const currentTestName = task?.fullTestName ?? ''
3839

3940
if (task?.type !== 'test') {
4041
task = undefined
@@ -43,6 +44,7 @@ function getMatcherState(
4344
const matcherState: MatcherState = {
4445
...getState(expect),
4546
task,
47+
currentTestName,
4648
customTesters: getCustomEqualityTesters(),
4749
isNot,
4850
utils: jestUtils,

0 commit comments

Comments
 (0)