Repository navigation
How to write to "test case output"? #2876
|
I'm talking specifically about this view, that always presents "The test case did not report any output." message
I suggested this enhancement in the Jest extension repo but I realized there's no information in docs and it's not clear to me from the documentation, typings and the API structure how to actually put anything to this window. If you press the "Show Result Output" that's the parent of the test case -- the whole test run (in my screenshot, the redacted thing), then you can see the whole output of the test runner, terminal style. But the children nodes, individual tests (test cases), do not contain any information. What's the API that allows enriching this view? |
Replies: 1 comment 2 replies
|
The "test case output" panel displays content when you use the // In your test controller's run handler
const testRun = controller.createTestRun(request);
// For individual test case output
testRun.appendOutput('Test starting execution...\n', undefined, specificTestCase);
// During test execution
testRun.appendOutput('Assertion passed: value meets criteria\n', undefined, specificTestCase);
// For error output
testRun.appendOutput('ERROR: Timeout reached after 5000ms\n', undefined, specificTestCase);
// Mark test completion
testRun.passed(specificTestCase, duration);Critical details:
This directs output specifically to the individual test case's "Show Output" panel instead of the general test results. |

The "test case output" panel displays content when you use the
TestRun.appendOutput()method with a specific test case parameter. Here's the precise implementation:Critical details: