You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update from upstream repo facebook/create-react-app@master (#3)
* Add modes to our Babel preset (1.x) (facebook#4668)
* babel-preset-react-app@3.1.2
* add react-testing-library documentation/examples (facebook#4679)
* add react-testing-library documentation/examples
* make react-testing-library a heading
* fix typo
* Fix link to the article about BEM (facebook#4858)
* Use file name whitelist to prevent RCE (facebook#4866)
* Use file name whitelist to prevent RCE
Use a whitelist to validate user-provided file names. This doesn't cover
the entire range of valid filenames but should cover almost all of them
in practice. Allows letters, numbers, periods, dashes, and underscores.
Opting to use a whitelist instead of a blacklist because getting this
wrong leaves us vulnerable to a RCE attack.
* Allow alphabet characters from all languages
Updated the whitelist to /^[\p{L}0-9/.\-_]+$/u, which matches
alphanumeric characters, periods, dashes, and underscores. Unicode
property support is stage 4 so I've inlined the transpiled version.
* Only use file name whitelist on Windows
* Log error message if file name does not pass whitelist
* Bump versions
* Bump release
* Add 1.1.5 release notes
Copy file name to clipboardexpand all lines: CHANGELOG.md
+28
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,31 @@
1
+
## 1.1.5 (August 24, 2018)
2
+
3
+
*`react-scripts`
4
+
5
+
* Update the `webpack-dev-server` dependency
6
+
7
+
*`react-dev-utils`
8
+
9
+
*[#4866](https://github.com/facebook/create-react-app/pull/4866) Fix a Windows-only vulnerability (`CVE-2018-6342`) in the development server ([@acdlite](https://github.com/acdlite))
10
+
* Update the `sockjs-client` dependency
11
+
12
+
#### Committers: 1
13
+
- Andrew Clark ([acdlite](https://github.com/acdlite))
14
+
15
+
### Migrating from 1.1.4 to 1.1.5
16
+
17
+
Inside any created project that has not been ejected, run:
Copy file name to clipboardexpand all lines: packages/react-scripts/template/README.md
+43-1
Original file line number
Diff line number
Diff line change
@@ -506,7 +506,7 @@ class Button extends Component {
506
506
}
507
507
```
508
508
509
-
**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-ui-engineering/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.
509
+
**This is not required for React** but many people find this feature convenient. You can read about the benefits of this approach [here](https://medium.com/seek-blog/block-element-modifying-your-javascript-components-d7f99fcab52b). However you should be aware that this makes your code less portable to other build tools and environments than Webpack.
510
510
511
511
In development, expressing dependencies this way allows your styles to be reloaded on the fly as you edit them. In production, all CSS files will be concatenated into a single minified `.css` file in the build output.
512
512
@@ -1428,6 +1428,48 @@ Import it in [`src/setupTests.js`](#initializing-test-environment) to make its m
1428
1428
import'jest-enzyme';
1429
1429
```
1430
1430
1431
+
#### Use `react-testing-library`
1432
+
1433
+
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.
1434
+
1435
+
To install `react-testing-library` and `jest-dom`, you can run:
1436
+
1437
+
```sh
1438
+
npm install --save react-testing-library jest-dom
1439
+
```
1440
+
1441
+
Alternatively you may use `yarn`:
1442
+
1443
+
```sh
1444
+
yarn add react-testing-library jest-dom
1445
+
```
1446
+
1447
+
Similar to `enzyme` you can create a `src/setupTests.js` file to avoid boilerplate in your test files:
1448
+
1449
+
```js
1450
+
// react-testing-library renders your components to document.body,
1451
+
// this will ensure they're removed after each test.
1452
+
import'react-testing-library/cleanup-after-each';
1453
+
1454
+
// this adds jest-dom's custom assertions
1455
+
import'jest-dom/extend-expect';
1456
+
```
1457
+
1458
+
Here's an example of using `react-testing-library` and `jest-dom` for testing that the `<App />` component renders "Welcome to React".
1459
+
1460
+
```js
1461
+
importReactfrom'react';
1462
+
import { render } from'react-testing-library';
1463
+
importAppfrom'./App';
1464
+
1465
+
it('renders welcome message', () => {
1466
+
const { getByText } =render(<App />);
1467
+
expect(getByText('Welcome to React')).toBeInTheDOM();
1468
+
});
1469
+
```
1470
+
1471
+
Learn more about the utilities provided by `react-testing-library` to facilitate testing asynchronous interactions as well as selecting form elements from [the `react-testing-library` documentation](https://github.com/kentcdodds/react-testing-library) and [examples](https://codesandbox.io/s/github/kentcdodds/react-testing-library-examples).
1472
+
1431
1473
### Using Third Party Assertion Libraries
1432
1474
1433
1475
We recommend that you use `expect()` for assertions and `jest.fn()` for spies. If you are having issues with them please [file those against Jest](https://github.com/facebook/jest/issues/new), and we’ll fix them. We intend to keep making them better for React, supporting, for example, [pretty-printing React elements as JSX](https://github.com/facebook/jest/pull/1566).
0 commit comments