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
14 changes: 8 additions & 6 deletions .mocha-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,22 @@
//
//===----------------------------------------------------------------------===//

const BaseReporter = require("mocha/lib/reporters/base");
const SpecReporter = require("mocha/lib/reporters/spec");
const JsonReporter = require("mocha/lib/reporters/json");
const mocha = require("mocha");
const GHASummaryReporter = require("./dist/test/reporters/GitHubActionsSummaryReporter");

// Taking inspiration from https://github.com/stanleyhlng/mocha-multi-reporters/issues/108#issuecomment-2028773686
// since mocha-multi-reporters seems to have bugs with newer mocha versions
module.exports = class MultiReporter extends BaseReporter {
module.exports = class MultiReporter extends mocha.reporters.Base {
constructor(runner, options) {
super(runner, options);
this.reporters = [
new SpecReporter(runner, {
new mocha.reporters.Spec(runner, {
reporterOption: options.reporterOption.specReporterOptions,
}),
new JsonReporter(runner, {
new GHASummaryReporter(runner, {
reporterOption: options.reporterOption.githubActionsSummaryReporterOptions,
}),
new mocha.reporters.JSON(runner, {
reporterOption: options.reporterOption.jsonReporterOptions,
}),
];
Expand Down
12 changes: 11 additions & 1 deletion .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const dataDir = process.env["VSCODE_DATA_DIR"];

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

function log(/** @type {string} */ message) {
if (!isDebugRun) {
Expand Down Expand Up @@ -122,6 +123,9 @@ module.exports = defineConfig({
retries: 1,
reporter: path.join(__dirname, ".mocha-reporter.js"),
reporterOptions: {
githubActionsSummaryReporterOptions: {
title: "Integration Test Summary",
},
jsonReporterOptions: {
output: path.join(__dirname, "test-results", "integration-tests.json"),
},
Expand Down Expand Up @@ -155,6 +159,9 @@ module.exports = defineConfig({
retries: 1,
reporter: path.join(__dirname, ".mocha-reporter.js"),
reporterOptions: {
githubActionsSummaryReporterOptions: {
title: "Code Workspace Test Summary",
},
jsonReporterOptions: {
output: path.join(__dirname, "test-results", "code-workspace-tests.json"),
},
Expand All @@ -177,6 +184,9 @@ module.exports = defineConfig({
slow: 100,
reporter: path.join(__dirname, ".mocha-reporter.js"),
reporterOptions: {
githubActionsSummaryReporterOptions: {
title: "Unit Test Summary",
},
jsonReporterOptions: {
output: path.join(__dirname, "test-results", "unit-tests.json"),
},
Expand Down
174 changes: 168 additions & 6 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1986,12 +1986,14 @@
"**/*": "prettier --write --ignore-unknown"
},
"devDependencies": {
"@actions/core": "^1.11.1",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/archiver": "^6.0.3",
"@types/chai": "^4.3.19",
"@types/chai-as-promised": "^7.1.8",
"@types/chai-subset": "^1.3.6",
"@types/decompress": "^4.2.7",
"@types/diff": "^7.0.2",
"@types/lcov-parse": "^1.0.2",
"@types/lodash.debounce": "^4.0.9",
"@types/lodash.throttle": "^4.1.9",
Expand Down Expand Up @@ -2019,6 +2021,7 @@
"chai-subset": "^1.6.0",
"decompress": "^4.2.1",
"del-cli": "^6.0.0",
"diff": "^8.0.2",
"esbuild": "^0.25.9",
"eslint": "^8.57.0",
"eslint-config-prettier": "^10.1.8",
Expand Down
Loading