[ad_1]
Im trying to integrate an ionic project with sonar, and everything seems to be ok but the coverage, tests are developed with jest and the test:coverage task (jest --coverage) is reporting a 97% but I get a 0 coverage in sonar.
npm run test:coverage result:
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 | |
-----------------------------------|----------|----------|----------|----------|----------------|
The coverage/lcov.info it's been correctly generated (abstract of a file):
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
And linked into the sonar-project.properties file:
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
This is the listing for the coverage folder
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
Related log lines for sonnar-scanner command are the following:
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
Any hint?, Am I missing something?
[ad_2]
لینک منبع