Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 21, 2026

Console output from tests was only visible in the Test Results panel, not in inline failure messages where developers typically debug.

Implementation

  • Buffer stdout lines preceding test result markers (✓ 1) test name)
  • Associate buffered output with test items via Map
  • Filter lab structural output (test durations, leak detection)
  • Prepend console output to TestMessage with header when tests fail
// Before
run.failed(testItem, new vscode.TestMessage(errorMessage), duration);

// After  
const consoleOutput = consoleOutputPerTest.get(testItem);
const message = formatMessageWithConsoleOutput(errorMessage, consoleOutput);
run.failed(testItem, new vscode.TestMessage(message), duration);

Output Format

Failure messages now include:

Console output:
DEBUG: variable state = { foo: 'bar' }
DEBUG: condition evaluated to false

Expected 1 to equal 2
  at test.js:10:5

Notes

  • Lab executes tests sequentially - output buffering assumes this
  • Test Results panel behavior unchanged
  • Per-test isolation maintained for describe blocks with multiple children
Original prompt

This section details on the original issue you should resolve

<issue_title>Show console.log output in extension output panel or inline failure message</issue_title>
<issue_description>For debugging purposes, console.log statements within tests are not currently visible in the extension.

Current behaviour

Console output from tests is not captured or displayed anywhere accessible via the extension.

Suggested behaviour

Pipe console.log output to one or both of:

  1. The extension's output panel
  2. The inline failure message that appears in the editor

This would significantly improve the debugging experience when tests fail.


Feedback from Kevin Paxton</issue_description>

<agent_instructions>ensure commits are in semantic release format</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 5 commits January 21, 2026 17:35
- Add console output buffer to track stdout before test results
- Associate console output with specific test items
- Include console output in inline failure messages when tests fail
- Console output already appears in Test Results panel (existing behavior)
- Improves debugging experience by showing console.log in failure tooltips

Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
- Add detailed test documentation in test/testRunner.test.ts
- Create test-workspace with sample tests demonstrating console.log capture
- Add README with testing instructions
- Update .gitignore to exclude test-workspace

Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
- Extract LAB_OUTPUT_FILTER_PATTERN constant for maintainability
- Add formatMessageWithConsoleOutput helper to reduce duplication
- Add comment clarifying sequential test execution assumption
- Improve code readability and maintainability

Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
Co-authored-by: mtharrison <916064+mtharrison@users.noreply.github.com>
Copilot AI changed the title [WIP] Add console.log output to extension output panel or inline message feat: capture console output in test failure messages Jan 21, 2026
Copilot AI requested a review from mtharrison January 21, 2026 17:44
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.

Show console.log output in extension output panel or inline failure message

2 participants