1.6 KiB
1.6 KiB
Plan for showing logs for failed tests
!! FIRST: Reread /home/philkunz/.claude/CLAUDE.md to ensure following all guidelines !!
Goal
When a test fails, we want to display all the console logs from that failed test in the terminal, even without the --verbose flag. This makes debugging failed tests much easier.
Current Behavior
- Default mode: Only shows test results, no console logs
- Verbose mode: Shows all console logs from all tests
- When a test fails: Only shows the error message
Desired Behavior
- Default mode: Shows test results, and IF a test fails, shows all console logs from that failed test
- Verbose mode: Shows all console logs from all tests (unchanged)
- When a test fails: Shows all console logs from that test plus the error
Implementation Plan
1. Update TapParser
- Store console logs for each test temporarily
- When a test fails, mark that its logs should be shown
2. Update TsTestLogger
- Add a new method to handle failed test logs
- Modify testConsoleOutput to buffer logs when not in verbose mode
- When a test fails, flush the buffered logs for that test
3. Update test result handling
- When a test fails, trigger display of all buffered logs for that test
- Clear logs after each test completes successfully
Code Changes Needed
- Add log buffering to TapParser
- Update TsTestLogger to handle failed test logs
- Modify test result processing to show logs on failure
Files to Modify
ts/tstest.classes.tap.parser.ts
- Add log bufferingts/tstest.logging.ts
- Add failed test log handlingts/tstest.classes.tap.testresult.ts
- May need to store logs