@@ -21,7 +21,9 @@ gulp.task('test:razor', async () => {
21
21
22
22
const razorIntegrationTestProjects = [ 'BasicRazorApp2_1' ] ;
23
23
for ( 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
+ ) ;
25
27
}
26
28
27
29
gulp . task (
@@ -41,10 +43,10 @@ const omnisharpIntegrationTestProjects = ['singleCsproj', 'slnWithCsproj', 'slnF
41
43
42
44
for ( const projectName of omnisharpIntegrationTestProjects ) {
43
45
gulp . task ( `omnisharptest:integration:${ projectName } :stdio` , async ( ) =>
44
- runOmnisharpJestIntegrationTest ( projectName , 'stdio' )
46
+ runOmnisharpJestIntegrationTest ( projectName , 'stdio' , `OmniSharp Test Integration ${ projectName } STDIO}` )
45
47
) ;
46
48
gulp . task ( `omnisharptest:integration:${ projectName } :lsp` , async ( ) =>
47
- runOmnisharpJestIntegrationTest ( projectName , 'lsp' )
49
+ runOmnisharpJestIntegrationTest ( projectName , 'lsp' , `OmniSharp Test Integration ${ projectName } LSP}` )
48
50
) ;
49
51
gulp . task (
50
52
`omnisharptest:integration:${ projectName } ` ,
@@ -73,7 +75,9 @@ gulp.task('test:unit', async () => {
73
75
74
76
const integrationTestProjects = [ 'slnWithCsproj' ] ;
75
77
for ( 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
+ ) ;
77
81
}
78
82
79
83
gulp . task (
@@ -83,7 +87,7 @@ gulp.task(
83
87
84
88
gulp . task ( 'test' , gulp . series ( 'test:unit' , 'test:integration' , 'test:razor' , 'test:razorintegration' ) ) ;
85
89
86
- async function runOmnisharpJestIntegrationTest ( testAssetName : string , engine : 'stdio' | 'lsp' ) {
90
+ async function runOmnisharpJestIntegrationTest ( testAssetName : string , engine : 'stdio' | 'lsp' , suiteName : string ) {
87
91
const workspaceFile = `omnisharp${ engine === 'lsp' ? '_lsp' : '' } _${ testAssetName } .code-workspace` ;
88
92
const testFolder = path . join ( 'omnisharptest' , 'omnisharpIntegrationTests' ) ;
89
93
@@ -96,26 +100,28 @@ async function runOmnisharpJestIntegrationTest(testAssetName: string, engine: 's
96
100
CODE_DISABLE_EXTENSIONS : 'true' ,
97
101
} ;
98
102
99
- await runJestIntegrationTest ( testAssetName , testFolder , workspaceFile , env ) ;
103
+ await runJestIntegrationTest ( testAssetName , testFolder , workspaceFile , suiteName , env ) ;
100
104
}
101
105
102
- async function runIntegrationTest ( testAssetName : string , razor = false ) {
106
+ async function runIntegrationTest ( testAssetName : string , testFolderName : string , suiteName : string ) {
103
107
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 ) ;
106
110
}
107
111
108
112
/**
109
113
* Runs jest based integration tests.
110
114
* @param testAssetName the name of the test asset
111
115
* @param testFolderName the relative path (from workspace root)
112
116
* @param workspaceFileName the name of the vscode workspace file to use.
117
+ * @param suiteName a unique name for the test suite being run.
113
118
* @param env any environment variables needed.
114
119
*/
115
120
async function runJestIntegrationTest (
116
121
testAssetName : string ,
117
122
testFolderName : string ,
118
123
workspaceFileName : string ,
124
+ suiteName : string ,
119
125
env : NodeJS . ProcessEnv = { }
120
126
) {
121
127
// Test assets are always in a testAssets folder inside the integration test folder.
@@ -143,6 +149,10 @@ async function runJestIntegrationTest(
143
149
env . CODE_EXTENSIONS_PATH = rootPath ;
144
150
env . EXTENSIONS_TESTS_PATH = vscodeRunnerPath ;
145
151
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
+
146
156
const result = await spawnNode ( [ launcherPath , '--enable-source-maps' ] , { env, cwd : rootPath } ) ;
147
157
148
158
if ( result . code === null || result . code > 0 ) {
@@ -154,6 +164,8 @@ async function runJestIntegrationTest(
154
164
}
155
165
156
166
async function runJestTest ( project : string ) {
167
+ process . env . JEST_JUNIT_OUTPUT_NAME = getJUnitFileName ( project ) ;
168
+ process . env . JEST_SUITE_NAME = project ;
157
169
const configPath = path . join ( rootPath , 'jest.config.ts' ) ;
158
170
const { results } = await jest . runCLI (
159
171
{
@@ -168,3 +180,7 @@ async function runJestTest(project: string) {
168
180
throw new Error ( 'Tests failed.' ) ;
169
181
}
170
182
}
183
+
184
+ function getJUnitFileName ( suiteName : string ) {
185
+ return `${ suiteName . replaceAll ( ' ' , '_' ) } _junit.xml` ;
186
+ }
0 commit comments