Skip to content
Merged
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
11 changes: 0 additions & 11 deletions .vscode-test.mjs

This file was deleted.

1 change: 0 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ demo/**
.eslintignore
.eslintrc.json
eslint.config.js
.vscode-test.mjs
.gitattributes
.gitignore
.gitignore-revs
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
### Maintenance

- Updated CI to Node.js 24 and current Node.js 24-based GitHub Actions.
- Migrated extension tests to the current VS Code test CLI, including automatic installation of declared extension dependencies.
- Updated the VS Code test runtime to support current macOS runners.
- Updated the VS Code Electron test harness for current CI runners without replacing the project's custom test entry point.
- Added weekly Dependabot updates for npm packages and GitHub Actions.

## [0.5.4] - 2025-12-23
Expand Down
4 changes: 4 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ module.exports = [
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ caughtErrors: "none" },
],
},
},
];
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"lint": "eslint src",
"watch": "tsc -watch -p ./",
"pretest": "yarn compile",
"test": "vscode-test"
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
Expand All @@ -82,9 +82,10 @@
"@types/vscode": "1.46.0",
"@typescript-eslint/eslint-plugin": "^8.68.0",
"@typescript-eslint/parser": "^8.68.0",
"@vscode/test-cli": "^0.0.15",
"@vscode/test-electron": "^3.1.0",
"eslint": "^10.9.1",
"glob": "^13.0.6",
"mocha": "^11.8.0",
"typescript": "^6.0.3"
},
"resolutions": {
Expand Down
12 changes: 12 additions & 0 deletions src/test/node24-globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The test launcher runs under CI's Node.js 24 runtime, while extension source
* is checked against the Node.js 12 runtime provided by the minimum VS Code
* version. Declare only the newer global required by the test launcher.
*/
interface TestRunnerFetchResponse {
readonly ok: boolean;
readonly status: number;
arrayBuffer(): Promise<ArrayBuffer>;
}

declare function fetch(input: string): Promise<TestRunnerFetchResponse>;
26 changes: 26 additions & 0 deletions src/test/runTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as path from "path";
import { runTests } from "@vscode/test-electron";

async function main() {
try {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, "../../");

// The path to test runner
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, "./suite/index");

// Download VS Code, unzip it and run the integration test
await runTests({
extensionDevelopmentPath,
extensionTestsPath,
launchArgs: [extensionDevelopmentPath],
});
} catch (err) {
console.error("Failed to run tests");
process.exit(1);
}
}

main();
30 changes: 30 additions & 0 deletions src/test/suite/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as path from "path";
import { glob } from "glob";
import Mocha = require("mocha");

export async function run(): Promise<void> {
const mocha = new Mocha({
ui: "tdd",
color: true,
timeout: 10_000,
});

const testsRoot = path.resolve(__dirname, "..");
const files = await glob("**/*.test.js", { cwd: testsRoot });

files.forEach((file) => mocha.addFile(path.resolve(testsRoot, file)));

return new Promise((resolve, reject) => {
try {
mocha.run((failures) => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
reject(err);
}
});
}
Loading