Skip to content

Commit

Permalink
docs: remove deprecated setupTestFrameworkScriptFile option and `se…
Browse files Browse the repository at this point in the history
…tupFilesAfterEnv` instead (#11910)
  • Loading branch information
mrazauskas authored Sep 29, 2021
1 parent 2ca98ec commit aaed73a
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ Run only the tests that were specified with their exact paths.

_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_

### `--setupTestFrameworkScriptFile=<file>`
### `--setupFilesAfterEnv <path1> ... <pathN>`

The path to a module that runs some code to configure or set up the testing framework before each test. Beware that files imported by the setup script will not be mocked during testing.
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.

### `--showConfig`

Expand Down
2 changes: 1 addition & 1 deletion docs/JestObjectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ jest.mock(
);
```

> **Warning:** Importing a module in a setup file (as specified by `setupTestFrameworkScriptFile`) will prevent mocking for the module in question, as well as all the modules that it imports.
> **Warning:** Importing a module in a setup file (as specified by `setupFilesAfterEnv`) will prevent mocking for the module in question, as well as all the modules that it imports.
Modules that are mocked with `jest.mock` are mocked only for the file that calls `jest.mock`. Another file that imports the module will get the original implementation even if it runs after the test file that mocks the module.

Expand Down
3 changes: 3 additions & 0 deletions packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ export type InitialOptions = Partial<{
runTestsByPath: boolean;
scriptPreprocessor: string;
setupFiles: Array<Path>;
/**
* @deprecated Use `setupFilesAfterEnv` options instead.
*/
setupTestFrameworkScriptFile: Path;
setupFilesAfterEnv: Array<Path>;
silent: boolean;
Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-25.x/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ Run only the tests that were specified with their exact paths.

_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_

### `--setupTestFrameworkScriptFile=<file>`
### `--setupFilesAfterEnv <path1> ... <pathN>`

The path to a module that runs some code to configure or set up the testing framework before each test. Beware that files imported by the setup script will not be mocked during testing.
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.

### `--showConfig`

Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-25.x/JestObjectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ jest.mock(
);
```

> **Warning:** Importing a module in a setup file (as specified by `setupTestFrameworkScriptFile`) will prevent mocking for the module in question, as well as all the modules that it imports.
> **Warning:** Importing a module in a setup file (as specified by `setupFilesAfterEnv`) will prevent mocking for the module in question, as well as all the modules that it imports.
Modules that are mocked with `jest.mock` are mocked only for the file that calls `jest.mock`. Another file that imports the module will get the original implementation even if it runs after the test file that mocks the module.

Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-26.x/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ Run only the tests that were specified with their exact paths.

_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_

### `--setupTestFrameworkScriptFile=<file>`
### `--setupFilesAfterEnv <path1> ... <pathN>`

The path to a module that runs some code to configure or set up the testing framework before each test. Beware that files imported by the setup script will not be mocked during testing.
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.

### `--showConfig`

Expand Down
2 changes: 0 additions & 2 deletions website/versioned_docs/version-26.x/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -898,8 +898,6 @@ If you want a path to be [relative to the root directory of your project](#rootd

For example, Jest ships with several plug-ins to `jasmine` that work by monkey-patching the jasmine API. If you wanted to add even more jasmine plugins to the mix (or if you wanted some custom, project-wide matchers for example), you could do so in these modules.

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

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

```js
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-26.x/JestObjectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ jest.mock(
);
```

> **Warning:** Importing a module in a setup file (as specified by `setupTestFrameworkScriptFile`) will prevent mocking for the module in question, as well as all the modules that it imports.
> **Warning:** Importing a module in a setup file (as specified by `setupFilesAfterEnv`) will prevent mocking for the module in question, as well as all the modules that it imports.
Modules that are mocked with `jest.mock` are mocked only for the file that calls `jest.mock`. Another file that imports the module will get the original implementation even if it runs after the test file that mocks the module.

Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-27.0/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ Run only the tests that were specified with their exact paths.

_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_

### `--setupTestFrameworkScriptFile=<file>`
### `--setupFilesAfterEnv <path1> ... <pathN>`

The path to a module that runs some code to configure or set up the testing framework before each test. Beware that files imported by the setup script will not be mocked during testing.
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.

### `--showConfig`

Expand Down
2 changes: 0 additions & 2 deletions website/versioned_docs/version-27.0/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,6 @@ If you want a path to be [relative to the root directory of your project](#rootd

For example, Jest ships with several plug-ins to `jasmine` that work by monkey-patching the jasmine API. If you wanted to add even more jasmine plugins to the mix (or if you wanted some custom, project-wide matchers for example), you could do so in these modules.

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

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

```js
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.0/JestObjectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ jest.mock(
);
```

> **Warning:** Importing a module in a setup file (as specified by `setupTestFrameworkScriptFile`) will prevent mocking for the module in question, as well as all the modules that it imports.
> **Warning:** Importing a module in a setup file (as specified by `setupFilesAfterEnv`) will prevent mocking for the module in question, as well as all the modules that it imports.
Modules that are mocked with `jest.mock` are mocked only for the file that calls `jest.mock`. Another file that imports the module will get the original implementation even if it runs after the test file that mocks the module.

Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-27.1/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ Run only the tests that were specified with their exact paths.

_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_

### `--setupTestFrameworkScriptFile=<file>`
### `--setupFilesAfterEnv <path1> ... <pathN>`

The path to a module that runs some code to configure or set up the testing framework before each test. Beware that files imported by the setup script will not be mocked during testing.
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.

### `--showConfig`

Expand Down
2 changes: 0 additions & 2 deletions website/versioned_docs/version-27.1/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,6 @@ If you want a path to be [relative to the root directory of your project](#rootd

For example, Jest ships with several plug-ins to `jasmine` that work by monkey-patching the jasmine API. If you wanted to add even more jasmine plugins to the mix (or if you wanted some custom, project-wide matchers for example), you could do so in these modules.

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

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

```js
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.1/JestObjectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ jest.mock(
);
```

> **Warning:** Importing a module in a setup file (as specified by `setupTestFrameworkScriptFile`) will prevent mocking for the module in question, as well as all the modules that it imports.
> **Warning:** Importing a module in a setup file (as specified by `setupFilesAfterEnv`) will prevent mocking for the module in question, as well as all the modules that it imports.
Modules that are mocked with `jest.mock` are mocked only for the file that calls `jest.mock`. Another file that imports the module will get the original implementation even if it runs after the test file that mocks the module.

Expand Down
4 changes: 2 additions & 2 deletions website/versioned_docs/version-27.2/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ Run only the tests that were specified with their exact paths.

_Note: The default regex matching works fine on small runs, but becomes slow if provided with multiple patterns and/or against a lot of tests. This option replaces the regex matching logic and by that optimizes the time it takes Jest to filter specific test files_

### `--setupTestFrameworkScriptFile=<file>`
### `--setupFilesAfterEnv <path1> ... <pathN>`

The path to a module that runs some code to configure or set up the testing framework before each test. Beware that files imported by the setup script will not be mocked during testing.
A list of paths to modules that run some code to configure or to set up the testing framework before each test. Beware that files imported by the setup scripts will not be mocked during testing.

### `--showConfig`

Expand Down
2 changes: 0 additions & 2 deletions website/versioned_docs/version-27.2/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,6 @@ If you want a path to be [relative to the root directory of your project](#rootd

For example, Jest ships with several plug-ins to `jasmine` that work by monkey-patching the jasmine API. If you wanted to add even more jasmine plugins to the mix (or if you wanted some custom, project-wide matchers for example), you could do so in these modules.

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

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

```js
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-27.2/JestObjectAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ jest.mock(
);
```

> **Warning:** Importing a module in a setup file (as specified by `setupTestFrameworkScriptFile`) will prevent mocking for the module in question, as well as all the modules that it imports.
> **Warning:** Importing a module in a setup file (as specified by `setupFilesAfterEnv`) will prevent mocking for the module in question, as well as all the modules that it imports.
Modules that are mocked with `jest.mock` are mocked only for the file that calls `jest.mock`. Another file that imports the module will get the original implementation even if it runs after the test file that mocks the module.

Expand Down

0 comments on commit aaed73a

Please sign in to comment.