Issue
I'm using lint-staged with Jest testing framework to test only changed files from last commit as described in this blog.
My configuration is as below:
"src/**/*.{ts}": [
"prettier --write",
"tslint --fix --project .",
"jest --bail --findRelatedTests",
"git add"
]
I also want to generate coverage-report for only changed files. To do this, I have to put list of changed files in multiple places.
jest --bail --findRelatedTests <spaceSeparatedListOfSourceFiles> --collectCoverageFrom=<glob>
Using lint-staged, how can I limit both test and coverage-report only for changed files?
Solution
I didn't know about lint-staged
. I'll give it a try. I looked for this a while ago.
Have you tried?
"jest --bail --coverage --findRelatedTests",
Jest docs say that findRelatedTests
can be used together with --coverage to include a test coverage for the source files, no duplicate --collectCoverageFrom arguments needed.
Should work but I haven't tried.
Answered By - bamse
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.