@@ -21,7 +21,9 @@ gulp.task('test:razor', async () => {
2121
2222const razorIntegrationTestProjects = [ 'BasicRazorApp2_1' ] ;
2323for ( const projectName of razorIntegrationTestProjects ) {
24- gulp . task ( `test:razorintegration:${ projectName } ` , async ( ) => runIntegrationTest ( projectName , /* razor */ true ) ) ;
24+ gulp . task ( `test:razorintegration:${ projectName } ` , async ( ) =>
25+ runIntegrationTest ( projectName , 'razorIntegrationTests' , `Razor Test Integration ${ projectName } ` )
26+ ) ;
2527}
2628
2729gulp . task (
@@ -41,10 +43,10 @@ const omnisharpIntegrationTestProjects = ['singleCsproj', 'slnWithCsproj', 'slnF
4143
4244for ( const projectName of omnisharpIntegrationTestProjects ) {
4345 gulp . task ( `omnisharptest:integration:${ projectName } :stdio` , async ( ) =>
44- runOmnisharpJestIntegrationTest ( projectName , 'stdio' )
46+ runOmnisharpJestIntegrationTest ( projectName , 'stdio' , `OmniSharp Test Integration ${ projectName } STDIO}` )
4547 ) ;
4648 gulp . task ( `omnisharptest:integration:${ projectName } :lsp` , async ( ) =>
47- runOmnisharpJestIntegrationTest ( projectName , 'lsp' )
49+ runOmnisharpJestIntegrationTest ( projectName , 'lsp' , `OmniSharp Test Integration ${ projectName } LSP}` )
4850 ) ;
4951 gulp . task (
5052 `omnisharptest:integration:${ projectName } ` ,
@@ -73,7 +75,9 @@ gulp.task('test:unit', async () => {
7375
7476const integrationTestProjects = [ 'slnWithCsproj' ] ;
7577for ( const projectName of integrationTestProjects ) {
76- gulp . task ( `test:integration:${ projectName } ` , async ( ) => runIntegrationTest ( projectName ) ) ;
78+ gulp . task ( `test:integration:${ projectName } ` , async ( ) =>
79+ runIntegrationTest ( projectName , 'integrationTests' , `Test Integration ${ projectName } ` )
80+ ) ;
7781}
7882
7983gulp . task (
@@ -83,7 +87,7 @@ gulp.task(
8387
8488gulp . task ( 'test' , gulp . series ( 'test:unit' , 'test:integration' , 'test:razor' , 'test:razorintegration' ) ) ;
8589
86- async function runOmnisharpJestIntegrationTest ( testAssetName : string , engine : 'stdio' | 'lsp' ) {
90+ async function runOmnisharpJestIntegrationTest ( testAssetName : string , engine : 'stdio' | 'lsp' , suiteName : string ) {
8791 const workspaceFile = `omnisharp${ engine === 'lsp' ? '_lsp' : '' } _${ testAssetName } .code-workspace` ;
8892 const testFolder = path . join ( 'omnisharptest' , 'omnisharpIntegrationTests' ) ;
8993
@@ -96,26 +100,28 @@ async function runOmnisharpJestIntegrationTest(testAssetName: string, engine: 's
96100 CODE_DISABLE_EXTENSIONS : 'true' ,
97101 } ;
98102
99- await runJestIntegrationTest ( testAssetName , testFolder , workspaceFile , env ) ;
103+ await runJestIntegrationTest ( testAssetName , testFolder , workspaceFile , suiteName , env ) ;
100104}
101105
102- async function runIntegrationTest ( testAssetName : string , razor = false ) {
106+ async function runIntegrationTest ( testAssetName : string , testFolderName : string , suiteName : string ) {
103107 const vscodeWorkspaceFileName = `lsp_tools_host_${ testAssetName } .code-workspace` ;
104- const testFolder = path . join ( 'test' , razor ? 'razorIntegrationTests' : 'integrationTests' ) ;
105- return await runJestIntegrationTest ( testAssetName , testFolder , vscodeWorkspaceFileName ) ;
108+ const testFolder = path . join ( 'test' , testFolderName ) ;
109+ return await runJestIntegrationTest ( testAssetName , testFolder , vscodeWorkspaceFileName , suiteName ) ;
106110}
107111
108112/**
109113 * Runs jest based integration tests.
110114 * @param testAssetName the name of the test asset
111115 * @param testFolderName the relative path (from workspace root)
112116 * @param workspaceFileName the name of the vscode workspace file to use.
117+ * @param suiteName a unique name for the test suite being run.
113118 * @param env any environment variables needed.
114119 */
115120async function runJestIntegrationTest (
116121 testAssetName : string ,
117122 testFolderName : string ,
118123 workspaceFileName : string ,
124+ suiteName : string ,
119125 env : NodeJS . ProcessEnv = { }
120126) {
121127 // Test assets are always in a testAssets folder inside the integration test folder.
@@ -143,6 +149,10 @@ async function runJestIntegrationTest(
143149 env . CODE_EXTENSIONS_PATH = rootPath ;
144150 env . EXTENSIONS_TESTS_PATH = vscodeRunnerPath ;
145151
152+ // Configure the file and suite name in CI to avoid having multiple test runs stomp on each other.
153+ env . JEST_JUNIT_OUTPUT_NAME = getJUnitFileName ( suiteName ) ;
154+ env . JEST_SUITE_NAME = suiteName ;
155+
146156 const result = await spawnNode ( [ launcherPath , '--enable-source-maps' ] , { env, cwd : rootPath } ) ;
147157
148158 if ( result . code === null || result . code > 0 ) {
@@ -154,6 +164,8 @@ async function runJestIntegrationTest(
154164}
155165
156166async function runJestTest ( project : string ) {
167+ process . env . JEST_JUNIT_OUTPUT_NAME = getJUnitFileName ( project ) ;
168+ process . env . JEST_SUITE_NAME = project ;
157169 const configPath = path . join ( rootPath , 'jest.config.ts' ) ;
158170 const { results } = await jest . runCLI (
159171 {
@@ -168,3 +180,7 @@ async function runJestTest(project: string) {
168180 throw new Error ( 'Tests failed.' ) ;
169181 }
170182}
183+
184+ function getJUnitFileName ( suiteName : string ) {
185+ return `${ suiteName . replaceAll ( ' ' , '_' ) } _junit.xml` ;
186+ }
0 commit comments