As explained in the Jest Documentation, you can specify multiple thresholds, and can use wild cards. While this is not the glob specific method, like collectCoverageFrom, it will support what you are trying to accomplish.
{
...
"jest": {
"coverageThreshold": {
"global": {
"branches": 50,
"functions": 50,
"lines": 50,
"statements": 50
},
"./src/components/": {
"branches": 40,
"statements": 40
},
"./src/reducers/**/*.js": {
"statements": 90
},
"./src/api/very-important-module.js": {
"branches": 100,
"functions": 100,
"lines": 100,
"statements": 100
}
}
}
}
I have my coverage set to cover the project, and in using the parent directory with a glob, then removing what I do not want to cover, I do get a source tree view. This view then has folder 'A' with overall metrics.
Click into it, then the individual files (or more folders) with the metrics for that folder or file.
Likely still not want you want. I have also run before the Jest
The next option is to create multiple jest.config.js files (jest.config.main.js, jest.config.projectb.js) and run Jest with each of these configuration files, but putting the output into different directories. I use this for test coverage during my e2e tests.
Again, not sure this fully does what you want.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…