Skip to content

Commit 2208288

Browse files
authored
rename prettier option to prettierPath (#6607)
1 parent 4ec046b commit 2208288

14 files changed

Lines changed: 21 additions & 20 deletions

File tree

TestUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const DEFAULT_PROJECT_CONFIG: ProjectConfig = {
9090
modulePathIgnorePatterns: [],
9191
modulePaths: [],
9292
name: 'test_name',
93-
prettier: 'prettier',
93+
prettierPath: 'prettier',
9494
resetMocks: false,
9595
resetModules: false,
9696
resolver: null,

docs/Configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ Presets may also be relative filesystem paths.
402402
}
403403
```
404404

405-
### `prettier` [string]
405+
### `prettierPath` [string]
406406

407407
Default: `'prettier'`
408408

docs/SnapshotTesting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Inline snapshots behave identically to external snapshots (`.snap` files), excep
9999

100100
> Inline snapshots are powered by [Prettier](https://prettier.io). To use inline snapshots you must have `prettier` installed in your project. Your Prettier configuration will be respected when writing to test files.
101101
>
102-
> If you have `prettier` installed in a location where Jest can't find it, you can tell Jest how to find it using the [`"prettier"`](./Configuration.md#prettier-string) configuration property.
102+
> If you have `prettier` installed in a location where Jest can't find it, you can tell Jest how to find it using the [`"prettierPath"`](./Configuration.md#prettierpath-string) configuration property.
103103
104104
**Example:**
105105

e2e/__tests__/__snapshots__/show_config.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
3333
\\"moduleNameMapper\\": {},
3434
\\"modulePathIgnorePatterns\\": [],
3535
\\"name\\": \\"[md5 hash]\\",
36-
\\"prettier\\": null,
36+
\\"prettierPath\\": null,
3737
\\"resetMocks\\": false,
3838
\\"resetModules\\": false,
3939
\\"resolver\\": null,

packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter_init.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ export const initialize = ({
9494
const {expand, updateSnapshot} = globalConfig;
9595
const snapshotState = new SnapshotState(testPath, {
9696
expand,
97-
getPrettier: () => (config.prettier ? localRequire(config.prettier) : null),
97+
getPrettier: () =>
98+
config.prettierPath ? localRequire(config.prettierPath) : null,
9899
updateSnapshot,
99100
});
100101
setState({snapshotState, testPath});

packages/jest-cli/src/cli/args.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ export const options = {
424424
description: "A preset that is used as a base for Jest's configuration.",
425425
type: 'string',
426426
},
427-
prettier: {
427+
prettierPath: {
428428
default: 'prettier',
429429
description: 'The path to the "prettier" module used for inline snapshots.',
430430
type: 'string',

packages/jest-config/src/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default ({
4949
notify: false,
5050
notifyMode: 'always',
5151
preset: null,
52-
prettier: 'prettier',
52+
prettierPath: 'prettier',
5353
projects: null,
5454
resetMocks: false,
5555
resetModules: false,

packages/jest-config/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const getConfigs = (
173173
modulePathIgnorePatterns: options.modulePathIgnorePatterns,
174174
modulePaths: options.modulePaths,
175175
name: options.name,
176-
prettier: options.prettier,
176+
prettierPath: options.prettierPath,
177177
resetMocks: options.resetMocks,
178178
resetModules: options.resetModules,
179179
resolver: options.resolver,

packages/jest-config/src/normalize.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,10 @@ export default function normalize(options: InitialOptions, argv: Argv) {
440440
rootDir: options.rootDir,
441441
});
442442
break;
443-
case 'prettier':
444-
// We only want this to throw if "prettier" is explicitly passed from
445-
// config or CLI, and the requested path isn't found. Otherwise we set
446-
// it to null and throw an error lazily when it is used.
443+
case 'prettierPath':
444+
// We only want this to throw if "prettierPath" is explicitly passed
445+
// from config or CLI, and the requested path isn't found. Otherwise we
446+
// set it to null and throw an error lazily when it is used.
447447
value =
448448
options[key] &&
449449
resolve(newOptions.resolver, {

packages/jest-config/src/valid_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default ({
6565
notifyMode: 'always',
6666
onlyChanged: false,
6767
preset: 'react-native',
68-
prettier: '<rootDir>/node_modules/prettier',
68+
prettierPath: '<rootDir>/node_modules/prettier',
6969
projects: ['project-a', 'project-b/'],
7070
reporters: [
7171
'default',

0 commit comments

Comments
 (0)