我想從我的代碼覆蓋率輸出忽略幾個文件。在閱讀文檔coveragePathIgnorePatterns時,它看起來像我可以忽略文件夾。Jest覆蓋忽略
我試圖忽視虛擬和助手從我的報道文件夾,但他們似乎總是包含:
玩笑配置:
{
"browser": true,
"collectCoverageFrom": ["<rootDir>/src/**/*.{js,jsx}", "!<rootDir>/__tests__/__dummy__/test.js"],
"coveragePathIgnorePatterns": ["<rootDir>/node_modules/", "<rootDir>/__tests__/__helpers__/", "<rootDir>/__tests__/__dummy__/"],
"roots": [
"<rootDir>/__tests__/",
"<rootDir>/src/"
],
"modulePaths": [
"<rootDir>/src/"
],
"modulePathIgnorePatterns": [
"<rootDir>/lib/",
"<rootDir>/node_modules/",
"<rootDir>/__tests__/__helpers__/",
"<rootDir>/__tests__/__dummy__/"
],
"setupTestFrameworkScriptFile": "@djforth/jest-matchers",
"testPathIgnorePatterns": [
"<rootDir>/__tests__/__dummy__",
"<rootDir>/__tests__/__dummy__",
"<rootDir>/lib",
"<rootDir>/node_modules",
"<rootDir>/bower_components"
],
"verbose": true
}
我得到如下報告:
-----------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-----------------------|----------|----------|----------|----------|----------------|
All files | 98.87 | 96.48 | 92.5 | 99.55 | |
__helpers__ | 84.21 | 100 | 54.55 | 90.91 | |
test.js | 84.21 | 100 | 54.55 | 90.91 | 6 |
__tests__/__helpers__ | 100 | 100 | 100 | 100 | |
create_spy_obj.js | 100 | 100 | 100 | 100 | |
src | 100 | 80 | 87.5 | 100 | |
index.js | 100 | 80 | 87.5 | 100 | |
src/utils | 100 | 97.73 | 100 | 100 | |
compile_spies.js | 100 | 81.82 | 100 | 100 | |
create_callbacks.js | 100 | 100 | 100 | 100 | |
create_spies.js | 100 | 97.44 | 100 | 100 | |
create_stubs.js | 100 | 100 | 100 | 100 | |
get_spy.js | 100 | 100 | 100 | 100 | |
merger.js | 100 | 100 | 100 | 100 | |
reset_spies.js | 100 | 100 | 100 | 100 | |
title_keys.js | 100 | 100 | 100 | 100 | |
-----------------------|----------|----------|----------|----------|----------------|