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]: Not able to run storybook 8.4.2 tests with vitest, compilation error with react-swc #29602

Open
jainaks01-bh opened this issue Nov 13, 2024 · 0 comments

Comments

@jainaks01-bh
Copy link

Describe the bug

I am able to start storybook, and also able to see the coverage with the command test-storybook --coverage --verbose

but when i run vitest tests with vitest --project=storybook
I am getting below error

[plugin:vite:react-swc] × Expected ';', '}' or <eof>
   ╭─[/__vitest_test__/__test__/2aa264b0-e93d-45d5-9477-c86b6ca530ae/C%3A%2FUsers%2FAkshay%2FDocuments%2Fcode%2Fz%2Fstorybook-vitest%2Fsrc%2Fcomponents%2FErrorDisplay.stories.tsx:2:1]
 1 │ 
 2 │       html {
   ·       ──┬─ ─
   ·         ╰── This is the expression part of an expression statement
 3 │         padding: 0;
 4 │         margin: 0;
 5 │       }
   ╰────


Caused by:
    Syntax Error
/__vitest_test__/__test__/2aa264b0-e93d-45d5-9477-c86b6ca530ae/C%3A%2FUsers%2FAkshay%2FDocuments%2Fcode%2Fz%2Fstorybook-vitest%2Fsrc%2Fcomponents%2FErrorDisplay.stories.tsx:2:1
1  |  
2  |        html {
   |            ^
3  |          padding: 0;
4  |          margin: 0;```

I am using storybook 8.4.2

### Reproduction link

https://codesandbox.io/p/github/jainaks01-bh/storybook-test-vitest/draft/blazing-water

### Reproduction steps

running command below gives error mentioned above 

https://github.com/jainaks01-bh/storybook-test-vitest

`npm run test`

### System

```bash
Storybook Environment Info:

  System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 7730U with Radeon Graphics
  Binaries:
    Node: 22.7.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD <----- active
  Browsers:
    Edge: Chromium (128.0.2739.42)
  npmPackages:
    @storybook/addon-coverage: ^1.0.4 => 1.0.4
    @storybook/addon-essentials: ^8.4.2 => 8.4.2
    @storybook/addon-interactions: ^8.4.2 => 8.4.2
    @storybook/addon-links: ^8.4.2 => 8.4.2
    @storybook/addon-onboarding: ^8.4.2 => 8.4.2
    @storybook/blocks: ^8.4.2 => 8.4.2
    @storybook/experimental-addon-test: ^8.4.2 => 8.4.2
    @storybook/react: ^8.4.2 => 8.4.2
    @storybook/react-vite: ^8.4.2 => 8.4.2
    @storybook/test: ^8.4.2 => 8.4.2
    @storybook/test-runner: ^0.19.1 => 0.19.1
    before-storybook: file: => 0.0.0
    chromatic: ^11.18.1 => 11.18.1
    eslint-plugin-storybook: ^0.11.0 => 0.11.0
    msw-storybook-addon: ^2.0.4 => 2.0.4
    storybook: ^8.4.2 => 8.4.2

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Empathy Backlog
Development

No branches or pull requests

2 participants