@@ -121,7 +121,9 @@ def _build_vitest_behavioral_command(
121121 ]
122122
123123 if output_file :
124- cmd .append (f"--outputFile={ output_file } " )
124+ # Use dot notation for junit reporter output file when multiple reporters are used
125+ # Format: --outputFile.junit=/path/to/file.xml
126+ cmd .append (f"--outputFile.junit={ output_file } " )
125127
126128 if timeout :
127129 cmd .append (f"--test-timeout={ timeout * 1000 } " ) # Vitest uses milliseconds
@@ -156,7 +158,8 @@ def _build_vitest_benchmarking_command(
156158 ]
157159
158160 if output_file :
159- cmd .append (f"--outputFile={ output_file } " )
161+ # Use dot notation for junit reporter output file when multiple reporters are used
162+ cmd .append (f"--outputFile.junit={ output_file } " )
160163
161164 if timeout :
162165 cmd .append (f"--test-timeout={ timeout * 1000 } " )
@@ -258,6 +261,13 @@ def run_vitest_behavioral_tests(
258261 args = result .args , returncode = result .returncode , stdout = result .stdout + "\n " + result .stderr , stderr = ""
259262 )
260263 logger .debug (f"Vitest result: returncode={ result .returncode } " )
264+ # Log detailed output if tests fail or no XML output
265+ if result .returncode != 0 :
266+ logger .warning (
267+ f"Vitest failed with returncode={ result .returncode } .\n "
268+ f"Command: { ' ' .join (vitest_cmd )} \n "
269+ f"Stdout: { result .stdout [:2000 ] if result .stdout else '(empty)' } "
270+ )
261271 except subprocess .TimeoutExpired :
262272 logger .warning (f"Vitest tests timed out after { subprocess_timeout } s" )
263273 result = subprocess .CompletedProcess (
@@ -272,6 +282,21 @@ def run_vitest_behavioral_tests(
272282 wall_clock_ns = time .perf_counter_ns () - start_time_ns
273283 logger .debug (f"Vitest behavioral tests completed in { wall_clock_ns / 1e9 :.2f} s" )
274284
285+ # Check if JUnit XML was created and has content
286+ if result_file_path .exists ():
287+ file_size = result_file_path .stat ().st_size
288+ logger .debug (f"Vitest JUnit XML created: { result_file_path } ({ file_size } bytes)" )
289+ if file_size < 200 : # Suspiciously small - likely empty or just headers
290+ logger .warning (
291+ f"Vitest JUnit XML is very small ({ file_size } bytes). "
292+ f"Content: { result_file_path .read_text ()[:500 ]} "
293+ )
294+ else :
295+ logger .warning (
296+ f"Vitest JUnit XML not created at { result_file_path } . "
297+ f"Vitest stdout: { result .stdout [:1000 ] if result .stdout else '(empty)' } "
298+ )
299+
275300 return result_file_path , result , coverage_json_path , None
276301
277302
@@ -436,7 +461,8 @@ def run_vitest_line_profile_tests(
436461 "--no-file-parallelism" , # Serial execution for consistent line profiling
437462 ]
438463
439- vitest_cmd .append (f"--outputFile={ result_file_path } " )
464+ # Use dot notation for junit reporter output file when multiple reporters are used
465+ vitest_cmd .append (f"--outputFile.junit={ result_file_path } " )
440466
441467 if timeout :
442468 vitest_cmd .append (f"--test-timeout={ timeout * 1000 } " )
0 commit comments