-
Notifications
You must be signed in to change notification settings - Fork 83
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
Simulating a server-side/client-side request by setting process.client or process.server #576
Comments
I think the issue may stem from here: Where the ssr override is being set so I cannot set whether a unit/function would behave in a certain way if called server-side or client-side renders |
To test this we can create a composable to test:
and the tests:
This happens on test files whether we are using |
Yes, the 'nuxt' environment exposed by this module is purely client-side. Simulating a server environment is a little more complex than setting This is on the roadmap but not a top priority. Let's track in https://github.com/danielroe/nuxt-vitest/issues/201. |
I some unit tests, before using this setup I was able to set
process.client = false
orprocess.server
and then in my test it would be set to false so I can ensure certain expectations e.g.These are just unit tests and I'm wondering why this does not work using this setup and if there's a better way to do this that is supported in my unit tests?
The text was updated successfully, but these errors were encountered: