Skip to content

Restrict error message length #1131

@KuznetsovRoman

Description

@KuznetsovRoman

Description

We should truncate error message to readable size, so that users would only see start of error message, if its large, which is usually the most useful part of long error message.

When resolving the issue, it also worth to pay extra attention to code snippets, where error message is also shown:

https://github.com/gemini-testing/testplane/blob/master/src/error-snippets/index.ts#L29

Verify latest release

  • I verified that the issue exists in the latest Testplane release

Testplane version

No response

Last Testplane version that worked

No response

Which area(s) of Testplane are affected? (leave empty if unsure)

Runner

Link to the code that reproduces this issue or a replay of the bug

No response

Reproduction steps

  • Build up new project using "npm init testplane@latest my-project"
  • Modify generated test so it would produce extra long error message
  • This error message is shown fully in console and in html-report

Test with long error message example:

describe("test", () => {
    it("example", async () => {
        throw new Error("1234567890".repeat(1000));
    });
});

Actual Behavior

Error message is large and not truncated:

Image

Expected Behavior

Error message is truncated to reasonable size. Users can configure maximum error length from config.

Which Node.js version are you using?

20.11.0

Internal issue: https://nda.ya.ru/t/JD_HOekG7JhH2V

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions