diff --git a/.changes/unreleased/INTERNAL-20241205-163130.yaml b/.changes/unreleased/INTERNAL-20241205-163130.yaml new file mode 100644 index 000000000..9c235c9d8 --- /dev/null +++ b/.changes/unreleased/INTERNAL-20241205-163130.yaml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7949701f4..cf37a13d2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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: diff --git a/.gitignore b/.gitignore index 828e1609e..536a3e549 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .test-extensions *.vsix bin +coverage node_modules npm-debug.log dist diff --git a/.vscode-test.mjs b/.vscode-test.mjs index e47771205..c57d95c5a 100644 --- a/.vscode-test.mjs +++ b/.vscode-test.mjs @@ -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'], @@ -30,6 +31,11 @@ const configs = testSuiteFolderNames.map((folderName) => ({ }, })); -const config = defineConfig(configs); +const config = defineConfig({ + tests: configs, + coverage: { + exclude: ['src/test/**', '**/node_modules/**', '**/dist/**'], + }, +}); export default config; diff --git a/package.json b/package.json index 46870c4b8..77b8e8bcd 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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 .",