Skip to content

Commit

Permalink
Updates for react 0.15: bundle exclusions & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glenjamin committed Apr 11, 2016
1 parent 6fafff4 commit 84325b1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ after_script: "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
env:
- REACT=0.13
- REACT=0.14
- REACT=15.0
before_script: "npm install -g npm@2; sh install-relevant-react.sh"
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Test assertion helpers for use with React's shallowRender test utils.

### React Version

This lib works on both React 0.13 and React 0.14. Because it uses some tools that changed between these versions, it cannot depend on them directly via `package.json`. When using React 0.14, you'll need to add `react-addons-test-utils` into your project's dependencies yourself.
This lib works on both React 0.13 and React 0.14+. Because it uses some tools that changed between these versions, it cannot depend on them directly via `package.json`. When using React 0.14, you'll need to add `react-addons-test-utils` into your project's dependencies yourself.

## Install

Expand Down Expand Up @@ -37,23 +37,24 @@ You can also consult the [documentation for the upcoming Version 1.0](https://gi

### Errors when bundling

This lib currently supports both React 0.13 and React 0.14. If you are using a bundling tool for your test suite this will cause problems. You will need to add config to ignore the React internals for the version you are not using:
This lib currently supports both React 0.13 and React 0.14+. If you are using a bundling tool for your test suite this will cause problems. You will need to add config to ignore the React internals for the version you are not using:

####

```js
// React 0.14 & Webpack
// React 0.14+ & Webpack
plugins: [
new webpack.IgnorePlugin(/ReactContext/),
new webpack.IgnorePlugin(/ReactContext|react\/addons/),
]

// React 0.13 & Webpack
// React 0.13+ & Webpack
plugins: [
new webpack.IgnorePlugin(/react-addons|react-dom/),
]

// React 0.14 & Browserify
bundle.exclude('react/lib/ReactContext');
bundle.exclude('react/addons');

// React 0.13 & Browserify
bundle.exclude('react-dom/server');
Expand All @@ -62,10 +63,11 @@ bundle.exclude('react-addons-test-utils');

```sh
// React 0.14 & jspm
jspm install npm:skin-deep -o "{map: {'react/lib/ReactContext': '@empty'}}"
jspm install npm:skin-deep -o "{map: {'react/lib/ReactContext': '@empty',
'react/addons': '@empty'}}"

// React 0.13 & jspm
jspm install npm:skin-deep -o "{map: {'react-dom/server': '@empty'
jspm install npm:skin-deep -o "{map: {'react-dom/server': '@empty',
'react-addons-test-utils': '@empty'}}"
```

Expand Down
5 changes: 4 additions & 1 deletion install-relevant-react.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ if [ "$REACT" = "0.13" ]; then
fi

npm prune
npm install
npm install react@$REACT \
react-dom@$REACT \
react-addons-test-utils@$REACT \
react-addons-create-fragment@$REACT

0 comments on commit 84325b1

Please sign in to comment.