-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Handle disabled state gracefully #552
Comments
I see similar issue has raised #454 |
Hi @peterbud! So we do a bunch of testing in our projects as well. The way we approached it was to override the This composable then also mocks a user account and returns demo functions that our testing suite can use. You can add this into a testing file: const pathToMocks = resolve('./nuxt-auth.ts')
nuxt.hook('imports:extend', (_imports) => {
_imports.push({ name: 'useAuth', from: pathToMocks })
}) This will then overwrite the Otherwise lets keep discussing how |
Thanks for the reply and the help. Can you point me to an example where this is used somewhere? When I have tried to add this hook to
|
This is very dependent on your testing setup. I do not have much experience with historie, but I assume there is a setup file, similarly to how storybook does this. Inside this setup file you can then inject this new hook. You have to ensure it is only being used for your historie setup and does not override the actual composable in the app. |
Describe the feature
nuxt-auth is working great in my project. However I'm using also
histoire
to build and test my components in isolation. In that case I setisEnabled: false
for nuxt-auth in nuxt.config.tsThe problem is that in that case I get a bunch of errors everywhere where on the server side I have #auth import:
Could not resolve import "#auth"
Question: would it be possible to handle such cases more gracefully and avoid those errors, when the module is disabled?
Additional information
No response
The text was updated successfully, but these errors were encountered: