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

Unit tests are not executed #2889

Closed
jurosh opened this issue Aug 2, 2017 · 7 comments
Closed

Unit tests are not executed #2889

jurosh opened this issue Aug 2, 2017 · 7 comments

Comments

@jurosh
Copy link

jurosh commented Aug 2, 2017

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

I am using latest yarn 0.27.5 and npm 5.2.0 on Windows.

Environment

Steps to Reproduce

  1. Run yarn test or npm test (is running script react-scripts test --env=jsdom)

  2. It says: "Determining test suites to run..." -> "Press a to run all tests."

  3. After hitting a

  4. You see:

No tests found
In C:\PROJECT
  18490 files checked.
  testMatch: C:\PROJECT\src\**\__tests__\**\*.js?(x),C:\PROJECT\src\**\?(*.)(spec|test).js?(x) - 6 matches
  testPathIgnorePatterns: \\node_modules\\ - 18490 matches
Pattern: "" - 0 matches

No tests were executed but there are tests inside in PROJECT/src/ eg. default App.test.js - these tests are being executed when saving changes while in jest watch mode.

Expected Behavior

All tests inside src/**/*.test.js should be executed

Note (Temporary workaround)

Using Windows 10 bash (ubuntu) it's running fine, so looks like it affects only Windows (tested on both - Win 7 & 10)

@Timer Timer added this to the 1.0.11 milestone Aug 2, 2017
@jurosh
Copy link
Author

jurosh commented Aug 4, 2017

FYI Maybe it's related to jestjs/jest#4033

@Timer Timer modified the milestones: 1.0.x, 1.0.11 Aug 9, 2017
@embiem
Copy link

embiem commented Oct 11, 2017

Hello. I can confirm this issue on my machine as well. Thanks to the note's temporary workaround (using bash), I'm able to execute my tests again.

My machine is running:

  • Microsoft Windows 10 Enterprise (x64)
  • Version 10.0.14393 Build 14393

To make sure the issue isn't caused by my project's setup, I created a clean create-react-app project in C:\my-app. The output of running all tests in an admin cmd prompt:

No tests found
In C:\my-app
  14439 files checked.
  testMatch: C:\my-app\src\**\__tests__\**\*.js?(x),C:\my-app\src\**\?(*.)(spec|test).js?(x) - 1 match
  testPathIgnorePatterns: \\node_modules\\ - 14439 matches
Pattern: "" - 0 matches

The "1 match" will have to be the default src/App.test.js file, created when running the create-react-app command. Still, no test is actually executed and the "No tests found" output is shown.

When run using bash on Windows, the output is:

yarn test v1.0.2
$ react-scripts test --env=jsdom
  console.error node_modules\fbjs\lib\warning.js:33
    Warning: React depends on requestAnimationFrame. Make sure that you load a polyfill in older browsers. http://fb.me/react-polyfills

 PASS  src\App.test.js
  √ renders without crashing (24ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.772s
Ran all test suites related to changed files.

@zehbauer
Copy link

Hi,
I solved this issue by removing the locally installed watchman path variable. When running jest --verbose I got "@providesModule naming collision" warnings as reported in issue.
After removing the variable, jest is matching and executing all tests again.
Maybe this workaround helps some of you.
My system is running:

  • Microsoft Windows 10 Enterprise (x64)
  • Version 10.0.15063 Build 15063

@embiem
Copy link

embiem commented Oct 18, 2017

Thank you very much @zehbauer, removing watchman from my path env-var worked!

@gaearon
Copy link
Contributor

gaearon commented Jan 8, 2018

I'll close as that doesn't appear to be an issue on our side.

@gaearon gaearon closed this as completed Jan 8, 2018
@gaearon
Copy link
Contributor

gaearon commented Jan 9, 2018

I can also reproduce this with a computer that has C:\tools\watchman in its %PATH%.

Seems like we should at least figure out what’s causing this.

@gaearon
Copy link
Contributor

gaearon commented Jan 9, 2018

Seems like this is fixed on Jest 22 so I'll close. We'll update to it soon.

As a temporary workaround you can run your tests with --no-watchman, i.e. npm test -- --no-watchman.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants