Testing React 0.15 on Meteor

I’m following the instructions in the testing React, using enzyme, which is cool. But when I try to run the tests I get:

Unable to resolve some modules:

  "react/addons" in
/Users/jherri1/projects/admiral2/node_modules/enzyme/build/react-compat.js
(web.browser)
  "react/lib/ReactContext" in
/Users/jherri1/projects/admiral2/node_modules/enzyme/build/react-compat.js
(web.browser)
  "react/lib/ExecutionEnvironment" in
/Users/jherri1/projects/admiral2/node_modules/enzyme/build/react-compat.js
(web.browser)

I’ve been looking around for solutions. On the webpack side there are solutions for adding externals, but on the Meteor side the question is left unanswered. Any way to add externals to the Meteor module loader?

I thought these are not even included in react 15 anymore. Like aren’t the React addons in a separate package now?

Yup. These are no longer necessary. enzyme appears to include them “just in case” it’s being run on 0.13, but the module loader thinks it needs them anyway.

Ok, turns out those are just warnings, but they are annoying anyway. And, as it turns out, these particular module load warnings can be ignored. But others can’t. So… I’d still love to see them go. Any ideas?

Did you find any solution for that?

1 Like