Allow testMatch to be configurable in jest
See original GitHub issueI want to be able to pass different testMatch
https://jestjs.io/docs/en/configuration#testmatch-arraystring for Jest to run tests in specific folders
Currently, it runs tests in the entire codebase. My case is that we have a bunch of microservices, with some shared code in the parent level, such as dependencies. serverless-bundle
is one of them (so it’s not installed in every MS, although it is listed in the serverless’ plugin list).
Although the rest seems to work (for example, webpack), here https://github.com/AnomalyInnovations/serverless-bundle/blob/master/scripts/config/createJestConfig.js#L23 the testMatch
is hardcoded, ponting to the entire codebase. So when I run tests from one service it gets run in others. Allowing this to be configurable would allow me to run tests in a subfolder (which is only the microservice I’m interested in)
Thanks in advance
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:20 (8 by maintainers)
Top GitHub Comments
@gndelia @pal I looked into it a bit more and I got this to work. Let’s take your structure:
In
proy1/package.json
use this as yourtest
command:This will only run the tests inside
proy1/
.Let me know if that works for you.
Thanks for that idea @gndelia, it won’t work in my case however, since I’m only using a single
package.json
in my root dir.For now, I’m able to use a prefix on test names and run tests using
yarn test -t TESTPREFIX
, ornpm test -t FOLDERNAME
. 🤷♂