Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(TFECO-8268) Enable code coverage reporting #1901

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/INTERNAL-20241205-163130.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: INTERNAL
body: Enable code coverage reporting
time: 2024-12-05T16:31:30.723429-05:00
custom:
Issue: "1901"
Repository: vscode-terraform
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ jobs:
cache: npm
- name: npm install
run: npm ci
- name: lint
run: npm run lint
- name: check types
run: npm run check-types
- name: format
run: npm run check-format
- name: lint
run: npm run lint

test:
strategy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.test-extensions
*.vsix
bin
coverage
node_modules
npm-debug.log
dist
Expand Down
16 changes: 15 additions & 1 deletion .vscode-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const testSuiteFolderNames = fs
.map((entry) => entry.name);

const configs = testSuiteFolderNames.map((folderName) => ({
label: `Integration Tests - ${folderName}`,
version: process.env['VSCODE_VERSION'] ?? 'stable',
workspaceFolder: process.env['VSCODE_WORKSPACE_FOLDER'] ?? path.join(BASE_SRC_PATH, folderName, 'workspace'),
launchArgs: ['--disable-extensions', '--disable-workspace-trust'],
Expand All @@ -30,6 +31,19 @@ const configs = testSuiteFolderNames.map((folderName) => ({
},
}));

const config = defineConfig(configs);
const config = defineConfig({
tests: configs,
coverage: {
exclude: ['src/test/**', '**/node_modules/**', '**/dist/**'],
thresholds: {
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80,
},
},
dbanck marked this conversation as resolved.
Show resolved Hide resolved
},
});

export default config;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@
},
"scripts": {
"prepare": "npm run download:artifacts",
"compile": "npm run check-types && npm run lint && node esbuild.mjs",
"compile": "node esbuild.mjs",
"compile:prod": "npm run check-types && npm run lint && node esbuild.mjs --production",
"compile:tests": "tsc -p .",
"watch": "npm-run-all -p watch:esbuild watch:tsc",
Expand All @@ -945,8 +945,8 @@
"download:artifacts": "node ./build/downloader.mjs",
"vscode:prepublish": "npm run compile:prod",
"package": "vsce package",
"pretest": "npm run compile:tests && npm run compile && npm run lint",
"test": "vscode-test",
"pretest": "npm run compile:tests && npm run compile",
"test": "vscode-test --coverage",
"test:ui": "npm run compile:tests && node .vscode-uitest.mjs",
"lint": "eslint",
"format": "prettier --write .",
Expand Down
Loading