Create-react-app: npm test does not detect new test file changes

Created on 19 Oct 2016  ·  6Comments  ·  Source: facebook/create-react-app

Hi

I created a new app using create-react-app. When npm test is run i get following message

I am using node v4.6.1 and npm 2.15.9

No tests found related to files changed since last commit.
Press a to run all tests, or run Jest with --watchAll.

Watch Usage
› Press a to run all tests.
› Press p to filter by a filename regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.

Even if the App.test.js file is changed that doesnt trigger the npm test.

Most helpful comment

Hi I am having the same issue : I get the "No tests found related to files changed since last commit." error-I see the test passing locally, but when I run the same job with jenkins it says : no tests found"
I have compared the workspace of jenkins , src code and the git repo .. all have the same code..
thanks for any help--
And I added a after npm test in the build actions but it did not work
I also tried jest --watchAll still it did not work
Naveen 👍

All 6 comments

What do you see when you run git status in that project?

I got

Your branch is up-to-date with 'origin/master'.

Then this is by design: you have committed the changes.
Please see the message:

No tests found related to files changed since last commit.

The test runner assumes that you don't commit code that fails the tests. This lets it run the tests much faster on larger projects because it only runs tests related to "dirty" files.

Even so, if you want to run all tests (and if you commit broken code), press "a" in the test runner:

Press a to run all tests, or run Jest with --watchAll.

If you are running the test from an IDE or have the command stored somewhere. Add a after the command: npm test a

Hi I am having the same issue : I get the "No tests found related to files changed since last commit." error-I see the test passing locally, but when I run the same job with jenkins it says : no tests found"
I have compared the workspace of jenkins , src code and the git repo .. all have the same code..
thanks for any help--
And I added a after npm test in the build actions but it did not work
I also tried jest --watchAll still it did not work
Naveen 👍

Hello
I am having the same behavior. I committed everything, then I modify 1 file and its test and I get the "No tests found related to files changed since last commit."

But then, if I modify "App.test" it does trigger the test on that file. There are also some _other_ components that do trigger the test. But I can't find why some do and some other don't...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

onelson picture onelson  ·  3Comments

jnachtigall picture jnachtigall  ·  3Comments

Aranir picture Aranir  ·  3Comments

adrice727 picture adrice727  ·  3Comments

dualcnhq picture dualcnhq  ·  3Comments