@@ -72,6 +72,10 @@ program
7272 '--output-directory [directory]' ,
7373 'Write test results to files, results written in JSON'
7474 )
75+ . option (
76+ '--junit' ,
77+ 'Write test results to files, results written in JUnit XML format'
78+ )
7579 . option (
7680 '--force' ,
7781 "Forcibly run the project, regardless of project's version"
@@ -228,7 +232,18 @@ function runProject(project) {
228232 ] ,
229233 testEnvironment : 'jest-environment-selenium' ,
230234 testEnvironmentOptions : configuration ,
235+ ...( program . junit ? { reporters : [ 'default' , 'jest-junit' ] } : { } ) ,
231236 } ,
237+ ...( program . junit && program . outputDirectory
238+ ? {
239+ 'jest-junit' : {
240+ outputDirectory : path . isAbsolute ( program . outputDirectory )
241+ ? program . outputDirectory
242+ : '../' + program . outputDirectory ,
243+ outputName : `${ project . name } .xml` ,
244+ } ,
245+ }
246+ : { } ) ,
232247 dependencies : project . dependencies || { } ,
233248 } ,
234249 null ,
@@ -319,7 +334,7 @@ function runJest(project) {
319334 ]
320335 . concat ( program . maxWorkers ? [ '-w' , program . maxWorkers ] : [ ] )
321336 . concat (
322- program . outputDirectory
337+ program . outputDirectory && ! program . junit
323338 ? [
324339 '--json' ,
325340 '--outputFile' ,
0 commit comments