-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Closed
Copy link
Labels
Description
🐛 Bug Report
When using the new snapshot resolver feature: #6143, the "Obsolete" Snapshot checker is deciding that all my snapshots are obsolete after a test run.
To Reproduce
- Using a simple project, configure a snapshot resolver to move your snapshot files to a different directory-structure.
- Run
yarn testnotice all your tests pass, and snapshots are in their new location - Notice that it says
45 snapshot files obsolete from 45 test suites. - Run
jest -uto remove obsolete snapshots, notice that all your snapshots are gone.
Expected behavior
I would expect that the snapshot files that just got written to wouldn't be considered instantly obsolete.
Speculation: It looks like the custom snapshotResolver isn't invoked when analyzing obsolete snapshots, so Jest doesn't know that these files were actually written to, or something else is weird.
Link to repl or repo (highly encouraged)
I haven't yet figured out how to do Snapshot Testing in repl.it, will upload a repo shortly if I can't find an example.
Run npx envinfo --preset jest
Paste the results here:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Binaries:
Node: 10.10.0 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.0.0 - /usr/local/bin/npm
npmPackages:
@types/jest: 23.x => 23.3.7
jest: ^24.0.0-alpha.1 => 24.0.0-alpha.1