diff --git a/CHANGELOG.md b/CHANGELOG.md index cb2c40262a72..e4aca3a8512d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 diff --git a/docs/Configuration.md b/docs/Configuration.md index 1e3e77e18799..d05ec5d8afbc 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -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] @@ -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] diff --git a/docs/TutorialReact.md b/docs/TutorialReact.md index 86e7ad818d8d..11b6f3664ddd 100644 --- a/docs/TutorialReact.md +++ b/docs/TutorialReact.md @@ -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'); @@ -202,24 +202,22 @@ Warning: is using uppercase HTML. Always use lowercase HTML ta Warning: The tag 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 diff --git a/docs/TutorialReactNative.md b/docs/TutorialReactNative.md index fddf9ebefcbd..48e98ba72684 100644 --- a/docs/TutorialReactNative.md +++ b/docs/TutorialReactNative.md @@ -211,8 +211,8 @@ jest.mock('react-native-video', () => 'Video'); ``` This will render the component as `