Skip to content

Tests hang when running  #713

Closed
Closed
@luizkowalski

Description

@luizkowalski

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
``

Activity

gaearon

gaearon commented on Sep 23, 2016

@gaearon
Contributor

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

gaearon

gaearon commented on Sep 23, 2016

@gaearon
Contributor

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

brew install watchman

?

luizkowalski

luizkowalski commented on Sep 23, 2016

@luizkowalski
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

gaearon commented on Sep 23, 2016

@gaearon
Contributor

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

luizkowalski

luizkowalski commented on Sep 23, 2016

@luizkowalski
Author

I do have watchmen 4.7.0 installed

gaearon

gaearon commented on Sep 23, 2016

@gaearon
Contributor

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

gaearon

gaearon commented on Sep 23, 2016

@gaearon
Contributor

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

gaearon

gaearon commented on Sep 23, 2016

@gaearon
Contributor

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

luizkowalski

luizkowalski commented on Sep 23, 2016

@luizkowalski
Author

uninstall watchman fixed!

gaearon

gaearon commented on Sep 23, 2016

@gaearon
Contributor

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

luizkowalski commented on Sep 23, 2016

@luizkowalski
Author

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

gaearon

gaearon commented on Sep 23, 2016

@gaearon
Contributor

Does doing this help?

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

(and then run tests)

3 remaining items

luizkowalski

luizkowalski commented on Sep 23, 2016

@luizkowalski
Author

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

gaearon

gaearon commented on Sep 24, 2016

@gaearon
Contributor

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

dmr

dmr commented on Nov 20, 2016

@dmr
Contributor

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

gaearon

gaearon commented on Nov 20, 2016

@gaearon
Contributor

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

gaearon

gaearon commented on Nov 20, 2016

@gaearon
Contributor
added a commit that references this issue on Nov 22, 2016
locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @luizkowalski@dmr@gaearon

        Issue actions

          Tests hang when running · Issue #713 · facebook/create-react-app