diff --git a/docs/Configuration.md b/docs/Configuration.md index 7d19328833d9..7a8b85413131 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -769,20 +769,28 @@ A preset that is used as a base for Jest's configuration. A preset should point For example, this preset `foo-bar/jest-preset.js` will be configured as follows: -```json -{ - "preset": "foo-bar" -} +```js +/** @type { import('@jest/types').Config.InitialOptions } */ +module.exports = { + preset: 'foo-bar', +}; ``` Presets may also be relative to filesystem paths. -```json -{ - "preset": "./node_modules/foo-bar/jest-preset.js" -} +```js +/** @type { import('@jest/types').Config.InitialOptions } */ +module.exports = { + preset: './node_modules/foo-bar/jest-preset.js', +}; ``` +:::info + +Note that if you also have specified [`rootDir`](#rootdir-string) that the resolution of this file will be relative to that root directory. + +::: + ### `prettierPath` \[string] Default: `'prettier'` diff --git a/website/versioned_docs/version-28.0/Configuration.md b/website/versioned_docs/version-28.0/Configuration.md index eefccaab7fac..8998e48befab 100644 --- a/website/versioned_docs/version-28.0/Configuration.md +++ b/website/versioned_docs/version-28.0/Configuration.md @@ -769,20 +769,28 @@ A preset that is used as a base for Jest's configuration. A preset should point For example, this preset `foo-bar/jest-preset.js` will be configured as follows: -```json -{ - "preset": "foo-bar" -} +```js +/** @type { import('@jest/types').Config.InitialOptions } */ +module.exports = { + preset: 'foo-bar', +}; ``` Presets may also be relative to filesystem paths. -```json -{ - "preset": "./node_modules/foo-bar/jest-preset.js" -} +```js +/** @type { import('@jest/types').Config.InitialOptions } */ +module.exports = { + preset: './node_modules/foo-bar/jest-preset.js', +}; ``` +:::info + +Note that if you also have specified [`rootDir`](#rootdir-string) that the resolution of this file will be relative to that root directory. + +::: + ### `prettierPath` \[string] Default: `'prettier'` diff --git a/website/versioned_docs/version-28.1/Configuration.md b/website/versioned_docs/version-28.1/Configuration.md index 7d19328833d9..7a8b85413131 100644 --- a/website/versioned_docs/version-28.1/Configuration.md +++ b/website/versioned_docs/version-28.1/Configuration.md @@ -769,20 +769,28 @@ A preset that is used as a base for Jest's configuration. A preset should point For example, this preset `foo-bar/jest-preset.js` will be configured as follows: -```json -{ - "preset": "foo-bar" -} +```js +/** @type { import('@jest/types').Config.InitialOptions } */ +module.exports = { + preset: 'foo-bar', +}; ``` Presets may also be relative to filesystem paths. -```json -{ - "preset": "./node_modules/foo-bar/jest-preset.js" -} +```js +/** @type { import('@jest/types').Config.InitialOptions } */ +module.exports = { + preset: './node_modules/foo-bar/jest-preset.js', +}; ``` +:::info + +Note that if you also have specified [`rootDir`](#rootdir-string) that the resolution of this file will be relative to that root directory. + +::: + ### `prettierPath` \[string] Default: `'prettier'`