gemini-testing / gemini-testing/testplane

Restrict error message length

Open
#1,131 0 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
TypeScript
Stars
830
Forks
76
Avg merge
4d 10h
Merged PRs (30d)
14

Description

### 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

- [x] 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:
```ts
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_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.