diff --git a/.eslintrc.json b/.eslintrc.json index 1f6c16a2..74529563 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,11 +19,11 @@ "overrides": [ { "files": ["*.ts"], - // Since parserOptions.project is used, can't include files outside of + // Since parserOptions.project is used, we can't include files outside of // the listed tsconfig files and seems silly to add a tsconfig just for - // the one file. It will still be linted by the base config above. It just - // won't be included in this overrides section. - "excludedFiles": ["vitest.config.ts"], + // a few vitest files. These files will still be linted by the base config + // above. They just won't be included in this overrides section. + "excludedFiles": ["__mocks__/**/*.ts", "vitest.config.ts"], "parserOptions": { "project": [ "./tsconfig.json", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c4fd14e7..270110cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ # This action orchestrates CI actions that can be run in parallel. This action # can be listed by any actions that use `workflow_run` as a trigger that depend # on all orchestrated actions being completed (e.g. pr-comment.yml). -name: 'Orchestrator' +name: 'CI Tests' on: push: branches: diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index 7b15d59d..4d9b410b 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -13,7 +13,7 @@ name: End-to-end PR Comment # access to secrets on: workflow_run: - workflows: ['Orchestrator'] + workflows: ['CI Tests'] types: - completed diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index c302e545..e1199ace 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -26,6 +26,16 @@ jobs: npm run report:ctrfsummary sed -i 's/

Test Summary<\/h3>/

Unit Test Summary<\/h3>/' $GITHUB_STEP_SUMMARY npm run report:prcomment + + # The junit-to-ctrf npm package exits with a 0 status code even if + # it fails to parse the JUnit report, so check for the file manually + # and explicilty exit with a non-zero status code if it's not found. + # We do this after npm run report:prcomment so that the PR number can + # still be associated in subsequent steps. + if [ ! -e test-reports/vitest.junit.xml ]; then + echo "No JUnit report found at test-reports/vitest.junit.xml" + exit 1 + fi - name: Save PR Number if: ${{ always() }} run: echo ${{ github.event.number }} > pr-comment/PR-number.txt diff --git a/src/__mocks__/vscode.ts b/__mocks__/vscode.ts similarity index 84% rename from src/__mocks__/vscode.ts rename to __mocks__/vscode.ts index 40573747..6399f5ad 100644 --- a/src/__mocks__/vscode.ts +++ b/__mocks__/vscode.ts @@ -2,7 +2,9 @@ /** * Mock `vscode` module. Note that `vi.mock('vscode')` has to be explicitly * called in any test module needing to use this mock. It will not be loaded - * automatically. + * automatically. This module also needs to be located under the `__mocks__` + * directory under the project root to be found when `vi.mock('vscode')` is + * called. */ import { vi } from 'vitest'; diff --git a/vitest.config.mts b/vitest.config.mts index bcc2ba9f..2e75bc96 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -3,7 +3,7 @@ import { defineConfig } from 'vite'; export default defineConfig({ test: { - root: 'src', + dir: 'src', server: { deps: { // Imports of .js files without extensions fail without this