Setting up SonarQube for an AngularJS project utilizing Typescript is a breeze with these simple steps!

After setting up SonarQube and SonarScanner and successfully scanning my project, I noticed that all metrics appear on my screen except for code coverage, which remains at 0%. What could be causing this issue?

#----- Default SonarQube server
sonar.host.url=http://localhost:9000/sonar

#----- Default source code encoding
#sonar.sourceEncoding=UTF-8

# must be unique in a given SonarQube instance
sonar.projectKey=pwta
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=PWTA
sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# This property is optional if sonar.modules is set. 
sonar.sources=client

sonar.language=ts
sonar.exclusions=**/node_modules/**
sonar.typescript.lcov.reportPaths=coverage/lcov.info

The above snippet is from the sonar-project.properties file. The LCOV file located at coverage/lcov.info was generated using the nyc library.

https://i.sstatic.net/eO2S8.jpg

Logs extracted from the command prompt:

INFO: Scanner configuration file: NONE
INFO: Project root configuration file: C:\Repos\pwta-desktop\ui\sonar-project.properties
...

...continues...

...
INFO: Sensor Zero Coverage Sensor (done) | time=248ms
INFO: ------------- Run sensors on project
INFO: SCM provider for this project is: git
INFO: 1 files to be analyzed
INFO: 0/1 files analyzed
WARN: Missing blame information for the following files:
WARN:   * client/version.ts
WARN: This may lead to missing/broken features in SonarQube
INFO: 43 files had no CPD blocks
INFO: Calculating CPD for 300 files
INFO: CPD calculation finished
INFO: Analysis report generated in 3904ms, dir size=2 MB
INFO: Analysis report compressed in 3421ms, zip size=1 MB
INFO: Analysis report uploaded in 145ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/sonar/dashboard?id=pwta
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/sonar/api/ce/task?id=AWmkhBxOhYEp7lx6Lmb2
INFO: Analysis total time: 1:01.823 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: Total time: 1:04.060s
INFO: Final Memory: 19M/407M
INFO: ------------------------------------------------------------------------

The log indicates that the lcov file is being successfully located.

Additionally, there seems to be a complaint regarding a path mentioned in the log above. Could this be contributing to the issue?

Answer №1

It appears that the lcov.info path in your sonar-project.properties file is incorrect. Here is an example of how it should be configured:

# Adjusting for TypeScript settings
sonar.typescript.lcov.reportPaths=coverage/my-app/lcov.info
sonar.test.inclusions=**/*.spec.ts

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I'm receiving an error code 500 when attempting a patch request on my Express backend - what's causing this issue

Whenever my angular frontend sends a patch request to my express backend, all routes work smoothly except for the patch routes. The specific error message that pops up is: Error: No default engine was specified and no extension was provided. Should I be ...

Converting Typescript Object Types to Array Types with Tuple Structures

Presently, I have the following: interface Obj { foo: string, bar: number, baz: boolean } The desired outcome is to convert this interface into the tuple format below: [string, number, boolean] Is there a way to achieve this conversion? Up ...

Bring in a function by its name from the ts-nameof package that is not declared in the d.ts export

Recently, I came across a captivating package that caught my interest and I would love to incorporate it into my TypeScript application: https://github.com/dsherret/ts-nameof However, upon attempting to import the nameof function, I realized it was not be ...

Receiving distinct data from server with Ionic 2 promises

Utilizing ionic 2 RC0 with promises to retrieve data from the server, I am facing an issue where I consistently receive the same data in every request due to the nature of promises. Hence, my question is: How can I tackle this problem and ensure differen ...

Angular.js: The Best Way to Attach a "Change" Event to a Service

Just starting out with angular.js... I have a HTML5 page where I can input new URLs along with names. Now, I need to validate these URLs against a back-end service to see if they already exist. How can I trigger the “onChange” event on the input field ...

Ways to redirect to a different page following a successful execution of a mutation in React-query

