Single file testing doesn't work correctly after migration to Jest 22
See original GitHub issueDo you want to request a feature or report a bug? a bug
What is the current behavior? Jest tries running test 2 times instead of 1
- 1st run is successful
- 2nd run fails with unmatched snapshot error if such test scenario exists
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install
and yarn test
.
https://github.com/aakula-edmunds/sampleJestIssue
What is the expected behavior? A test should be run only once.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system. https://github.com/aakula-edmunds/sampleJestIssue/tree/master/archetype/config/jest
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Jest not working properly after upgrading to react-scripts ...
Post upgrade I seem to be having a lot of issues with Jest@26.6.0. My mocks do not seem to be working as intended...
Read more >Troubleshooting
Troubleshooting. Uh oh, something went wrong? Use this guide to resolve issues with Jest. Tests are Failing and You Don't Know Why.
Read more >Setup and Teardown
By default, the beforeAll and afterAll blocks apply to every test in a file. You can also group tests together using a describe...
Read more >Snapshot Testing
The first time this test is run, Jest creates a snapshot file that ... snapshot tests will not affect the first one, as...
Read more >Configuring Jest
To read TypeScript configuration files Jest requires ts-node . ... The bail config option can be used here to have Jest stop running...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, I see! I can confirm this (introduced in 22.0.0)
When you run
yarn test server/sample.test.jsx
it runs both the client and server project configs for that single test file, even though the client config shouldn’t run based on thetestMatch
Thanks for following up @adaniliuk!
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.