storybookjs / testing-react

Testing utilities that allow you to reuse your Storybook stories in your React unit tests!
MIT License
588 stars 24 forks source link

Storybook 7.0 alpha.44 removed defaultDecorateStory, breaks testing-react #119

Closed IanVS closed 1 year ago

IanVS commented 2 years ago

I attempted to upgrade storybook to the latest alphas, and got this error:

'defaultDecorateStory' is not exported by node_modules/@storybook/client-api/dist/index.mjs, imported by node_modules/@storybook/testing-react/dist/testing-react.esm.js
file: /Users/ianvs/code/defined/webclient/node_modules/@storybook/testing-react/dist/testing-react.esm.js:1:28
1: import { combineParameters, defaultDecorateStory } from '@storybook/client-api';
                               ^
2: import addons, { mockChannel, HooksContext, applyHooks } from '@storybook/addons';

The only thing I'm using from this library is:

import { composeStory } from '@storybook/testing-react';
IanVS commented 2 years ago

Note for others having trouble with this, you might be able to import composeStory from @storybook/react instead, in recent 7.0 alpha versions.

0xDing commented 2 years ago

Note for others having trouble with this, you might be able to import composeStory from @storybook/react instead, in recent 7.0 alpha versions.

But @storybook/react has invalid esm dist, that not work in vitest

https://github.com/storybookjs/storybook/issues/19501

IanVS commented 1 year ago

This is fixed in version v2.0.0-next.0. Please let us know if you still have any problems after updating.