I am facing an issue where a memory leak warning appears when I redirect to another page after a mutation. Despite trying various methods, I have not been able to find a solution. The specific warning message is: Warning: Can't perform a React state ...

What are the steps for launching a Yeoman Angular-Fullstack project?

I'm looking to launch a basic Angular project created with the angular fullstack framework. https://github.com/DaftMonk/generator-angular-fullstack I've attempted: yo angular-fullstack test grunt build After this, I ended up with 2 folders i ...

From converting jQuery nav-scroll to a directive in AngularJS: the power of directives

I'm struggling to convert my jQuery code into a pure AngularJS directive. I thought it should work, but I've only created one directive before. Could someone please point out what I might be doing wrong? The directive doesn't seem to have a ...

Error: The function type 'Dispatch<SetStateAction<string>>' cannot be assigned to the type '(value: OptionValue) => void'

I recently dove into the world of integrating Typescript generics with React after reading this insightful article. I followed the code provided in the article, but encountered the following error: Type 'Dispatch<SetStateAction<string>>&ap ...

Trouble navigating through an index of elastic data? Learn how to smoothly scroll with Typescript in conjunction with

I'm currently using the JavaScript client for Elasticsearch to index and search my data, but I've encountered an issue with using the scroll method. Although I can't seem to set the correct index, I am confident in my technique because I am ...

Cannot display value in NumericFormat when using MUI TextField due to prefix restrictions

When using MUI TextField with the NumericFormat and prefix prop, there seems to be an issue. If I start typing a number quickly, only one digit gets registered. On the other hand, if I type slowly all my numbers show up but the prefix disappears. All inp ...

How to invoke a function in an isolated scope of AngularJS using JavaScript

We are in the process of gradually switching our application to work with Angular. I have developed an angular module and a directive that aims to connect specific functionality to an HTML element. angular.module('myApp', [ ]) .controller(&ap ...

Ways to implement ng-show without using attributes

Is there a way to centrally add ng-show to elements in multiple places within my codebase for hiding them? Instead of individually adding ng-show in each template like this: <tr my-row ng-show="$ctrl.model.toShow()"></tr> We can simplify it ...

Update the root URL for a specific asset

Utilizing Angular to access a RESTful API within the same application has been a successful endeavor. I've configured a $resource for the contacts resource at http://sample-site.com/api/contacts While this setup works perfectly, I now find myself nee ...

Using Angular CLI with ES6 instead of TypeScript for your development needs can offer a

Is there a way to utilize an ES6 transpiler such as Babel instead of TypeScript in an Angular CLI project? Are there any specific flags for specifying the script language, similar to using --style? Thank you. ...

Accessing the .env file to configure a NestJS application using TypeORM and a custom provider

I am still learning my way around nestJS and I am currently trying to configure .env for an existing application but encountering some issues. Within my custom provider for the appModule, it looks like this: @Module({ providers: [ AbcService, ...

Encountering an error while trying to read a JSON file in AngularJS

I'm encountering an issue while trying to read a json file in my visual studio 2013 environment. The error message states: The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If ...

ng-switch only 1 element within an ng-repeat loop

Within my ng-repeat, each row features an edit button. When the user clicks on the edit button, the row's element will be updated using ng-switch. For instance: <div>{{sample.name}}</div> change to <input type="text" ng-model="{{sampl ...

Troubleshooting why the ngcheck does not detect if the checkbox is checked

I have come up with a logic, but I am encountering some difficulties in proceeding further. The idea is to use mouseenter/mouseleave events to show/hide a checkbox. If the checkbox is checked, deactivate the mouse and leave function to keep the checkbox v ...

The specified property 'length' is not found on type OkPacket within the mysql2 module

In my code example below, I am simply showcasing a specific scenario: this.getCode = (code: string): Promise<codeObject | false> => { return new Promise((resolve, reject) => { pool.query('SELECT * FROM ?? WHERE code = ...