Skip to content
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

Is it possible to run Enzyme tests in a browser? #132

Closed
vladimir-rovensky opened this issue Jan 22, 2016 · 2 comments
Closed

Is it possible to run Enzyme tests in a browser? #132

vladimir-rovensky opened this issue Jan 22, 2016 · 2 comments

Comments

@vladimir-rovensky
Copy link

I like the library a lot, but I was wondering if it's possible to run tests written with enzyme in a browser? Say I use the full DOM rendering mode which uses jsdom, then run the test in Chrome. Will it use Chrome's DOM API instead of jsdom?
I think it would be beneficial to still be able to run tests in a real browser, surely there can be subtle differences between jsdom and the real thing.

Thanks

@marr
Copy link

marr commented Jan 26, 2016

I got tests running in the browser with my boilerplate here using browserify and browser-run: marr/my-boilerplate@18d9273

I don't think jsdom is required, even though its pulled into the package.json. I was thinking about using chai-enzyme with tape, but that may not possible.

If you look at the package.json I have to run a weird command:
browserify -i 'react/lib/ReactContext' -i 'react/lib/ExecutionEnvironment' -t babelify test/index.js | browser-run -p 2222 but you can then open the browser (http://localhost:2222) and open web inspector to see the test output. I used the "Cool, huh?" section here: https://medium.com/javascript-scene/why-i-use-tape-instead-of-mocha-so-should-you-6aa105d8eaf4 and some help from @lelandrichardson

@milesj
Copy link
Contributor

milesj commented Feb 5, 2016

I run all my tests through Karma, which launch instances of Chrome and FF. Here's an example of my config: https://github.com/titon/toolkit/blob/3.0/.karma.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants