Using Jest, I want to exclude files from coverage according to the beginning of their filename, regardless of the depth with which the file sits in a directory structure.
Let's say I have something like this:
I would want to exclude any component file beginning with Form
from coverage. Something like
coveragePathIgnorePatterns: [
'src/form/controls/**/*(^Form)*.component.js'
]
That doesn't work, but hopefully you get the gist of what it is I'm trying to accomplish
I use the not (!) operator on the collectCoverageFrom setting, and this seems to work for me:
collectCoverageFrom: [
'<rootDir>/**/*.ts',
'!<rootDir>/**/*.interface.ts',
'!<rootDir>/**/*.mock.ts',
'!<rootDir>/src/main.ts',
'!<rootDir>/src/library/base/abstract-fetch-data-service.ts',
In that case, I believe you can simply add a line:
'!<rootDir>/src/form/controls/**/form*.component.js',