-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Description
๐ Bug Report
Jest ignores obsolete file snapshots if there are inline snapshots in this test.
To Reproduce
Steps to reproduce the behavior:
test('test', () => {
expect('foo').toMatchSnapshot();
});$ jest
PASS __tests__/test.js
โ test (3ms)
โบ 1 snapshot written.
Snapshot Summary
โบ 1 snapshot written from 1 test suite.
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 1 written, 1 total
Time: 2.244s
Ran all test suites.
Change the above test to use inline snapshots:
test('test', () => {
expect('foo').toMatchInlineSnapshot();
});$ jest
PASS __tests__/test.js
โ test (3ms)
โบ 1 snapshot written.
Snapshot Summary
โบ 1 snapshot written from 1 test suite.
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 1 written, 1 total
Time: 2.302s
Ran all test suites.
Now both a file and an inline snapshots exists. The file snapshot is completely ignored, Jest doesn't report that it's obsolete and doesn't remove it with jest -u.
Expected behavior
Jest should fail on obsolete snapshots and remove them with jest -u.