Skip to content

Commit

Permalink
Merge branch 'next' into upgrade-vta-3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld authored Oct 28, 2024
2 parents 02743b3 + e0f2877 commit 5856975
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions code/addons/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ addons.register(ADDON_ID, (api) => {
.map(({ storyId, status, testRunId, ...rest }) => {
if (storyId) {
const statusObject: API_StatusObject = {
title: 'Vitest',
title: 'Component tests',
status: statusMap[status],
description:
'failureMessages' in rest && rest.failureMessages?.length
Expand Down
4 changes: 3 additions & 1 deletion code/addons/test/src/utils.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -22,12 +23,13 @@ export function isJestError(error: unknown) {
typeof error === 'object' &&
'message' in error &&
typeof error.message === 'string' &&
error.message.startsWith('expect(')
stripAnsi(error.message).startsWith('expect(')
);
}

export function createAnsiToHtmlFilter(theme: StorybookTheme) {
return new Filter({
escapeXML: true,
fg: theme.color.defaultText,
bg: theme.background.content,
});
Expand Down
3 changes: 2 additions & 1 deletion code/core/src/manager/components/sidebar/Tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
CollapseIcon as CollapseIconSvg,
ExpandAltIcon,
StatusFailIcon,
StatusPassIcon,
StatusWarnIcon,
SyncIcon,
} from '@storybook/icons';
Expand Down Expand Up @@ -224,7 +225,7 @@ const Node = React.memo<NodeProps>(function Node({
description: value.description,
'aria-label': `Test status for ${value.title}: ${value.status}`,
icon: {
success: null, // We don't show a checkmark, to avoid clutter
success: <StatusPassIcon color={theme.color.positive} />,
error: <StatusFailIcon color={theme.color.negative} />,
warn: <StatusWarnIcon color={theme.color.warning} />,
pending: <SyncIcon size={12} color={theme.color.defaultText} />,
Expand Down
1 change: 1 addition & 0 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6267,6 +6267,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"
Expand Down

0 comments on commit 5856975

Please sign in to comment.