Skip to content

Commit

Permalink
docs: use admonition in Testing Asynchronous Code page (#13284)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrazauskas committed Sep 23, 2022
1 parent 15ce7b9 commit bf02c87
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
6 changes: 5 additions & 1 deletion docs/TestingAsyncCode.md
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
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
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
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
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
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

0 comments on commit bf02c87

Please sign in to comment.