React: No tests found

Created on 1 Jun 2016  路  15Comments  路  Source: facebook/react

Trying to run grunt test on version 16.0.0-alpha return no tests found:
image

Most helpful comment

Found the bug, it only occurs when testFileExtensions is enabled in the Jest config. Moved to Jest repo: https://github.com/facebook/jest/issues/1180

All 15 comments

@omerts running grunt test on the master branch seems to work fine for me.

@Aweary are you getting test results? FWIW, I am on a windows machine .

I am getting test results on master with archlinux

@omerts have you made any changes locally? I'm on OS X and I do get test results as well.

I'm pretty sure tests used to run fine on Windows. I don't have a VM handy to test myself right now. cc @cpojer in case some of the recent jest upgrades have broken that (perhaps something with haste and the filesystem).

It should work fine with 12.1.1.

@Aweary, I did make changes, but I get the same no tests found even when switching back to master.

I don't have any experience with jest, I just know that it looks for __tests__. Does it look for it recursively? Because looking at the root directory I don't see any __tests__folder, only in sub-directories. Maybe there is some problem with the directory lookup in windows.

Specs:
Windows 7 64-bit
node v4.4.0
npm v3.8.1

To make sure, I just did a fresh clone as follows:

git clone https://github.com/facebook/react.git
cd react
npm i
grunt build
grunt test

Still same error:
image

@omerts nice, thanks for the details. Definitely looks like a problem. Someone else running Windows will have to try and reproduce, I can't reproduce at all on OS X.

We are working on fixing this for the next Jest release. Sorry that this is causing trouble.

Hmm... Even when I pass an absolute file path, it still can't find test files:

 .\node_modules\.bin\jest C:\src\react\src\shared\utils\__tests__\KeyEscapeUtils-test.js
Using Jest CLI v12.1.1, jasmine2
No tests found for "C:\src\react\src\shared\utils\__tests__\KeyEscapeUtils-test.js".

I suspect this is an issue in Jest, however I'm currently blocked from easily investigating as Jest doesn't build on Windows due to https://github.com/lerna/lerna/issues/226. I'll investigate more once I get Jest to build properly

If I create a brand new project using Jest v12.1.1 and make a single test in __tests__\foo-test.js, it works fine:

Screenshot

Works in a nested directory too (ie. `c:\src\testappwithjest\foobar__tests__\foo-test.js)

I wonder if it has something to do with the configuration in this repository specifically.

Found the bug, it only occurs when testFileExtensions is enabled in the Jest config. Moved to Jest repo: https://github.com/facebook/jest/issues/1180

Thanks for finding that @Daniel15!

I'm still having this problem on Windows. I suppose jest hasn't been updated to ^13.0.0 on master yet

Yes.. updated to 13.0.0 and it now finds 120 tests

Was this page helpful?
0 / 5 - 0 ratings

Related issues

varghesep picture varghesep  路  3Comments

jimfb picture jimfb  路  3Comments

trusktr picture trusktr  路  3Comments

jvorcak picture jvorcak  路  3Comments

krave1986 picture krave1986  路  3Comments