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

code coverage #1884

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Run tests

permissions:
pull-requests: write

on:
push:
branches:
Expand Down Expand Up @@ -36,6 +39,34 @@ jobs:
- name: format
run: npm run check-format

coverage:
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version-file: '.nvmrc'
cache: npm
- run: npm ci
- name: coverage
run: xvfb-run -a npm test -- --coverage
# - name: Print coverage to PR
# if: github.event_name == 'pull_request'
# env:
# GH_TOKEN: ${{ github.token }}
# run: |
# COVERAGE=$(jq . < coverage/coverage-summary.json)
# gh pr comment ${{ github.event.pull_request.number }} --body "$COVERAGE"
- name: Upload coverage to PR
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: coverage-summary
path: |
coverage/coverage-summary.json
coverage/index.html

test:
strategy:
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ npm-debug.log
dist
out
syntaxes
.coverage
coverage
22 changes: 20 additions & 2 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ 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'],
launchArgs: [
path.join(BASE_SRC_PATH, folderName, 'workspace'),
'--profile-temp',
'--sync=off',
'--disable-extensions',
'--disable-updates',
'--disable-crash-reporter',
'--disable-workspace-trust',
'--disable-telemetry',
],
files: `${BASE_OUT_PATH}/${folderName}/*.test.js`,
mocha: {
ui: 'tdd',
Expand All @@ -30,6 +40,14 @@ const configs = testSuiteFolderNames.map((folderName) => ({
},
}));

const config = defineConfig(configs);
// const config = defineConfig(configs);
const config = defineConfig({
tests: configs,
coverage: {
includeAll: true,
exclude: ['**/src/test', '**/dist', '**/*.test.[tj]s', '**/*.ts'],
reporter: ['text-summary', 'html', 'json-summary'],
},
});

export default config;
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
.vscode-test.mjs
.vscodeignore
.wdio-vscode-service
.coverage
coverage
**/__mocks__
build/
DEVELOPMENT.md
Expand Down
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,8 @@
},
"scripts": {
"prepare": "npm run download:artifacts && cd src/test/e2e && npm install",
"compile": "npm run check-types && npm run lint && node esbuild.mjs",
"compile": "node esbuild.mjs",
"compile:check": "npm run check-types && npm run lint && 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 +946,9 @@
"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",
"pretest": "npm run compile:tests && npm run compile",
"test": "vscode-test",
"test:coverage": "npm run compile:tests && npm run compile && vscode-test --coverage",
"wdio": "npm run compile && wdio run ./src/test/e2e/wdio.conf.ts",
"lint": "eslint",
"format": "prettier --write .",
Expand Down Expand Up @@ -978,7 +980,7 @@
"@types/semver": "^7.5.8",
"@types/vscode": "~1.92",
"@types/which": "^3.0.0",
"@vscode/test-cli": "^0.0.9",
"@vscode/test-cli": "^0.0.10",
"@vscode/test-electron": "^2.3.9",
"@vscode/test-web": "^0.0.56",
"@vscode/vsce": "^3.2.0",
Expand Down
Loading