Skip to content

fix: add warning log when Jest fails without XML output#1213

Merged
misrasaurabh1 merged 1 commit intomainfrom
fix/jest-debug-logging
Jan 31, 2026
Merged

fix: add warning log when Jest fails without XML output#1213
misrasaurabh1 merged 1 commit intomainfrom
fix/jest-debug-logging

Conversation

@misrasaurabh1
Copy link
Contributor

@misrasaurabh1 misrasaurabh1 commented Jan 31, 2026

Summary

  • Add WARNING level logging when Jest fails and doesn't produce XML output
  • Add post-processing to strip .js/.ts/.tsx extensions from generated test imports

This fixes module resolution failures where LLMs add file extensions to import paths.

Changes

  1. Log Jest stdout/stderr at WARNING level when tests fail without XML output
  2. Strip file extensions from relative imports in generated tests

Test plan

  • Verify strip_js_extensions works correctly (unit test passes)
  • Run codeflash on a JS/TS project to verify extension stripping
  • Check that normal test runs aren't affected

🤖 Generated with Claude Code

When Jest fails early (e.g., due to import errors) and doesn't produce
XML output, the error was only logged at DEBUG level, making it hard
to diagnose issues.

This change adds WARNING level logging that includes Jest's stdout
and stderr when:
1. Jest exits with non-zero return code
2. No XML output file is created

This helps debug common issues like:
- Invalid import paths in generated tests
- Module resolution failures
- TypeScript compilation errors

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@misrasaurabh1 misrasaurabh1 merged commit 13e35ca into main Jan 31, 2026
22 of 26 checks passed
@misrasaurabh1 misrasaurabh1 deleted the fix/jest-debug-logging branch January 31, 2026 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant