我正在尝试将一个离子项目与声纳集成,一切似乎都没问题,但覆盖范围,测试是用开玩笑开发的,而test:coverage
任务(jest --coverage
)报告的是97%但我在声纳中获得了0的覆盖率。
npm run test:覆盖结果:
Test Suites: 5 passed, 5 total
Tests: 14 passed, 14 total
Snapshots: 0 total
Time: 3.004s
Ran all test suites.
-----------------------------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
-----------------------------------|----------|----------|----------|----------|----------------|
All files | 97.53 | 75 | 84.85 | 97.22 | |
app | 100 | 76.92 | 100 | 100 | |
app.component.ts | 100 | 76.92 | 100 | 100 | 14 |
app.html | 100 | 100 | 100 | 100 | |
pages/appointment | 100 | 100 | 100 | 100 | |
appointment.module.ts | 100 | 100 | 100 | 100 | |
pages/appointment/appointmentItem | 100 | 76.92 | 100 | 100 | |
appointmentItemPage.html | 100 | 100 | 100 | 100 | |
appointmentItemPage.ts | 100 | 76.92 | 100 | 100 | 17,18 |
pages/appointment/appointmentList | 94.12 | 75 | 80 | 93.33 | |
appointmentListPage.html | 100 | 100 | 100 | 100 | |
appointmentListPage.ts | 93.75 | 75 | 80 | 92.86 | 32 |
pages/home | 85.71 | 66.67 | 66.67 | 83.33 | |
home.html | 100 | 100 | 100 | 100 | |
home.ts | 83.33 | 66.67 | 66.67 | 80 | 16 |
providers/appointment | 100 | 66.67 | 83.33 | 100 | |
appointmentData.ts | 100 | 100 | 83.33 | 100 | |
appointmentProvider.ts | 100 | 66.67 | 100 | 100 | 21 |
prospectData.ts | 100 | 100 | 66.67 | 100 | |
-----------------------------------|----------|----------|----------|----------|----------------|
它正确生成的coverage / lcov.info(文件摘要):
TN:
SF:/home/jmgomez/securitas/sst/src/app/app.component.ts
FN:11,(anonymous_2)
FN:14,MyApp
FN:15,(anonymous_4)
FNF:3
FNH:3
FNDA:1,(anonymous_2)
FNDA:1,MyApp
FNDA:1,(anonymous_4)
DA:11,1
DA:12,1
DA:15,1
DA:18,1
DA:19,1
DA:22,1
LF:6
LH:6
BRDA:14,0,0,1
BRDA:14,0,1,0
BRDA:14,1,0,1
BRDA:14,2,0,1
BRDA:14,2,1,1
BRDA:14,2,2,0
BRDA:14,3,0,1
BRDA:14,3,1,1
BRDA:14,4,0,1
BRDA:14,4,1,1
BRDA:14,4,2,0
BRDA:14,5,0,1
BRDA:14,5,1,1
BRF:13
BRH:10
end_of_record
并链接到sonar-project.properties文件:
sonar.projectKey=sst:app
sonar.projectName=sst_app
sonar.projectVersion=1.0
sonar.sources=./src/
sonar.tests=.
sonar.test.inclusions=**/*.spec.ts
sonar.javascript.lcov.reportPaths=coverage/lcov.info
这是coverage文件夹的列表
ls coverage/ -la
total 36
drwxrwxr-x 3 myuser mygroup 4096 ene 3 12:01 .
drwxrwxr-x 11 myuser mygroup 4096 ene 3 11:57 ..
-rw-rw-r-- 1 myuser mygroup 19778 ene 3 11:57 coverage-final.json
-rw-rw-r-- 1 myuser mygroup 4032 ene 3 11:57 lcov.info
drwxrwxr-x 7 myuser mygroup 4096 dic 20 15:27 lcov-report
sonnar-scanner命令的相关日志行如下:
INFO: Excluded sources:
INFO: **/*.spec.ts
INFO: Included tests:
INFO: **/*.spec.ts
INFO: 35 files indexed
...
INFO: Sensor TypeScript LCOV Coverage Sensor [typescript]
INFO: Sensor TypeScript LCOV Coverage Sensor [typescript] (done) | time=4ms
INFO: Sensor JavaScript Squid Sensor [javascript]
INFO: 1 source files to be analyzed
INFO: Test Coverage Sensor is started
INFO: 1/1 source files have been analyzed
INFO: Analysing [/home/jmgomez/securitas/sst/coverage/lcov.info]
INFO: Sensor JavaScript Squid Sensor [javascript] (done) | time=135ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=29ms
任何提示?我错过了什么?