-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
isServer detection faulty when jsdom is present #154
Comments
This actually make t3-env support Deno out of the box, so why not🤷 The only question is how reliable is this |
I'd say this is an app-concern and you should use the option to override the default behavior. We can't cover every case by default and I think |
Hmm looks like we use a slightly more covering one in trpc so maybe? |
Feel free to extend the default isServer check to something that covers more runtimes. We can't cover everything though so it has to be a reasonable default for common setups widely used |
I added detection of Deno as server in #220 (Netlify uses Deno to bundle Next.js for edge) For those coming here for a workaround until #220 is merged can add this to
e.g.
|
My testing environment installs jsdom which sets a window global - meaning that all tests run as a client according to t3-env.
My initial reaction is to override the isServer check to something like this solution mentioned on the jsdom repo.
It feels like an acceptable solution (and I'm happy to send a PR) but I'm not 100% sure if the change is a good one?
https://github.com/t3-oss/t3-env/blob/63a7fed1cb85e05d59c1c3c87e5b434cc8a353cc/packages/core/index.ts#L202C37-L202C66
The text was updated successfully, but these errors were encountered: