From 8b7988cffd4edc0c852d349499ba8d7ae94ef5a9 Mon Sep 17 00:00:00 2001 From: Aman Karmani Date: Tue, 1 Jul 2025 16:45:28 -0700 Subject: [PATCH] [engineering] ensure typescript integration tests emit junit reports not sure if this was intentional but it seems like an oversight --- .../src/test/unit/index.ts | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/extensions/typescript-language-features/src/test/unit/index.ts b/extensions/typescript-language-features/src/test/unit/index.ts index 16d163fa241..116465a8c85 100644 --- a/extensions/typescript-language-features/src/test/unit/index.ts +++ b/extensions/typescript-language-features/src/test/unit/index.ts @@ -15,14 +15,28 @@ // to report the results back to the caller. When the tests are finished, return // a possible error to the callback or null if none. +const path = require('path'); const testRunner = require('../../../../../test/integration/electron/testrunner'); -// You can directly control Mocha options by uncommenting the following lines -// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info -testRunner.configure({ - ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.) +const suite = 'Integration TypeScript Tests'; + +const options: import('mocha').MochaOptions = { + ui: 'tdd', color: true, - timeout: 60000, -}); + timeout: 60000 +}; + +if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) { + options.reporter = 'mocha-multi-reporters'; + options.reporterOptions = { + reporterEnabled: 'spec, mocha-junit-reporter', + mochaJunitReporterReporterOptions: { + testsuitesTitle: `${suite} ${process.platform}`, + mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${process.arch}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) + } + }; +} + +testRunner.configure(options); export = testRunner;