mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
Merge pull request #29458 from storybookjs/hide-assertion-error-stacktrace
Addon Test: Fix hiding stacktrace for assertion errors in test panel
This commit is contained in:
commit
e0f287775e
@ -103,6 +103,7 @@
|
||||
"react-dom": "^18.2.0",
|
||||
"semver": "^7.6.3",
|
||||
"slash": "^5.0.0",
|
||||
"strip-ansi": "^7.1.0",
|
||||
"ts-dedent": "^2.2.0",
|
||||
"typescript": "^5.3.2",
|
||||
"vitest": "^2.1.3"
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { type StorybookTheme, useTheme } from 'storybook/internal/theming';
|
||||
|
||||
import Filter from 'ansi-to-html';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
|
||||
export function isTestAssertionError(error: unknown) {
|
||||
return isChaiError(error) || isJestError(error);
|
||||
@ -22,7 +23,7 @@ export function isJestError(error: unknown) {
|
||||
typeof error === 'object' &&
|
||||
'message' in error &&
|
||||
typeof error.message === 'string' &&
|
||||
error.message.startsWith('expect(')
|
||||
stripAnsi(error.message).startsWith('expect(')
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -6253,6 +6253,7 @@ __metadata:
|
||||
react-dom: "npm:^18.2.0"
|
||||
semver: "npm:^7.6.3"
|
||||
slash: "npm:^5.0.0"
|
||||
strip-ansi: "npm:^7.1.0"
|
||||
ts-dedent: "npm:^2.2.0"
|
||||
typescript: "npm:^5.3.2"
|
||||
vitest: "npm:^2.1.3"
|
||||
|
Loading…
x
Reference in New Issue
Block a user