These are chat archives for airbnb/enzyme

26th
Jan 2016
David Marr
@marr
Jan 26 2016 02:45
I'm trying to browserify a test that uses enzyme with the babelify plugin, and I get Error: Cannot find module 'react/lib/ReactContext' from '/Users/dm/src/my-boilerplate/node_modules/enzyme/build'
Leland Richardson
@lelandrichardson
Jan 26 2016 02:46
you’ll have to add react/lib/ReactContext to the list of ignored module paths
David Marr
@marr
Jan 26 2016 02:48
I added that to .babelrc but it still fails: "ignore": ["react/lib/ReactContext", "react/lib/ExecutionEnvironment"]
Leland Richardson
@lelandrichardson
Jan 26 2016 02:48
that just causes babel to ignore it, not browserify
browserify is trying to bundle it but it’s a file that doesn’t exist
David Marr
@marr
Jan 26 2016 02:51
thanks @lelandrichardson -- this does seem to work browserify -i 'react/lib/ReactContext' -i 'react/lib/ExecutionEnvironment' -t babelify test/index.js
Leland Richardson
@lelandrichardson
Jan 26 2016 02:51
:thumbsup:
i’m working on setting up several sample repos with different testing environments to point people to
it’s kind of a bummer you have to jump through so many hoops right now
David Marr
@marr
Jan 26 2016 02:52
i do get some errors about modifying global now.. i'm trying to pipe it to browser-run
yeah, getting stuff working in webpack/browserify, karma, mocha/tape seems to have issues every step of the way
Seeing this TypeError: Cannot assign to read only property 'document' of [object global]
Leland Richardson
@lelandrichardson
Jan 26 2016 02:53
yah. Working on making that way easier with 2.0
that might be because you are using describeWithDOM
if you are running it in the browser, there is no need to use that
David Marr
@marr
Jan 26 2016 02:54
nah i'm using tape
Leland Richardson
@lelandrichardson
Jan 26 2016 02:55
what does browser-run do?
if you search that page for 'cool' it explains running the tests in a browser
Leland Richardson
@lelandrichardson
Jan 26 2016 02:58
it seems like the TypeError you’re getting above is from trying to set global.document, which IIRC only happens in describeWithDOM
i’m not sure why you’d be getting the error if you’re not using that
(or jsdom)
David Marr
@marr
Jan 26 2016 02:59
@lelandrichardson ahh thank you .. i was trying to load a helper
Leland Richardson
@lelandrichardson
Jan 26 2016 03:00
ahh, gotcha
David Marr
@marr
Jan 26 2016 03:00
im not sure chai-enzyme will work with tape
thats what i'm trying to figure out
at least i have enzyme working with tape in the browser now.. thanks!
Leland Richardson
@lelandrichardson
Jan 26 2016 03:03
:thumbsup:
i’d love it if you posted the workarounds you needed to do in an issue on the repo
David Marr
@marr
Jan 26 2016 03:05
yeah i will!
Leland Richardson
@lelandrichardson
Jan 26 2016 03:05
thanks
David Marr
@marr
Jan 26 2016 03:30
done
Joseph McElroy
@joemcelroy
Jan 26 2016 14:09
hey guys we blogged about how we component test using enzyme
amongst other things
love to hear your feedback