Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] "NoMeta error" with Storybook v7 with typescript satisfies #235

Closed
ollie-bud opened this issue Dec 23, 2022 · 2 comments · Fixed by #237
Closed

[Bug] "NoMeta error" with Storybook v7 with typescript satisfies #235

ollie-bud opened this issue Dec 23, 2022 · 2 comments · Fixed by #237
Labels
bug Something isn't working linear released

Comments

@ollie-bud
Copy link

ollie-bud commented Dec 23, 2022

"NoMeta error" with Storybook v7 with typescript satisfies

Stories that use the satisfies keyword in TypeScript aren't being found by test-runner.

On Storybook v7, when running the storybook init command, the stories created use the new typescript satisfies keyword by default.

export default {
  title: "Example/Header",
  component: LoggedIn,
  // This component will have an automatically generated docsPage entry: https://storybook.js.org/docs/7.0/react/writing-docs/docs-page
  tags: ["docsPage"],
  parameters: {
    // More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
    layout: "fullscreen",
  },
} satisfies Meta<typeof LoggedIn>;

However unless they are explicitly marked with as the stories are not found, and a NoMetaError: CSF: missing default export (line 1, col 0) is thrown.

Steps to reproduce the behavior

  1. Run the storybook init for v7 beta
  2. Check the default stories use the satisfies keyword
  3. Install test runner
  4. Run test runner
  5. See NoMetaError: CSF: missing default export (line 1, col 0) for the componet
  6. Replace satisfies for as and check that the component now tests correctly

Expected behavior

  1. Accept satisfies aswell as as
  2. Have a clearer warning around what's happening
  3. Don't default to 'satisfies' for storybook init in new projects

Screenshots and/or logs

AIL   browser: chromium  stories/Page.stories.ts
  ● Test suite failed to run

    NoMetaError: CSF: missing default export (line 1, col 0)

    More info: https://storybook.js.org/docs/react/writing-stories/introduction#default-export

      at CsfFile.parse (node_modules/@storybook/test-runner/node_modules/@storybook/csf-tools/dist/cjs/CsfFile.js:480:15)
      at transformCsf (node_modules/@storybook/test-runner/dist/cjs/csf/transformCsf.js:65:7)
      at transformPlaywright (node_modules/@storybook/test-runner/dist/cjs/playwright/transformPlaywright.js:89:49)
      at Object.process (node_modules/@storybook/test-runner/playwright/transform.js:6:21)

Environment

  • OS: MacOS Monteray
  • Node.js version: 18

Additional context

Just wanted to say thanks for the amazing work you're all doing!

@ollie-bud ollie-bud added the bug Something isn't working label Dec 23, 2022
@yannbf
Copy link
Member

yannbf commented Dec 24, 2022

Hey @ollie-bud thank you so much for opening this issue! The test runner does not yet support the satisfies operator. Well add support as soon as we can, probably after the holidays. Have a nice one!

cc @kasperpeulen

@github-actions
Copy link

github-actions bot commented Apr 3, 2023

🚀 Issue was released in v0.10.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linear released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants