Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jensraaby opened this issue Jan 12, 2017 · 7 comments
Closed

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

jensraaby opened this issue Jan 12, 2017 · 7 comments
Milestone

Comments

@jensraaby
Copy link

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.

@gaearon
Copy link
Contributor

gaearon commented Jan 12, 2017

We should probably scope the watcher to src somehow. Maybe @cpojer has some insight on this, I’m not sure how aggressive Jest watcher is regarding filesystem changes. I would expect that only the dependency tree is watched, but maybe not.

@jensraaby
Copy link
Author

Thanks @gaearon - if there's anything I can do to help fix just point me in the right direction.

@cpojer
Copy link
Contributor

cpojer commented Jan 13, 2017

You may be able to download jest's master version from github, run yarn build and then do yarn link from inside packages/jest. With that, you can try out the latest master version of Jest in your project – we rewrote watch mode and I'm curious whether your problem was solved.

If not, on master it will likely work when using testPathIgnorePatterns for these json files that get written by your test framework.

@jensraaby
Copy link
Author

Thanks @cpojer . I tried what you suggested with the current Jest master, but the issue still happens.

Is there a way to set testPathIgnorePatterns in Create-React-App without ejecting @gaearon ?

I'm wondering whether changing this could help: #1299

I'm all for minimum configuration though.

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

As of Jest 18, this doesn’t appear fixed yet.

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

Let's fix it by fixing #544.
Closing as a duplicate.

@gaearon gaearon closed this as completed Feb 11, 2017
@gaearon gaearon added this to the 0.9.1 milestone Feb 11, 2017
@adamhinckley
Copy link

adamhinckley commented Dec 5, 2018

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

@lock lock bot locked and limited conversation to collaborators Jan 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants