Skip to content

Commit 025d33a

Browse files
Fix timeouts for tests and add a test summary to CI jobs (#1828)
1 parent 96192cb commit 025d33a

12 files changed

+396
-32
lines changed

.mocha-reporter.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,22 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
const BaseReporter = require("mocha/lib/reporters/base");
16-
const SpecReporter = require("mocha/lib/reporters/spec");
17-
const JsonReporter = require("mocha/lib/reporters/json");
15+
const mocha = require("mocha");
16+
const GHASummaryReporter = require("./dist/test/reporters/GitHubActionsSummaryReporter");
1817

1918
// Taking inspiration from https://github.com/stanleyhlng/mocha-multi-reporters/issues/108#issuecomment-2028773686
2019
// since mocha-multi-reporters seems to have bugs with newer mocha versions
21-
module.exports = class MultiReporter extends BaseReporter {
20+
module.exports = class MultiReporter extends mocha.reporters.Base {
2221
constructor(runner, options) {
2322
super(runner, options);
2423
this.reporters = [
25-
new SpecReporter(runner, {
24+
new mocha.reporters.Spec(runner, {
2625
reporterOption: options.reporterOption.specReporterOptions,
2726
}),
28-
new JsonReporter(runner, {
27+
new GHASummaryReporter(runner, {
28+
reporterOption: options.reporterOption.githubActionsSummaryReporterOptions,
29+
}),
30+
new mocha.reporters.JSON(runner, {
2931
reporterOption: options.reporterOption.jsonReporterOptions,
3032
}),
3133
];

.vscode-test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ const dataDir = process.env["VSCODE_DATA_DIR"];
2323

2424
// Check if we're debugging by looking at the process executable. Unfortunately, the VS Code debugger
2525
// doesn't seem to allow setting environment variables on a launched extension host.
26-
const isDebugRun = !(process.env["_"] ?? "").endsWith("node_modules/.bin/vscode-test");
26+
const processPath = process.env["_"] ?? "";
27+
const isDebugRun = !isCIBuild && !processPath.endsWith("node_modules/.bin/vscode-test");
2728

2829
function log(/** @type {string} */ message) {
2930
if (!isDebugRun) {
@@ -122,6 +123,9 @@ module.exports = defineConfig({
122123
retries: 1,
123124
reporter: path.join(__dirname, ".mocha-reporter.js"),
124125
reporterOptions: {
126+
githubActionsSummaryReporterOptions: {
127+
title: "Integration Test Summary",
128+
},
125129
jsonReporterOptions: {
126130
output: path.join(__dirname, "test-results", "integration-tests.json"),
127131
},
@@ -155,6 +159,9 @@ module.exports = defineConfig({
155159
retries: 1,
156160
reporter: path.join(__dirname, ".mocha-reporter.js"),
157161
reporterOptions: {
162+
githubActionsSummaryReporterOptions: {
163+
title: "Code Workspace Test Summary",
164+
},
158165
jsonReporterOptions: {
159166
output: path.join(__dirname, "test-results", "code-workspace-tests.json"),
160167
},
@@ -177,6 +184,9 @@ module.exports = defineConfig({
177184
slow: 100,
178185
reporter: path.join(__dirname, ".mocha-reporter.js"),
179186
reporterOptions: {
187+
githubActionsSummaryReporterOptions: {
188+
title: "Unit Test Summary",
189+
},
180190
jsonReporterOptions: {
181191
output: path.join(__dirname, "test-results", "unit-tests.json"),
182192
},

package-lock.json

Lines changed: 168 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,12 +1986,14 @@
19861986
"**/*": "prettier --write --ignore-unknown"
19871987
},
19881988
"devDependencies": {
1989+
"@actions/core": "^1.11.1",
19891990
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
19901991
"@types/archiver": "^6.0.3",
19911992
"@types/chai": "^4.3.19",
19921993
"@types/chai-as-promised": "^7.1.8",
19931994
"@types/chai-subset": "^1.3.6",
19941995
"@types/decompress": "^4.2.7",
1996+
"@types/diff": "^7.0.2",
19951997
"@types/lcov-parse": "^1.0.2",
19961998
"@types/lodash.debounce": "^4.0.9",
19971999
"@types/lodash.throttle": "^4.1.9",
@@ -2019,6 +2021,7 @@
20192021
"chai-subset": "^1.6.0",
20202022
"decompress": "^4.2.1",
20212023
"del-cli": "^6.0.0",
2024+
"diff": "^8.0.2",
20222025
"esbuild": "^0.25.9",
20232026
"eslint": "^8.57.0",
20242027
"eslint-config-prettier": "^10.1.8",

0 commit comments

Comments
 (0)