diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8df07ee..2ac686c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,8 +36,7 @@ jobs: - name: Build run: pnpm run build -# Tests are not implemented yet - # - name: Test - # run: pnpm run test - # continue-on-error: true + # vscode-test launches a real VS Code instance, which needs a display on Linux. + - name: Test + run: xvfb-run -a pnpm run test diff --git a/.vscodeignore b/.vscodeignore index c6b00f0..1d69387 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -14,6 +14,7 @@ test-data/** .yarnrc vsc-extension-quickstart.md tsconfig.json +tsconfig.test.json esbuild.js eslint.config.mjs pnpm-lock.yaml diff --git a/.whitesource b/.whitesource deleted file mode 100644 index 9c7ae90..0000000 --- a/.whitesource +++ /dev/null @@ -1,14 +0,0 @@ -{ - "scanSettings": { - "baseBranches": [] - }, - "checkRunSettings": { - "vulnerableCheckRunConclusionLevel": "failure", - "displayMode": "diff", - "useMendCheckNames": true - }, - "issueSettings": { - "minSeverityLevel": "LOW", - "issueType": "DEPENDENCY" - } -} \ No newline at end of file diff --git a/README.md b/README.md index 851ed9e..f352e67 100644 --- a/README.md +++ b/README.md @@ -63,3 +63,21 @@ Set the log level in VS Code settings: - Use `logger.warn()` for recoverable issues (e.g., 404s, validation warnings) - Use `logger.error()` for failures (e.g., server errors, exceptions) - Never use `showInformationMessage()` for routine operations—reserve for critical user notifications only + +### Testing + +```bash +pnpm run test +``` + +`vscode-test` downloads and launches a real VS Code instance, so the tests need a display. On a +headless machine (including CI) run them under `xvfb-run -a pnpm run test`. + +The `pretest` hook compiles the sources with `tsconfig.test.json`, which is the only place emit is +configured: the main `tsconfig.json` is type-check only, so the test build overrides it to emit +CommonJS into `out/`. `.vscode-test.mjs` then picks up `out/test/**/*.test.js`. + +### Dependency updates + +Renovate keeps dependencies current. `renovate.json` extends the org-wide preset in +[`EduIDE/.github`](https://github.com/EduIDE/.github), so repo-local config stays minimal. diff --git a/package.json b/package.json index 7006224..0c2f8c8 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,8 @@ "watch:esbuild": "node esbuild.js --watch", "build": "pnpm run ts:check && pnpm run lint && node esbuild.js --production", "package": "vsce package --no-dependencies", - "compile-tests": "tsc -p . --outDir out", - "watch-tests": "tsc -p . -w --outDir out", + "compile-tests": "tsc -p ./tsconfig.test.json", + "watch-tests": "tsc -p ./tsconfig.test.json -w", "pretest": "pnpm run compile-tests && pnpm run compile && pnpm run lint", "ts:check": "tsc --noEmit", "ts:watch": "tsc --noEmit --watch --project tsconfig.json", diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..b54e28f --- /dev/null +++ b/renovate.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["local>EduIDE/.github:renovate-config"], + "postUpdateOptions": ["pnpmDedupe"] +} diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..88dbb83 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,16 @@ +{ + /* The main tsconfig is type-check only (noEmit) and keeps the source module + syntax as authored. vscode-test needs real CommonJS files on disk under + out/, so the test build overrides just enough to emit them. */ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "outDir": "out", + "module": "commonjs", + "moduleResolution": "node10", + "verbatimModuleSyntax": false, + /* Source files import each other with explicit .ts extensions; rewrite + those to .js so the emitted requires resolve. */ + "rewriteRelativeImportExtensions": true + } +}