Unverified Commit 69374fbb authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[test] Fix crashes in Dev Overlay Stories (#80292)

A bit annoying that Storybook marks required props as optional. Makes it hard to keep those working during refactor.
parent bbaa1647
...@@ -15,6 +15,9 @@ const config: TestRunnerConfig = { ...@@ -15,6 +15,9 @@ const config: TestRunnerConfig = {
detailedReportOptions: { detailedReportOptions: {
html: true, html: true,
}, },
// Verbose prints additional logs in the terminal on passing tests taking up space
// that's needed by failed tests.
verbose: false,
}) })
}, },
} }
......
...@@ -15,6 +15,10 @@ type Story = StoryObj<typeof ErrorOverlayLayout> ...@@ -15,6 +15,10 @@ type Story = StoryObj<typeof ErrorOverlayLayout>
export const Default: Story = { export const Default: Story = {
args: { args: {
error: {
name: 'ModuleNotFoundError',
message: "Cannot find module './missing-module'",
},
errorType: 'Build Error', errorType: 'Build Error',
errorMessage: 'Failed to compile', errorMessage: 'Failed to compile',
errorCode: 'E001', errorCode: 'E001',
......
...@@ -58,7 +58,7 @@ export function PseudoHtmlDiff({ ...@@ -58,7 +58,7 @@ export function PseudoHtmlDiff({
const htmlComponents = useMemo(() => { const htmlComponents = useMemo(() => {
const componentStacks: React.ReactNode[] = [] const componentStacks: React.ReactNode[] = []
const reactComponentDiffLines = reactOutputComponentDiff!.split('\n') const reactComponentDiffLines = reactOutputComponentDiff.split('\n')
reactComponentDiffLines.forEach((line, index) => { reactComponentDiffLines.forEach((line, index) => {
const isDiffLine = line[0] === '+' || line[0] === '-' const isDiffLine = line[0] === '+' || line[0] === '-'
const isHighlightedLine = line[0] === '>' const isHighlightedLine = line[0] === '>'
......
...@@ -156,6 +156,7 @@ const runtimeErrors: ReadyRuntimeError[] = [ ...@@ -156,6 +156,7 @@ const runtimeErrors: ReadyRuntimeError[] = [
export const Default: Story = { export const Default: Story = {
args: { args: {
getSquashedHydrationErrorDetails: () => null,
runtimeErrors, runtimeErrors,
versionInfo: { versionInfo: {
installed: '15.0.0', installed: '15.0.0',
...@@ -188,6 +189,7 @@ export const VeryLongErrorMessage: Story = { ...@@ -188,6 +189,7 @@ export const VeryLongErrorMessage: Story = {
export const WithHydrationWarning: Story = { export const WithHydrationWarning: Story = {
args: { args: {
...Default.args,
runtimeErrors: [ runtimeErrors: [
{ {
id: 1, id: 1,
......
...@@ -15,22 +15,17 @@ type Story = StoryObj<typeof PseudoHtmlDiff> ...@@ -15,22 +15,17 @@ type Story = StoryObj<typeof PseudoHtmlDiff>
export const TextMismatch: Story = { export const TextMismatch: Story = {
args: { args: {
reactOutputComponentDiff: undefined, reactOutputComponentDiff: `<Page>
}, <Layout>
} <div>
- Server content
export const TextInTagMismatch: Story = { + Client content`,
args: {
reactOutputComponentDiff: undefined,
}, },
} }
export const ReactUnifiedMismatch: Story = { export const ReactUnifiedMismatch: Story = {
args: { args: {
reactOutputComponentDiff: `<Page> reactOutputComponentDiff:
<Layout> '<Page>\n <Layout>\n <div>asd\n- <p>Server content</p>\n+ <p>Client content</p>',
<div>
- <p>Server content</p>
+ <p>Client content</p>`,
}, },
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment