bcapd7363q
bcapd7363q

Reputation: 43

how to Cover import statement in jest

how to covered unit test on import module . tried "transformIgnorePatterns" and "coveragePathIgnorePatterns" to ignore it but its not working

enter image description here

Upvotes: 0

Views: 529

Answers (1)

Steven Scott
Steven Scott

Reputation: 11270

In the Jest configuration, in the variable collectCoverageFrom, use a negative entry:

collectCoverageFrom: [
    '<rootDir>/**/*.ts',
    '!<rootDir>/**/*.interface.ts',
    '!<rootDir>/**/*.module.ts',
    '!<rootDir>/**/__mock__/*',
],

Upvotes: 1

Related Questions