You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
Hey @brvnonascimento thanks for opening an issue in this repo.
You're right! Addons might either expose decorators that you have to export in your preview.js file or they can expose presets which are automatically applied by Storybook. Unfortunately this library currently has a limitation which is the fact that it does not load presets from addons, so the decorator from storybook-addon-next-router is never picked up.
In order to work around this, you could inject the decorator from the addon, something that would look like this:
// setupTest.jsimport{setGlobalConfig}from'@storybook/testing-react'import*asglobalConfigfrom'../.storybook/preview'import{WithNextRouter}from"storybook-addon-next-router/dist/decorators"setGlobalConfig({
...globalConfig,decorators: [
...globalConfig.decorators,WithNextRouter// not loaded automatically in preset, must add this manually for @storybook/testing-react to pick it up]})
And hopefully your problem is solved. It's not a great solution, especially because you rely on internals from the addon given that it does not export the decorator its the entry file.
I'm working on figuring the presets situation but that might take some time. Hope this helps!
Doesn't work with Storybook Addon Next Router. Probably because it doesn't wrap it around a decorator and uses the
addon
field onmain.js
instead.The text was updated successfully, but these errors were encountered: