Skip to content

Commit edf675c

Browse files
committed
feat: ✨ add integration with sonarqube
1 parent d497f97 commit edf675c

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lcov.info
2+
node_modules
3+
.scannerwork

index.test.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
const soma = require('./index.js')
2-
const { deepStrictEqual } = require('assert')
1+
const soma = require("./index.js");
2+
const { deepStrictEqual } = require("assert");
3+
const { test } = require("node:test");
34

4-
;(async () => {
5-
deepStrictEqual(30, soma(15, 15))
6-
})()
5+
/**
6+
* Node v22.11.0 LTS
7+
* node --test --experimental-test-coverage --test-reporter=lcov --test-reporter-destination=lcov.info
8+
* Gerar arquivo lcov.info para integração com sonar scanner
9+
*/
10+
11+
test("teste da funcao soma", () => {
12+
deepStrictEqual(30, soma(15, 15));
13+
});

sonar-project.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sonar.projectKey=ci-project
2+
3+
sonar.sources=.
4+
sonar.exclusions=**/*.test.js
5+
6+
sonar.tests=.
7+
sonar.test.inclusions=**/*.test.js
8+
# sonar.host.url=http://sonarqube:9000
9+
# sonar.login=
10+
sonar.javascript.lcov.reportPaths=lcov.info

0 commit comments

Comments
 (0)