-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
How do you use mount/jsdom without mocha? #75
Comments
I figured it out. You can close this or leave it to help others. What I needed to do was load jsdom as a global object in my node test script:
|
It might be good to post these things on stack overflow as it's a first resource for most developers these days. |
I consider Stack Overflow a good place to find help for something you want to do with the library which is not a shortcoming of the library itself, but your own knowledge. To me this seems like a legit question to post as an issue, because the library is indeed tied to Mocha, which might be something that should be fixed or at least documented. |
"the library is indeed tied to Mocha" The documentation implies that you can use it without mocha. Which is what I do, so far without problems, except for not knowing how to get jsdom working. Now that I've done that, everything is going well. |
@silvenon @mgeduld We agree this is a legitimate issue. We are working on a 2.0 release that will gut out all ties to mocha, and also include guides/documentation on getting enzyme up and running in every popular testing framework. I apologize for the issues thus far, but I'm glad you've gotten it up and running! |
@mgeduld your jsdom hack worked 👌 for me, thanks! |
Yay! |
Not sure why, but your code wasn't working for me. My version: import {JSDOM} from 'jsdom'
const dom = new JSDOM('<!doctype html><html><body></body></html>')
global.window = dom.window
global.document = dom.window.document |
Hi. I've loaded jsdom like this:
And just to be through I tried const document = jsdom.env... and const window = jsdom.env ...
The runTests method had this statement: mount();
But ever time I run it, I get the following error: "It looks like you called
mount()
without a jsdom document being loaded. ' + 'Make sure to only usemount()
inside of a `describeWithDOM(...)"Your documentation says I don't need to use describeWithDOM if I'm not using mocha.
The text was updated successfully, but these errors were encountered: