Skip to content

Commit

Permalink
initial coverage setup
Browse files Browse the repository at this point in the history
Improve coverage configs

checkpoint 1

checkpoint 2

checkpoint 3

add task to run test in build-extension workflow

Add sonar cloud analysis step

Remove unused libraries

Add projectKey to sonar properties
  • Loading branch information
fey101 committed Oct 23, 2024
1 parent fa3f77f commit bfb57ea
Show file tree
Hide file tree
Showing 15 changed files with 383 additions and 275 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-vscode-extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ jobs:
working-directory: vscode/microsoft-kiota
- run: npm run lint
working-directory: vscode/microsoft-kiota
- name: run tests(linux)
if: runner.os == 'Linux'
run: xvfb-run -a npm run test-with-coverage
working-directory: vscode/microsoft-kiota
- name: run tests
if: runner.os != 'Linux'
run: npm run test-with-coverage
working-directory: vscode/microsoft-kiota
- name: Run sonar cloud analysis
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: vscode/microsoft-kiota
- run: npm run package
working-directory: vscode/microsoft-kiota
- run: npm i -g @vscode/vsce
Expand Down
86 changes: 0 additions & 86 deletions .github/workflows/sonarcloud.yml

This file was deleted.

1 change: 1 addition & 0 deletions vscode/microsoft-kiota/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ out/
.kiotabin/
*.vsix
.vscode-test
coverage/
11 changes: 10 additions & 1 deletion vscode/microsoft-kiota/.vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
tests:[
{
files: 'out/test/**/*.test.js'
}
],
coverage: {
includeAll: true,
exclude: ["**/src/test", "**/dist", "**/*.test.[tj]s", "**/*.ts"],
reporter: ["text-summary", "html", "json-summary", "lcov", "cobertura"],
},
});
60 changes: 31 additions & 29 deletions vscode/microsoft-kiota/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,35 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "tasks: watch-tests"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "tasks: watch-tests"
}
]
}
2 changes: 2 additions & 0 deletions vscode/microsoft-kiota/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ vsc-extension-quickstart.md
.kiotabin/
.vsix
images/samples/
.vscode-test
coverage/
6 changes: 3 additions & 3 deletions vscode/microsoft-kiota/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import stylisticTs from '@stylistic/eslint-plugin-ts'
import stylisticTs from '@stylistic/eslint-plugin-ts';
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";

export default [{
ignores: ["**/out", "**/dist", "**/*.d.ts", ".vscode-test", "node_modules", "eslint.config.mjs", "webpack.config.cjs"],
ignores: ["**/out", "**/dist", "**/*.d.ts", ".vscode-test", "node_modules", "eslint.config.mjs", "webpack.config.cjs", "coverage"],
}, {
files: ["**/*.ts"],
plugins: {
Expand Down Expand Up @@ -31,4 +31,4 @@ export default [{
"no-throw-literal": "warn",
semi: "off",
},
}];
}];
Loading

0 comments on commit bfb57ea

Please sign in to comment.