Skip to content
New issue

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

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

Already on GitHub? # to your account

Tests hang when running #713

Closed
luizkowalski opened this issue Sep 23, 2016 · 19 comments
Closed

Tests hang when running #713

luizkowalski opened this issue Sep 23, 2016 · 19 comments

Comments

@luizkowalski
Copy link

I have a test like this:

test('renders without crashing', () => {
  // const div = document.createElement('div');
  // ReactDOM.render(<App />, div);
  expect(true).toBe(true)
});

when I run it, with npm t it hangs. here is the output

→ npm t --loglevel=silly
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/Cellar/node/6.6.0/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   't',
npm verb cli   '--loglevel=silly' ]
npm info using npm@3.10.7
npm info using node@v6.6.0
npm verb run-script [ 'pretest', 'test', 'posttest' ]
npm info lifecycle reg-dashboard@0.1.0~pretest: reg-dashboard@0.1.0
npm sill lifecycle reg-dashboard@0.1.0~pretest: no script for pretest, continuing
npm info lifecycle reg-dashboard@0.1.0~test: reg-dashboard@0.1.0

> reg-dashboard@0.1.0 test /Users/luizeduardo/js_dev/reg-dashboard
> react-scripts test --env=jsdom

I'm running macOS Sierra with.
I can reproduce it with a new app as well.

the react-scripts:

→ npm ls react-scripts
reg-dashboard@0.1.0 /Users/luizeduardo/js_dev/reg-dashboard
├── react-scripts@0.4.1
``
@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

By "hangs" do you mean that interactive watcher never appears?

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

As mentioned in jestjs/jest#1767 (comment), can you try running

brew install watchman

?

@luizkowalski
Copy link
Author

@gaearon yes, as the log above, I see > react-scripts test --env=jsdom as the last output, and nothing else happens. I tried edit the test files, change the __tests__ folder location, or have just one simple test like expect(true).toBe(true)
I do have watchmen installed, btw.

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

I meant to run this command to update it to 4.7.0 (as explained in jestjs/jest#1767 (comment)).

@luizkowalski
Copy link
Author

I do have watchmen 4.7.0 installed

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

I see. Can you reproduce this on any other computer (with or without Sierra)?

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

I think it would be best if you shared your report in jestjs/jest#1767 to provide more context around this issue.

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

It’s also worth trying to uninstall watchmen and seeing if that fixes the issue.

@luizkowalski
Copy link
Author

uninstall watchman fixed!

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Can you try to install it again now and see if the problem persists? If it does, please also try suggestions in jestjs/jest#1767 (comment) and let us know if either worked.

@luizkowalski
Copy link
Author

Just did, yes, the problem persists if I reinstall.

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Does doing this help?

launchctl unload ~/Library/LaunchAgents/com.github.facebook.watchman.plist
watchman version

(and then run tests)

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Another workaround worth trying is to delete /usr/local/var/run/watchman/<USER>-state and try again.

@gaearon
Copy link
Contributor

gaearon commented Sep 23, 2016

Closing as this is a problem with watchman, and can’t be resolved here. Uninstalling watchman is a reasonable workaround in the meantime.

@gaearon gaearon closed this as completed Sep 23, 2016
@luizkowalski
Copy link
Author

Hey, sorry for the delay.
No, unload didn't worked for me, anyway.
Thanks!

@gaearon
Copy link
Contributor

gaearon commented Sep 24, 2016

I’d appreciate if you could report this upstream to Jest or watchman.

@dmr
Copy link
Contributor

dmr commented Nov 20, 2016

I ran into this and it took me a while to find this issue. --> Can we mention this in the docs somewhere?

@gaearon
Copy link
Contributor

gaearon commented Nov 20, 2016

Sure, a PR to the User Guide with troubleshooting steps would be welcome.

@gaearon
Copy link
Contributor

gaearon commented Nov 20, 2016

dmr added a commit to dmr/create-react-app that referenced this issue Nov 21, 2016
Minor additional information on how to solve watchman problems reported in facebook#713 and facebook#1767
dmr added a commit to dmr/create-react-app that referenced this issue Nov 22, 2016
Add better explanation how to solve facebook#713 and linked related Issues.
gaearon pushed a commit that referenced this issue Nov 23, 2016
* Add a note for OSX users about watchman and jest

Minor additional information on how to solve watchman problems reported in #713 and #1767

* Introduced new Troubleshooting section

Add better explanation how to solve #713 and linked related Issues.

* Tweak wording and add it to TOC
jarlef pushed a commit to jarlef/create-react-app that referenced this issue Nov 28, 2016
* Add a note for OSX users about watchman and jest

Minor additional information on how to solve watchman problems reported in facebook#713 and facebook#1767

* Introduced new Troubleshooting section

Add better explanation how to solve facebook#713 and linked related Issues.

* Tweak wording and add it to TOC
alexdriaguine pushed a commit to alexdriaguine/create-react-app that referenced this issue Jan 23, 2017
* Add a note for OSX users about watchman and jest

Minor additional information on how to solve watchman problems reported in facebook#713 and facebook#1767

* Introduced new Troubleshooting section

Add better explanation how to solve facebook#713 and linked related Issues.

* Tweak wording and add it to TOC
randycoulman pushed a commit to CodingZeal/create-react-app that referenced this issue May 8, 2017
* Add a note for OSX users about watchman and jest

Minor additional information on how to solve watchman problems reported in facebook#713 and facebook#1767

* Introduced new Troubleshooting section

Add better explanation how to solve facebook#713 and linked related Issues.

* Tweak wording and add it to TOC
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants