question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Single file testing doesn't work correctly after migration to Jest 22

See original GitHub issue

Do 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:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rickhanloniicommented, Feb 13, 2018

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 the testMatch

Thanks for following up @adaniliuk!

0reactions
github-actions[bot]commented, May 13, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found