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

react-scripts test --onlyChanged always runs ALL tests instead of only the changed tests, yarn jest --onlyChanged works as expected. #7324

Open
LaurensBosscher opened this issue Jul 5, 2019 · 2 comments

Comments

@LaurensBosscher
Copy link

LaurensBosscher commented Jul 5, 2019

Describe the bug

If I run yarn jest -o, jest attempts to run 18 tests (out of the 158 in total).

If I run yarn react-scripts test -o, jest attempts to run all tests.

If I edit /node_modules/react-scripts/scripts/test.js so that only the following options are passed to Jest: "argv [ '-o' ]" Jest will still attempt to run all the tests so this doesn't seem like a configuration issue.

Did you try recovering your dependencies?

Yes, 1.16.0

Which terms did you search for in User Guide?

Jest, --watch, --onlyChanged, -o

Environment

Environment Info:

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 12.5.0 - ~/.nvm/versions/node/v12.5.0/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.9.2 - ~/.nvm/versions/node/v12.5.0/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
    Safari: Not Found
  npmPackages:
    babel-plugin-named-asset-import:  0.3.2
    babel-preset-react-app:  9.0.0
    confusing-browser-globals:  1.0.7
    create-react-app:  3.0.1
    eslint-config-react-app:  4.0.1
    react: 16.8.6 => 16.8.6
    react-app-polyfill: ^0.2.2 => 1.0.1
    react-dev-utils:  9.0.1
    react-dom: 16.8.6 => 16.8.6
    react-error-overlay:  5.1.6
    react-scripts: 3.0.1
  npmGlobalPackages:
    create-react-app: Not Found

We're using Typescript.

Steps to reproduce

I understand that this is hard to reproduce, I'm willing to debug this issue if someone could help me to get started with this issue.

Expected behavior

If I run yarn react-scripts test -o, runs only the relevant tests.

Actual behavior

If I run yarn react-scripts test -o, jest attempts to run all tests.

Reproducible demo

Will attempt to create one.

@LaurensBosscher LaurensBosscher changed the title react-scripts test always runs ALL tests instead of only the changed tests, yarn jest --onlyChanged works as expected. react-scripts test --onlyChanged always runs ALL tests instead of only the changed tests, yarn jest --onlyChanged works as expected. Jul 5, 2019
@bugzpodder
Copy link

I'm not seeing an option https://jestjs.io/docs/en/cli for --onlyChanged or -o, can you point me to the docs?

Why are you running yarn react-scripts test instead of yarn test?
And it seems that you said yarn test already give you the end result you wanted? That is the standard way of running tests.

@LaurensBosscher
Copy link
Author

LaurensBosscher commented Jul 5, 2019

I'm not seeing an option https://jestjs.io/docs/en/cli for --onlyChanged or -o, can you point me to the docs?

Sure! https://jestjs.io/docs/en/cli#onlychanged

Why are you running yarn react-scripts test instead of yarn test?

Yarn test is overwritten in our package.json, for a better bugreport I figured I would run yarn react-scripts test to see if that makes a difference.

And it seems that you said yarn test already give you the end result you wanted? That is the standard way of running tests.

No, unfortunately it doesn't.

Yarn test and yearn react-scripts test behave exactly the same. yarn Jest -o** does run only the relevant tests.

Running yarn jest does start Jest directly without the CRA config though, so it doesn't transpile or load JS Dom.

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

No branches or pull requests

3 participants