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]: expect.toThrow does not work #28406

Open
kasperpeulen opened this issue Jul 1, 2024 · 0 comments
Open

[Bug]: expect.toThrow does not work #28406

kasperpeulen opened this issue Jul 1, 2024 · 0 comments
Assignees

Comments

@kasperpeulen
Copy link
Contributor

Describe the bug

Getting this error when calling expect.toThrow()

export const LoggedIn: Story = {
  play: async ({ canvasElement }) => {
    await expect(() => {
      throw new Error('throw');
    }).toThrowError();
  },
};
Caught exception in play function
TypeError: Cannot redefine property: not
    at Function.defineProperty (<anonymous>)
    at https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-ICANM5TM.js?v=455c4f60:1577:23
    at Array.reduce (<anonymous>)
    at Instrumenter.instrument (https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-ICANM5TM.js?v=455c4f60:1570:29)
    at Instrumenter.track (https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-ICANM5TM.js?v=455c4f60:1588:17)
    at Proxy.toThrowError (https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/node_modules/.cache/storybook/1c3385a5d25e538d10b518b310c74d3ca2690b6aaffeadccd74da79736171f86/sb-vite/deps/chunk-ICANM5TM.js?v=455c4f60:1580:262)
    at play (https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/src/stories/Page.stories.ts:23:8)
    at playFunction (https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/sb-preview/runtime.js:113:6184)
    at https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/sb-preview/runtime.js:149:3903
    at StoryRender.runPhase (https://kkvilmnmwpgithub-soxc--6006--70dbe416.local-credentialless.webcontainer.io/sb-preview/runtime.js:149:943)

Reproduction link

https://stackblitz.com/edit/github-qlgvbq?file=src%2Fstories%2FPage.stories.ts

Reproduction steps

No response

System

torybook Environment Info:

  System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm <----- active
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @storybook/addon-essentials: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    @storybook/addon-interactions: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    @storybook/addon-links: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    @storybook/addon-onboarding: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    @storybook/blocks: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    @storybook/react: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    @storybook/react-vite: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    @storybook/test: ^8.2.0-alpha.10 => 8.2.0-alpha.10 
    storybook: ^8.2.0-alpha.10 => 8.2.0-alpha.10

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

1 participant