From fca3c4dd9da56d98d754c4420cb61cb9f0565a7c Mon Sep 17 00:00:00 2001 From: michaelw85 Date: Tue, 5 Mar 2019 11:13:09 +0100 Subject: [PATCH 1/4] Add note to automock configuration Add info related to manual mocks for node module mocks. Closes #8049 --- docs/Configuration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Configuration.md b/docs/Configuration.md index 585a8a1b6e9d..34928b7963bc 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -94,6 +94,7 @@ test('if utils mocked automatically', () => { expect(utils.isAuthorized('not_wizard')).toBeTruthy(); }); ``` +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ From e18e379cca363d8ea81099fe47abd3a644563f58 Mon Sep 17 00:00:00 2001 From: michaelw85 Date: Tue, 5 Mar 2019 11:19:19 +0100 Subject: [PATCH 2/4] Update Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39d765fd161b..ad31ab6fef4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -87,6 +87,7 @@ - `[docs]`: Improve runAllTimers doc (it exhausts the micro-task queue) ([#8031](https://github.com/facebook/jest/pull/8031)) - `[jest-cli]`: Migrate to TypeScript ([#8024](https://github.com/facebook/jest/pull/8024)) - `[jest]`: Migrate to TypeScript ([#8024](https://github.com/facebook/jest/pull/8024)) +- `[docs]` Update automock configuration, add note related to manual mocks ([#8051](https://github.com/facebook/jest/pull/8051)) ### Performance From 64e040f3955475bb3f1bf1ef8dd54b34935d491c Mon Sep 17 00:00:00 2001 From: michaelw85 Date: Tue, 5 Mar 2019 11:33:13 +0100 Subject: [PATCH 3/4] Update versioned docs + fix linting issue --- docs/Configuration.md | 1 + website/versioned_docs/version-22.x/Configuration.md | 2 ++ website/versioned_docs/version-23.x/Configuration.md | 2 ++ website/versioned_docs/version-24.0/Configuration.md | 2 ++ website/versioned_docs/version-24.1/Configuration.md | 2 ++ 5 files changed, 9 insertions(+) diff --git a/docs/Configuration.md b/docs/Configuration.md index 34928b7963bc..593a96885489 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -94,6 +94,7 @@ test('if utils mocked automatically', () => { expect(utils.isAuthorized('not_wizard')).toBeTruthy(); }); ``` + _Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ diff --git a/website/versioned_docs/version-22.x/Configuration.md b/website/versioned_docs/version-22.x/Configuration.md index 14271562155d..af7c0143c5f1 100644 --- a/website/versioned_docs/version-22.x/Configuration.md +++ b/website/versioned_docs/version-22.x/Configuration.md @@ -82,6 +82,8 @@ test('if utils mocked automatically', () => { }); ``` +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ + _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ _Note: Automocking has a performance cost most noticeable in large projects. See [here](troubleshooting.html#tests-are-slow-when-leveraging-automocking) for details and a workaround._ diff --git a/website/versioned_docs/version-23.x/Configuration.md b/website/versioned_docs/version-23.x/Configuration.md index d7866feec924..d0863762a7b5 100644 --- a/website/versioned_docs/version-23.x/Configuration.md +++ b/website/versioned_docs/version-23.x/Configuration.md @@ -96,6 +96,8 @@ test('if utils mocked automatically', () => { }); ``` +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ + _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ _Note: Automocking has a performance cost most noticeable in large projects. See [here](troubleshooting.html#tests-are-slow-when-leveraging-automocking) for details and a workaround._ diff --git a/website/versioned_docs/version-24.0/Configuration.md b/website/versioned_docs/version-24.0/Configuration.md index b7c2dc92c3ba..bf52b821c9c5 100644 --- a/website/versioned_docs/version-24.0/Configuration.md +++ b/website/versioned_docs/version-24.0/Configuration.md @@ -96,6 +96,8 @@ test('if utils mocked automatically', () => { }); ``` +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ + _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ _Note: Automocking has a performance cost most noticeable in large projects. See [here](troubleshooting.html#tests-are-slow-when-leveraging-automocking) for details and a workaround._ diff --git a/website/versioned_docs/version-24.1/Configuration.md b/website/versioned_docs/version-24.1/Configuration.md index e79fee27dd77..4e65bd00d225 100644 --- a/website/versioned_docs/version-24.1/Configuration.md +++ b/website/versioned_docs/version-24.1/Configuration.md @@ -96,6 +96,8 @@ test('if utils mocked automatically', () => { }); ``` +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ + _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ _Note: Automocking has a performance cost most noticeable in large projects. See [here](troubleshooting.html#tests-are-slow-when-leveraging-automocking) for details and a workaround._ From e94cb74e1170dda39d14456236eef640b5a90cb3 Mon Sep 17 00:00:00 2001 From: michaelw85 Date: Tue, 5 Mar 2019 11:53:11 +0100 Subject: [PATCH 4/4] Add trailing . --- docs/Configuration.md | 2 +- website/versioned_docs/version-22.x/Configuration.md | 2 +- website/versioned_docs/version-23.x/Configuration.md | 2 +- website/versioned_docs/version-24.0/Configuration.md | 2 +- website/versioned_docs/version-24.1/Configuration.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index 593a96885489..894e840f4b83 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -95,7 +95,7 @@ test('if utils mocked automatically', () => { }); ``` -_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)._ _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ diff --git a/website/versioned_docs/version-22.x/Configuration.md b/website/versioned_docs/version-22.x/Configuration.md index af7c0143c5f1..8647c4cb58f2 100644 --- a/website/versioned_docs/version-22.x/Configuration.md +++ b/website/versioned_docs/version-22.x/Configuration.md @@ -82,7 +82,7 @@ test('if utils mocked automatically', () => { }); ``` -_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)._ _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ diff --git a/website/versioned_docs/version-23.x/Configuration.md b/website/versioned_docs/version-23.x/Configuration.md index d0863762a7b5..605744066224 100644 --- a/website/versioned_docs/version-23.x/Configuration.md +++ b/website/versioned_docs/version-23.x/Configuration.md @@ -96,7 +96,7 @@ test('if utils mocked automatically', () => { }); ``` -_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)._ _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ diff --git a/website/versioned_docs/version-24.0/Configuration.md b/website/versioned_docs/version-24.0/Configuration.md index bf52b821c9c5..a855c76816fb 100644 --- a/website/versioned_docs/version-24.0/Configuration.md +++ b/website/versioned_docs/version-24.0/Configuration.md @@ -96,7 +96,7 @@ test('if utils mocked automatically', () => { }); ``` -_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)._ _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._ diff --git a/website/versioned_docs/version-24.1/Configuration.md b/website/versioned_docs/version-24.1/Configuration.md index 4e65bd00d225..025f0c8cec21 100644 --- a/website/versioned_docs/version-24.1/Configuration.md +++ b/website/versioned_docs/version-24.1/Configuration.md @@ -96,7 +96,7 @@ test('if utils mocked automatically', () => { }); ``` -_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)_ +_Note: Node modules are automatically mocked when you have a manual mock in place (e.g.: `__mocks__/lodash.js`). More info [here](manual-mocks.html#mocking-node-modules)._ _Note: Core modules, like `fs`, are not mocked by default. They can be mocked explicitly, like `jest.mock('fs')`._