SonarCloud (TypeScript): Coverage data not being reported

We recently noticed that coverage is not being recorded for our pipelines:

We are using SonarCloud With Bitbucket cloud.

  • sonarsource/sonarcloud-scan:1.2.1
  • sonarsource/sonarcloud-quality-gate:0.1.4

To make sure it wasn’t a problem on our end, I modified some code for a repository which had code coverage information the last time it ran and ran the scan and quality gate against the new branch. I verified that the coverage artifact was being captured in Bitbucket.

** Output from new branch **

INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=7ms
INFO: Sensor Import of ESLint issues [javascript]
INFO: Importing /opt/atlassian/pipelines/agent/build/lint/lint_report.json
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/NewRelicTelemetry.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/StateMachineNames.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/Telemetry.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/TelemetryAttributes.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/TelemetryProxy.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/index.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/mocks/MemoryTelemetry.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/mocks/MockError.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/mocks/MockTelemetry.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/src/types/ErrorAttribute.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/NewRelicTelemetry.test.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/TelemetryProxy.test.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/changelog.test.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/mocks/MemoryTelemetry.test.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/mocks/MockReceiver.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/mocks/MockTelemetry.test.ts. No ESLint issues will be imported on this file.
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/package.test.ts. No ESLint issues will be imported on this file.
INFO: Sensor Import of ESLint issues [javascript] (done) | time=11ms
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]

** Output from previous run **

INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms
INFO: Sensor TypeScript analysis [javascript]
INFO: Deploying custom rules bundle jar:file:/root/.sonar/cache/f2d4f3985cfdc8a536978941e81bc342/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /opt/atlassian/pipelines/agent/build/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules9841587408682898944
INFO: Found 2 tsconfig.json file(s): [/opt/atlassian/pipelines/agent/build/tsconfig.json, /opt/atlassian/pipelines/agent/build/test/tsconfig.json]
INFO: 10 source files to be analyzed
INFO: Analyzing 10 files using tsconfig: /opt/atlassian/pipelines/agent/build/tsconfig.json
INFO: 10/10 source files have been analyzed
INFO: Sensor TypeScript analysis [javascript] (done) | time=4492ms
INFO: Sensor JavaScript/TypeScript Coverage [javascript]
INFO: Analysing [/opt/atlassian/pipelines/agent/build/coverage/lcov.info]
INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=18ms
INFO: Sensor Import of ESLint issues [javascript]
INFO: Importing /opt/atlassian/pipelines/agent/build/lint/lint_report.json
WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/mocks/MockReceiver.ts. No ESLint issues will be imported on this file.
INFO: Sensor Import of ESLint issues [javascript] (done) | time=4ms
INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]

Looking at the two runs, the old one seems to recognize the code as TypeScript and run coverage accordingly whereas the run on my branch jumps straight in to eslint data.

2 Likes

Coverage appears to be working as expected again. This morning we are seeing coverage reports and the output from the build pipeline shows it is identifying the language as TypeScript again:

`INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=3ms`
`INFO: Sensor TypeScript analysis [javascript]`
`INFO: Deploying custom rules bundle jar:file:/root/.sonar/cache/89a79ed6219c43720f92a0780fe73b4c/sonar-securityjsfrontend-plugin.jar!/js-vulnerabilities-rules-1.0.0.tgz to /opt/atlassian/pipelines/agent/build/.scannerwork/.sonartmp/eslint-bridge-bundle/package/custom-rules5384229726627511207`
`INFO: Found 2 tsconfig.json file(s): [/opt/atlassian/pipelines/agent/build/test/tsconfig.json, /opt/atlassian/pipelines/agent/build/tsconfig.json]`
`INFO: 10 source files to be analyzed`
`INFO: Analyzing 10 files using tsconfig: /opt/atlassian/pipelines/agent/build/test/tsconfig.json`
`INFO: Load project repositories`
`INFO: Load project repositories (done) | time=110ms`
`INFO: 10/10 source files have been analyzed`
`INFO: Sensor TypeScript analysis [javascript] (done) | time=4848ms`
`INFO: Sensor JavaScript/TypeScript Coverage [javascript]`
`INFO: Analysing [/opt/atlassian/pipelines/agent/build/coverage/lcov.info]`
`INFO: Sensor JavaScript/TypeScript Coverage [javascript] (done) | time=17ms`
`INFO: Sensor Import of ESLint issues [javascript]`
`INFO: Importing /opt/atlassian/pipelines/agent/build/lint/lint_report.json`
`WARN: No input file found for /opt/atlassian/pipelines/agent/build/test/unit/mocks/MockReceiver.ts. No ESLint issues will be imported on this file.`
`INFO: Sensor Import of ESLint issues [javascript] (done) | time=3ms`

Hey there.

You were almost certainly impacted by this.

Which was fixed. :slight_smile:

Sorry I didn’t catch this thread in the initial consolidation.

Thank you for the follow-up, Colin.