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

Running jest in docker with watch option throw me not supported without git/hg error #5551

Closed
zushenyan opened this issue Feb 13, 2018 · 12 comments

Comments

@zushenyan
Copy link

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Running with jest --watch in docker exits with --watch is not supported without git/hg, please use --watchAll error.

Running with jest --watchAll could run test successfully, however when I am trying to update snapshot with option u or o it still exits with --watch is not supported without git/hg, please use --watchAll error.

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/zushenyan/docker-jest-issue

What is the expected behavior?

Running Jest in Docker without errors like local machine.

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

  • docker Version 17.12.0-ce-mac49 (21995)
  • node 8.9.4-alpine
  • jest 22.2.2
  • yarn 1.3.2 (included in node:8.9.4-alpine)
@alexgurr
Copy link

alexgurr commented Mar 5, 2018

I'm having this issue too, outside of docker. I am running node/jest/yarn natively in MacOS. I experience this with the -u for updating snapshot but also when performing the action described here:

#5725

@xqlsq
Copy link

xqlsq commented Mar 6, 2018

I use jest@22.4.2 run tests, but throw error :

TypeError: environment.setup is not a function. in node_modules/jest-cli/node_modules/jest-runner/build/run_test.js

and I use jest@20.0.4 run tests, but throw error:

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

my packjson file's configure test script:

"test": "jest --env=jsdom --watch"

who can help me?

@SimenB
Copy link
Member

SimenB commented Mar 6, 2018

@xqlsq what does your package.json look like?

@alexgurr
Copy link

alexgurr commented Mar 6, 2018

@xqlsq @SimenB is this really relevant to this issue thread?

@SimenB
Copy link
Member

SimenB commented Mar 6, 2018

Good point, not at all.

@xqlsq your issue is probably a mismatch in jest versions. If not, please open up a new issue if you think it's a bug in Jest. Keep in mind that this issue tracker is not a help forum

@rickhanlonii
Copy link
Member

Fixed by #5696 (unreleased)

@zushenyan
Copy link
Author

zushenyan commented Mar 15, 2018

Actually it was me being silly~

Docker image node:8.9.4-alpine doesn't come with git or hg utilities.

--watch is not supported without git/hg as this error says, to get Jest work with normal watch mode you will have to install these utilities manually in your image.

For anyone puzzled by this issue please take a look at this branch for solution.

Thank you guys for answering.

@christopher-francisco
Copy link

christopher-francisco commented Jul 5, 2018

I have the same problem, but my container DOES have git installed. I even installed watchman on it (built from source) but no luck

@karneaud
Copy link

same issue as @chris-fran

I have the following on a Docker image

git version 2.11.0
node version v11.13.0
jest version 24.5.0.

@bfagundez
Copy link

Same here.
git version: 2.18.1
node version: 10.14.2
jest: 24.9.0

@RMS21
Copy link

RMS21 commented Dec 18, 2019

I used @zushenyan solution it fixed the error for --watch option but it did not reload tests.
I came up with this solution that was running jest with nodemon
cross-env NODE_ENV=test nodemon -L --exec jest

@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 11, 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

9 participants