Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/config/browser/expect.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ receives an object with the following properties:
The value provided to [`attachmentsDir`](/config/attachmentsdir), if none is
provided, its default value.

- `project: TestProject` <Version type="experimental">4.1.5</Version> <Experimental />

The [`TestProject`](/api/advanced/test-project) the test belongs to.

For example, to group screenshots by browser:

```ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export function resolveOptions(
testFileName: basename(context.testPath),
testName: sanitize(testName, false),
browserName: context.project.config.browser.name,
project: context.project,
} satisfies Parameters<GlobalOptions['resolveDiffPath']>[0]

return {
Expand Down
6 changes: 6 additions & 0 deletions packages/vitest/src/node/types/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ type ToMatchScreenshotResolvePath = (data: {
* if none is provided, its default value.
*/
attachmentsDir: string
/**
* The {@linkcode https://vitest.dev/api/advanced/test-project|TestProject} the test belongs to.
*
* @experimental
*/
project: TestProject
}) => string

export interface ToMatchScreenshotOptions {
Expand Down
Loading