Skip to content

Commit 3078172

Browse files
danmjeysalthymikee
authored
Updated config docs with default transform value (#8583)
* Updated config docs - transform I've added a default option to clear up any confusion, hopefully that will make it more obvious how it should be added back in when additional transformers are added. * Updated change log for #8583 * Update docs/Configuration.md Co-Authored-By: Tim Seckinger <[email protected]> * Update Configuration.md * transform is an object instead of array - fixing. * --amend * update versioned docs Co-authored-by: Tim Seckinger <[email protected]> Co-authored-by: Michał Pierzchała <[email protected]>
1 parent b6052e0 commit 3078172

File tree

8 files changed

+15
-14
lines changed

8 files changed

+15
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- `[expect, jest-mock, pretty-format]` [**BREAKING**] Remove `build-es5` from package ([#9945](https://github.com/facebook/jest/pull/9945))
2121
- `[jest-haste-map]` [**BREAKING**] removed `providesModuleNodeModules` ([#8535](https://github.com/facebook/jest/pull/8535))
2222
- `[docs]` Fix example reference implementation to use Jest with Phabricator ([#8662](https://github.com/facebook/jest/pull/8662))
23+
- `[docs]` Added default compiler to tranform ([#8583](https://github.com/facebook/jest/pull/8583))
2324

2425
### Performance
2526

docs/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as
11191119

11201120
### `transform` [object\<string, pathToTransformer | [pathToTransformer, object]>]
11211121

1122-
Default: `undefined`
1122+
Default: `{"^.+\\.[jt]sx?$": "babel-jest"}`
11231123

11241124
A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. For example, if you wanted to be able to use a new language feature in your modules or tests that isn't yet supported by node, you might plug in one of many compilers that compile a future version of JavaScript to a current one. Example: see the [examples/typescript](https://github.com/facebook/jest/blob/master/examples/typescript/package.json#L16) example or the [webpack tutorial](Webpack.md).
11251125

@@ -1134,7 +1134,7 @@ You can pass configuration to a transformer like `{filePattern: ['path-to-transf
11341134

11351135
_Note: a transformer is only run once per file unless the file has changed. During development of a transformer it can be useful to run Jest with `--no-cache` to frequently [delete Jest's cache](Troubleshooting.md#caching-issues)._
11361136

1137-
_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
1137+
_Note: when adding additional code transformers, this will overwrite the default config and `babel-jest` is no longer automatically loaded. If you want to use it to compile JavaScript or Typescript, it has to be explicitly defined by adding `{"^.+\\.[jt]sx?$": "babel-jest"}` to the transform property. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
11381138

11391139
### `transformIgnorePatterns` [array\<string>]
11401140

website/versioned_docs/version-22.x/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as
835835

836836
### `transform` [object\<string, string>]
837837

838-
Default: `undefined`
838+
Default: `{"^.+\\.[jt]sx?$": "babel-jest"}`
839839

840840
A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. For example, if you wanted to be able to use a new language feature in your modules or tests that isn't yet supported by node, you might plug in one of many compilers that compile a future version of JavaScript to a current one. Example: see the [examples/typescript](https://github.com/facebook/jest/blob/master/examples/typescript/package.json#L16) example or the [webpack tutorial](Webpack.md).
841841

@@ -848,7 +848,7 @@ Examples of such compilers include:
848848

849849
_Note: a transformer is only run once per file unless the file has changed. During development of a transformer it can be useful to run Jest with `--no-cache` to frequently [delete Jest's cache](Troubleshooting.md#caching-issues)._
850850

851-
_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
851+
_Note: when adding additional code transformers, this will overwrite the default config and `babel-jest` is no longer automatically loaded. If you want to use it to compile JavaScript or Typescript, it has to be explicitly defined by adding `{"^.+\\.[jt]sx?$": "babel-jest"}` to the transform property. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
852852

853853
### `transformIgnorePatterns` [array\<string>]
854854

website/versioned_docs/version-23.x/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as
904904

905905
### `transform` [object\<string, string>]
906906

907-
Default: `undefined`
907+
Default: `{"^.+\\.[jt]sx?$": "babel-jest"}`
908908

909909
A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. For example, if you wanted to be able to use a new language feature in your modules or tests that isn't yet supported by node, you might plug in one of many compilers that compile a future version of JavaScript to a current one. Example: see the [examples/typescript](https://github.com/facebook/jest/blob/master/examples/typescript/package.json#L16) example or the [webpack tutorial](Webpack.md).
910910

@@ -917,7 +917,7 @@ Examples of such compilers include:
917917

918918
_Note: a transformer is only run once per file unless the file has changed. During development of a transformer it can be useful to run Jest with `--no-cache` to frequently [delete Jest's cache](Troubleshooting.md#caching-issues)._
919919

920-
_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
920+
_Note: when adding additional code transformers, this will overwrite the default config and `babel-jest` is no longer automatically loaded. If you want to use it to compile JavaScript or Typescript, it has to be explicitly defined by adding `{"^.+\\.[jt]sx?$": "babel-jest"}` to the transform property. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
921921

922922
### `transformIgnorePatterns` [array\<string>]
923923

website/versioned_docs/version-24.x/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as
10921092

10931093
### `transform` [object\<string, pathToTransformer | [pathToTransformer, object]>]
10941094

1095-
Default: `undefined`
1095+
Default: `{"^.+\\.[jt]sx?$": "babel-jest"}`
10961096

10971097
A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. For example, if you wanted to be able to use a new language feature in your modules or tests that isn't yet supported by node, you might plug in one of many compilers that compile a future version of JavaScript to a current one. Example: see the [examples/typescript](https://github.com/facebook/jest/blob/master/examples/typescript/package.json#L16) example or the [webpack tutorial](Webpack.md).
10981098

@@ -1107,7 +1107,7 @@ You can pass configuration to a transformer like `{filePattern: ['path-to-transf
11071107

11081108
_Note: a transformer is only run once per file unless the file has changed. During development of a transformer it can be useful to run Jest with `--no-cache` to frequently [delete Jest's cache](Troubleshooting.md#caching-issues)._
11091109

1110-
_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
1110+
_Note: when adding additional code transformers, this will overwrite the default config and `babel-jest` is no longer automatically loaded. If you want to use it to compile JavaScript or Typescript, it has to be explicitly defined by adding `{"^.+\\.[jt]sx?$": "babel-jest"}` to the transform property. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
11111111

11121112
### `transformIgnorePatterns` [array\<string>]
11131113

website/versioned_docs/version-25.1/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as
11071107

11081108
### `transform` [object\<string, pathToTransformer | [pathToTransformer, object]>]
11091109

1110-
Default: `undefined`
1110+
Default: `{"^.+\\.[jt]sx?$": "babel-jest"}`
11111111

11121112
A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. For example, if you wanted to be able to use a new language feature in your modules or tests that isn't yet supported by node, you might plug in one of many compilers that compile a future version of JavaScript to a current one. Example: see the [examples/typescript](https://github.com/facebook/jest/blob/master/examples/typescript/package.json#L16) example or the [webpack tutorial](Webpack.md).
11131113

@@ -1122,7 +1122,7 @@ You can pass configuration to a transformer like `{filePattern: ['path-to-transf
11221122

11231123
_Note: a transformer is only run once per file unless the file has changed. During development of a transformer it can be useful to run Jest with `--no-cache` to frequently [delete Jest's cache](Troubleshooting.md#caching-issues)._
11241124

1125-
_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
1125+
_Note: when adding additional code transformers, this will overwrite the default config and `babel-jest` is no longer automatically loaded. If you want to use it to compile JavaScript or Typescript, it has to be explicitly defined by adding `{"^.+\\.[jt]sx?$": "babel-jest"}` to the transform property. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
11261126

11271127
### `transformIgnorePatterns` [array\<string>]
11281128

website/versioned_docs/version-25.3/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as
11201120

11211121
### `transform` [object\<string, pathToTransformer | [pathToTransformer, object]>]
11221122

1123-
Default: `undefined`
1123+
Default: `{"^.+\\.[jt]sx?$": "babel-jest"}`
11241124

11251125
A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. For example, if you wanted to be able to use a new language feature in your modules or tests that isn't yet supported by node, you might plug in one of many compilers that compile a future version of JavaScript to a current one. Example: see the [examples/typescript](https://github.com/facebook/jest/blob/master/examples/typescript/package.json#L16) example or the [webpack tutorial](Webpack.md).
11261126

@@ -1135,7 +1135,7 @@ You can pass configuration to a transformer like `{filePattern: ['path-to-transf
11351135

11361136
_Note: a transformer is only run once per file unless the file has changed. During development of a transformer it can be useful to run Jest with `--no-cache` to frequently [delete Jest's cache](Troubleshooting.md#caching-issues)._
11371137

1138-
_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
1138+
_Note: when adding additional code transformers, this will overwrite the default config and `babel-jest` is no longer automatically loaded. If you want to use it to compile JavaScript or Typescript, it has to be explicitly defined by adding `{"^.+\\.[jt]sx?$": "babel-jest"}` to the transform property. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
11391139

11401140
### `transformIgnorePatterns` [array\<string>]
11411141

website/versioned_docs/version-25.5/Configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ Setting this value to `fake` allows the use of fake timers for functions such as
11201120

11211121
### `transform` [object\<string, pathToTransformer | [pathToTransformer, object]>]
11221122

1123-
Default: `undefined`
1123+
Default: `{"^.+\\.[jt]sx?$": "babel-jest"}`
11241124

11251125
A map from regular expressions to paths to transformers. A transformer is a module that provides a synchronous function for transforming source files. For example, if you wanted to be able to use a new language feature in your modules or tests that isn't yet supported by node, you might plug in one of many compilers that compile a future version of JavaScript to a current one. Example: see the [examples/typescript](https://github.com/facebook/jest/blob/master/examples/typescript/package.json#L16) example or the [webpack tutorial](Webpack.md).
11261126

@@ -1135,7 +1135,7 @@ You can pass configuration to a transformer like `{filePattern: ['path-to-transf
11351135

11361136
_Note: a transformer is only run once per file unless the file has changed. During development of a transformer it can be useful to run Jest with `--no-cache` to frequently [delete Jest's cache](Troubleshooting.md#caching-issues)._
11371137

1138-
_Note: if you are using the `babel-jest` transformer and want to use an additional code preprocessor, keep in mind that when "transform" is overwritten in any way the `babel-jest` is not loaded automatically anymore. If you want to use it to compile JavaScript code it has to be explicitly defined. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
1138+
_Note: when adding additional code transformers, this will overwrite the default config and `babel-jest` is no longer automatically loaded. If you want to use it to compile JavaScript or Typescript, it has to be explicitly defined by adding `{"^.+\\.[jt]sx?$": "babel-jest"}` to the transform property. See [babel-jest plugin](https://github.com/facebook/jest/tree/master/packages/babel-jest#setup)_
11391139

11401140
### `transformIgnorePatterns` [array\<string>]
11411141

0 commit comments

Comments
 (0)