-
-
Notifications
You must be signed in to change notification settings - Fork 72
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 to get it working in Karma? #16
Comments
@jbinto thanks for your work! chai-enzyme is transpiled to es2015 with babel, so this shouldn't be the issue. i believe it's the fact that we are trying to run commonjs code in a browser environment without any preparation. both mocha and chai come with a browser bundle see https://github.com/xdissent/karma-chai/blob/master/index.js#L9 i believe we can use webpack to accomplish it see https://webpack.github.io/docs/configuration.html#output-librarytarget this can be done either in this repository, a separate one or in your karma plugin. let me know if you wanna try to tackle this... i'll be very happy to assist in any way possible |
(You can also use browserify) |
I am having trouble getting this working with browserify and tape. Unrelated to karma but it seems appropriate:
Here is a repo I am working on: https://github.com/marr/my-boilerplate |
FWIW, I did get this working in browser with tape, enzymejs/enzyme#132 (comment) |
good to know, thanks! |
@jbinto is it possible you can get it working by requiring like this: var chai-enzyme = require('chai-enzyme').default
// vs.
var chai-enzyme = require('chai-enzyme') This is something we will have to address soon, let me know if that fixes it for you if so I'll make some time to get this working out of the box. For future me see |
Actually a better solution would be for |
@jbinto this should be no longer an issue as of |
I'm trying to get this working with a Karma/webpack setup and I'm pretty lost as to how to do this. What is the proper way to get this working with Karma? Is there documentation anywhere that would show this? Would really appreciate any help offered. |
@reintroducing I'm not familiar with karma, but I saw @jbinto figured this out in react-boilerplate/react-boilerplate#119 & react-boilerplate/react-boilerplate#150. Maybe checking out react-boilerplate's karma.conf.js will help you out. |
@ayrton I looked it over before posting but the setup is slightly different than mine. I'm going to try again with that exact setup when I get a moment and see if I can chase this down. Thanks for the links. |
On react-boilerplate/react-boilerplate#79 (comment) (see link for more info) we are trying to convert from mocha/jsdom to Karma/Chrome.
I tried to create a Karma plugin for
chai-enzyme
(a naive copy paste based on anotherkarma-chai-foobar
) but I'm having trouble with the fact thatchai-enzyme
is published as an ES6 module, and Karma doesn't understand that.I admit I am pretty fuzzy when it comes to implementation details of
require
, CommonJS, ES modules, etc. I know even less about Karma plugins.How could we get this working?
The text was updated successfully, but these errors were encountered: