How to detect happy-dom environment? #481
-
Hi! I'm currently using the following code to detect JSDOM environment: const isJSDOM =
typeof navigator !== "undefined" && navigator.userAgent.includes("jsdom"); How do I do this for Happy DOM? Is there a recommended way to reliably detect both JSDOM and Happy DOM (and maybe other alternatives)? |
Beta Was this translation helpful? Give feedback.
Answered by
capricorn86
May 20, 2022
Replies: 1 comment
-
Hi @diegohaz! 🙂 It is possible to detect that it is an Happy DOM environment by checking if Example if(window.happyDOM) {
// Do something
} I have added the issue #482 for adding it to navigation.userAgent as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
capricorn86
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @diegohaz! 🙂
It is possible to detect that it is an Happy DOM environment by checking if
window.happyDOM
is defined.Example
I have added the issue #482 for adding it to navigation.userAgent as well.