Uma*_*pta 9 code-coverage reactjs jestjs
我需要帮助来查找代码覆盖率。
我刚刚使用最新的 create-react-app 创建了一个新应用程序。
我正在尝试使用npm run test -- --coverage
. 这是显示空代码覆盖率。任何人都可以帮我找到我失踪的地方。
PASS src/__tests__/App.test.js
? renders without crashing (2ms)
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 0 | 0 | 0 | 0 | |
----------|----------|----------|----------|----------|-------------------|
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 0.17s, estimated 1s
Ran all test suites.
Watch Usage: Press w to show more.
Run Code Online (Sandbox Code Playgroud)
小智 17
https://github.com/facebook/create-react-app/issues/6888
只需将标志添加--watchAll=false
到您的npm run test -- --coverage
Cyb*_*hay 13
尝试将以下内容添加到脚本下的 package.json 中
"test:coverage": "npm test -- --coverage --watchAll=false",
Run Code Online (Sandbox Code Playgroud)
然后你可以运行命令来检查覆盖率'npm run test:coverage'
归档时间: |
|
查看次数: |
3236 次 |
最近记录: |