몇 가지 새로운 구성을 jest로 설정하고 있는데, 같은 일부 파일을 무시 *.stories.js
했지만 *.js.snap
또는을 사용할 때 *.snap
농담이 잘 작동하지 않습니다.
동일한 용도로 반응 스크립트를 사용하고 있습니다. jest
예를 들어 *.stories.js
아래 명령 만 무시 하면 다음과 같습니다.
react-scripts test --coverage --collectCoverageFrom=!src/**/*.stories.js
------------------------------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
------------------------------------------------|----------|----------|----------|----------|-------------------|
All files | 92.98 | 90 | 96.43 | 94.34 | |
components/atoms/grid | 100 | 100 | 100 | 100 | |
Grid.js | 100 | 100 | 100 | 100 | |
index.js | 0 | 0 | 0 | 0 | |
components/atoms/grid/__snapshots__ | 0 | 100 | 100 | 0 | |
Grid.test.js.snap | 0 | 100 | 100 | 0 | 1 |
components/atoms/grid/components | 100 | 100 | 100 | 100 | |
Cell.js | 100 | 100 | 100 | 100 | |
index.js | 0 | 0 | 0 | 0 | |
components/atoms/grid/components/__snapshots__ | 0 | 100 | 100 | 0 | |
Cell.test.js.snap | 0 | 100 | 100 | 0 | 1 |
components/atoms/grid/helpers | 0 | 0 | 0 | 0 | |
calcOffset.js | 0 | 0 | 0 | 0 | |
index.js | 0 | 0 | 0 | 0 | |
components/atoms/text | 100 | 100 | 100 | 100 | |
Text.js | 100 | 100 | 100 | 100 | |
index.js | 0 | 0 | 0 | 0 | |
components/atoms/text/__snapshots__ | 0 | 100 | 100 | 0 | |
Text.test.js.snap | 0 | 100 | 100 | 0 | 1 |
helpers | 100 | 100 | 100 | 100 | |
breakpoints.js | 100 | 100 | 100 | 100 | |
calcPercent.js | 100 | 100 | 100 | 100 | |
index.js | 0 | 0 | 0 | 0 | |
provider | 100 | 50 | 100 | 100 | |
style.js | 100 | 50 | 100 | 100 | 9 |
theme | 87.5 | 100 | 50 | 100 | |
GlobalStyle.js | 100 | 100 | 100 | 100 | |
colors.js | 100 | 100 | 100 | 100 | |
index.js | 83.33 | 100 | 50 | 100 | |
------------------------------------------------|----------|----------|----------|----------|-------------------|
그러나 내가 추가 *.js.snap
하지 않는 다른 파일을 찾지 못하면snap
react-scripts test --coverage --collectCoverageFrom=!src/**/*.stories.js --collectCoverageFrom=!src/**/*.js.snap
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 0 | 0 | 0 | 0 | |
----------|----------|----------|----------|----------|-------------------|
나는 내부에 구성을 추가했다. package.json
"jest": {
"collectCoverageFrom": [
"!<rootDir>/src/**/*.stories.js",
"src/**/*.{js,jsx}",
"!<rootDir>/node_modules/"
]
},
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다