From d85d5429ade560852737cc03b3649fcd2252685f Mon Sep 17 00:00:00 2001 From: Tom Mrazauskas Date: Tue, 2 May 2023 13:14:14 +0300 Subject: [PATCH] docs: add few more missing admonitions (#14100) --- docs/SnapshotTesting.md | 2 +- .../versioned_docs/version-25.x/MockFunctionAPI.md | 12 ++++++++++-- .../versioned_docs/version-25.x/SnapshotTesting.md | 12 ++++++++---- .../versioned_docs/version-26.x/MockFunctionAPI.md | 12 ++++++++++-- .../versioned_docs/version-26.x/SnapshotTesting.md | 12 ++++++++---- website/versioned_docs/version-26.x/TimerMocks.md | 2 -- .../versioned_docs/version-27.x/MockFunctionAPI.md | 12 ++++++++++-- .../versioned_docs/version-27.x/SnapshotTesting.md | 2 +- .../versioned_docs/version-28.x/SnapshotTesting.md | 2 +- .../versioned_docs/version-29.0/SnapshotTesting.md | 2 +- .../versioned_docs/version-29.1/SnapshotTesting.md | 2 +- .../versioned_docs/version-29.2/SnapshotTesting.md | 2 +- .../versioned_docs/version-29.3/SnapshotTesting.md | 2 +- .../versioned_docs/version-29.4/SnapshotTesting.md | 2 +- .../versioned_docs/version-29.5/SnapshotTesting.md | 2 +- 15 files changed, 55 insertions(+), 25 deletions(-) diff --git a/docs/SnapshotTesting.md b/docs/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/docs/SnapshotTesting.md +++ b/docs/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-25.x/MockFunctionAPI.md b/website/versioned_docs/version-25.x/MockFunctionAPI.md index 616c1b8d8d8c..3cbc6e53f6ad 100644 --- a/website/versioned_docs/version-25.x/MockFunctionAPI.md +++ b/website/versioned_docs/version-25.x/MockFunctionAPI.md @@ -360,7 +360,11 @@ You can see an example of using Jest with TypeScript in our [GitHub repository]( ### `jest.MockedFunction` -> `jest.MockedFunction` is available in the `@types/jest` module from version `24.9.0`. +:::tip + +`jest.MockedFunction` is available in the `@types/jest` module from version `24.9.0`. + +::: The following examples will assume you have an understanding of how [Jest mock functions work with JavaScript](MockFunctions.md). @@ -424,7 +428,11 @@ test('calculate calls add', () => { ### `jest.MockedClass` -> `jest.MockedClass` is available in the `@types/jest` module from version `24.9.0`. +:::tip + +`jest.MockedClass` is available in the `@types/jest` module from version `24.9.0`. + +::: The following examples will assume you have an understanding of how [Jest mock classes work with JavaScript](Es6ClassMocks.md). diff --git a/website/versioned_docs/version-25.x/SnapshotTesting.md b/website/versioned_docs/version-25.x/SnapshotTesting.md index 5c640fc308d2..1dabee33f66a 100644 --- a/website/versioned_docs/version-25.x/SnapshotTesting.md +++ b/website/versioned_docs/version-25.x/SnapshotTesting.md @@ -107,11 +107,15 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -> Inline snapshots are powered by [Prettier](https://prettier.io). To use inline snapshots you must have `prettier` installed in your project. Your Prettier configuration will be respected when writing to test files. -> -> If you have `prettier` installed in a location where Jest can't find it, you can tell Jest how to find it using the [`"prettierPath"`](./Configuration.md#prettierpath-string) configuration property. +:::info + +Inline snapshots are powered by [Prettier](https://prettier.io). To use inline snapshots you must have `prettier` installed in your project. Your Prettier configuration will be respected when writing to test files. + +If you have `prettier` installed in a location where Jest can't find it, you can tell Jest how to find it using the [`prettierPath`](./Configuration.md#prettierpath-string) configuration property. + +::: -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-26.x/MockFunctionAPI.md b/website/versioned_docs/version-26.x/MockFunctionAPI.md index 616c1b8d8d8c..3cbc6e53f6ad 100644 --- a/website/versioned_docs/version-26.x/MockFunctionAPI.md +++ b/website/versioned_docs/version-26.x/MockFunctionAPI.md @@ -360,7 +360,11 @@ You can see an example of using Jest with TypeScript in our [GitHub repository]( ### `jest.MockedFunction` -> `jest.MockedFunction` is available in the `@types/jest` module from version `24.9.0`. +:::tip + +`jest.MockedFunction` is available in the `@types/jest` module from version `24.9.0`. + +::: The following examples will assume you have an understanding of how [Jest mock functions work with JavaScript](MockFunctions.md). @@ -424,7 +428,11 @@ test('calculate calls add', () => { ### `jest.MockedClass` -> `jest.MockedClass` is available in the `@types/jest` module from version `24.9.0`. +:::tip + +`jest.MockedClass` is available in the `@types/jest` module from version `24.9.0`. + +::: The following examples will assume you have an understanding of how [Jest mock classes work with JavaScript](Es6ClassMocks.md). diff --git a/website/versioned_docs/version-26.x/SnapshotTesting.md b/website/versioned_docs/version-26.x/SnapshotTesting.md index 5c640fc308d2..1dabee33f66a 100644 --- a/website/versioned_docs/version-26.x/SnapshotTesting.md +++ b/website/versioned_docs/version-26.x/SnapshotTesting.md @@ -107,11 +107,15 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -> Inline snapshots are powered by [Prettier](https://prettier.io). To use inline snapshots you must have `prettier` installed in your project. Your Prettier configuration will be respected when writing to test files. -> -> If you have `prettier` installed in a location where Jest can't find it, you can tell Jest how to find it using the [`"prettierPath"`](./Configuration.md#prettierpath-string) configuration property. +:::info + +Inline snapshots are powered by [Prettier](https://prettier.io). To use inline snapshots you must have `prettier` installed in your project. Your Prettier configuration will be respected when writing to test files. + +If you have `prettier` installed in a location where Jest can't find it, you can tell Jest how to find it using the [`prettierPath`](./Configuration.md#prettierpath-string) configuration property. + +::: -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-26.x/TimerMocks.md b/website/versioned_docs/version-26.x/TimerMocks.md index a57094e2d9a2..81e9f5e120a8 100644 --- a/website/versioned_docs/version-26.x/TimerMocks.md +++ b/website/versioned_docs/version-26.x/TimerMocks.md @@ -128,8 +128,6 @@ describe('infiniteTimerGame', () => { ## Advance Timers by Time -##### renamed from `runTimersToTime` to `advanceTimersByTime` in Jest **22.0.0** - Another possibility is use `jest.advanceTimersByTime(msToRun)`. When this API is called, all timers are advanced by `msToRun` milliseconds. All pending "macro-tasks" that have been queued via setTimeout() or setInterval(), and would be executed during this time frame, will be executed. Additionally, if those macro-tasks schedule new macro-tasks that would be executed within the same time frame, those will be executed until there are no more macro-tasks remaining in the queue that should be run within msToRun milliseconds. ```javascript title="timerGame.js" diff --git a/website/versioned_docs/version-27.x/MockFunctionAPI.md b/website/versioned_docs/version-27.x/MockFunctionAPI.md index 2d7008e2acb5..a5eb6f45a7de 100644 --- a/website/versioned_docs/version-27.x/MockFunctionAPI.md +++ b/website/versioned_docs/version-27.x/MockFunctionAPI.md @@ -370,7 +370,11 @@ You can see an example of using Jest with TypeScript in our [GitHub repository]( ### `jest.MockedFunction` -> `jest.MockedFunction` is available in the `@types/jest` module from version `24.9.0`. +:::tip + +`jest.MockedFunction` is available in the `@types/jest` module from version `24.9.0`. + +::: The following examples will assume you have an understanding of how [Jest mock functions work with JavaScript](MockFunctions.md). @@ -434,7 +438,11 @@ test('calculate calls add', () => { ### `jest.MockedClass` -> `jest.MockedClass` is available in the `@types/jest` module from version `24.9.0`. +:::tip + +`jest.MockedClass` is available in the `@types/jest` module from version `24.9.0`. + +::: The following examples will assume you have an understanding of how [Jest mock classes work with JavaScript](Es6ClassMocks.md). diff --git a/website/versioned_docs/version-27.x/SnapshotTesting.md b/website/versioned_docs/version-27.x/SnapshotTesting.md index e7b1ccf2a3e4..f7cad46f049f 100644 --- a/website/versioned_docs/version-27.x/SnapshotTesting.md +++ b/website/versioned_docs/version-27.x/SnapshotTesting.md @@ -107,7 +107,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-28.x/SnapshotTesting.md b/website/versioned_docs/version-28.x/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/website/versioned_docs/version-28.x/SnapshotTesting.md +++ b/website/versioned_docs/version-28.x/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-29.0/SnapshotTesting.md b/website/versioned_docs/version-29.0/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/website/versioned_docs/version-29.0/SnapshotTesting.md +++ b/website/versioned_docs/version-29.0/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-29.1/SnapshotTesting.md b/website/versioned_docs/version-29.1/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/website/versioned_docs/version-29.1/SnapshotTesting.md +++ b/website/versioned_docs/version-29.1/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-29.2/SnapshotTesting.md b/website/versioned_docs/version-29.2/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/website/versioned_docs/version-29.2/SnapshotTesting.md +++ b/website/versioned_docs/version-29.2/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-29.3/SnapshotTesting.md b/website/versioned_docs/version-29.3/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/website/versioned_docs/version-29.3/SnapshotTesting.md +++ b/website/versioned_docs/version-29.3/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-29.4/SnapshotTesting.md b/website/versioned_docs/version-29.4/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/website/versioned_docs/version-29.4/SnapshotTesting.md +++ b/website/versioned_docs/version-29.4/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: diff --git a/website/versioned_docs/version-29.5/SnapshotTesting.md b/website/versioned_docs/version-29.5/SnapshotTesting.md index c75de94ab19c..dfbe33c25995 100644 --- a/website/versioned_docs/version-29.5/SnapshotTesting.md +++ b/website/versioned_docs/version-29.5/SnapshotTesting.md @@ -106,7 +106,7 @@ Once you're finished, Jest will give you a summary before returning back to watc Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written. -**Example:** +Example: First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments: