Skip to content

Show more error properties in the Test Results (e.g. cause) #708

@rendmath

Description

@rendmath

Clear and concise description of the problem

When running a failing test from the VS Code extension, the error logged in the Test Results panel do not contain enough properties of the error objects (e.g. the cause property is missing).

In many cases, it makes it impossible to conduct proper troubleshooting from the test output and requires re-running the test through the Vitest CLI.

import { it } from "vitest";

it("throws an error with cause", () => {
  throw new Error("Outer", {
    cause: new AggregateError(
      [new Error("Inner 1"), new Error("Inner 2")],
      "Middle"
    ),
  });
});

The output will be:

Outer

Which is clearly not usable.

Suggested solution

Align the error serialization of the VS Code extension closer to that of the Vitest CLI. At the minimum add support for cause. AggregateError already seems to be working.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions