Skip to content

resolveSnapshotPath to provide project root #6742

@unional

Description

@unional

Clear and concise description of the problem

Currently, test.resolveSnapshotPath(testfilePath, extension) does not provide a way to discover the project root.

This make it not possible to create snapshots relative to the project root in workspace use case.

for example:

- packages
  - project-a
    # want to create snapshots here, similar to the default of `jest-image-snapshot`
    - __snapshot__
- vitest.config.ts
- vitest.workspace.ts

Suggested solution

pass a context object to the function including project specific info, such as root and other information.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    Status

    Approved

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions