storybookjs / storybook

Storybook is the industry standard workshop for building, documenting, and testing UI components in isolation
https://storybook.js.org
MIT License
84.08k stars 9.25k forks source link

[Bug]: Remove ES2017 transpilation limitation when using mount #29202

Open kasperpeulen opened 3 days ago

kasperpeulen commented 3 days ago

At this moment, you can only use mount in the play function if you transpile your stories to ES2017 or newer: https://storybook.js.org/docs/writing-tests/component-testing#run-code-before-the-component-gets-rendered

Angular can not use ES2017 (specifically: async/await) natively if zone.js is used https://angular.dev/guide/experimental/zoneless#why-use-zoneless

ZoneJS works by patching browser APIs but does not automatically have patches for every new browser API. Some APIs simply cannot be patched effectively, such as async/await, and have to be downleveled to work with ZoneJS.

Vitest has a similar issue with fixtures: https://github.com/vitest-dev/vitest/pull/6531

We copied the regex from vitest to detect function arguments on runtime. When this issue is fixed, we should align our regex again :)