Repo Now Defunct, as fix was found!
The purpose of this repo is to reproduce the issue described here [jest-snapshot] Custom Snapshot Directories confuse the Obsolete Snapshot Logger #7257
- clone this repo
yarn install
- Run the tests:
$ yarn test
yarn run v1.12.1
$ cp -R src/ dist; jest
PASS dist/__tests__/Link.react.test.js
✓ Link changes the class when hovered (18ms)
Snapshot Summary
› 2 snapshot files obsolete from 2 test suites. To remove them all, run `yarn test -u`.
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 2 files obsolete, 3 passed, 3 total
Time: 1.264s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.yarn test`
- Notice: the tests pass, but also it says there are
2 snapshot files obsolete
. If you subsequently runyarn test -u
it will delete these files, and then running yarn test again, will re-create them, then runningyarn test
again will once again declare that 2 snapshot files are obsolete.
I would expect it to not consider these files obsolete, and to not have this toggling behavior of deleting & recreating all the snapshots.
- Pretends it's using a pre-processor/separate compile phase like
tsc
by copying the files intodist/
before running the tests against thedist/
directory