-
Notifications
You must be signed in to change notification settings - Fork 204
Description
When using vitest 1.1.1 my snapshots are getting renamed to include the file path.
For example, a test file with:
- path
./lib/chart-components/drawChart.test.ts
- describe name
draw-chart
- test name
should generate an image data url for scenario 38
Would, with jest, generate a snapshot filename:
draw-chart-test-ts-draw-chart-should-generate-an-image-data-url-for-scenario-38-1-snap.png
Whereas with vitest re-running the test generates a new snapshot file with filename:
draw-chart-test-ts-lib-chart-components-draw-chart-test-ts-draw-chart-should-generate-an-image-data-url-for-scenario-38-1-snap.png
Node is then falling over with ENAMETOOLONG error when running the tests from the root directory of my monorepo.
I thought the toMatchImageSnapshot()
option customSnapshotIdentifier
might help but reducing it to:
{
customSnapshotIdentifier: (parameters) =>
kebabCase(`${parameters.currentTestName}`)
}
Gives:
lib-chart-components-draw-chart-test-ts-draw-chart-should-generate-an-image-data-url-for-scenario-38.png
Which tells me the Vitest API differs from Jest.
I'm pretty much blocked by this so help would be appreciated!