Markdown test failure messages clip long unbreakable text in Test Results view — cannot wrap, scroll, or configure
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Does this issue occur when all extensions are disabled?: Reproducing requires an extension that reports test results, but the clipping happens in VS Code's built-in Test Results rendering, not in the extension.
- VS Code Version: 1.128.0 (fc3def6774c76082adf699d366f31a557ce5573f), also present in current `main`
- OS Version: macOS
### Summary
When a test extension reports a failure with `TestMessage.message` as a **`MarkdownString`** (the Test Runner for Java does this for every failure/stack trace), the message is rendered in the Test Results view / testing peek as a plain HTML `div.preview-text` by `MarkdownTestMessagePeek` (`src/vs/workbench/contrib/testing/browser/testResultsView/testResultsOutput.ts`).
Stack-trace lines are long tokens with no break opportunities, e.g.:
```
at com.example.project.persistence.db.SomeRepository.saveSomething(SomeRepository.java:42)
```
and in `src/vs/workbench/contrib/testing/browser/media/testing.css`:
- `.test-output-peek-message-container` has `overflow: hidden`
- `.test-output-peek-message-container .preview-text` has `white-space: normal` and no `overflow-wrap`
so everything past the pane width is simply unreadable: the text cannot wrap (no soft-break opportunities in the tokens), cannot be scrolled (container clips; in the inline peek the hosting code editor consumes wheel events over the zone widget, so even changing the container to `overflow-x: auto` doesn't help there — I tried), and no setting affects it.
This is different from **plain-string** messages, which are rendered in an embedded code editor and follow the global `editor.wordWrap`. That distinction seems to be why #250333 was closed ("content is shown in an editor which will wrap or not based on your setting") — that is true for plain strings but not for `MarkdownString` messages, where there is no editor and no setting, and which extensions commonly use to get clickable links in stack traces.
### Steps to Reproduce
1. In any test controller: `run.failed(test, new vscode.TestMessage(new vscode.MarkdownString('at com.example.a.very.long.package.name.SomeClass.someMethod(SomeClass.java:42)')))` — or simply fail a JUnit test with an assertion/Mockito error using the Test Runner for Java extension.
2. Open the failure message in the TEST RESULTS panel or the inline peek.
3. The tail of every long line is clipped and cannot be read.
### Suggested fix
One line in `testing.css` makes the whole message readable:
```css
.test-output-peek-message-container .preview-text {
overflow-wrap: anywhere;
}
```
I have verified this locally by patching the built CSS: long tokens wrap and full stack traces become readable in both the panel and the inline peek. Alternatively this could be a setting (e.g. `testing.messageWordWrap`) for symmetry with the editor-rendered plain-string messages.
I'm happy to submit a PR for this.
Contributor guide
Assessment
This issue has not been assessed yet.