Skip to content

Commit 7983d73

Browse files
github-actions[bot]aseembits93claude
committed
fix: use POSIX paths in jest-reporter XML test to fix Windows path escaping
On Windows, Path objects stringify with backslashes which are treated as escape sequences in JS string literals, breaking the Node.js test script. Co-authored-by: Aseem Saxena <aseembits93@users.noreply.github.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d627fed commit 7983d73

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/test_languages/test_javascript_test_runner.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,15 +907,18 @@ def test_reporter_produces_valid_junit_xml(self):
907907

908908
# Create a Node.js script that exercises the reporter with mock data
909909
test_script = Path(tmpdir) / "test_reporter.js"
910+
# Use POSIX-style paths in JS strings to avoid backslash escape issues on Windows
911+
output_file_js = output_file.as_posix()
912+
reporter_path_js = reporter_path.as_posix()
910913
test_script.write_text(f"""
911914
// Set env vars BEFORE requiring reporter (matches real Jest behavior)
912-
process.env.JEST_JUNIT_OUTPUT_FILE = '{output_file}';
915+
process.env.JEST_JUNIT_OUTPUT_FILE = '{output_file_js}';
913916
process.env.JEST_JUNIT_CLASSNAME = '{{filepath}}';
914917
process.env.JEST_JUNIT_SUITE_NAME = '{{filepath}}';
915918
process.env.JEST_JUNIT_ADD_FILE_ATTRIBUTE = 'true';
916919
process.env.JEST_JUNIT_INCLUDE_CONSOLE_OUTPUT = 'true';
917920
918-
const Reporter = require('{reporter_path}');
921+
const Reporter = require('{reporter_path_js}');
919922
920923
// Mock Jest globalConfig
921924
const globalConfig = {{ rootDir: '/tmp/project' }};

0 commit comments

Comments
 (0)