How to use lint-staged with a joke --collectCoverageFrom

I use lint-staged with Jest to check only modified files from the last commit, as described in this blog .

My configuration is as follows:

"src/**/*.{ts}": [
  "prettier --write",
  "tslint --fix --project .",
  "jest --bail --findRelatedTests",
  "git add"
]

I also want to create a coverage report only for modified files. To do this, I need to put the list of modified files in several places.

jest --bail --findRelatedTests <spaceSeparatedListOfSourceFiles> --collectCoverageFrom=<glob>

Using lint-staged , how can I limit both the test and the coverage report to modified files only?

+4
source share

Source: https://habr.com/ru/post/1694093/


All Articles