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.

Jest CLI seems to get stuck in an infinite loop running Pact tests

See original GitHub issue

Description

I’m trying to use PactJS with Create-React-App to add some contract tests for an API client. The PactJS examples include a Jest example which I copied into my CRA based project. When I run “npm test” or “yarn test” the tests run and pass/fail as expected, but then they keep running every time they complete. I think this is because the Pact tests generate artefacts (JSON files and log files).

Expected behavior

When I run npm test, and press a, the tests run once. The tests should run as normal, and not be re-triggered by the generated log files (in the logs/ directory) or pact json artefacts (in the pacts/ directory) .

Actual behavior

Jest interactive mode keeps re-running the tests forever.

Environment

  1. npm ls react-scripts (if you haven’t ejected):
pmui@0.0.1 ..../pmui
└── react-scripts@0.8.5
  1. node -v: v7.4.0
  2. npm -v: 4.0.5

Then, specify:

  1. Operating system: Mac OS X 10.9.5
  2. Browser and version: n/a

Reproducible Demo

I have reproduced the issue here: https://github.com/jensraaby/pact-create-react-app-example.

Simply run npm test (or yarn test) and observe the infinite loop beginning. As explained above, I think the problem is to do with the log file or the pact JSON file that is generated by the test.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
adamhinckleycommented, Dec 5, 2018

I am having this problem today @gaearon. It seems to be broken again.

1reaction
gaearoncommented, Feb 11, 2017

Let’s fix it by fixing https://github.com/facebookincubator/create-react-app/issues/544. Closing as a duplicate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - jest hangs indefinitely, runs no tests
I have discovered a workaround which is to run using the --runInBand flag, which just runs tests in the same thread: jest --runInBand....
Read more >
A brand new website interface for an even better experience!
Jest CLI seems to get stuck in an infinite loop running Pact tests.
Read more >
pact-net-development
CLI is easier but we get isolated from the run, getting something back requires us to use a headless prompt and read in...
Read more >
SQUARISM
I have run into terrible web apis written late or poorly as a feature reluctantly bolted on. Misformed XML, weird JSON, wrong verbs....
Read more >
The 250 Best Songs of the 1990s
Here are the 250 songs that would make up Pitchfork's ultimate '90s mixtape. Read Pitchfork's list of the best albums of the 1990s...
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