Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: rootdir affects preset resolution #12817

Merged
merged 3 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -761,20 +761,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'`
Expand Down
24 changes: 16 additions & 8 deletions website/versioned_docs/version-28.0/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -761,20 +761,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'`
Expand Down
24 changes: 16 additions & 8 deletions website/versioned_docs/version-28.1/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -761,20 +761,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 = {
dimitropoulos marked this conversation as resolved.
Show resolved Hide resolved
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.
dimitropoulos marked this conversation as resolved.
Show resolved Hide resolved

:::

### `prettierPath` \[string]

Default: `'prettier'`
Expand Down