From 6d2163c5f1093c9e3f99ba2f9772ef0709fafaa3 Mon Sep 17 00:00:00 2001 From: James Pogran Date: Thu, 21 Nov 2024 15:27:10 -0500 Subject: [PATCH] VS Code integration coverage --- .github/workflows/test.yml | 16 ++++++++++++++++ .gitignore | 2 ++ .vscode-test.mjs | 17 +++-------------- .vscodeignore | 2 ++ package.json | 1 + 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 079003c280..4e3cdf8c42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -72,3 +72,19 @@ jobs: - name: Run Tests run: npm test if: runner.os != 'Linux' + + coverage: + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - name: Checkout Repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version-file: '.nvmrc' + cache: npm + - name: npm install + run: npm ci + - name: format + # Coverage summary printed to console and in coverage/coverage-summary.json + run: npm run test:coverage diff --git a/.gitignore b/.gitignore index 80a7de4f8b..74f8737d9b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ npm-debug.log dist out syntaxes +.coverage +coverage diff --git a/.vscode-test.mjs b/.vscode-test.mjs index 4a300a33f0..2635941ea6 100644 --- a/.vscode-test.mjs +++ b/.vscode-test.mjs @@ -27,27 +27,16 @@ const configs = testSuiteFolderNames.map((folderName) => ({ color: true, timeout: 100000, require: ['./out/test/mockSetup.js'], // mocks are shared for all test suites - // reporter: path.join(__dirname, '.mocha-reporter.js'), - reporter: 'json', // "lcov" also generates HTML - reporterOptions: { - jsonReporterOptions: { - output: '.integration-tests.json', - }, - }, }, })); +// const config = defineConfig(configs); const config = defineConfig({ tests: configs, coverage: { includeAll: true, - exclude: [`./out`], - reporter: 'json', // "lcov" also generates HTML - reporterOptions: { - jsonReporterOptions: { - output: '.integration-tests.json', - }, - }, + exclude: ['**/src/test', '**/dist', '**/*.test.[tj]s', '**/*.ts'], + reporter: ['text-summary', 'json-summary'], }, }); diff --git a/.vscodeignore b/.vscodeignore index d307823730..69320d5969 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -16,6 +16,8 @@ .vscode-test.mjs .vscodeignore .wdio-vscode-service +.coverage +coverage **/__mocks__ build/ DEVELOPMENT.md diff --git a/package.json b/package.json index 7a7023f1fb..6c9d9c0d6c 100644 --- a/package.json +++ b/package.json @@ -947,6 +947,7 @@ "package": "vsce package", "pretest": "npm run compile:tests && npm run compile && npm run lint", "test": "vscode-test", + "test:coverage": "vscode-test --coverage", "wdio": "npm run compile && wdio run ./src/test/e2e/wdio.conf.ts", "lint": "eslint", "format": "prettier --write .",