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 does not respect settings in package.json if .git folder is present #5892

Closed
ProfessorSalty opened this issue Mar 28, 2018 · 3 comments

Comments

@ProfessorSalty
Copy link

Do you want to request a feature or report a bug?
Bug
What is the current behavior?
npm t, and node_modules/.bin/jest --watch do not run my test files.
screen shot 2018-03-28 at 1 01 22 pm

node_modules/.bin/jest --watchAll does find and run my tests

screen shot 2018-03-28 at 1 04 21 pm

This is a project I had bootstrapped with CRA and then immediately ejected so I could specify a different path for my tests in package.json. npm t was working fine until my last commit, which gave me this spectacularly fun error:

node[50036] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)

I have since:

  • Running the commands with the --no-cache flag
  • Installed watchman via homebrew
  • Upgraded to the latest version of Jest
  • Tried explicitly setting jest to ignore .git
  • Restarted my computer

While the FSEvents error has gone away, Jest still does not find my test files. The only way that I can make jest --watch work is to remove my .git folder from the project, at which point everything seems to work just fine.

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.

The project is small, so it shouldn't be much trouble to clone:

https://github.com/PortableStick/reddit-react

What is the expected behavior?

It should begin testing and watch for changes normally.

Please provide your exact Jest configuration

Output of jest --showConfig:
jest-config.txt

Run npx envinfo --preset jest in your project directory and paste the
results here

npx: installed 1 in 2.246s

  System:
    OS: macOS Sierra 10.12.6
    CPU: x64 Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
  Binaries:
    Node: 6.11.1
    Yarn: Not Found
    npm: 5.8.0
  npmPackages:
    jest:
      wanted: 20.0.4
      installed: 20.0.4
@rafaelramalho19
Copy link
Contributor

I've cloned your projected an ran jest --watch and it checks out. But that seems to be due to Jest using the working directory as ./node_modules/jest../jest-cli, which does not contain tests.

If you run jest --watch . (note the . that specifies the current working directory) it works fine.

I've submitted a pull request to your project fixing this issue. Can you check it out? :)

@ProfessorSalty
Copy link
Author

Very cool. That FSEvents error came back, but went away again after installing watchman from homebrew. Thanks a ton for the fix, @rafaelramalho19! Since there's no problem with Jest here, I guess I'll close the issue.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants