testing-react
                                
                                 testing-react copied to clipboard
                                
                                    testing-react copied to clipboard
                            
                            
                            
                        Doesn't work with Storybook Addon Next Router
Doesn't work with Storybook Addon Next Router. Probably because it doesn't wrap it around a decorator and uses the addon field on main.js instead.
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.js
import { setGlobalConfig } from '@storybook/testing-react'
import * as globalConfig from '../.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!