File tree Expand file tree Collapse file tree
packages/browser/src/client/tester/expect Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ export default async function toMatchScreenshot(
2121 throw new Error ( '\'toMatchScreenshot\' cannot be used with "not"' )
2222 }
2323
24- if ( this . task === undefined || this . currentTestName === undefined ) {
24+ if ( this . task === undefined ) {
2525 throw new Error ( '\'toMatchScreenshot\' cannot be used without test context' )
2626 }
2727
28- const counterName = `${ this . task . result ?. repeatCount ?? 0 } ${ this . testPath } ${ this . currentTestName } `
28+ const counterName = `${ this . task . result ?. repeatCount ?? 0 } ${ this . testPath } ${ this . task . fullTestName } `
2929 let counter = counters . get ( counterName )
3030
3131 if ( counter === undefined ) {
@@ -38,7 +38,7 @@ export default async function toMatchScreenshot(
3838
3939 const name = typeof nameOrOptions === 'string'
4040 ? nameOrOptions
41- : `${ this . currentTestName } ${ counter . current } `
41+ : `${ this . task . fullTestName } ${ counter . current } `
4242
4343 const normalizedOptions : Omit < ScreenshotMatcherArguments [ 2 ] , 'element' > = (
4444 options . screenshotOptions && 'mask' in options . screenshotOptions
@@ -58,7 +58,7 @@ export default async function toMatchScreenshot(
5858 '__vitest_screenshotMatcher' ,
5959 [
6060 name ,
61- this . currentTestName ,
61+ this . task . fullTestName ,
6262 {
6363 element : convertToSelector ( actual ) ,
6464 ...normalizedOptions ,
You can’t perform that action at this time.
0 commit comments