Skip to content

Simplify walk on compiled Stories component default function #142

Simplify walk on compiled Stories component default function

Simplify walk on compiled Stories component default function #142

Triggered via push August 12, 2024 11:18
Status Failure
Total duration 33s
Artifacts

test.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

3 errors
src/compiler/transform/index.test.ts > transformStoriesCode > transformed code matches inlined snapshot: src/compiler/transform/index.test.ts#L47
Error: Snapshot `transformStoriesCode > transformed code matches inlined snapshot 1` mismatched - Expected + Received @@ -4,17 +4,17 @@ Example_stories.filename = 'stories/Example.stories.svelte'; import * as $ from 'svelte/internal/client'; var Example_default = $.add_locations( - $.template(`<p> </p> <p> </p> <br>`, 1), - Example_stories.filename, - [ - [45, 4], - [46, 4], - [47, 24], - ] + $.template(`<p> </p> <p> </p> <br>`, 1), + Example_stories.filename, + [ + [45, 4], + [46, 4], + [47, 24], + ] ); var Example_default_1 = $.add_locations($.template(`Label`, 1), Example_stories.filename, []); var root = $.add_locations($.template(`<!> <!> <!> <!>`, 1), Example_stories.filename, []); import { action } from '@storybook/addon-actions'; @@ -47,148 +47,113 @@ } } }); function Example_stories($$anchor, $$props) { - if (new.target === Example_stories) - throw new Error( - 'Instantiating a component with `new` is no longer valid in Svelte 5. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information' - ); - $.push($$props, true, Example_stories); + if (new.target === Example_stories) + throw new Error( + 'Instantiating a component with `new` is no longer valid in Svelte 5. See https://svelte-5-preview.vercel.app/docs/breaking-changes#components-are-no-longer-classes for more information' + ); + $.push($$props, true, Example_stories); - var render = $.wrap_snippet(($$anchor, args = $.noop, context = $.noop) => { - var fragment = $.comment(); - var node = $.first_child(fragment); + var render = $.wrap_snippet(($$anchor, args = $.noop, context = $.noop) => { + var fragment = $.comment(); + var node = $.first_child(fragment); - $.validate_component(Example)( - node, - $.spread_props(args, { - onclick: handleClick, - children: $.wrap_snippet(($$anchor, $$slotProps) => { - var fragment_1 = Example_default(); - var p = $.first_child(fragment_1); - var text = $.child(p); - var p_1 = $.sibling($.sibling(p, true)); - var text_1 = $.child(p_1); - var text_2 = $.sibling(p_1, true); - var br = $.sibling(text_2); + $.validate_component(Example)( + node, + $.spread_props(args, { + onclick: handleClick, + children: $.wrap_snippet(($$anchor, $$slotProps) => { + var fragment_1 = Example_default(); + var p = $.first_child(fragment_1); + var text = $.child(p); + var p_1 = $.sibling($.sibling(p, true)); + var text_1 = $.child(p_1); + var text_2 = $.sibling(p_1, true); + var br = $.sibling(text_2); - $.template_effect(() => { - $.set_text(text, args()?.id); - $.set_text(text_1, context().name); - $.set_text(text_2, ` You clicked: ${$.stringify($.get(count))}`); - }); + $.template_effect(() => { + $.set_text(text, args()?.id); + $.set_text(text_1, context().name); + $.set_text(text_2, ` You clicked: ${$.stringify($.get(count))}`); + }); - $.append($$anchor, fragment_1); - }), - $$slots: { default: true }, - }) - ); + $.append($$anchor, fragment_1); + }), + $$slots: { default: true }, + }) + ); - $.append($$anchor, fragment); - }); + $.append($$anchor, fragment); + }); - $.validate_prop_bindings($$props, [], [], Example_stories); + $.validate_prop_bindings($$props, [], [], Example_stories); - let count = $.source(0); + let count = $.source(0); - function handleClick() { - $.set(count, $.get(count) + 1); - } + function handleClick() { + $.set(count, $.get(count) + 1); + } - setTemplate(render); + setTemplate(render); - var fragment_2 = root(); - var node_1 = $.first_child(fragment_2); + var fragment_2 = root(); + var node_1 = $.first_child(fragment_2); - $.validate_component(Story)(node_1, { - name: 'Default', - paramet
src/compiler/transform/story/index.test.ts > transformStory > each transformed compiled 'Story' component matches inlined snapshots: src/parser/extract/compiled/story.ts#L30
TypeError: Cannot read properties of undefined (reading 'type') ❯ Module.getStoryPropsObjectExpression src/parser/extract/compiled/story.ts:30:12 ❯ Module.insertSvelteCSFToStoryParameters src/compiler/transform/story/insert-svelte-csf.ts:33:38 ❯ Module.transformStory src/compiler/transform/story/index.ts:35:3 ❯ src/compiler/transform/story/index.test.ts:51:7 ❯ src/compiler/transform/story/index.test.ts:50:19
Test
Process completed with exit code 1.