Skip to content

Commit

Permalink
docs: Add setupFilesAfterEnv and jest.setTimeout example
Browse files Browse the repository at this point in the history
* docs: setupFilesAfterEnv arr expansion and updated reference in JestObjectApi

* docs: latest pr added to changelog

* docs: Configuration naming convention from setup to jest.setup

* docs: Tweaking timeout docs to better explain when it can be applied universally

* cleanup
  • Loading branch information
Acrontum-Carmichael authored and jeysal committed Sep 22, 2019
1 parent 9583060 commit bfb4805
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -44,6 +44,7 @@
- `[*]` [**BREAKING**] Upgrade to Micromatch v4 ([#8852](https://github.com/facebook/jest/pull/8852))
- `[babel-plugin-jest-hoist]` [**BREAKING**] Use ESM exports ([#8874](https://github.com/facebook/jest/pull/8874))
- `[docs]` Fix broken link pointing to legacy JS file in "Snapshot Testing".
- `[docs]` Add `setupFilesAfterEnv` and `jest.setTimeout` example ([#8971](https://github.com/facebook/jest/pull/8971))
- `[jest]` [**BREAKING**] Use ESM exports ([#8874](https://github.com/facebook/jest/pull/8874))
- `[jest-cli]` [**BREAKING**] Use ESM exports ([#8874](https://github.com/facebook/jest/pull/8874))
- `[jest-cli]` [**BREAKING**] Remove re-exports from `@jest/core` ([#8874](https://github.com/facebook/jest/pull/8874))
Expand Down
13 changes: 13 additions & 0 deletions docs/Configuration.md
Expand Up @@ -754,6 +754,19 @@ For example, Jest ships with several plug-ins to `jasmine` that work by monkey-p

_Note: `setupTestFrameworkScriptFile` is deprecated in favor of `setupFilesAfterEnv`._

Example `setupFilesAfterEnv` array in a jest.config.js:

```js
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
}
```

Example `jest.setup.js` file
```js
jest.setTimeout(10000); // in milliseconds
```

### `snapshotResolver` [string]

Default: `undefined`
Expand Down
2 changes: 1 addition & 1 deletion docs/JestObjectAPI.md
Expand Up @@ -647,7 +647,7 @@ Set the default timeout interval for tests and before/after hooks in millisecond

_Note: The default timeout interval is 5 seconds if this method is not called._

_Note: The method must be called after the test framework is installed in the environment and before the test runs. A good place to do this is in the `setupTestFrameworkScriptFile`._
_Note: If you want to set the timeout for all test files, a good place to do this is in `setupFilesAfterEnv`._

Example:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-22.x/JestObjectAPI.md
Expand Up @@ -542,7 +542,7 @@ Set the default timeout interval for tests and before/after hooks in millisecond

_Note: The default timeout interval is 5 seconds if this method is not called._

_Note: The method must be called after the test framework is installed in the environment and before the test runs. A good place to do this is in the `setupTestFrameworkScriptFile`._
_Note: If you want to set the timeout for all test files, a good place to do this is in `setupFilesAfterEnv`._

Example:

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-23.x/JestObjectAPI.md
Expand Up @@ -558,7 +558,7 @@ Set the default timeout interval for tests and before/after hooks in millisecond

_Note: The default timeout interval is 5 seconds if this method is not called._

_Note: The method must be called after the test framework is installed in the environment and before the test runs. A good place to do this is in the `setupTestFrameworkScriptFile`._
_Note: If you want to set the timeout for all test files, a good place to do this is in `setupFilesAfterEnv`._

Example:

Expand Down
13 changes: 13 additions & 0 deletions website/versioned_docs/version-24.0/Configuration.md
Expand Up @@ -727,6 +727,19 @@ For example, Jest ships with several plug-ins to `jasmine` that work by monkey-p

_Note: `setupTestFrameworkScriptFile` is deprecated in favor of `setupFilesAfterEnv`._

Example `setupFilesAfterEnv` array in a jest.config.js:

```js
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
}
```

Example `jest.setup.js` file
```js
jest.setTimeout(10000); // in milliseconds
```

### `snapshotResolver` [string]

Default: `undefined`
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-24.0/JestObjectAPI.md
Expand Up @@ -642,7 +642,7 @@ Set the default timeout interval for tests and before/after hooks in millisecond

_Note: The default timeout interval is 5 seconds if this method is not called._

_Note: The method must be called after the test framework is installed in the environment and before the test runs. A good place to do this is in the `setupTestFrameworkScriptFile`._
_Note: If you want to set the timeout for all test files, a good place to do this is in `setupFilesAfterEnv`._

Example:

Expand Down
13 changes: 13 additions & 0 deletions website/versioned_docs/version-24.1/Configuration.md
Expand Up @@ -736,6 +736,19 @@ For example, Jest ships with several plug-ins to `jasmine` that work by monkey-p

_Note: `setupTestFrameworkScriptFile` is deprecated in favor of `setupFilesAfterEnv`._

Example `setupFilesAfterEnv` array in a jest.config.js:

```js
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
}
```

Example `jest.setup.js` file
```js
jest.setTimeout(10000); // in milliseconds
```

### `snapshotResolver` [string]

Default: `undefined`
Expand Down
13 changes: 13 additions & 0 deletions website/versioned_docs/version-24.6/Configuration.md
Expand Up @@ -755,6 +755,19 @@ For example, Jest ships with several plug-ins to `jasmine` that work by monkey-p

_Note: `setupTestFrameworkScriptFile` is deprecated in favor of `setupFilesAfterEnv`._

Example `setupFilesAfterEnv` array in a jest.config.js:

```js
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
}
```

Example `jest.setup.js` file
```js
jest.setTimeout(10000); // in milliseconds
```

### `snapshotResolver` [string]

Default: `undefined`
Expand Down
13 changes: 13 additions & 0 deletions website/versioned_docs/version-24.8/Configuration.md
Expand Up @@ -755,6 +755,19 @@ For example, Jest ships with several plug-ins to `jasmine` that work by monkey-p

_Note: `setupTestFrameworkScriptFile` is deprecated in favor of `setupFilesAfterEnv`._

Example `setupFilesAfterEnv` array in a jest.config.js:

```js
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
}
```

Example `jest.setup.js` file
```js
jest.setTimeout(10000); // in milliseconds
```

### `snapshotResolver` [string]

Default: `undefined`
Expand Down
13 changes: 13 additions & 0 deletions website/versioned_docs/version-24.9/Configuration.md
Expand Up @@ -755,6 +755,19 @@ For example, Jest ships with several plug-ins to `jasmine` that work by monkey-p

_Note: `setupTestFrameworkScriptFile` is deprecated in favor of `setupFilesAfterEnv`._

Example `setupFilesAfterEnv` array in a jest.config.js:

```js
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
}
```

Example `jest.setup.js` file
```js
jest.setTimeout(10000); // in milliseconds
```

### `snapshotResolver` [string]

Default: `undefined`
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-24.9/JestObjectAPI.md
Expand Up @@ -648,7 +648,7 @@ Set the default timeout interval for tests and before/after hooks in millisecond

_Note: The default timeout interval is 5 seconds if this method is not called._

_Note: The method must be called after the test framework is installed in the environment and before the test runs. A good place to do this is in the `setupTestFrameworkScriptFile`._
_Note: If you want to set the timeout for all test files, a good place to do this is in `setupFilesAfterEnv`._

Example:

Expand Down

0 comments on commit bfb4805

Please sign in to comment.