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

Tests hang when running #713

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

Comments

Projects
None yet
3 participants
@luizkowalski
Copy link

luizkowalski commented Sep 23, 2016

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

This comment has been minimized.

Copy link
Member

gaearon commented Sep 23, 2016

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

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Sep 23, 2016

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

brew install watchman

?

@luizkowalski

This comment has been minimized.

Copy link
Author

luizkowalski commented Sep 23, 2016

@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

This comment has been minimized.

Copy link
Member

gaearon commented Sep 23, 2016

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

@luizkowalski

This comment has been minimized.

Copy link
Author

luizkowalski commented Sep 23, 2016

I do have watchmen 4.7.0 installed

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Sep 23, 2016

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

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Sep 23, 2016

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

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Sep 23, 2016

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

@luizkowalski

This comment has been minimized.

Copy link
Author

luizkowalski commented Sep 23, 2016

uninstall watchman fixed!

@gaearon

This comment has been minimized.

Copy link
Member

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 facebook/jest#1767 (comment) and let us know if either worked.

@luizkowalski

This comment has been minimized.

Copy link
Author

luizkowalski commented Sep 23, 2016

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

@gaearon

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Member

gaearon commented Sep 23, 2016

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

@gaearon

This comment has been minimized.

Copy link
Member

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 Sep 23, 2016

@luizkowalski

This comment has been minimized.

Copy link
Author

luizkowalski commented Sep 23, 2016

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

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Sep 24, 2016

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

@dmr

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

gaearon commented Nov 20, 2016

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

@gaearon

This comment has been minimized.

Copy link
Member

gaearon commented Nov 20, 2016

A few other reported ways to fix it:

dmr added a commit to dmr/create-react-app that referenced this issue Nov 21, 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

dmr added a commit to dmr/create-react-app that referenced this issue Nov 22, 2016

Introduced new Troubleshooting section
Add better explanation how to solve facebook#713 and linked related Issues.

gaearon added a commit that referenced this issue Nov 23, 2016

Add a note for OSX users about watchman and jest (#1080)
* 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 added a commit to jarlef/create-react-app that referenced this issue Nov 28, 2016

Add a note for OSX users about watchman and jest (facebook#1080)
* 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

EnoahNetzach pushed a commit to EnoahNetzach/create-react-app that referenced this issue Dec 7, 2016

Add a note for OSX users about watchman and jest (facebook#1080)
* 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 added a commit to alexdriaguine/create-react-app that referenced this issue Jan 23, 2017

Add a note for OSX users about watchman and jest (facebook#1080)
* 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 added a commit to CodingZeal/create-react-app that referenced this issue May 8, 2017

Add a note for OSX users about watchman and jest (facebook#1080)
* 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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.