Skip to content

Commit 5ff14ae

Browse files
committed
Merge branch 'master' into feature/organize-config
2 parents 94f91ab + 567f36c commit 5ff14ae

File tree

10 files changed

+35
-33
lines changed

10 files changed

+35
-33
lines changed

docusaurus/docs/running-tests.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,18 +173,18 @@ import 'jest-enzyme';
173173

174174
### Option 2: React Testing Library
175175

176-
As an alternative or companion to `enzyme`, you may consider using `react-testing-library`. [`react-testing-library`](https://github.com/kentcdodds/react-testing-library) is a library for testing React components in a way that resembles the way the components are used by end users. It is well suited for unit, integration, and end-to-end testing of React components and applications. It works more directly with DOM nodes, and therefore it's recommended to use with [`jest-dom`](https://github.com/gnapse/jest-dom) for improved assertions.
176+
As an alternative or companion to `enzyme`, you may consider using `react-testing-library`. [`react-testing-library`](https://github.com/testing-library/react-testing-library) is a library for testing React components in a way that resembles the way the components are used by end users. It is well suited for unit, integration, and end-to-end testing of React components and applications. It works more directly with DOM nodes, and therefore it's recommended to use with [`jest-dom`](https://github.com/testing-library/jest-dom) for improved assertions.
177177

178178
To install `react-testing-library` and `jest-dom`, you can run:
179179

180180
```sh
181-
npm install --save @testing-library/react jest-dom
181+
npm install --save @testing-library/react @testing-library/jest-dom
182182
```
183183

184184
Alternatively you may use `yarn`:
185185

186186
```sh
187-
yarn add @testing-library/react jest-dom
187+
yarn add @testing-library/react @testing-library/jest-dom
188188
```
189189

190190
Similar to `enzyme` you can create a `src/setupTests.js` file to avoid boilerplate in your test files:
@@ -194,7 +194,7 @@ Similar to `enzyme` you can create a `src/setupTests.js` file to avoid boilerpla
194194
// this will ensure they're removed after each test.
195195
import '@testing-library/react/cleanup-after-each';
196196
// this adds jest-dom's custom assertions
197-
import 'jest-dom/extend-expect';
197+
import '@testing-library/jest-dom/extend-expect';
198198
```
199199

200200
Here's an example of using `react-testing-library` and `jest-dom` for testing that the `<App />` component renders "Welcome to React".

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"compile:lockfile": "node tasks/compile-lockfile.js"
2020
},
2121
"devDependencies": {
22-
"eslint": "5.16.0",
22+
"eslint": "6.1.0",
2323
"execa": "1.0.0",
2424
"fs-extra": "^7.0.1",
2525
"get-port": "^4.2.0",

packages/eslint-config-react-app/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ module.exports = {
163163
'no-obj-calls': 'warn',
164164
'no-octal': 'warn',
165165
'no-octal-escape': 'warn',
166-
'no-redeclare': 'warn',
166+
// TODO: Remove this option in the next major release of CRA.
167+
// https://eslint.org/docs/user-guide/migrating-to-6.0.0#-the-no-redeclare-rule-is-now-more-strict-by-default
168+
'no-redeclare': ['warn', { builtinGlobals: false }],
167169
'no-regex-spaces': 'warn',
168170
'no-restricted-syntax': ['warn', 'WithStatement'],
169171
'no-script-url': 'warn',

packages/eslint-config-react-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"@typescript-eslint/eslint-plugin": "1.x",
1919
"@typescript-eslint/parser": "1.x",
2020
"babel-eslint": "10.x",
21-
"eslint": "5.x",
22-
"eslint-plugin-flowtype": "2.x",
21+
"eslint": "6.x",
22+
"eslint-plugin-flowtype": "3.x",
2323
"eslint-plugin-import": "2.x",
2424
"eslint-plugin-jsx-a11y": "6.x",
2525
"eslint-plugin-react": "7.x",

packages/react-error-overlay/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@
3737
"@babel/code-frame": "7.0.0",
3838
"@babel/core": "7.4.3",
3939
"anser": "1.4.8",
40-
"babel-eslint": "10.0.1",
40+
"babel-eslint": "10.0.2",
4141
"babel-jest": "^24.8.0",
4242
"babel-loader": "8.0.5",
4343
"babel-preset-react-app": "^9.0.0",
4444
"chalk": "^2.4.2",
4545
"chokidar": "^2.1.2",
4646
"cross-env": "5.2.0",
47-
"eslint": "^5.16.0",
47+
"eslint": "^6.1.0",
4848
"eslint-config-react-app": "^4.0.1",
49-
"eslint-plugin-flowtype": "2.50.1",
50-
"eslint-plugin-import": "2.16.0",
51-
"eslint-plugin-jsx-a11y": "6.2.1",
52-
"eslint-plugin-react": "7.12.4",
49+
"eslint-plugin-flowtype": "3.12.1",
50+
"eslint-plugin-import": "2.18.2",
51+
"eslint-plugin-jsx-a11y": "6.2.3",
52+
"eslint-plugin-react": "7.14.3",
5353
"flow-bin": "^0.63.1",
5454
"html-entities": "1.2.1",
5555
"jest": "24.7.1",

packages/react-scripts/config/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ module.exports = function(webpackEnv) {
192192
manifest[file.name] = file.path;
193193
return manifest;
194194
}, seed);
195-
196195
return {
197196
files: manifestFiles,
198197
};

packages/react-scripts/config/webpack.rules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const eslint = require('eslint');
1212
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
1313
const postcssNormalize = require('postcss-normalize');
1414

15-
const paths = require(',/paths');
15+
const paths = require('./paths');
1616
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
1717
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
1818

packages/react-scripts/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"dependencies": {
3131
"@babel/core": "7.4.3",
3232
"@svgr/webpack": "4.3.1",
33-
"@typescript-eslint/eslint-plugin": "1.10.2",
34-
"@typescript-eslint/parser": "1.10.2",
35-
"babel-eslint": "10.0.1",
33+
"@typescript-eslint/eslint-plugin": "1.13.0",
34+
"@typescript-eslint/parser": "1.13.0",
35+
"babel-eslint": "10.0.2",
3636
"babel-jest": "^24.8.0",
3737
"babel-loader": "8.0.5",
3838
"babel-plugin-named-asset-import": "^0.3.2",
@@ -42,14 +42,14 @@
4242
"css-loader": "2.1.1",
4343
"dotenv": "6.2.0",
4444
"dotenv-expand": "4.2.0",
45-
"eslint": "^5.16.0",
45+
"eslint": "^6.1.0",
4646
"eslint-config-react-app": "^4.0.1",
47-
"eslint-loader": "2.1.2",
48-
"eslint-plugin-flowtype": "2.50.1",
49-
"eslint-plugin-import": "2.16.0",
50-
"eslint-plugin-jsx-a11y": "6.2.1",
51-
"eslint-plugin-react": "7.12.4",
52-
"eslint-plugin-react-hooks": "^1.5.0",
47+
"eslint-loader": "2.2.1",
48+
"eslint-plugin-flowtype": "3.12.1",
49+
"eslint-plugin-import": "2.18.2",
50+
"eslint-plugin-jsx-a11y": "6.2.3",
51+
"eslint-plugin-react": "7.14.3",
52+
"eslint-plugin-react-hooks": "^1.6.1",
5353
"file-loader": "3.0.1",
5454
"fs-extra": "7.0.1",
5555
"html-webpack-plugin": "4.0.0-beta.5",

packages/react-scripts/scripts/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ function isInMercurialRepository() {
5757
// Watch unless on CI or explicitly running all tests
5858
if (
5959
!process.env.CI &&
60-
argv.indexOf('--watchAll') === -1
60+
argv.indexOf('--watchAll') === -1 &&
61+
argv.indexOf('--watchAll=false') === -1
6162
) {
6263
// https://github.com/facebook/create-react-app/issues/5210
6364
const hasSourceControl = isInGitRepository() || isInMercurialRepository();

packages/react-scripts/scripts/utils/createJestConfig.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ module.exports = (resolve, rootDir, isEjecting) => {
8484
];
8585
if (overrides) {
8686
supportedKeys.forEach(key => {
87-
if (overrides.hasOwnProperty(key)) {
88-
if (Array.isArray(config[key]) || typeof config[key] !== 'object') {
87+
if (Object.prototype.hasOwnProperty.call(overrides, key)) {
88+
if (Array.isArray(config[key]) || typeof config[key] !== 'object') {
8989
// for arrays or primitive types, directly override the config key
90-
config[key] = overrides[key];
90+
config[key] = overrides[key];
9191
} else {
9292
// for object types, extend gracefully
93-
config[key] = Object.assign({}, config[key], overrides[key]);
94-
}
95-
93+
config[key] = Object.assign({}, config[key], overrides[key]);
94+
}
95+
9696
delete overrides[key];
9797
}
9898
});

0 commit comments

Comments
 (0)