Add support for testing #395
mintydev789
started this conversation in
Ideas
Replies: 1 comment
-
|
I just realized that it was my auth step that was accessing the headers, which I was able to circumvent by checking if I'm in a testing environment and just always skipping auth in that case |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It's currently difficult to test server functions created with this library (or even without it, I imagine). It would be nice if there was some support for mocking them out of the box, just like with the nuqs library. When I try to run a server function wrapped in next-safe-action using Vitest, I get the following error due to it not being able to access the headers:
Action error: `headers` was called outside a request scope. Read more: https://nextjs.org/docs/messages/next-dynamic-api-wrong-contextBeta Was this translation helpful? Give feedback.
All reactions