glenjamin / skin-deep

Test assertion helpers for use with React's shallowRender test utils
MIT License
200 stars 40 forks source link

Support for React 0.14 #36

Closed clouddra closed 8 years ago

clouddra commented 8 years ago

These are the portions of code that needs to be changed in order to add support for React 0.14.

var React013 = (React.version.substring(0, 4) == '0.13');

var TestUtils;
if (React013) {
  TestUtils = require('react/addons').addons.TestUtils;
} else {
  TestUtils = require('react-addons-test-utils');
}
function withContext(context, fn) {
  if (!React013) return fn();

  var ReactContext = require('react/lib/ReactContext');
  ReactContext.current = context;
  var result = fn();
  ReactContext.current = {};
  return result;
}

The following fork by @raphaeltanyw and me has the changes (need someone to verify if the code is correct).

glenjamin commented 8 years ago

This lib already works on 0.13 and 0.14 - it even runs the tests on both https://travis-ci.org/glenjamin/skin-deep/builds/90946189

The code you've posted is the code which detects 0.14 vs 0.13 and makes things work.

Can you point to any specific issues you're having with 0.14?

clouddra commented 8 years ago

Sorry it was my mistake due to a misconfiguration in my package.json. Thanks for the help.