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

merge in testing #3

Merged
merged 2 commits into from
Aug 11, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"env": {
"test": {
"plugins": [
"istanbul",
["transform-es2015-modules-commonjs", { "loose": true }]
]
},
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ lib
.nyc_output
coverage
es
test/**/lcov.info
test/**/lcov-report
test/react/*/test/**/*.spec.js
test/react/**/src
lcov.info
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
language: node_js
node_js:
- "8"
before_install:
- 'nvm install-latest-npm'
env:
matrix:
- REACT=0.14
- REACT=15
- REACT=16.2
- REACT=16.3
- REACT=16.4
sudo: false
script:
- npm run lint
- npm test
- npm run test
after_success:
- npm run coverage
118 changes: 116 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,135 @@ npm run build:umd:min

### Testing and Linting

To run the tests:
To run the tests in the latest React version:
```
npm run test
```

To run in explicit React versions (the number is the version, so `test:16.3` will run in React version `16.3`):
```
REACT=16.4 npm run test:ci
```

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

To continuously watch and run tests, run the following:
```
npm run test:watch
npm run test -- --watch
```

To perform linting with `eslint`, run the following:
```
npm run lint
```

#### Adding a new React version for testing

To add a new version of React to test react-redux against, create a directory structure
in this format for React version `XX`:

```
test/
react/
XX/
package.json
test/
getTestDeps.js
```

So, for example, to test against React 15.4:


```
test/
react/
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:

```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"
}
}
```

`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:

```
REACT=15.4 npm run test
```

and the new version will also be automatically included in

```
REACT=all npm run test
```

In addition, the new version should be added to the .travis.yml matrix list:

```yaml
language: node_js
node_js:
- "8"
before_install:
- 'nvm install-latest-npm'
env:
matrix:
- REACT=0.14
- REACT=15
- REACT=15.4
- REACT=16.2
- REACT=16.3
- REACT=16.4
sudo: false
script:
- npm run lint
- npm run test
after_success:
- npm run coverage
```

### New Features

Please open an issue with a proposal for a new feature or refactoring before starting on the work. We don't want you to waste your efforts on a pull request that we won't want to accept.
Expand Down
Loading