Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: use admonition in Testing Asynchronous Code page #13284

Merged
merged 3 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ If `done()` is never called, the test will fail (with timeout error), which is w

If the `expect` statement fails, it throws an error and `done()` is not called. If we want to see in the test log why it failed, we have to wrap `expect` in a `try` block and pass the error in the `catch` block to `done`. Otherwise, we end up with an opaque timeout error that doesn't show what value was received by `expect(data)`.

_Note: `done()` should not be mixed with Promises as this tends to lead to memory leaks in your tests._
:::caution

Jest will throw an error, if the same test function is passed a `done()` callback and returns a promise. This is done as a precaution to avoid memory leaks in your tests.

:::

## `.resolves` / `.rejects`

Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-25.x/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ If `done()` is never called, the test will fail (with timeout error), which is w

If the `expect` statement fails, it throws an error and `done()` is not called. If we want to see in the test log why it failed, we have to wrap `expect` in a `try` block and pass the error in the `catch` block to `done`. Otherwise, we end up with an opaque timeout error that doesn't show what value was received by `expect(data)`.

_Note: `done()` should not be mixed with Promises as this tends to lead to memory leaks in your tests._
:::caution

`done()` should not be mixed with promises as this tends to lead to memory leaks in your tests.

:::

## `.resolves` / `.rejects`

Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-26.x/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ If `done()` is never called, the test will fail (with timeout error), which is w

If the `expect` statement fails, it throws an error and `done()` is not called. If we want to see in the test log why it failed, we have to wrap `expect` in a `try` block and pass the error in the `catch` block to `done`. Otherwise, we end up with an opaque timeout error that doesn't show what value was received by `expect(data)`.

_Note: `done()` should not be mixed with Promises as this tends to lead to memory leaks in your tests._
:::caution

`done()` should not be mixed with promises as this tends to lead to memory leaks in your tests.

:::

## `.resolves` / `.rejects`

Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-27.x/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ If `done()` is never called, the test will fail (with timeout error), which is w

If the `expect` statement fails, it throws an error and `done()` is not called. If we want to see in the test log why it failed, we have to wrap `expect` in a `try` block and pass the error in the `catch` block to `done`. Otherwise, we end up with an opaque timeout error that doesn't show what value was received by `expect(data)`.

_Note: `done()` should not be mixed with Promises as this tends to lead to memory leaks in your tests._
:::caution

Jest will throw an error, if the same test function is passed a `done()` callback and returns a promise. This is done as a precaution to avoid memory leaks in your tests.

:::

## `.resolves` / `.rejects`

Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-28.x/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ If `done()` is never called, the test will fail (with timeout error), which is w

If the `expect` statement fails, it throws an error and `done()` is not called. If we want to see in the test log why it failed, we have to wrap `expect` in a `try` block and pass the error in the `catch` block to `done`. Otherwise, we end up with an opaque timeout error that doesn't show what value was received by `expect(data)`.

_Note: `done()` should not be mixed with Promises as this tends to lead to memory leaks in your tests._
:::caution

Jest will throw an error, if the same test function is passed a `done()` callback and returns a promise. This is done as a precaution to avoid memory leaks in your tests.

:::

## `.resolves` / `.rejects`

Expand Down
6 changes: 5 additions & 1 deletion website/versioned_docs/version-29.0/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ If `done()` is never called, the test will fail (with timeout error), which is w

If the `expect` statement fails, it throws an error and `done()` is not called. If we want to see in the test log why it failed, we have to wrap `expect` in a `try` block and pass the error in the `catch` block to `done`. Otherwise, we end up with an opaque timeout error that doesn't show what value was received by `expect(data)`.

_Note: `done()` should not be mixed with Promises as this tends to lead to memory leaks in your tests._
:::caution

Jest will throw an error, if the same test function is passed a `done()` callback and returns a promise. This is done as a precaution to avoid memory leaks in your tests.

:::

## `.resolves` / `.rejects`

Expand Down