TypeScript_JEST TypeScript로 Node TestCast만들기 : 커버리지(Coverage) 생성하고 사용하기 -4

// jest.config.ts import type { Config } from '@jest/types' const config : Config . InitialOptions = { roots : [ '<rootDir>/src' ], transform : { '^.+ \\ .tsx?$' : 'ts-jest' }, testRegex : '(/__test__/.*|( \\ .|/)(test|spec)) \\ .[jt]sx?$' , moduleFileExtensions : [ 'ts' , 'tsx' , 'js' , 'jsx' , 'json' , 'node' ], verbose : true , collectCoverage : true , // 커버리지 사용 collectCoverageFrom : [ '<rootDir>/src/app/**/*.ts' ] // rootDir(루트 경로)에서 src/app폴더안 모든(**)폴더, 파일 및 모든 TypeScript 파일*.ts } export default config ; 커버리지를 사용한다고 하면 위 사진과 같이 테스트 결과가 다르게 나오는 것을 알수 있습니다. HTML문서로 해당 테스트의 커버리지를 확인을 할수 있습니다.