question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests outside of src folder shouldn't be run

See original GitHub issue

The README.md says: The .test.js / .spec.js files (or the __tests__ folders) can be located at any depth under the src top level folder.

However, if I create a .spec.js in a e2e folder at the root of the project, it is still executed by npm test

image

I guess that’s a bug. Right now I can workaround by overriding the testPathPattern parameter in my package.json: react-scripts test --env=jsdom --testPathPattern ./src\/.*

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

15reactions
mpywcommented, Sep 19, 2017

I’d like to place all test files outside of src. Do I need to eject?

1reaction
gaearoncommented, Sep 2, 2016

Interesting, thanks for writing up. I probably forgot to limit this. Now that I think of it I think maybe we should allow them to be in top level src, test, tests and __tests__.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running Jest on TypeScript tests in non-src folders of a React ...
I can't be the only one that wants to run tests on server code in TypeScript in a React application. UPDATE I tried...
Read more >
Do you put tests outside the `tests/` folder? - Elm Discourse
Yes. I generally put tests inside the module they are meant to test. A lot of people point out that you shouldnt test...
Read more >
How To Structure React Projects From Beginner To Advanced
Outside the src folder your files will be very project dependent so there is no good universal structure to apply since it will...
Read more >
Organizing Gradle Projects - Gradle User Manual
Optimally, the test source code for each test type should be stored in dedicated source directories. Separated test source code has a positive...
Read more >
Bundling Extensions - Visual Studio Code
src /extension.ts --bundle --outfile=out/main.js --external:vscode --format=cjs --platform=node", "esbuild": "npm run esbuild-base -- --sourcemap", ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found