You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/JestObjectAPI.md
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -555,10 +555,6 @@ test('works too', () => {
555
555
556
556
Returns the `jest` object for chaining.
557
557
558
-
### `jest.isEnvironmentTornDown(fn)`
559
-
560
-
Returns `true` if test environment has been torn down.
561
-
562
558
### `jest.isolateModules(fn)`
563
559
564
560
`jest.isolateModules(fn)` goes a step further than `jest.resetModules()` and creates a sandbox registry for the modules that are loaded inside the callback function. This is useful to isolate specific modules for every test so that local module state doesn't conflict between tests.
@@ -993,23 +989,9 @@ Use the [`--showSeed`](CLI.md#--showseed) flag to print the seed in the test rep
993
989
994
990
:::
995
991
996
-
### `jest.setTimeout(timeout)`
997
-
998
-
Set the default timeout interval (in milliseconds) for all tests and before/after hooks in the test file. This only affects the test file from which this function is called. The default timeout interval is 5 seconds if this method is not called.
999
-
1000
-
Example:
992
+
### `jest.isEnvironmentTornDown()`
1001
993
1002
-
```js
1003
-
jest.setTimeout(1000); // 1 second
1004
-
```
1005
-
1006
-
:::tip
1007
-
1008
-
To set timeout intervals on different tests in the same file, use the [`timeout` option on each individual test](GlobalAPI.md#testname-fn-timeout).
1009
-
1010
-
If you want to set the timeout for all test files, use [`testTimeout`](Configuration.md#testtimeout-number) configuration option.
1011
-
1012
-
:::
994
+
Returns `true` if test environment has been torn down.
1013
995
1014
996
### `jest.retryTimes(numRetries, options)`
1015
997
@@ -1034,3 +1016,21 @@ test('will fail', () => {
1034
1016
```
1035
1017
1036
1018
Returns the `jest` object for chaining.
1019
+
1020
+
### `jest.setTimeout(timeout)`
1021
+
1022
+
Set the default timeout interval (in milliseconds) for all tests and before/after hooks in the test file. This only affects the test file from which this function is called. The default timeout interval is 5 seconds if this method is not called.
1023
+
1024
+
Example:
1025
+
1026
+
```js
1027
+
jest.setTimeout(1000); // 1 second
1028
+
```
1029
+
1030
+
:::tip
1031
+
1032
+
To set timeout intervals on different tests in the same file, use the [`timeout` option on each individual test](GlobalAPI.md#testname-fn-timeout).
1033
+
1034
+
If you want to set the timeout for all test files, use [`testTimeout`](Configuration.md#testtimeout-number) configuration option.
0 commit comments