The template provided by the teachers contained an bug in the way that it was collecting coverage report. It was only collecting data from the webapp module leaving out the information from the restapi. This was due to two reasons:
There was a bug in jest (the test runner), that was saving the file paths with relative paths instead of abosulute. This was a problem in the restapi because the tests were stored in a folder named tests.
Having two github actions jobs to execute the unit tests was making two different test reports that when uploaded to SonarCloud were being overwritten.
In order to solve these two issues it is necessary to do the following changes:
Update the package.json from restapi to change the folder were the tests will be created. Line 6
Replace the two github actions jobs by one action jobs. The job should install the dependencies and run the tests for both modules. In this way we only upload to sonarcloud one test coverage so everything works as expected.
Add a jest.config.ts file to configure jest for the restapi.
You can see the result in lomap_0 repository and the resulting coverage report in SonarCloud
The template provided by the teachers contained an bug in the way that it was collecting coverage report. It was only collecting data from the webapp module leaving out the information from the restapi. This was due to two reasons:
restapi
because the tests were stored in a folder namedtests
.In order to solve these two issues it is necessary to do the following changes:
restapi
to change the folder were the tests will be created. Line 6You can see the result in lomap_0 repository and the resulting coverage report in SonarCloud