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 --watch runs tests twice after chokidar accesses a file #12498

Closed
kumar303 opened this issue Oct 8, 2018 · 0 comments · Fixed by mozilla/addons-frontend#6617
Closed
Assignees
Labels
qa:not_needed repository:addons-frontend Issue relating to addons-frontend
Milestone

Comments

@kumar303
Copy link
Contributor

kumar303 commented Oct 8, 2018

Describe the problem and steps to reproduce it:

  • Start yarn test in a shell
  • Start yarn flow:dev in another shell
  • Edit a file

What happened?

Changing the file causes the tests to run twice.

What did you expect to happen?

The tests should only run once.

Anything else we should know?

It's happening because chokidar changes the file access time shortly after emitting a change event. I'm not sure why. Changing access time causes jest to re-run tests (see jestjs/jest#7124) which seems like a bug.

I deduced it with something like this:

stat -x src/amo/components/AddonReviewCard/index.js
chokidar src/ tests/ -c 'sleep 5 && echo "done"' --initial

I was using the p filter in jest to only run TestAddonReviewCard.js. Since this test suite is fast, it helped to see the flicker of jest running the tests twice.

We fixed a separate (I think?) but related bug in #10514

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qa:not_needed repository:addons-frontend Issue relating to addons-frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants