Skip to content
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

Upgrade to babel@7 #1043

Merged
merged 6 commits into from Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 0 additions & 42 deletions .babelrc

This file was deleted.

14 changes: 14 additions & 0 deletions .babelrc.js
@@ -0,0 +1,14 @@
const { NODE_ENV, BABEL_ENV } = process.env
const cjs = NODE_ENV === 'test' || BABEL_ENV === 'commonjs'
const loose = true

module.exports = {
presets: [['@babel/env', { loose, modules: false }]],
plugins: [
['@babel/proposal-decorators', { legacy: true }],
['@babel/proposal-object-rest-spread', { loose }],
'@babel/transform-react-jsx',
cjs && ['@babel/transform-modules-commonjs', { loose }],
['@babel/transform-runtime', { useESModules: !cjs }],
].filter(Boolean),
}
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -10,6 +10,7 @@ env:
- REACT=16.2
- REACT=16.3
- REACT=16.4
- REACT=16.5
sudo: false
script:
- npm run lint
Expand Down
41 changes: 6 additions & 35 deletions CONTRIBUTING.md
Expand Up @@ -45,10 +45,10 @@ To run in explicit React versions (the number is the version, so `test:16.3` wil
REACT=16.4 npm run test:ci
```

To run tests in all supported React versions, `0.14`, `15`, `16.2`, `16.3`, `16.4`,
To run tests in all supported React versions, `0.14`, `15`, `16.2`, `16.3`, `16.4`, 16.5`,
```
REACT=all npm run test:ci
```
```

To continuously watch and run tests, run the following:
```
Expand All @@ -71,7 +71,6 @@ test/
XX/
package.json
test/
getTestDeps.js
```

So, for example, to test against React 15.4:
Expand All @@ -83,51 +82,22 @@ test/
15.4/
package.json
test/
getTestDeps.js
```

The package.json must include the correct versions of `react`, `react-dom`,
`react-test-renderer` and the correct enzyme adapter for the React version
being used, as well as the needed `create-react-class`, `jest`, `enzyme` versions
and the `jest` and `scripts` sections copied verbatim like this:
The package.json must include the correct versions of `react` & `react-dom`
as well as the needed `create-react-class` like this:

```json
{
"private": true,
"devDependencies": {
"create-react-class": "^15.6.3",
"enzyme": "^3.3.0",
"enzyme-adapter-react-15.4": "^1.0.6",
"jest": "^23.4.2",
"react": "15.4",
"react-dom": "15.4",
"react-test-renderer": "15.4"
},
"jest": {
"testURL": "http://localhost",
"collectCoverage": true,
"coverageDirectory": "./coverage"
},
"scripts": {
"test": "jest"
"react-dom": "15.4"
}
}
```

`getTestDeps.js` should load the version-specific enzyme adapter and
test renderer (all versions newer than 0.14 use `react-test-renderer`,
0.14 uses `react-addons-test-utils`):

```js
import enzyme from 'enzyme'
import TestRenderer from 'react-test-renderer'
import Adapter from 'enzyme-adapter-react-15.4'

enzyme.configure({ adapter: new Adapter() })

export { TestRenderer, enzyme }
```

Then you can run tests against this version with:

```
Expand Down Expand Up @@ -156,6 +126,7 @@ env:
- REACT=16.2
- REACT=16.3
- REACT=16.4
- REACT=16.5
sudo: false
script:
- npm run lint
Expand Down