Problem(s) to solve
The current default value of a snapshot filename is to append .snapshot to the name of generating file (aka a "test file"). For instance foo.test.js → foo.test.js.snapshot.
This breaks any IDE trying to help with the file.
A snapshot file is actually a CJS file.
Proposed solution(s)
Adjust the default filename to ${TEST_FILE_BASENAME}.snap.cjs (see nodejs-loaders/…/test/snapshots.ts).
Ex foo.test.js → foo.test.snap.cjs
IDEs recognise this and render the snapshot file as the CJS that it actually is.
We can mitigate a breaking change by detecting the old on read and renaming the file on disk whilst also outputting a message to the console.
Problem(s) to solve
The current default value of a snapshot filename is to append
.snapshotto the name of generating file (aka a "test file"). For instancefoo.test.js→foo.test.js.snapshot.This breaks any IDE trying to help with the file.
A snapshot file is actually a CJS file.
Proposed solution(s)
Adjust the default filename to
${TEST_FILE_BASENAME}.snap.cjs(seenodejs-loaders/…/test/snapshots.ts).Ex
foo.test.js→foo.test.snap.cjsIDEs recognise this and render the snapshot file as the CJS that it actually is.
We can mitigate a breaking change by detecting the old on read and renaming the file on disk whilst also outputting a message to the console.