Skip to content

Commit

Permalink
chore: add missing release to changelog (#5348)
Browse files Browse the repository at this point in the history
* chore: add missing release to changelog

* docs: run prettier on all markdown

* docs: add missing parens in changelog
  • Loading branch information
SimenB authored and cpojer committed Jan 19, 2018
1 parent e8eb1d1 commit 630b5c0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 29 deletions.
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@
* `[jest-config]` Added restoreMocks config option.
([#5327](https://github.com/facebook/jest/pull/5327))

## jest 22.1.1

### Fixes

* `[*]` Move from "process.exit" to "exit.
([#5313](https://github.com/facebook/jest/pull/5313))

## jest 22.1.0

### Features
Expand All @@ -30,14 +37,18 @@
having been passed to the CLI

### Fixes

* `[jest-cli]` Use `import-local` to support global Jest installations.
([#5304](https://github.com/facebook/jest/pull/5304))
* `[jest-runner]` Fix memory leak in coverage reporting
([#5289](https://github.com/facebook/jest/pull/5289))
* `[docs]` Update mention of the minimal version of node supported [#4947](https://github.com/facebook/jest/issues/4947)
* `[jest-cli]` Fix missing newline in console message ([#5308](https://github.com/facebook/jest/pull/5308))
* `[docs]` Update mention of the minimal version of node supported
([#4947](https://github.com/facebook/jest/issues/4947))
* `[jest-cli]` Fix missing newline in console message
([#5308](https://github.com/facebook/jest/pull/5308))
* `[jest-cli]` `--lastCommit` and `--changedFilesWithAncestor` now take effect
even when `--onlyChanged` is not specified. ([#5307](https://github.com/facebook/jest/pull/5307))
even when `--onlyChanged` is not specified.
([#5307](https://github.com/facebook/jest/pull/5307))

### Chore & Maintenance

Expand Down
7 changes: 3 additions & 4 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ For example, the following would create a global `__DEV__` variable set to
Note that, if you specify a global reference value (like an object or array)
here, and some code mutates that value in the midst of running a test, that
mutation will _not_ be persisted across test runs for other test files. In
addition the `globals` object must be json-serializable, so it can't be used
to specify global functions. For that you should use `setupFiles`.
addition the `globals` object must be json-serializable, so it can't be used to
specify global functions. For that you should use `setupFiles`.

### `globalSetup` [string]

Expand Down Expand Up @@ -611,8 +611,7 @@ Default: `false`

Automatically restore mock state between every test. Equivalent to calling
`jest.restoreAllMocks()` between each test. This will lead to any mocks having
their fake implementations removed and restores their initial
implementation.
their fake implementations removed and restores their initial implementation.

### `rootDir` [string]

Expand Down
38 changes: 18 additions & 20 deletions docs/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ The code for this example is available at

#### Snapshot Testing with Mocks, Enzyme and React 16

There's a caveat around snapshot testing when using Enzyme and React 16+.
If you mock out a module using the following style:
There's a caveat around snapshot testing when using Enzyme and React 16+. If you
mock out a module using the following style:

```js
jest.mock('../SomeDirectory/SomeComponent', () => 'SomeComponent');
Expand All @@ -202,24 +202,22 @@ Warning: <SomeComponent /> is using uppercase HTML. Always use lowercase HTML ta
Warning: The tag <SomeComponent> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.
```

React 16 triggers these warnings due to how it checks element types, and
the mocked module fails these checks. Your options are:

1. Render as text. This way you won't see the props passed to the mock
component in the snapshot, but it's straightforward:
```js
jest.mock('./SomeComponent', () => () => 'SomeComponent');
```
2. Render as a custom element. DOM "custom elements" aren't checked for
anything and shouldn't fire warnings. They are lowercase and have a
dash in the name.
```js
jest.mock('./Widget', () => 'mock-widget');
```
3. Use `react-test-renderer`. The test renderer doesn't care about
element types and will happily accept e.g. `SomeComponent`. You could
check snapshots using the test renderer, and check component
behaviour separately using Enzyme.
React 16 triggers these warnings due to how it checks element types, and the
mocked module fails these checks. Your options are:

1. Render as text. This way you won't see the props passed to the mock component
in the snapshot, but it's straightforward:
```js
jest.mock('./SomeComponent', () => () => 'SomeComponent');
```
2. Render as a custom element. DOM "custom elements" aren't checked for anything
and shouldn't fire warnings. They are lowercase and have a dash in the name.
```js
jest.mock('./Widget', () => 'mock-widget');
```
3. Use `react-test-renderer`. The test renderer doesn't care about element types
and will happily accept e.g. `SomeComponent`. You could check snapshots using
the test renderer, and check component behaviour separately using Enzyme.
### DOM Testing
Expand Down
4 changes: 2 additions & 2 deletions docs/TutorialReactNative.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ jest.mock('react-native-video', () => 'Video');
```

This will render the component as `<Video {...props} />` with all of its props
in the snapshot output. See also [caveats around Enzyme and React
16](tutorial-react.html#snapshot-testing-with-mocks-enzyme-and-react-16).
in the snapshot output. See also
[caveats around Enzyme and React 16](tutorial-react.html#snapshot-testing-with-mocks-enzyme-and-react-16).

Sometimes you need to provide a more complex manual mock. For example if you'd
like to forward the prop types or static fields of a native component to a mock,
Expand Down

0 comments on commit 630b5c0

Please sign in to comment.