Skip to content

Commit 75b0c35

Browse files
jpanacleto2claude
andcommitted
ci: adiciona cobertura de testes com c8 para satisfazer Quality Gate do SonarCloud
- Adiciona dependência c8 para geração de relatório LCOV - Adiciona script test:coverage no package.json - Atualiza workflow CI para rodar testes com cobertura antes do SonarCloud - Adiciona testes unitários para msgramApi (login, fetchRepositories, fetchScoreForRepo) - Adiciona coverage/ ao .gitignore Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 70a0ba0 commit 75b0c35

4 files changed

Lines changed: 428 additions & 24 deletions

File tree

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: Compilar extensão
2828
run: npm run compile
2929

30+
- name: Rodar testes com cobertura
31+
run: npm run test:coverage
32+
3033
- name: Scanner do SonarCloud
3134
uses: SonarSource/sonarqube-scan-action@v6
3235
env:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,7 @@ lerna-debug.log*
3636
*.vsix
3737

3838
# SonarScanner
39-
.scannerwork/
39+
.scannerwork/
40+
41+
# Coverage reports
42+
coverage/

package.json

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@
1212
"activationEvents": [],
1313
"main": "./out/extension.js",
1414
"contributes": {
15-
"viewsContainers": {
16-
"activitybar": [
17-
{
18-
"id": "msgram-sidebar",
19-
"title": "MeasureSoftGram",
20-
"icon": "assets/icon.svg"
21-
}
22-
]
15+
"viewsContainers": {
16+
"activitybar": [
17+
{
18+
"id": "msgram-sidebar",
19+
"title": "MeasureSoftGram",
20+
"icon": "assets/icon.svg"
21+
}
22+
]
23+
},
24+
"views": {
25+
"msgram-sidebar": [
26+
{
27+
"type": "webview",
28+
"id": "msgram.sidebarView",
29+
"name": "Measure"
30+
}
31+
]
32+
}
2333
},
24-
"views": {
25-
"msgram-sidebar": [
26-
{
27-
"type": "webview",
28-
"id": "msgram.sidebarView",
29-
"name": "Measure"
30-
}
31-
]
32-
}
33-
},
3434
"scripts": {
3535
"install:all": "npm install && cd webview-ui && npm install",
3636
"start:webview": "cd webview-ui && npm run start",
@@ -40,16 +40,20 @@
4040
"watch": "tsc -watch -p ./",
4141
"pretest": "npm run compile && npm run lint",
4242
"lint": "eslint src",
43-
"test": "vscode-test"
43+
"test": "vscode-test",
44+
"test:unit": "npm run compile && mocha --ui tdd --timeout 10000 'out/test/suite/**/*.test.js'",
45+
"test:coverage": "npm run compile && c8 --reporter=lcov --reporter=text mocha --ui tdd --timeout 10000 'out/test/suite/**/*.test.js'"
4446
},
4547
"devDependencies": {
46-
"@types/vscode": "^1.120.0",
4748
"@types/mocha": "^10.0.10",
4849
"@types/node": "22.x",
49-
"typescript-eslint": "^8.56.1",
50+
"@types/vscode": "^1.120.0",
51+
"@vscode/test-cli": "^0.0.12",
52+
"@vscode/test-electron": "^2.5.2",
53+
"c8": "^10.1.3",
5054
"eslint": "^9.39.3",
55+
"mocha": "^11.7.6",
5156
"typescript": "^5.9.3",
52-
"@vscode/test-cli": "^0.0.12",
53-
"@vscode/test-electron": "^2.5.2"
57+
"typescript-eslint": "^8.56.1"
5458
}
5559
}

0 commit comments

Comments
 (0)