Skip to content

Commit abd6f31

Browse files
committed
[test] Fix crashes in Dev Overlay Stories
1 parent 2f84810 commit abd6f31

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

packages/next/.storybook/test-runner.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const config: TestRunnerConfig = {
1515
detailedReportOptions: {
1616
html: true,
1717
},
18+
// Verbose prints additional logs in the terminal on passing tests taking up space
19+
// that's needed by failed tests.
20+
verbose: false,
1821
})
1922
},
2023
}

packages/next/src/next-devtools/dev-overlay/components/errors/error-overlay-layout/error-overlay-layout.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ type Story = StoryObj<typeof ErrorOverlayLayout>
1515

1616
export const Default: Story = {
1717
args: {
18+
error: {
19+
name: 'ModuleNotFoundError',
20+
message: "Cannot find module './missing-module'",
21+
},
1822
errorType: 'Build Error',
1923
errorMessage: 'Failed to compile',
2024
errorCode: 'E001',

packages/next/src/next-devtools/dev-overlay/components/hydration-diff/diff-view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function PseudoHtmlDiff({
5757

5858
const htmlComponents = useMemo(() => {
5959
const componentStacks: React.ReactNode[] = []
60-
const reactComponentDiffLines = reactOutputComponentDiff!.split('\n')
60+
const reactComponentDiffLines = reactOutputComponentDiff.split('\n')
6161
reactComponentDiffLines.forEach((line, index) => {
6262
const isDiffLine = line[0] === '+' || line[0] === '-'
6363
const isHighlightedLine = line[0] === '>'

packages/next/src/next-devtools/dev-overlay/container/errors.stories.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ const runtimeErrors: ReadyRuntimeError[] = [
156156

157157
export const Default: Story = {
158158
args: {
159+
getSquashedHydrationErrorDetails: () => null,
159160
runtimeErrors,
160161
versionInfo: {
161162
installed: '15.0.0',
@@ -188,6 +189,7 @@ export const VeryLongErrorMessage: Story = {
188189

189190
export const WithHydrationWarning: Story = {
190191
args: {
192+
...Default.args,
191193
runtimeErrors: [
192194
{
193195
id: 1,

packages/next/src/next-devtools/dev-overlay/container/runtime-error/component-stack-pseudo-html.stories.tsx

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,17 @@ type Story = StoryObj<typeof PseudoHtmlDiff>
1515

1616
export const TextMismatch: Story = {
1717
args: {
18-
reactOutputComponentDiff: undefined,
19-
},
20-
}
21-
22-
export const TextInTagMismatch: Story = {
23-
args: {
24-
reactOutputComponentDiff: undefined,
18+
reactOutputComponentDiff: `<Page>
19+
<Layout>
20+
<div>
21+
- Server content
22+
+ Client content`,
2523
},
2624
}
2725

2826
export const ReactUnifiedMismatch: Story = {
2927
args: {
30-
reactOutputComponentDiff: `<Page>
31-
<Layout>
32-
<div>
33-
- <p>Server content</p>
34-
+ <p>Client content</p>`,
28+
reactOutputComponentDiff:
29+
'<Page>\n <Layout>\n <div>asd\n- <p>Server content</p>\n+ <p>Client content</p>',
3530
},
3631
}

0 commit comments

Comments
 (0)