diff --git a/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap b/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap index 2dc09e6ea..068855c88 100644 --- a/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap +++ b/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap @@ -6,105 +6,58 @@ exports[`allow overriding flags (write) 1`] = `[]`; exports[`boolean flags do not swallow the next argument (stderr) 1`] = `""`; -exports[`boolean flags do not swallow the next argument (stdout) 1`] = ` -"console.log('could be single quote and without semi'); -" -`; +exports[`boolean flags do not swallow the next argument (stdout) 1`] = `"console.log('could be single quote and without semi');"`; exports[`boolean flags do not swallow the next argument (write) 1`] = `[]`; -exports[`deprecated option values are warned (stderr) 1`] = ` -"[warn] --jsx-bracket-same-line is deprecated. -" -`; +exports[`deprecated option values are warned (stderr) 1`] = `"[warn] --jsx-bracket-same-line is deprecated."`; -exports[`deprecated option values are warned (stdout) 1`] = ` -"console.log("could be single quote and without semi"); -" -`; +exports[`deprecated option values are warned (stdout) 1`] = `"console.log("could be single quote and without semi");"`; exports[`deprecated option values are warned (write) 1`] = `[]`; exports[`negated options work (stderr) 1`] = `""`; -exports[`negated options work (stdout) 1`] = ` -"console.log("could be single quote and without semi") -" -`; +exports[`negated options work (stdout) 1`] = `"console.log("could be single quote and without semi")"`; exports[`negated options work (write) 1`] = `[]`; -exports[`number file/dir (stdout) 1`] = ` -"1/file-in-dir-named-1.js -" -`; +exports[`number file/dir (stdout) 1`] = `"1/file-in-dir-named-1.js"`; -exports[`number file/dir (stdout) 2`] = ` -"2.2/file-in-dir-named-2.2.js -" -`; +exports[`number file/dir (stdout) 2`] = `"2.2/file-in-dir-named-2.2.js"`; -exports[`number file/dir (stdout) 3`] = ` -"3 -" -`; +exports[`number file/dir (stdout) 3`] = `"3"`; -exports[`number file/dir (stdout) 4`] = ` -"4.44 -" -`; +exports[`number file/dir (stdout) 4`] = `"4.44"`; exports[`number file/dir (stdout) 5`] = ` "1/file-in-dir-named-1.js 2.2/file-in-dir-named-2.2.js 3 -4.44 -" +4.44" `; exports[`options with \`cliName\` should not allow to pass directly (stderr) 1`] = ` "[warn] Ignored unknown option --filepath=file.js. -[error] No parser and no file path given, couldn't infer a parser. -" +[error] No parser and no file path given, couldn't infer a parser." `; -exports[`options with \`cliName\` should not allow to pass directly (stdout) 1`] = ` -"prettier(); -" -`; +exports[`options with \`cliName\` should not allow to pass directly (stdout) 1`] = `"prettier();"`; exports[`options with \`cliName\` should not allow to pass directly (stdout) 2`] = `""`; -exports[`unknown negated options are warned (stderr) 1`] = ` -"[warn] Ignored unknown option --no-unknown. -" -`; +exports[`unknown negated options are warned (stderr) 1`] = `"[warn] Ignored unknown option --no-unknown."`; -exports[`unknown negated options are warned (stdout) 1`] = ` -"console.log("could be single quote and without semi"); -" -`; +exports[`unknown negated options are warned (stdout) 1`] = `"console.log("could be single quote and without semi");"`; exports[`unknown negated options are warned (write) 1`] = `[]`; -exports[`unknown options are warned (stderr) 1`] = ` -"[warn] Ignored unknown option --unknown. -" -`; +exports[`unknown options are warned (stderr) 1`] = `"[warn] Ignored unknown option --unknown."`; -exports[`unknown options are warned (stdout) 1`] = ` -"console.log("could be single quote and without semi"); -" -`; +exports[`unknown options are warned (stdout) 1`] = `"console.log("could be single quote and without semi");"`; exports[`unknown options are warned (write) 1`] = `[]`; -exports[`unknown options not suggestion \`_\` (stderr) 1`] = ` -"[warn] Ignored unknown option -a. Did you mean -c? -" -`; +exports[`unknown options not suggestion \`_\` (stderr) 1`] = `"[warn] Ignored unknown option -a. Did you mean -c?"`; -exports[`unknown options not suggestion \`_\` (stdout) 1`] = ` -"console.log("could be single quote and without semi"); -" -`; +exports[`unknown options not suggestion \`_\` (stdout) 1`] = `"console.log("could be single quote and without semi");"`; diff --git a/tests/integration/__tests__/__snapshots__/check.js.snap b/tests/integration/__tests__/__snapshots__/check.js.snap index 2acc6718f..eb16520ca 100644 --- a/tests/integration/__tests__/__snapshots__/check.js.snap +++ b/tests/integration/__tests__/__snapshots__/check.js.snap @@ -3,38 +3,26 @@ exports[`--checks should print the number of files that need formatting (stderr) 1`] = ` "[warn] unformatted.js [warn] unformatted2.js -[warn] Code style issues found in 2 files. Run Prettier to fix. -" +[warn] Code style issues found in 2 files. Run Prettier to fix." `; -exports[`--checks should print the number of files that need formatting (stdout) 1`] = ` -"Checking formatting... -" -`; +exports[`--checks should print the number of files that need formatting (stdout) 1`] = `"Checking formatting..."`; exports[`--checks should print the number of files that need formatting (write) 1`] = `[]`; exports[`--checks works in CI just as in a non-TTY mode (stderr) 1`] = ` "[warn] unformatted.js -[warn] Code style issues found in the above file. Run Prettier to fix. -" +[warn] Code style issues found in the above file. Run Prettier to fix." `; exports[`--checks works in CI just as in a non-TTY mode (stderr) 2`] = ` "[warn] unformatted.js -[warn] Code style issues found in the above file. Run Prettier to fix. -" +[warn] Code style issues found in the above file. Run Prettier to fix." `; -exports[`--checks works in CI just as in a non-TTY mode (stdout) 1`] = ` -"Checking formatting... -" -`; +exports[`--checks works in CI just as in a non-TTY mode (stdout) 1`] = `"Checking formatting..."`; -exports[`--checks works in CI just as in a non-TTY mode (stdout) 2`] = ` -"Checking formatting... -" -`; +exports[`--checks works in CI just as in a non-TTY mode (stdout) 2`] = `"Checking formatting..."`; exports[`--checks works in CI just as in a non-TTY mode (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/config-invalid.js.snap b/tests/integration/__tests__/__snapshots__/config-invalid.js.snap index 15556a9fa..bd4724a33 100644 --- a/tests/integration/__tests__/__snapshots__/config-invalid.js.snap +++ b/tests/integration/__tests__/__snapshots__/config-invalid.js.snap @@ -1,36 +1,24 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`resolves external configuration from package.json (stderr) 1`] = ` -"[error] Invalid configuration file \`syntax-error.js\`: THIS ERROR MESSAGE MUST COME FROM THIS syntax-error.js FILE -" -`; +exports[`resolves external configuration from package.json (stderr) 1`] = `"[error] Invalid configuration file \`syntax-error.js\`: THIS ERROR MESSAGE MUST COME FROM THIS syntax-error.js FILE"`; exports[`resolves external configuration from package.json (stdout) 1`] = `""`; exports[`resolves external configuration from package.json (write) 1`] = `[]`; -exports[`show warning with kebab-case option key (stderr) 1`] = ` -"[warn] Ignored unknown option { "print-width": 3 }. Did you mean printWidth? -" -`; +exports[`show warning with kebab-case option key (stderr) 1`] = `"[warn] Ignored unknown option { "print-width": 3 }. Did you mean printWidth?"`; exports[`show warning with kebab-case option key (stdout) 1`] = `""`; exports[`show warning with kebab-case option key (write) 1`] = `[]`; -exports[`show warning with unknown option (stderr) 1`] = ` -"[warn] Ignored unknown option { hello: "world" }. -" -`; +exports[`show warning with unknown option (stderr) 1`] = `"[warn] Ignored unknown option { hello: "world" }."`; exports[`show warning with unknown option (stdout) 1`] = `""`; exports[`show warning with unknown option (write) 1`] = `[]`; -exports[`throw error for unsupported extension (stderr) 1`] = ` -"[error] Invalid configuration file \`/tests/integration/cli/config/invalid\`: No loader specified for extension ".unsupported" -" -`; +exports[`throw error for unsupported extension (stderr) 1`] = `"[error] Invalid configuration file \`/tests/integration/cli/config/invalid\`: No loader specified for extension ".unsupported""`; exports[`throw error for unsupported extension (stdout) 1`] = `""`; @@ -44,37 +32,25 @@ exports[`throw error with invalid config format (write) 1`] = `[]`; exports[`throw error with invalid config format (write) 2`] = `[]`; -exports[`throw error with invalid config option (int) (stderr) 1`] = ` -"[error] Invalid tabWidth value. Expected an integer, but received 0.5. -" -`; +exports[`throw error with invalid config option (int) (stderr) 1`] = `"[error] Invalid tabWidth value. Expected an integer, but received 0.5."`; exports[`throw error with invalid config option (int) (stdout) 1`] = `""`; exports[`throw error with invalid config option (int) (write) 1`] = `[]`; -exports[`throw error with invalid config option (trailingComma) (stderr) 1`] = ` -"[error] Invalid trailingComma value. Expected "all", "es5" or "none", but received "wow". -" -`; +exports[`throw error with invalid config option (trailingComma) (stderr) 1`] = `"[error] Invalid trailingComma value. Expected "all", "es5" or "none", but received "wow"."`; exports[`throw error with invalid config option (trailingComma) (stdout) 1`] = `""`; exports[`throw error with invalid config option (trailingComma) (write) 1`] = `[]`; -exports[`throw error with invalid config precedence option (configPrecedence) (stderr) 1`] = ` -"[error] Invalid --config-precedence value. Expected "cli-override", "file-override" or "prefer-file", but received "option/configPrecedence". -" -`; +exports[`throw error with invalid config precedence option (configPrecedence) (stderr) 1`] = `"[error] Invalid --config-precedence value. Expected "cli-override", "file-override" or "prefer-file", but received "option/configPrecedence"."`; exports[`throw error with invalid config precedence option (configPrecedence) (stdout) 1`] = `""`; exports[`throw error with invalid config precedence option (configPrecedence) (write) 1`] = `[]`; -exports[`throw error with invalid config target (directory) (stderr) 1`] = ` -"[error] Invalid configuration file \`/tests/integration/cli/config/invalid\`: EISDIR: illegal operation on a directory, read -" -`; +exports[`throw error with invalid config target (directory) (stderr) 1`] = `"[error] Invalid configuration file \`/tests/integration/cli/config/invalid\`: EISDIR: illegal operation on a directory, read"`; exports[`throw error with invalid config target (directory) (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/config-resolution.js.snap b/tests/integration/__tests__/__snapshots__/config-resolution.js.snap index 1eb93c5a8..ea6b122c3 100644 --- a/tests/integration/__tests__/__snapshots__/config-resolution.js.snap +++ b/tests/integration/__tests__/__snapshots__/config-resolution.js.snap @@ -5,66 +5,41 @@ exports[`accepts configuration from --config (stderr) 1`] = `""`; exports[`accepts configuration from --config (stdout) 1`] = ` "function js() { console.log("js/file.js should have tab width 8 (1 if CLI)") -} -" +}" `; exports[`accepts configuration from --config (write) 1`] = `[]`; -exports[`prints error message when no file found with --find-config-path (stderr) 1`] = ` -"[error] Can not find configure file for ".." -" -`; +exports[`prints error message when no file found with --find-config-path (stderr) 1`] = `"[error] Can not find configure file for "..""`; exports[`prints error message when no file found with --find-config-path (write) 1`] = `[]`; exports[`resolves configuration file with --find-config-path file (stderr) 1`] = `""`; -exports[`resolves configuration file with --find-config-path file (stdout) 1`] = ` -".prettierrc -" -`; +exports[`resolves configuration file with --find-config-path file (stdout) 1`] = `".prettierrc"`; exports[`resolves configuration file with --find-config-path file (write) 1`] = `[]`; -exports[`resolves external configuration from package.json (cjs package) (stdout) 1`] = ` -"console.log("should have no semi") -" -`; +exports[`resolves external configuration from package.json (cjs package) (stdout) 1`] = `"console.log("should have no semi")"`; -exports[`resolves external configuration from package.json (esm file) (stdout) 1`] = ` -"console.log("should have no semi") -" -`; +exports[`resolves external configuration from package.json (esm file) (stdout) 1`] = `"console.log("should have no semi")"`; -exports[`resolves external configuration from package.json (esm package) (stdout) 1`] = ` -"console.log("should have no semi") -" -`; +exports[`resolves external configuration from package.json (esm package) (stdout) 1`] = `"console.log("should have no semi")"`; exports[`resolves json configuration file with --find-config-path file (stderr) 1`] = `""`; -exports[`resolves json configuration file with --find-config-path file (stdout) 1`] = ` -"rc-json/.prettierrc.json -" -`; +exports[`resolves json configuration file with --find-config-path file (stdout) 1`] = `"rc-json/.prettierrc.json"`; exports[`resolves json configuration file with --find-config-path file (write) 1`] = `[]`; exports[`resolves toml configuration file with --find-config-path file (stderr) 1`] = `""`; -exports[`resolves toml configuration file with --find-config-path file (stdout) 1`] = ` -"rc-toml/.prettierrc.toml -" -`; +exports[`resolves toml configuration file with --find-config-path file (stdout) 1`] = `"rc-toml/.prettierrc.toml"`; exports[`resolves toml configuration file with --find-config-path file (write) 1`] = `[]`; exports[`resolves yaml configuration file with --find-config-path file (stderr) 1`] = `""`; -exports[`resolves yaml configuration file with --find-config-path file (stdout) 1`] = ` -"rc-yaml/.prettierrc.yaml -" -`; +exports[`resolves yaml configuration file with --find-config-path file (stdout) 1`] = `"rc-yaml/.prettierrc.yaml"`; exports[`resolves yaml configuration file with --find-config-path file (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap b/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap index 21bce4862..bdc131454 100644 --- a/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap +++ b/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap @@ -13,20 +13,13 @@ exports[`cursorOffset should not be affected by full-width character (stdout) 1` "中文", "中文", "中文", -]; -" +];" `; exports[`cursorOffset should not be affected by full-width character (write) 1`] = `[]`; -exports[`write cursorOffset to stderr with --cursor-offset (stderr) 1`] = ` -"1 -" -`; +exports[`write cursorOffset to stderr with --cursor-offset (stderr) 1`] = `"1"`; -exports[`write cursorOffset to stderr with --cursor-offset (stdout) 1`] = ` -"1; -" -`; +exports[`write cursorOffset to stderr with --cursor-offset (stdout) 1`] = `"1;"`; exports[`write cursorOffset to stderr with --cursor-offset (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/debug-check.js.snap b/tests/integration/__tests__/__snapshots__/debug-check.js.snap index 827da8185..7f0900816 100644 --- a/tests/integration/__tests__/__snapshots__/debug-check.js.snap +++ b/tests/integration/__tests__/__snapshots__/debug-check.js.snap @@ -9,18 +9,14 @@ exports[`should not exit non-zero for already prettified code with --debug-check exports[`should not exit non-zero for already prettified code with --debug-check + --check (stdout) 1`] = ` "Checking formatting... issue-4599.js -All matched files use Prettier code style! -" +All matched files use Prettier code style!" `; exports[`should not exit non-zero for already prettified code with --debug-check + --check (write) 1`] = `[]`; exports[`should not exit non-zero for already prettified code with --debug-check + --list-different (stderr) 1`] = `""`; -exports[`should not exit non-zero for already prettified code with --debug-check + --list-different (stdout) 1`] = ` -"issue-4599.js -" -`; +exports[`should not exit non-zero for already prettified code with --debug-check + --list-different (stdout) 1`] = `"issue-4599.js"`; exports[`should not exit non-zero for already prettified code with --debug-check + --list-different (write) 1`] = `[]`; @@ -46,8 +42,7 @@ exports[`show diff for 2+ error files with --debug-check (stderr) 1`] = ` [error] world [error] +world [error] +world -[error] -" +[error] " `; exports[`show diff for 2+ error files with --debug-check (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap b/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap index c5980a035..089c3914a 100644 --- a/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap +++ b/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap @@ -44,8 +44,7 @@ exports[`prints information for debugging comment attachment with --debug-print- "trailing": true, "nodeDescription": "ExpressionStatement" } -] -" +]" `; exports[`prints information for debugging comment attachment with --debug-print-comments (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/early-exit.js.snap b/tests/integration/__tests__/__snapshots__/early-exit.js.snap index 57ef18a5c..90ca01970 100644 --- a/tests/integration/__tests__/__snapshots__/early-exit.js.snap +++ b/tests/integration/__tests__/__snapshots__/early-exit.js.snap @@ -5,8 +5,7 @@ exports[`show detailed usage with --help l (alias) (stderr) 1`] = `""`; exports[`show detailed usage with --help l (alias) (stdout) 1`] = ` "-l, --list-different - Print the names of files that are different from Prettier's formatting (see also --check). -" + Print the names of files that are different from Prettier's formatting (see also --check)." `; exports[`show detailed usage with --help l (alias) (write) 1`] = `[]`; @@ -21,8 +20,7 @@ exports[`show detailed usage with plugin options (automatic resolution) (stdout) Default: 2 Plugin defaults: * prettier-plugin-bar: 4 -* prettier-plugin-baz.js: 4 -" +* prettier-plugin-baz.js: 4" `; exports[`show detailed usage with plugin options (automatic resolution) (write) 1`] = `[]`; @@ -36,8 +34,7 @@ exports[`show detailed usage with plugin options (manual resolution) (stdout) 1` Default: 2 Plugin defaults: -* ../plugins/automatic/node_modules/prettier-plugin-bar/index.js: 4 -" +* ../plugins/automatic/node_modules/prettier-plugin-bar/index.js: 4" `; exports[`show detailed usage with plugin options (manual resolution) (write) 1`] = `[]`; @@ -167,7 +164,6 @@ Other options: --support-info Print support information as JSON. -v, --version Print Prettier version. - " `; @@ -177,10 +173,7 @@ exports[`show version with --version (stderr) 1`] = `""`; exports[`show version with --version (write) 1`] = `[]`; -exports[`show warning with --help not-found (typo) (stderr) 1`] = ` -"[warn] Unknown flag "parserr", did you mean "parser"? -" -`; +exports[`show warning with --help not-found (typo) (stderr) 1`] = `"[warn] Unknown flag "parserr", did you mean "parser"?"`; exports[`show warning with --help not-found (typo) (stdout) 1`] = ` "--parser @@ -211,8 +204,7 @@ Valid options: glimmer Ember / Handlebars html HTML angular Angular - lwc Lightning Web Components -" + lwc Lightning Web Components" `; exports[`show warning with --help not-found (typo) (write) 1`] = `[]`; @@ -342,52 +334,36 @@ Other options: --support-info Print support information as JSON. -v, --version Print Prettier version. - " `; exports[`throw error and show usage with something unexpected (write) 1`] = `[]`; -exports[`throw error with --check + --list-different (stderr) 1`] = ` -"[error] Cannot use --check and --list-different together. -" -`; +exports[`throw error with --check + --list-different (stderr) 1`] = `"[error] Cannot use --check and --list-different together."`; exports[`throw error with --check + --list-different (stdout) 1`] = `""`; exports[`throw error with --check + --list-different (write) 1`] = `[]`; -exports[`throw error with --file-info + multiple files (stderr) 1`] = ` -"[error] Cannot use --file-info with multiple files -" -`; +exports[`throw error with --file-info + multiple files (stderr) 1`] = `"[error] Cannot use --file-info with multiple files"`; exports[`throw error with --file-info + multiple files (stdout) 1`] = `""`; exports[`throw error with --file-info + multiple files (write) 1`] = `[]`; -exports[`throw error with --find-config-path + multiple files (stderr) 1`] = ` -"[error] Cannot use --find-config-path with multiple files -" -`; +exports[`throw error with --find-config-path + multiple files (stderr) 1`] = `"[error] Cannot use --find-config-path with multiple files"`; exports[`throw error with --find-config-path + multiple files (stdout) 1`] = `""`; exports[`throw error with --find-config-path + multiple files (write) 1`] = `[]`; -exports[`throw error with --help not-found (stderr) 1`] = ` -"[error] Invalid --help value. Expected a flag, but received "not-found". -" -`; +exports[`throw error with --help not-found (stderr) 1`] = `"[error] Invalid --help value. Expected a flag, but received "not-found"."`; exports[`throw error with --help not-found (stdout) 1`] = `""`; exports[`throw error with --help not-found (write) 1`] = `[]`; -exports[`throw error with --write + --debug-check (stderr) 1`] = ` -"[error] Cannot use --write and --debug-check together. -" -`; +exports[`throw error with --write + --debug-check (stderr) 1`] = `"[error] Cannot use --write and --debug-check together."`; exports[`throw error with --write + --debug-check (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap b/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap index e8a274c60..9df1e5734 100644 --- a/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap +++ b/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap @@ -1,36 +1,26 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`error on unmatched pattern (stderr) 1`] = ` -"[error] No files matching the pattern were found: "**/*.toml". -" -`; +exports[`error on unmatched pattern (stderr) 1`] = `"[error] No files matching the pattern were found: "**/*.toml"."`; exports[`error on unmatched pattern (stdout) 1`] = `""`; exports[`error on unmatched pattern (write) 1`] = `[]`; -exports[`error on unmatched pattern when 2nd glob has no match (stderr) 1`] = ` -"[error] No files matching the pattern were found: "**/*.toml". -" -`; +exports[`error on unmatched pattern when 2nd glob has no match (stderr) 1`] = `"[error] No files matching the pattern were found: "**/*.toml"."`; exports[`error on unmatched pattern when 2nd glob has no match (stdout) 1`] = ` "const hello = "there"; { "hello": "there" } -hello: there -" +hello: there" `; exports[`error on unmatched pattern when 2nd glob has no match (write) 1`] = `[]`; exports[`no error on unmatched pattern (stderr) 1`] = `""`; -exports[`no error on unmatched pattern (stdout) 1`] = ` -"const hello = "there"; -" -`; +exports[`no error on unmatched pattern (stdout) 1`] = `"const hello = "there";"`; exports[`no error on unmatched pattern (write) 1`] = `[]`; @@ -41,8 +31,7 @@ exports[`no error on unmatched pattern when 2nd glob has no match (stdout) 1`] = { "hello": "there" } -hello: there -" +hello: there" `; exports[`no error on unmatched pattern when 2nd glob has no match (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/file-info.js.snap b/tests/integration/__tests__/__snapshots__/file-info.js.snap index e9d535992..bfb84d5cc 100644 --- a/tests/integration/__tests__/__snapshots__/file-info.js.snap +++ b/tests/integration/__tests__/__snapshots__/file-info.js.snap @@ -4,7 +4,6 @@ exports[`extracts file-info for a file in not_node_modules (stderr) 1`] = `""`; exports[`extracts file-info for a file in not_node_modules (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "babel" } - " `; @@ -14,7 +13,6 @@ exports[`extracts file-info for a js file (stderr) 1`] = `""`; exports[`extracts file-info for a js file (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "babel" } - " `; @@ -24,7 +22,6 @@ exports[`extracts file-info for a known markdown file with no extension (stderr) exports[`extracts file-info for a known markdown file with no extension (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "markdown" } - " `; @@ -34,7 +31,6 @@ exports[`extracts file-info for a markdown file (stderr) 1`] = `""`; exports[`extracts file-info for a markdown file (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "markdown" } - " `; @@ -44,7 +40,6 @@ exports[`extracts file-info with ignored=false for a file in node_modules when - exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "babel" } - " `; @@ -54,7 +49,6 @@ exports[`extracts file-info with ignored=true for a file in .prettierignore (std exports[`extracts file-info with ignored=true for a file in .prettierignore (stdout) 1`] = ` "{ "ignored": true, "inferredParser": null } - " `; @@ -64,7 +58,6 @@ exports[`extracts file-info with ignored=true for a file in a hand-picked .prett exports[`extracts file-info with ignored=true for a file in a hand-picked .prettierignore (stdout) 1`] = ` "{ "ignored": true, "inferredParser": null } - " `; @@ -74,7 +67,6 @@ exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "foo" } - " `; @@ -84,7 +76,6 @@ exports[`extracts file-info with inferredParser=foo when plugins are autoloaded exports[`extracts file-info with inferredParser=foo when plugins are autoloaded (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "foo" } - " `; @@ -94,7 +85,6 @@ exports[`extracts file-info with inferredParser=foo when plugins are loaded with exports[`extracts file-info with inferredParser=foo when plugins are loaded with --plugin-search-dir (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "foo" } - " `; @@ -104,7 +94,6 @@ exports[`extracts file-info with inferredParser=null for file.foo (stderr) 1`] = exports[`extracts file-info with inferredParser=null for file.foo (stdout) 1`] = ` "{ "ignored": false, "inferredParser": null } - " `; @@ -114,7 +103,6 @@ exports[`extracts file-info with with ignored=true for a file in node_modules (s exports[`extracts file-info with with ignored=true for a file in node_modules (stdout) 1`] = ` "{ "ignored": true, "inferredParser": null } - " `; @@ -122,7 +110,6 @@ exports[`extracts file-info with with ignored=true for a file in node_modules (w exports[`file-info should not try resolve config with --no-config (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "babel" } - " `; @@ -130,7 +117,6 @@ exports[`file-info should try resolve config (stderr) 1`] = `""`; exports[`file-info should try resolve config (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "override-js-parser" } - " `; @@ -140,7 +126,6 @@ exports[`non-exists ignore path (stderr) 1`] = `""`; exports[`non-exists ignore path (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "babel" } - " `; diff --git a/tests/integration/__tests__/__snapshots__/help-options.js.snap b/tests/integration/__tests__/__snapshots__/help-options.js.snap index 6dda333cc..035cd0d47 100644 --- a/tests/integration/__tests__/__snapshots__/help-options.js.snap +++ b/tests/integration/__tests__/__snapshots__/help-options.js.snap @@ -12,8 +12,7 @@ Valid options: always Always include parens. Example: \`(x) => x\` avoid Omit parens when possible. Example: \`x => x\` -Default: always -" +Default: always" `; exports[`show detailed usage with --help arrow-parens (write) 1`] = `[]`; @@ -25,8 +24,7 @@ exports[`show detailed usage with --help bracket-same-line (stdout) 1`] = ` Put > of opening tags on the last line instead of on a new line. -Default: false -" +Default: false" `; exports[`show detailed usage with --help bracket-same-line (write) 1`] = `[]`; @@ -38,8 +36,7 @@ exports[`show detailed usage with --help bracket-spacing (stdout) 1`] = ` Print spaces between brackets. -Default: true -" +Default: true" `; exports[`show detailed usage with --help bracket-spacing (write) 1`] = `[]`; @@ -51,8 +48,7 @@ exports[`show detailed usage with --help cache (stdout) 1`] = ` Only format changed files. Cannot use with --stdin-filepath. -Default: false -" +Default: false" `; exports[`show detailed usage with --help cache (write) 1`] = `[]`; @@ -62,8 +58,7 @@ exports[`show detailed usage with --help cache-location (stderr) 1`] = `""`; exports[`show detailed usage with --help cache-location (stdout) 1`] = ` "--cache-location - Path to the cache file. -" + Path to the cache file." `; exports[`show detailed usage with --help cache-location (write) 1`] = `[]`; @@ -78,8 +73,7 @@ exports[`show detailed usage with --help cache-strategy (stdout) 1`] = ` Valid options: metadata Use the file metadata such as timestamps as cache keys - content Use the file content as cache keys -" + content Use the file content as cache keys" `; exports[`show detailed usage with --help cache-strategy (write) 1`] = `[]`; @@ -90,8 +84,7 @@ exports[`show detailed usage with --help check (stdout) 1`] = ` "-c, --check Check if the given files are formatted, print a human-friendly summary - message and paths to unformatted files (see also --list-different). -" + message and paths to unformatted files (see also --list-different)." `; exports[`show detailed usage with --help check (write) 1`] = `[]`; @@ -103,8 +96,7 @@ exports[`show detailed usage with --help color (stdout) 1`] = ` Colorize error messages. -Default: true -" +Default: true" `; exports[`show detailed usage with --help color (write) 1`] = `[]`; @@ -114,8 +106,7 @@ exports[`show detailed usage with --help config (stderr) 1`] = `""`; exports[`show detailed usage with --help config (stdout) 1`] = ` "--config - Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js). -" + Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js)." `; exports[`show detailed usage with --help config (write) 1`] = `[]`; @@ -134,8 +125,7 @@ Valid options: prefer-file If a config file is found will evaluate it and ignore other CLI options. If no config file is found CLI options will evaluate as normal. -Default: cli-override -" +Default: cli-override" `; exports[`show detailed usage with --help config-precedence (write) 1`] = `[]`; @@ -148,8 +138,7 @@ exports[`show detailed usage with --help cursor-offset (stdout) 1`] = ` Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and --range-end. -Default: -1 -" +Default: -1" `; exports[`show detailed usage with --help cursor-offset (write) 1`] = `[]`; @@ -161,8 +150,7 @@ exports[`show detailed usage with --help editorconfig (stdout) 1`] = ` Take .editorconfig into account when parsing configuration. -Default: true -" +Default: true" `; exports[`show detailed usage with --help editorconfig (write) 1`] = `[]`; @@ -179,8 +167,7 @@ Valid options: auto Format embedded code if Prettier can automatically identify it. off Never automatically format embedded code. -Default: auto -" +Default: auto" `; exports[`show detailed usage with --help embedded-language-formatting (write) 1`] = `[]`; @@ -200,8 +187,7 @@ Valid options: auto Maintain existing (mixed values within one file are normalised by looking at what's used after the first line) -Default: lf -" +Default: lf" `; exports[`show detailed usage with --help end-of-line (write) 1`] = `[]`; @@ -213,8 +199,7 @@ exports[`show detailed usage with --help file-info (stdout) 1`] = ` Extract the following info (as JSON) for a given file path. Reported fields: * ignored (boolean) - true if file path is filtered by --ignore-path - * inferredParser (string | null) - name of parser inferred from file path -" + * inferredParser (string | null) - name of parser inferred from file path" `; exports[`show detailed usage with --help file-info (write) 1`] = `[]`; @@ -224,8 +209,7 @@ exports[`show detailed usage with --help find-config-path (stderr) 1`] = `""`; exports[`show detailed usage with --help find-config-path (stdout) 1`] = ` "--find-config-path - Find and print the path to a configuration file for the given input file. -" + Find and print the path to a configuration file for the given input file." `; exports[`show detailed usage with --help find-config-path (write) 1`] = `[]`; @@ -236,8 +220,7 @@ exports[`show detailed usage with --help help (stdout) 1`] = ` "-h, --help Show CLI usage, or details about the given flag. - Example: --help write -" + Example: --help write" `; exports[`show detailed usage with --help help (write) 1`] = `[]`; @@ -255,8 +238,7 @@ Valid options: strict Whitespaces are considered sensitive. ignore Whitespaces are considered insensitive. -Default: css -" +Default: css" `; exports[`show detailed usage with --help html-whitespace-sensitivity (write) 1`] = `[]`; @@ -268,8 +250,7 @@ exports[`show detailed usage with --help ignore-path (stdout) 1`] = ` Path to a file with patterns describing files to ignore. -Default: .prettierignore -" +Default: .prettierignore" `; exports[`show detailed usage with --help ignore-path (write) 1`] = `[]`; @@ -279,8 +260,7 @@ exports[`show detailed usage with --help ignore-unknown (stderr) 1`] = `""`; exports[`show detailed usage with --help ignore-unknown (stdout) 1`] = ` "-u, --ignore-unknown - Ignore unknown files. -" + Ignore unknown files." `; exports[`show detailed usage with --help ignore-unknown (write) 1`] = `[]`; @@ -292,8 +272,7 @@ exports[`show detailed usage with --help insert-pragma (stdout) 1`] = ` Insert @format pragma into file's first docblock comment. -Default: false -" +Default: false" `; exports[`show detailed usage with --help insert-pragma (write) 1`] = `[]`; @@ -305,8 +284,7 @@ exports[`show detailed usage with --help jsx-single-quote (stdout) 1`] = ` Use single quotes in JSX. -Default: false -" +Default: false" `; exports[`show detailed usage with --help jsx-single-quote (write) 1`] = `[]`; @@ -316,8 +294,7 @@ exports[`show detailed usage with --help list-different (stderr) 1`] = `""`; exports[`show detailed usage with --help list-different (stdout) 1`] = ` "-l, --list-different - Print the names of files that are different from Prettier's formatting (see also --check). -" + Print the names of files that are different from Prettier's formatting (see also --check)." `; exports[`show detailed usage with --help list-different (write) 1`] = `[]`; @@ -337,8 +314,7 @@ Valid options: log debug -Default: log -" +Default: log" `; exports[`show detailed usage with --help log-level (write) 1`] = `[]`; @@ -348,8 +324,7 @@ exports[`show detailed usage with --help no-bracket-spacing (stderr) 1`] = `""`; exports[`show detailed usage with --help no-bracket-spacing (stdout) 1`] = ` "--no-bracket-spacing - Do not print spaces between brackets. -" + Do not print spaces between brackets." `; exports[`show detailed usage with --help no-bracket-spacing (write) 1`] = `[]`; @@ -359,8 +334,7 @@ exports[`show detailed usage with --help no-color (stderr) 1`] = `""`; exports[`show detailed usage with --help no-color (stdout) 1`] = ` "--no-color - Do not colorize error messages. -" + Do not colorize error messages." `; exports[`show detailed usage with --help no-color (write) 1`] = `[]`; @@ -370,8 +344,7 @@ exports[`show detailed usage with --help no-config (stderr) 1`] = `""`; exports[`show detailed usage with --help no-config (stdout) 1`] = ` "--no-config - Do not look for a configuration file. -" + Do not look for a configuration file." `; exports[`show detailed usage with --help no-config (write) 1`] = `[]`; @@ -381,8 +354,7 @@ exports[`show detailed usage with --help no-editorconfig (stderr) 1`] = `""`; exports[`show detailed usage with --help no-editorconfig (stdout) 1`] = ` "--no-editorconfig - Don't take .editorconfig into account when parsing configuration. -" + Don't take .editorconfig into account when parsing configuration." `; exports[`show detailed usage with --help no-editorconfig (write) 1`] = `[]`; @@ -392,8 +364,7 @@ exports[`show detailed usage with --help no-error-on-unmatched-pattern (stderr) exports[`show detailed usage with --help no-error-on-unmatched-pattern (stdout) 1`] = ` "--no-error-on-unmatched-pattern - Prevent errors when pattern is unmatched. -" + Prevent errors when pattern is unmatched." `; exports[`show detailed usage with --help no-error-on-unmatched-pattern (write) 1`] = `[]`; @@ -403,8 +374,7 @@ exports[`show detailed usage with --help no-plugin-search (stderr) 1`] = `""`; exports[`show detailed usage with --help no-plugin-search (stdout) 1`] = ` "--no-plugin-search - Disable plugin autoloading. -" + Disable plugin autoloading." `; exports[`show detailed usage with --help no-plugin-search (write) 1`] = `[]`; @@ -414,8 +384,7 @@ exports[`show detailed usage with --help no-semi (stderr) 1`] = `""`; exports[`show detailed usage with --help no-semi (stdout) 1`] = ` "--no-semi - Do not print semicolons, except at the beginning of lines which may need them. -" + Do not print semicolons, except at the beginning of lines which may need them." `; exports[`show detailed usage with --help no-semi (write) 1`] = `[]`; @@ -451,8 +420,7 @@ Valid options: glimmer Ember / Handlebars html HTML angular Angular - lwc Lightning Web Components -" + lwc Lightning Web Components" `; exports[`show detailed usage with --help parser (write) 1`] = `[]`; @@ -464,8 +432,7 @@ exports[`show detailed usage with --help plugin (stdout) 1`] = ` Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s. -Default: [] -" +Default: []" `; exports[`show detailed usage with --help plugin (write) 1`] = `[]`; @@ -479,8 +446,7 @@ exports[`show detailed usage with --help plugin-search-dir (stdout) 1`] = ` Overrides default behavior when plugins are searched relatively to the location of Prettier. Multiple values are accepted. -Default: [] -" +Default: []" `; exports[`show detailed usage with --help plugin-search-dir (write) 1`] = `[]`; @@ -492,8 +458,7 @@ exports[`show detailed usage with --help print-width (stdout) 1`] = ` The line length where Prettier will try wrap. -Default: 80 -" +Default: 80" `; exports[`show detailed usage with --help print-width (write) 1`] = `[]`; @@ -511,8 +476,7 @@ Valid options: never Do not wrap prose. preserve Wrap prose as-is. -Default: preserve -" +Default: preserve" `; exports[`show detailed usage with --help prose-wrap (write) 1`] = `[]`; @@ -530,8 +494,7 @@ Valid options: consistent If at least one property in an object requires quotes, quote all properties. preserve Respect the input use of quotes in object properties. -Default: as-needed -" +Default: as-needed" `; exports[`show detailed usage with --help quote-props (write) 1`] = `[]`; @@ -545,8 +508,7 @@ exports[`show detailed usage with --help range-end (stdout) 1`] = ` The range will extend forwards to the end of the selected statement. This option cannot be used with --cursor-offset. -Default: Infinity -" +Default: Infinity" `; exports[`show detailed usage with --help range-end (write) 1`] = `[]`; @@ -560,8 +522,7 @@ exports[`show detailed usage with --help range-start (stdout) 1`] = ` The range will extend backwards to the start of the first line containing the selected statement. This option cannot be used with --cursor-offset. -Default: 0 -" +Default: 0" `; exports[`show detailed usage with --help range-start (write) 1`] = `[]`; @@ -574,8 +535,7 @@ exports[`show detailed usage with --help require-pragma (stdout) 1`] = ` Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted. -Default: false -" +Default: false" `; exports[`show detailed usage with --help require-pragma (write) 1`] = `[]`; @@ -587,8 +547,7 @@ exports[`show detailed usage with --help semi (stdout) 1`] = ` Print semicolons. -Default: true -" +Default: true" `; exports[`show detailed usage with --help semi (write) 1`] = `[]`; @@ -600,8 +559,7 @@ exports[`show detailed usage with --help single-attribute-per-line (stdout) 1`] Enforce single attribute per line in HTML, Vue and JSX. -Default: false -" +Default: false" `; exports[`show detailed usage with --help single-attribute-per-line (write) 1`] = `[]`; @@ -613,8 +571,7 @@ exports[`show detailed usage with --help single-quote (stdout) 1`] = ` Use single quotes instead of double quotes. -Default: false -" +Default: false" `; exports[`show detailed usage with --help single-quote (write) 1`] = `[]`; @@ -624,8 +581,7 @@ exports[`show detailed usage with --help stdin-filepath (stderr) 1`] = `""`; exports[`show detailed usage with --help stdin-filepath (stdout) 1`] = ` "--stdin-filepath - Path to the file to pretend that stdin comes from. -" + Path to the file to pretend that stdin comes from." `; exports[`show detailed usage with --help stdin-filepath (write) 1`] = `[]`; @@ -635,8 +591,7 @@ exports[`show detailed usage with --help support-info (stderr) 1`] = `""`; exports[`show detailed usage with --help support-info (stdout) 1`] = ` "--support-info - Print support information as JSON. -" + Print support information as JSON." `; exports[`show detailed usage with --help support-info (write) 1`] = `[]`; @@ -648,8 +603,7 @@ exports[`show detailed usage with --help tab-width (stdout) 1`] = ` Number of spaces per indentation level. -Default: 2 -" +Default: 2" `; exports[`show detailed usage with --help tab-width (write) 1`] = `[]`; @@ -667,8 +621,7 @@ Valid options: es5 Trailing commas where valid in ES5 (objects, arrays, etc.) none No trailing commas. -Default: all -" +Default: all" `; exports[`show detailed usage with --help trailing-comma (write) 1`] = `[]`; @@ -680,8 +633,7 @@ exports[`show detailed usage with --help use-tabs (stdout) 1`] = ` Indent with tabs instead of spaces. -Default: false -" +Default: false" `; exports[`show detailed usage with --help use-tabs (write) 1`] = `[]`; @@ -691,8 +643,7 @@ exports[`show detailed usage with --help version (stderr) 1`] = `""`; exports[`show detailed usage with --help version (stdout) 1`] = ` "-v, --version - Print Prettier version. -" + Print Prettier version." `; exports[`show detailed usage with --help version (write) 1`] = `[]`; @@ -704,8 +655,7 @@ exports[`show detailed usage with --help vue-indent-script-and-style (stdout) 1` Indent script and style tags in Vue files. -Default: false -" +Default: false" `; exports[`show detailed usage with --help vue-indent-script-and-style (write) 1`] = `[]`; @@ -715,8 +665,7 @@ exports[`show detailed usage with --help with-node-modules (stderr) 1`] = `""`; exports[`show detailed usage with --help with-node-modules (stdout) 1`] = ` "--with-node-modules - Process files inside 'node_modules' directory. -" + Process files inside 'node_modules' directory." `; exports[`show detailed usage with --help with-node-modules (write) 1`] = `[]`; @@ -726,8 +675,7 @@ exports[`show detailed usage with --help write (stderr) 1`] = `""`; exports[`show detailed usage with --help write (stdout) 1`] = ` "-w, --write - Edit files in-place. (Beware!) -" + Edit files in-place. (Beware!)" `; exports[`show detailed usage with --help write (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap b/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap index 120016090..bf1f4a62e 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap @@ -2,9 +2,6 @@ exports[`support absolute filename (stderr) 1`] = `""`; -exports[`support absolute filename (stdout) 1`] = ` -"regular-module.js -" -`; +exports[`support absolute filename (stdout) 1`] = `"regular-module.js"`; exports[`support absolute filename (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap b/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap index ea1e698c2..51dddc337 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap @@ -2,10 +2,7 @@ exports[`ignores file name contains emoji (stderr) 1`] = `""`; -exports[`ignores file name contains emoji (stdout) 1`] = ` -"not-ignored.js -" -`; +exports[`ignores file name contains emoji (stdout) 1`] = `"not-ignored.js"`; exports[`ignores file name contains emoji (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap b/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap index ab13f5025..49a61e6a4 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap @@ -4,15 +4,9 @@ exports[`formats files when executing in a subdirectory (stderr) 1`] = `""`; exports[`formats files when executing in a subdirectory (stderr) 2`] = `""`; -exports[`formats files when executing in a subdirectory (stdout) 1`] = ` -"should-not-ignore.js -" -`; +exports[`formats files when executing in a subdirectory (stdout) 1`] = `"should-not-ignore.js"`; -exports[`formats files when executing in a subdirectory (stdout) 2`] = ` -"should-not-ignore.js -" -`; +exports[`formats files when executing in a subdirectory (stdout) 2`] = `"should-not-ignore.js"`; exports[`formats files when executing in a subdirectory (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-path.js.snap b/tests/integration/__tests__/__snapshots__/ignore-path.js.snap index e5655fe8d..58e0e8c87 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-path.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-path.js.snap @@ -2,36 +2,24 @@ exports[`ignore file when using --debug-check (stderr) 1`] = `""`; -exports[`ignore file when using --debug-check (stdout) 1`] = ` -"other-regular-modules.js -" -`; +exports[`ignore file when using --debug-check (stdout) 1`] = `"other-regular-modules.js"`; exports[`ignore file when using --debug-check (write) 1`] = `[]`; exports[`ignore path (stderr) 1`] = `""`; -exports[`ignore path (stdout) 1`] = ` -"regular-module.js -" -`; +exports[`ignore path (stdout) 1`] = `"regular-module.js"`; exports[`ignore path (write) 1`] = `[]`; exports[`outputs files as-is if no --write (stderr) 1`] = `""`; -exports[`outputs files as-is if no --write (stdout) 1`] = ` -"'use strict'; -" -`; +exports[`outputs files as-is if no --write (stdout) 1`] = `"'use strict';"`; exports[`outputs files as-is if no --write (write) 1`] = `[]`; exports[`support .prettierignore (stderr) 1`] = `""`; -exports[`support .prettierignore (stdout) 1`] = ` -"other-regular-modules.js -" -`; +exports[`support .prettierignore (stdout) 1`] = `"other-regular-modules.js"`; exports[`support .prettierignore (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap b/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap index 6b1d6b92a..376ed1f25 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap @@ -5,8 +5,7 @@ exports[`support relative paths (stderr) 1`] = `""`; exports[`support relative paths (stdout) 1`] = ` "shouldNotBeIgnored.js level1-glob/level2-glob/level3-glob/shouldNotBeIgnored.scss -level1-glob/shouldNotBeIgnored.js -" +level1-glob/shouldNotBeIgnored.js" `; exports[`support relative paths (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap b/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap index 5ad4992f9..1d249792f 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap @@ -6,57 +6,37 @@ exports[`Ignored file (stdout) 1`] = `""`; exports[`Ignored file (write) 1`] = `[]`; -exports[`None exist file (stderr) 1`] = ` -"[error] No files matching the pattern were found: "non-exist-file". -" -`; +exports[`None exist file (stderr) 1`] = `"[error] No files matching the pattern were found: "non-exist-file"."`; exports[`None exist file (stdout) 1`] = `""`; exports[`None exist file (write) 1`] = `[]`; -exports[`Not matching pattern (stderr) 1`] = ` -"[error] No files matching the pattern were found: "*.non-exist-pattern". -" -`; +exports[`Not matching pattern (stderr) 1`] = `"[error] No files matching the pattern were found: "*.non-exist-pattern"."`; exports[`Not matching pattern (stdout) 1`] = `""`; exports[`Not matching pattern (write) 1`] = `[]`; -exports[`ignore-unknown alias (stdout) 1`] = ` -"javascript.js -" -`; +exports[`ignore-unknown alias (stdout) 1`] = `"javascript.js"`; exports[`ignore-unknown check (stderr) 1`] = ` "[warn] javascript.js -[warn] Code style issues found in the above file. Run Prettier to fix. -" +[warn] Code style issues found in the above file. Run Prettier to fix." `; -exports[`ignore-unknown check (stdout) 1`] = ` -"Checking formatting... -" -`; +exports[`ignore-unknown check (stdout) 1`] = `"Checking formatting..."`; exports[`ignore-unknown check (write) 1`] = `[]`; -exports[`ignore-unknown dir (stdout) 1`] = ` -"javascript.js -" -`; +exports[`ignore-unknown dir (stdout) 1`] = `"javascript.js"`; exports[`ignore-unknown pattern (stdout) 1`] = ` "javascript.js -override.as-js-file -" +override.as-js-file" `; -exports[`ignore-unknown write (stdout) 1`] = ` -"javascript.js -" -`; +exports[`ignore-unknown write (stdout) 1`] = `"javascript.js"`; exports[`ignore-unknown write (write) 1`] = ` [ diff --git a/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap b/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap index 612c4c62e..857af8156 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap @@ -2,9 +2,6 @@ exports[`ignores files in version control systems (stderr) 1`] = `""`; -exports[`ignores files in version control systems (stdout) 1`] = ` -"file.js -" -`; +exports[`ignores files in version control systems (stdout) 1`] = `"file.js"`; exports[`ignores files in version control systems (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/infer-parser.js.snap b/tests/integration/__tests__/__snapshots__/infer-parser.js.snap index e8d0b3581..bf42f1854 100644 --- a/tests/integration/__tests__/__snapshots__/infer-parser.js.snap +++ b/tests/integration/__tests__/__snapshots__/infer-parser.js.snap @@ -3,47 +3,29 @@ exports[`--check with unknown path and no parser multiple files (stderr) 1`] = ` "[error] No parser could be inferred for file: FOO [warn] foo.js -[warn] Code style issues found in the above file. Run Prettier to fix. -" +[warn] Code style issues found in the above file. Run Prettier to fix." `; -exports[`--check with unknown path and no parser multiple files (stdout) 1`] = ` -"Checking formatting... -" -`; +exports[`--check with unknown path and no parser multiple files (stdout) 1`] = `"Checking formatting..."`; -exports[`--check with unknown path and no parser specific file (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--check with unknown path and no parser specific file (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; exports[`--check with unknown path and no parser specific file (stdout) 1`] = ` "Checking formatting... -All matched files use Prettier code style! -" +All matched files use Prettier code style!" `; -exports[`--list-different with unknown path and no parser multiple files (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--list-different with unknown path and no parser multiple files (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; -exports[`--list-different with unknown path and no parser specific file (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--list-different with unknown path and no parser specific file (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; exports[`--write and --check with unknown path and no parser multiple files (stderr) 1`] = ` "[error] No parser could be inferred for file: FOO [warn] foo.js -[warn] Code style issues fixed in the above file. -" +[warn] Code style issues fixed in the above file." `; -exports[`--write and --check with unknown path and no parser multiple files (stdout) 1`] = ` -"Checking formatting... -" -`; +exports[`--write and --check with unknown path and no parser multiple files (stdout) 1`] = `"Checking formatting..."`; exports[`--write and --check with unknown path and no parser multiple files (write) 1`] = ` [ @@ -55,26 +37,16 @@ exports[`--write and --check with unknown path and no parser multiple files (wri ] `; -exports[`--write and --check with unknown path and no parser specific file (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--write and --check with unknown path and no parser specific file (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; exports[`--write and --check with unknown path and no parser specific file (stdout) 1`] = ` "Checking formatting... -All matched files use Prettier code style! -" +All matched files use Prettier code style!" `; -exports[`--write and --list-different with unknown path and no parser multiple files (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--write and --list-different with unknown path and no parser multiple files (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; -exports[`--write and --list-different with unknown path and no parser multiple files (stdout) 1`] = ` -"foo.js -" -`; +exports[`--write and --list-different with unknown path and no parser multiple files (stdout) 1`] = `"foo.js"`; exports[`--write and --list-different with unknown path and no parser multiple files (write) 1`] = ` [ @@ -86,20 +58,11 @@ exports[`--write and --list-different with unknown path and no parser multiple f ] `; -exports[`--write and --list-different with unknown path and no parser specific file (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--write and --list-different with unknown path and no parser specific file (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; -exports[`--write with unknown path and no parser multiple files (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--write with unknown path and no parser multiple files (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; -exports[`--write with unknown path and no parser multiple files (stdout) 1`] = ` -"foo.js 0ms -" -`; +exports[`--write with unknown path and no parser multiple files (stdout) 1`] = `"foo.js 0ms"`; exports[`--write with unknown path and no parser multiple files (write) 1`] = ` [ @@ -111,10 +74,7 @@ exports[`--write with unknown path and no parser multiple files (write) 1`] = ` ] `; -exports[`--write with unknown path and no parser specific file (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`--write with unknown path and no parser specific file (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; exports[`API with no path and no parser prettier.check 1`] = ` [ @@ -130,56 +90,25 @@ exports[`API with no path and no parser prettier.format 1`] = ` exports[`Interpreters (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "babel" } - " `; -exports[`Known/Unknown (stdout) 1`] = ` -"known.js -" -`; +exports[`Known/Unknown (stdout) 1`] = `"known.js"`; -exports[`stdin no path and no parser --check logs error but exits with 0 (stderr) 1`] = ` -"[error] No parser and no file path given, couldn't infer a parser. -" -`; +exports[`stdin no path and no parser --check logs error but exits with 0 (stderr) 1`] = `"[error] No parser and no file path given, couldn't infer a parser."`; -exports[`stdin no path and no parser --list-different logs error but exits with 0 (stderr) 1`] = ` -"[error] No parser and no file path given, couldn't infer a parser. -" -`; +exports[`stdin no path and no parser --list-different logs error but exits with 0 (stderr) 1`] = `"[error] No parser and no file path given, couldn't infer a parser."`; -exports[`stdin no path and no parser logs error and exits with 2 (stderr) 1`] = ` -"[error] No parser and no file path given, couldn't infer a parser. -" -`; +exports[`stdin no path and no parser logs error and exits with 2 (stderr) 1`] = `"[error] No parser and no file path given, couldn't infer a parser."`; -exports[`stdin with unknown path and no parser --check logs error but exits with 0 (stderr) 1`] = ` -"[error] No parser could be inferred for file: foo -" -`; +exports[`stdin with unknown path and no parser --check logs error but exits with 0 (stderr) 1`] = `"[error] No parser could be inferred for file: foo"`; -exports[`stdin with unknown path and no parser --list-different logs error but exits with 0 (stderr) 1`] = ` -"[error] No parser could be inferred for file: foo -" -`; +exports[`stdin with unknown path and no parser --list-different logs error but exits with 0 (stderr) 1`] = `"[error] No parser could be inferred for file: foo"`; -exports[`stdin with unknown path and no parser logs error and exits with 2 (stderr) 1`] = ` -"[error] No parser could be inferred for file: foo -" -`; +exports[`stdin with unknown path and no parser logs error and exits with 2 (stderr) 1`] = `"[error] No parser could be inferred for file: foo"`; -exports[`unknown path and no parser multiple files (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`unknown path and no parser multiple files (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; -exports[`unknown path and no parser multiple files (stdout) 1`] = ` -"foo(); -" -`; +exports[`unknown path and no parser multiple files (stdout) 1`] = `"foo();"`; -exports[`unknown path and no parser specific file (stderr) 1`] = ` -"[error] No parser could be inferred for file: FOO -" -`; +exports[`unknown path and no parser specific file (stderr) 1`] = `"[error] No parser could be inferred for file: FOO"`; diff --git a/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap b/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap index e8e2735d3..15f1e1e69 100644 --- a/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap +++ b/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap @@ -1,9 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`throw error with invalid ignore (stderr) 1`] = ` -"[error] Unable to read '.prettierignore': EISDIR: illegal operation on a directory, read -" -`; +exports[`throw error with invalid ignore (stderr) 1`] = `"[error] Unable to read '.prettierignore': EISDIR: illegal operation on a directory, read"`; exports[`throw error with invalid ignore (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/list-different.js.snap b/tests/integration/__tests__/__snapshots__/list-different.js.snap index 1fd48596b..a751bdfec 100644 --- a/tests/integration/__tests__/__snapshots__/list-different.js.snap +++ b/tests/integration/__tests__/__snapshots__/list-different.js.snap @@ -4,15 +4,9 @@ exports[`--list-different works in CI just as in a non-TTY mode (stderr) 1`] = ` exports[`--list-different works in CI just as in a non-TTY mode (stderr) 2`] = `""`; -exports[`--list-different works in CI just as in a non-TTY mode (stdout) 1`] = ` -"unformatted.js -" -`; +exports[`--list-different works in CI just as in a non-TTY mode (stdout) 1`] = `"unformatted.js"`; -exports[`--list-different works in CI just as in a non-TTY mode (stdout) 2`] = ` -"unformatted.js -" -`; +exports[`--list-different works in CI just as in a non-TTY mode (stdout) 2`] = `"unformatted.js"`; exports[`--list-different works in CI just as in a non-TTY mode (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/log-level.js.snap b/tests/integration/__tests__/__snapshots__/log-level.js.snap index 8eb4523e2..9fe2f774a 100644 --- a/tests/integration/__tests__/__snapshots__/log-level.js.snap +++ b/tests/integration/__tests__/__snapshots__/log-level.js.snap @@ -14,7 +14,4 @@ exports[`--write with --log-level=silent doesn't log filenames (write) 1`] = ` ] `; -exports[`Should use default level logger to log \`--log-level\` error (stderr) 1`] = ` -"[error] Invalid --log-level value. Expected "debug", "error", "log", "silent" or "warn", but received "a-unknown-log-level". -" -`; +exports[`Should use default level logger to log \`--log-level\` error (stderr) 1`] = `"[error] Invalid --log-level value. Expected "debug", "error", "log", "silent" or "warn", but received "a-unknown-log-level"."`; diff --git a/tests/integration/__tests__/__snapshots__/patterns-dirs.js.snap b/tests/integration/__tests__/__snapshots__/patterns-dirs.js.snap index 05cfe83ee..2513f29f2 100644 --- a/tests/integration/__tests__/__snapshots__/patterns-dirs.js.snap +++ b/tests/integration/__tests__/__snapshots__/patterns-dirs.js.snap @@ -9,8 +9,7 @@ dir1/nested1/bn1.js dir2/a2.js dir2/b2.js dir2/nested2/an2.js -dir2/nested2/bn2.js -" +dir2/nested2/bn2.js" `; exports[`1a - with *.foo plugin: prettier dir1 dir2 --plugin=../../plugins/extensions/plugin.cjs (stdout) 1`] = ` @@ -24,28 +23,20 @@ dir2/a2.foo dir2/a2.js dir2/b2.js dir2/nested2/an2.js -dir2/nested2/bn2.js -" +dir2/nested2/bn2.js" `; -exports[`1c: prettier dir1 empty (stderr) 1`] = ` -"[error] No supported files were found in the directory: "empty". -" -`; +exports[`1c: prettier dir1 empty (stderr) 1`] = `"[error] No supported files were found in the directory: "empty"."`; exports[`1c: prettier dir1 empty (stdout) 1`] = ` "dir1/a1.js dir1/b1.js dir1/nested1/an1.css dir1/nested1/an1.js -dir1/nested1/bn1.js -" +dir1/nested1/bn1.js" `; -exports[`2: prettier dir1 'dir2/**/*' (stderr) 1`] = ` -"[error] No parser could be inferred for file: dir2/a2.foo -" -`; +exports[`2: prettier dir1 'dir2/**/*' (stderr) 1`] = `"[error] No parser could be inferred for file: dir2/a2.foo"`; exports[`2: prettier dir1 'dir2/**/*' (stdout) 1`] = ` "dir1/a1.js @@ -57,14 +48,12 @@ dir2/a2.js dir2/b2.js dir2/nested2/an2.js dir2/nested2/bn2.js -dir2/node-shebang -" +dir2/node-shebang" `; exports[`3: prettier nonexistent-dir 'dir2/**/*' (stderr) 1`] = ` "[error] No files matching the pattern were found: "nonexistent-dir". -[error] No parser could be inferred for file: dir2/a2.foo -" +[error] No parser could be inferred for file: dir2/a2.foo" `; exports[`3: prettier nonexistent-dir 'dir2/**/*' (stdout) 1`] = ` @@ -72,14 +61,10 @@ exports[`3: prettier nonexistent-dir 'dir2/**/*' (stdout) 1`] = ` dir2/b2.js dir2/nested2/an2.js dir2/nested2/bn2.js -dir2/node-shebang -" +dir2/node-shebang" `; -exports[`4: prettier . 'dir2/**/*' (stderr) 1`] = ` -"[error] No parser could be inferred for file: dir2/a2.foo -" -`; +exports[`4: prettier . 'dir2/**/*' (stderr) 1`] = `"[error] No parser could be inferred for file: dir2/a2.foo"`; exports[`4: prettier . 'dir2/**/*' (stdout) 1`] = ` "!dir/a.js @@ -92,20 +77,17 @@ dir2/a2.js dir2/b2.js dir2/nested2/an2.js dir2/nested2/bn2.js -dir2/node-shebang -" +dir2/node-shebang" `; exports[`Negative patterns 1: prettier dir1 '!dir1/nested1' (stdout) 1`] = ` "dir1/a1.js -dir1/b1.js -" +dir1/b1.js" `; exports[`Negative patterns 1a: prettier dir1 '!dir1/nested1/*' (stdout) 1`] = ` "dir1/a1.js -dir1/b1.js -" +dir1/b1.js" `; exports[`Negative patterns 2: prettier . '!dir1/nested1' (stdout) 1`] = ` @@ -115,8 +97,7 @@ dir1/b1.js dir2/a2.js dir2/b2.js dir2/nested2/an2.js -dir2/nested2/bn2.js -" +dir2/nested2/bn2.js" `; exports[`Negative patterns 3: prettier . '!dir1/nested1/an1.js' (stdout) 1`] = ` @@ -128,26 +109,16 @@ dir1/nested1/bn1.js dir2/a2.js dir2/b2.js dir2/nested2/an2.js -dir2/nested2/bn2.js -" +dir2/nested2/bn2.js" `; -exports[`Negative patterns 4: prettier '!nonexistent-dir1 !nonexistent-dir2' (stderr) 1`] = ` -"[error] No matching files. Patterns: !nonexistent-dir1 !nonexistent-dir2 -" -`; +exports[`Negative patterns 4: prettier '!nonexistent-dir1 !nonexistent-dir2' (stderr) 1`] = `"[error] No matching files. Patterns: !nonexistent-dir1 !nonexistent-dir2"`; exports[`Negative patterns 4: prettier '!nonexistent-dir1 !nonexistent-dir2' (stdout) 1`] = `""`; -exports[`Negative patterns with explicit files: prettier dir1/a1.js dir2/a2.js '!dir1/*' (stderr) 1`] = ` -"[error] Explicitly specified file was ignored due to negative glob patterns: "dir1/a1.js". -" -`; +exports[`Negative patterns with explicit files: prettier dir1/a1.js dir2/a2.js '!dir1/*' (stderr) 1`] = `"[error] Explicitly specified file was ignored due to negative glob patterns: "dir1/a1.js"."`; -exports[`Negative patterns with explicit files: prettier dir1/a1.js dir2/a2.js '!dir1/*' (stdout) 1`] = ` -"dir2/a2.js -" -`; +exports[`Negative patterns with explicit files: prettier dir1/a1.js dir2/a2.js '!dir1/*' (stdout) 1`] = `"dir2/a2.js"`; exports[`Trailing slash 1: prettier ./ (stdout) 1`] = ` "!dir/a.js @@ -159,8 +130,7 @@ dir1/nested1/bn1.js dir2/a2.js dir2/b2.js dir2/nested2/an2.js -dir2/nested2/bn2.js -" +dir2/nested2/bn2.js" `; exports[`Trailing slash 2: prettier .// (stdout) 1`] = ` @@ -173,8 +143,7 @@ dir1/nested1/bn1.js dir2/a2.js dir2/b2.js dir2/nested2/an2.js -dir2/nested2/bn2.js -" +dir2/nested2/bn2.js" `; exports[`Trailing slash 3: prettier dir1/ (stdout) 1`] = ` @@ -182,8 +151,7 @@ exports[`Trailing slash 3: prettier dir1/ (stdout) 1`] = ` dir1/b1.js dir1/nested1/an1.css dir1/nested1/an1.js -dir1/nested1/bn1.js -" +dir1/nested1/bn1.js" `; exports[`Trailing slash 4: prettier dir1// (stdout) 1`] = ` @@ -191,8 +159,7 @@ exports[`Trailing slash 4: prettier dir1// (stdout) 1`] = ` dir1/b1.js dir1/nested1/an1.css dir1/nested1/an1.js -dir1/nested1/bn1.js -" +dir1/nested1/bn1.js" `; exports[`Trailing slash 5: prettier .//dir2/..//./dir1// (stdout) 1`] = ` @@ -200,8 +167,7 @@ exports[`Trailing slash 5: prettier .//dir2/..//./dir1// (stdout) 1`] = ` dir1/b1.js dir1/nested1/an1.css dir1/nested1/an1.js -dir1/nested1/bn1.js -" +dir1/nested1/bn1.js" `; exports[`Trailing slash run in sub dir 1: prettier .. (stdout) 1`] = ` @@ -214,8 +180,7 @@ exports[`Trailing slash run in sub dir 1: prettier .. (stdout) 1`] = ` a2.js b2.js nested2/an2.js -nested2/bn2.js -" +nested2/bn2.js" `; exports[`Trailing slash run in sub dir 2: prettier ../ (stdout) 1`] = ` @@ -228,8 +193,7 @@ exports[`Trailing slash run in sub dir 2: prettier ../ (stdout) 1`] = ` a2.js b2.js nested2/an2.js -nested2/bn2.js -" +nested2/bn2.js" `; exports[`Trailing slash run in sub dir 3: prettier ../dir1 (stdout) 1`] = ` @@ -237,8 +201,7 @@ exports[`Trailing slash run in sub dir 3: prettier ../dir1 (stdout) 1`] = ` ../dir1/b1.js ../dir1/nested1/an1.css ../dir1/nested1/an1.js -../dir1/nested1/bn1.js -" +../dir1/nested1/bn1.js" `; exports[`Trailing slash run in sub dir 4: prettier ../dir1/ (stdout) 1`] = ` @@ -246,23 +209,17 @@ exports[`Trailing slash run in sub dir 4: prettier ../dir1/ (stdout) 1`] = ` ../dir1/b1.js ../dir1/nested1/an1.css ../dir1/nested1/an1.js -../dir1/nested1/bn1.js -" +../dir1/nested1/bn1.js" `; -exports[`plugins \`*\` (stderr) 1`] = ` -"[error] No parser could be inferred for file: unknown.unknown -" -`; +exports[`plugins \`*\` (stderr) 1`] = `"[error] No parser could be inferred for file: unknown.unknown"`; exports[`plugins \`*\` (stdout) 1`] = ` "javascript.js -plugin.uppercase-rocks -" +plugin.uppercase-rocks" `; exports[`plugins \`.\` (stdout) 1`] = ` "javascript.js -plugin.uppercase-rocks -" +plugin.uppercase-rocks" `; diff --git a/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap b/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap index f64e341d2..c01feeb03 100644 --- a/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap +++ b/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap @@ -5,8 +5,7 @@ exports[`fixtures-1: Should match all files (stderr) 1`] = `""`; exports[`fixtures-1: Should match all files (stdout) 1`] = ` "!file.js a.js -b.js -" +b.js" `; exports[`fixtures-1: Should match all files (write) 1`] = `[]`; @@ -15,8 +14,7 @@ exports[`fixtures-1: Should match files except \`a.js\` (stderr) 1`] = `""`; exports[`fixtures-1: Should match files except \`a.js\` (stdout) 1`] = ` "!file.js -b.js -" +b.js" `; exports[`fixtures-1: Should match files except \`a.js\` (write) 1`] = `[]`; @@ -25,8 +23,7 @@ exports[`fixtures-2: Should match \`a.js\` and \`!b.js\` (stderr) 1`] = `""`; exports[`fixtures-2: Should match \`a.js\` and \`!b.js\` (stdout) 1`] = ` "!b.js -a.js -" +a.js" `; exports[`fixtures-2: Should match \`a.js\` and \`!b.js\` (write) 1`] = `[]`; @@ -37,36 +34,26 @@ exports[`fixtures-2: Should match all js files and all supported files in the '! "!b.js a.js !dir.js/1.css -!dir.js/2.css -" +!dir.js/2.css" `; exports[`fixtures-2: Should match all js files and all supported files in the '!dir.js' directory (write) 1`] = `[]`; exports[`fixtures-2: Should only match \`!b.js\` (stderr) 1`] = `""`; -exports[`fixtures-2: Should only match \`!b.js\` (stdout) 1`] = ` -"!b.js -" -`; +exports[`fixtures-2: Should only match \`!b.js\` (stdout) 1`] = `"!b.js"`; exports[`fixtures-2: Should only match \`!b.js\` (write) 1`] = `[]`; exports[`fixtures-3: Should exclude \`.svn\` (existing) (stderr) 1`] = `""`; -exports[`fixtures-3: Should exclude \`.svn\` (existing) (stdout) 1`] = ` -"outside.js -" -`; +exports[`fixtures-3: Should exclude \`.svn\` (existing) (stdout) 1`] = `"outside.js"`; exports[`fixtures-3: Should exclude \`.svn\` (existing) (write) 1`] = `[]`; exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (stderr) 1`] = `""`; -exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (stdout) 1`] = ` -"outside.js -" -`; +exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (stdout) 1`] = `"outside.js"`; exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (write) 1`] = `[]`; @@ -75,8 +62,7 @@ exports[`fixtures-3: Should match \`outside.js\`, \`dir/inside.js\` and \`dir/no exports[`fixtures-3: Should match \`outside.js\`, \`dir/inside.js\` and \`dir/node_modules/in-node_modules.js\` (stdout) 1`] = ` "dir/inside.js dir/node_modules/in-node_modules.js -outside.js -" +outside.js" `; exports[`fixtures-3: Should match \`outside.js\`, \`dir/inside.js\` and \`dir/node_modules/in-node_modules.js\` (write) 1`] = `[]`; @@ -85,44 +71,31 @@ exports[`fixtures-3: Should only match \`outside.js\` and \`dir/inside.js\` (std exports[`fixtures-3: Should only match \`outside.js\` and \`dir/inside.js\` (stdout) 1`] = ` "dir/inside.js -outside.js -" +outside.js" `; exports[`fixtures-3: Should only match \`outside.js\` and \`dir/inside.js\` (write) 1`] = `[]`; exports[`fixtures-4: Should match \`level-1.js\` #2 (stderr) 1`] = `""`; -exports[`fixtures-4: Should match \`level-1.js\` #2 (stdout) 1`] = ` -"0/level-1.js -" -`; +exports[`fixtures-4: Should match \`level-1.js\` #2 (stdout) 1`] = `"0/level-1.js"`; exports[`fixtures-4: Should match \`level-1.js\` #2 (write) 1`] = `[]`; exports[`fixtures-4: Should match \`level-1.js\` #3 (stderr) 1`] = `""`; -exports[`fixtures-4: Should match \`level-1.js\` #3 (stdout) 1`] = ` -"0/level-1.js -" -`; +exports[`fixtures-4: Should match \`level-1.js\` #3 (stdout) 1`] = `"0/level-1.js"`; exports[`fixtures-4: Should match \`level-1.js\` #3 (write) 1`] = `[]`; exports[`fixtures-4: Should match \`level-1.js\` (stderr) 1`] = `""`; -exports[`fixtures-4: Should match \`level-1.js\` (stdout) 1`] = ` -"0/level-1.js -" -`; +exports[`fixtures-4: Should match \`level-1.js\` (stdout) 1`] = `"0/level-1.js"`; exports[`fixtures-4: Should match \`level-1.js\` (write) 1`] = `[]`; exports[`should not ignore file paths contains object prototype keys (stderr) 1`] = `""`; -exports[`should not ignore file paths contains object prototype keys (stdout) 1`] = ` -"constructor/should-be-formatted.js -" -`; +exports[`should not ignore file paths contains object prototype keys (stdout) 1`] = `"constructor/should-be-formatted.js"`; exports[`should not ignore file paths contains object prototype keys (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/patterns.js.snap b/tests/integration/__tests__/__snapshots__/patterns.js.snap index e8cd41646..68b304f5d 100644 --- a/tests/integration/__tests__/__snapshots__/patterns.js.snap +++ b/tests/integration/__tests__/__snapshots__/patterns.js.snap @@ -6,8 +6,7 @@ exports[`multiple patterns (stdout) 1`] = ` "directory/file.js directory/nested-directory/nested-directory-file.js other-directory/file.js -other-directory/nested-directory/nested-directory-file.js -" +other-directory/nested-directory/nested-directory-file.js" `; exports[`multiple patterns (write) 1`] = `[]`; @@ -19,8 +18,7 @@ exports[`multiple patterns by with ignore pattern, doesn't ignore node_modules w other-directory/file.js other-directory/nested-directory/nested-directory-file.js other-regular-modules.js -regular-module.js -" +regular-module.js" `; exports[`multiple patterns by with ignore pattern, doesn't ignore node_modules with --with-node-modules flag (write) 1`] = `[]`; @@ -31,8 +29,7 @@ exports[`multiple patterns by with ignore pattern, ignores node_modules by defau "other-directory/file.js other-directory/nested-directory/nested-directory-file.js other-regular-modules.js -regular-module.js -" +regular-module.js" `; exports[`multiple patterns by with ignore pattern, ignores node_modules by default (write) 1`] = `[]`; @@ -43,8 +40,7 @@ exports[`multiple patterns by with ignore pattern, ignores node_modules by with "other-directory/file.js other-directory/nested-directory/nested-directory-file.js other-regular-modules.js -regular-module.js -" +regular-module.js" `; exports[`multiple patterns by with ignore pattern, ignores node_modules by with ./**/*.js (write) 1`] = `[]`; @@ -55,29 +51,23 @@ exports[`multiple patterns with ignore nested directories pattern (stdout) 1`] = "directory/file.js other-directory/file.js other-regular-modules.js -regular-module.js -" +regular-module.js" `; exports[`multiple patterns with ignore nested directories pattern (write) 1`] = `[]`; -exports[`multiple patterns with non exists pattern (stderr) 1`] = ` -"[error] No files matching the pattern were found: "non-existent.js". -" -`; +exports[`multiple patterns with non exists pattern (stderr) 1`] = `"[error] No files matching the pattern were found: "non-existent.js"."`; exports[`multiple patterns with non exists pattern (stdout) 1`] = ` "directory/file.js -directory/nested-directory/nested-directory-file.js -" +directory/nested-directory/nested-directory-file.js" `; exports[`multiple patterns with non exists pattern (write) 1`] = `[]`; exports[`multiple patterns, throw error and exit with non zero code on non existing files (stderr) 1`] = ` "[error] No files matching the pattern were found: "non-existent.js". -[error] No files matching the pattern were found: "other-non-existent.js". -" +[error] No files matching the pattern were found: "other-non-existent.js"." `; exports[`multiple patterns, throw error and exit with non zero code on non existing files (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/piped-output.js.snap b/tests/integration/__tests__/__snapshots__/piped-output.js.snap index da11285f7..860df516f 100644 --- a/tests/integration/__tests__/__snapshots__/piped-output.js.snap +++ b/tests/integration/__tests__/__snapshots__/piped-output.js.snap @@ -6,14 +6,12 @@ exports[`no file diffs with --check + formatted file (stderr) 2`] = `""`; exports[`no file diffs with --check + formatted file (stdout) 1`] = ` "Checking formatting... -formatted.jsAll matched files use Prettier code style! -" +formatted.jsAll matched files use Prettier code style!" `; exports[`no file diffs with --check + formatted file (stdout) 2`] = ` "Checking formatting... -All matched files use Prettier code style! -" +All matched files use Prettier code style!" `; exports[`no file diffs with --check + formatted file (write) 1`] = `[]`; @@ -34,14 +32,12 @@ exports[`no file diffs with --list-different + formatted file (write) 2`] = `[]` exports[`output with --check + unformatted differs when piped (stderr) 1`] = ` "[warn] unformatted.js -[warn] Code style issues fixed in the above file. -" +[warn] Code style issues fixed in the above file." `; exports[`output with --check + unformatted differs when piped (stderr) 2`] = ` "[warn] unformatted.js -[warn] Code style issues fixed in the above file. -" +[warn] Code style issues fixed in the above file." `; exports[`output with --check + unformatted differs when piped (stdout) 1`] = ` @@ -49,10 +45,7 @@ exports[`output with --check + unformatted differs when piped (stdout) 1`] = ` unformatted.js" `; -exports[`output with --check + unformatted differs when piped (stdout) 2`] = ` -"Checking formatting... -" -`; +exports[`output with --check + unformatted differs when piped (stdout) 2`] = `"Checking formatting..."`; exports[`output with --check + unformatted differs when piped (write) 1`] = ` [ @@ -78,15 +71,9 @@ exports[`output with --list-different + unformatted differs when piped (stderr) exports[`output with --list-different + unformatted differs when piped (stderr) 2`] = `""`; -exports[`output with --list-different + unformatted differs when piped (stdout) 1`] = ` -"unformatted.jsunformatted.js -" -`; +exports[`output with --list-different + unformatted differs when piped (stdout) 1`] = `"unformatted.jsunformatted.js"`; -exports[`output with --list-different + unformatted differs when piped (stdout) 2`] = ` -"unformatted.js -" -`; +exports[`output with --list-different + unformatted differs when piped (stdout) 2`] = `"unformatted.js"`; exports[`output with --list-different + unformatted differs when piped (write) 1`] = ` [ diff --git a/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap b/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap index fe098f7aa..5c6e9deba 100644 --- a/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap +++ b/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap @@ -7,8 +7,7 @@ exports[`show detailed external option with \`--help foo-string\` (stdout) 1`] = foo description -Default: bar -" +Default: bar" `; exports[`show detailed external option with \`--help foo-string\` (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/plugin-options.js.snap b/tests/integration/__tests__/__snapshots__/plugin-options.js.snap index 7567fdb7b..e59649807 100644 --- a/tests/integration/__tests__/__snapshots__/plugin-options.js.snap +++ b/tests/integration/__tests__/__snapshots__/plugin-options.js.snap @@ -32,8 +32,7 @@ Valid options: html HTML angular Angular lwc Lightning Web Components - foo-parser foo (plugin: ./plugin.cjs) -" + foo-parser foo (plugin: ./plugin.cjs)" `; exports[`include plugin's parsers to the values of the \`parser\` option\` (write) 1`] = `[]`; @@ -50,8 +49,7 @@ Valid options: bar bar description baz baz description -Default: bar -" +Default: bar" `; exports[`show detailed external option with \`--help foo-option\` (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/skip-folders.js.snap b/tests/integration/__tests__/__snapshots__/skip-folders.js.snap index a5cedb9e7..9ffde8599 100644 --- a/tests/integration/__tests__/__snapshots__/skip-folders.js.snap +++ b/tests/integration/__tests__/__snapshots__/skip-folders.js.snap @@ -2,16 +2,14 @@ exports[`skip folders passed specifically (stdout) 1`] = ` "a/file.js -b/file.js -" +b/file.js" `; exports[`skip folders passed specifically (write) 1`] = `[]`; exports[`skips folders in glob (stdout) 1`] = ` "a/file.js -b/file.js -" +b/file.js" `; exports[`skips folders in glob (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap b/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap index bd8822c04..0ef4e1161 100644 --- a/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap +++ b/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap @@ -7,15 +7,13 @@ exports[`apply editorconfig for stdin-filepath with a deep path (stderr) 2`] = ` exports[`apply editorconfig for stdin-filepath with a deep path (stdout) 1`] = ` "function f() { console.log("should be indented with a tab") -} -" +}" `; exports[`apply editorconfig for stdin-filepath with a deep path (stdout) 2`] = ` "function f() { console.log("should be indented with a tab") -} -" +}" `; exports[`apply editorconfig for stdin-filepath with a deep path (write) 1`] = `[]`; @@ -27,8 +25,7 @@ exports[`apply editorconfig for stdin-filepath with nonexistent directory (stder exports[`apply editorconfig for stdin-filepath with nonexistent directory (stdout) 1`] = ` "function f() { console.log("should be indented with a tab") -} -" +}" `; exports[`apply editorconfig for stdin-filepath with nonexistent directory (write) 1`] = `[]`; @@ -38,8 +35,7 @@ exports[`apply editorconfig for stdin-filepath with nonexistent file (stderr) 1` exports[`apply editorconfig for stdin-filepath with nonexistent file (stdout) 1`] = ` "function f() { console.log("should be indented with a tab") -} -" +}" `; exports[`apply editorconfig for stdin-filepath with nonexistent file (write) 1`] = `[]`; @@ -49,8 +45,7 @@ exports[`don’t apply editorconfig outside project for stdin-filepath with none exports[`don’t apply editorconfig outside project for stdin-filepath with nonexistent directory (stdout) 1`] = ` "function f() { console.log("should be indented with 2 spaces") -} -" +}" `; exports[`don’t apply editorconfig outside project for stdin-filepath with nonexistent directory (write) 1`] = `[]`; @@ -60,8 +55,7 @@ exports[`format correctly if stdin content compatible with stdin-filepath (stder exports[`format correctly if stdin content compatible with stdin-filepath (stdout) 1`] = ` ".name { display: none; -} -" +}" `; exports[`format correctly if stdin content compatible with stdin-filepath (write) 1`] = `[]`; @@ -71,8 +65,7 @@ exports[`gracefully handle stdin-filepath with nonexistent directory (stderr) 1` exports[`gracefully handle stdin-filepath with nonexistent directory (stdout) 1`] = ` ".name { display: none; -} -" +}" `; exports[`gracefully handle stdin-filepath with nonexistent directory (write) 1`] = `[]`; @@ -84,8 +77,7 @@ exports[`output file as-is if stdin-filepath matched patterns in ignore-path (wr exports[`throw error if stdin content incompatible with stdin-filepath (stderr) 1`] = ` "[error] abc.js: SyntaxError: Unexpected token (1:1) [error] > 1 | .name { display: none; } -[error] | ^ -" +[error] | ^" `; exports[`throw error if stdin content incompatible with stdin-filepath (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/support-info.js.snap b/tests/integration/__tests__/__snapshots__/support-info.js.snap index 6c8dace4a..10f01528d 100644 --- a/tests/integration/__tests__/__snapshots__/support-info.js.snap +++ b/tests/integration/__tests__/__snapshots__/support-info.js.snap @@ -1092,7 +1092,6 @@ exports[`CLI --support-info (stdout) 1`] = ` } ] } - " `; diff --git a/tests/integration/__tests__/__snapshots__/syntax-error.js.snap b/tests/integration/__tests__/__snapshots__/syntax-error.js.snap index 337d3602d..a2ff88d88 100644 --- a/tests/integration/__tests__/__snapshots__/syntax-error.js.snap +++ b/tests/integration/__tests__/__snapshots__/syntax-error.js.snap @@ -3,8 +3,7 @@ exports[`exits with non-zero code when input has a syntax error (stderr) 1`] = ` "[error] stdin: SyntaxError: Missing semicolon. (1:2) [error] > 1 | a.2 -[error] | ^ -" +[error] | ^" `; exports[`exits with non-zero code when input has a syntax error (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap b/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap index db3118ab3..7a3cc13ed 100644 --- a/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap @@ -1,23 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`CLI --stdin-filepath works with --config-precedence cli-override (stdout) 1`] = ` -"let x: keyof Y = foo() -" -`; +exports[`CLI --stdin-filepath works with --config-precedence cli-override (stdout) 1`] = `"let x: keyof Y = foo()"`; exports[`CLI --stdin-filepath works with --config-precedence cli-override (write) 1`] = `[]`; -exports[`CLI --stdin-filepath works with --config-precedence file-override (stdout) 1`] = ` -"let x: keyof Y = foo(); -" -`; +exports[`CLI --stdin-filepath works with --config-precedence file-override (stdout) 1`] = `"let x: keyof Y = foo();"`; exports[`CLI --stdin-filepath works with --config-precedence file-override (write) 1`] = `[]`; -exports[`CLI --stdin-filepath works with --config-precedence prefer-file (stdout) 1`] = ` -"let x: keyof Y = foo(); -" -`; +exports[`CLI --stdin-filepath works with --config-precedence prefer-file (stdout) 1`] = `"let x: keyof Y = foo();"`; exports[`CLI --stdin-filepath works with --config-precedence prefer-file (write) 1`] = `[]`; @@ -26,8 +17,7 @@ exports[`CLI overrides are still applied when no config is found with --config-p exports[`CLI overrides are still applied when no config is found with --config-precedence file-override (stdout) 1`] = ` "function noConfigJs() { console.log("no-config/file.js should have no semicolons") -} -" +}" `; exports[`CLI overrides are still applied when no config is found with --config-precedence file-override (write) 1`] = `[]`; @@ -39,8 +29,7 @@ exports[`CLI overrides gets applied when no config exists with --config-preceden console.log( "no-config/file.js should have no semicolons", ); -} -" +}" `; exports[`CLI overrides gets applied when no config exists with --config-precedence prefer-file (write) 1`] = `[]`; @@ -50,34 +39,24 @@ exports[`CLI overrides gets ignored when config exists with --config-precedence exports[`CLI overrides gets ignored when config exists with --config-precedence prefer-file (stdout) 1`] = ` "function js() { console.log("js/file.js should have tab width 8 (1 if CLI)"); -} -" +}" `; exports[`CLI overrides gets ignored when config exists with --config-precedence prefer-file (write) 1`] = `[]`; -exports[`CLI validate options with --config-precedence cli-override (stderr) 1`] = ` -"[error] Invalid printWidth value. Expected an integer, but received 0.5. -" -`; +exports[`CLI validate options with --config-precedence cli-override (stderr) 1`] = `"[error] Invalid printWidth value. Expected an integer, but received 0.5."`; exports[`CLI validate options with --config-precedence cli-override (stdout) 1`] = `""`; exports[`CLI validate options with --config-precedence cli-override (write) 1`] = `[]`; -exports[`CLI validate options with --config-precedence file-override (stderr) 1`] = ` -"[error] Invalid printWidth value. Expected an integer, but received 0.5. -" -`; +exports[`CLI validate options with --config-precedence file-override (stderr) 1`] = `"[error] Invalid printWidth value. Expected an integer, but received 0.5."`; exports[`CLI validate options with --config-precedence file-override (stdout) 1`] = `""`; exports[`CLI validate options with --config-precedence file-override (write) 1`] = `[]`; -exports[`CLI validate options with --config-precedence prefer-file (stderr) 1`] = ` -"[error] Invalid printWidth value. Expected an integer, but received 0.5. -" -`; +exports[`CLI validate options with --config-precedence prefer-file (stderr) 1`] = `"[error] Invalid printWidth value. Expected an integer, but received 0.5."`; exports[`CLI validate options with --config-precedence prefer-file (stdout) 1`] = `""`; diff --git a/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap b/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap index 7cf2d3fb3..ee53f965c 100644 --- a/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap @@ -6,8 +6,7 @@ exports[`doesn't ignore node_modules with --with-node-modules flag (stdout) 1`] "nested/node_modules/node-module.js node_modules/node-module.js not_node_modules/file.js -regular-module.js -" +regular-module.js" `; exports[`doesn't ignore node_modules with --with-node-modules flag (write) 1`] = `[]`; @@ -18,8 +17,7 @@ exports[`doesn't ignore node_modules with --with-node-modules flag for file list "node_modules/node-module.js not_node_modules/file.js nested/node_modules/node-module.js -regular-module.js -" +regular-module.js" `; exports[`doesn't ignore node_modules with --with-node-modules flag for file list (write) 1`] = `[]`; @@ -28,8 +26,7 @@ exports[`ignores node_modules by default (stderr) 1`] = `""`; exports[`ignores node_modules by default (stdout) 1`] = ` "not_node_modules/file.js -regular-module.js -" +regular-module.js" `; exports[`ignores node_modules by default (write) 1`] = `[]`; @@ -38,8 +35,7 @@ exports[`ignores node_modules by default for file list (stderr) 1`] = `""`; exports[`ignores node_modules by default for file list (stdout) 1`] = ` "not_node_modules/file.js -regular-module.js -" +regular-module.js" `; exports[`ignores node_modules by default for file list (write) 1`] = `[]`; @@ -48,8 +44,7 @@ exports[`ignores node_modules by with ./**/*.js (stderr) 1`] = `""`; exports[`ignores node_modules by with ./**/*.js (stdout) 1`] = ` "not_node_modules/file.js -regular-module.js -" +regular-module.js" `; exports[`ignores node_modules by with ./**/*.js (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap b/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap index 26f84ade7..10abdc79d 100644 --- a/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap @@ -8,8 +8,7 @@ exports[`infers postcss parser (stdout) 1`] = ` /* Stylesheet */ * { outline: none; -} -" +}" `; exports[`infers postcss parser (write) 1`] = `[]`; @@ -18,8 +17,7 @@ exports[`infers postcss parser with --check (stderr) 1`] = `""`; exports[`infers postcss parser with --check (stdout) 1`] = ` "Checking formatting... -All matched files use Prettier code style! -" +All matched files use Prettier code style!" `; exports[`infers postcss parser with --check (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/with-shebang.js.snap b/tests/integration/__tests__/__snapshots__/with-shebang.js.snap index b93745658..cd5382c89 100644 --- a/tests/integration/__tests__/__snapshots__/with-shebang.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-shebang.js.snap @@ -4,8 +4,7 @@ exports[`preserves shebang (stderr) 1`] = `""`; exports[`preserves shebang (stdout) 1`] = ` "#!/usr/bin/env node -"use strict"; -" +"use strict";" `; exports[`preserves shebang (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/write.js.snap b/tests/integration/__tests__/__snapshots__/write.js.snap index c83ebede0..7a5d44291 100644 --- a/tests/integration/__tests__/__snapshots__/write.js.snap +++ b/tests/integration/__tests__/__snapshots__/write.js.snap @@ -2,29 +2,19 @@ exports[`do not write file with --write + formatted file (stderr) 1`] = `""`; -exports[`do not write file with --write + formatted file (stdout) 1`] = ` -"formatted.js 0ms -" -`; +exports[`do not write file with --write + formatted file (stdout) 1`] = `"formatted.js 0ms"`; exports[`do not write file with --write + invalid file (stderr) 1`] = ` "[error] invalid.js: SyntaxError: Unexpected token (1:17) [error] > 1 | this is invalid! -[error] | ^ -" +[error] | ^" `; -exports[`do not write file with --write + invalid file (stdout) 1`] = ` -" -" -`; +exports[`do not write file with --write + invalid file (stdout) 1`] = `""`; exports[`write file with --write + unformatted file (stderr) 1`] = `""`; -exports[`write file with --write + unformatted file (stdout) 1`] = ` -"unformatted.js 0ms -" -`; +exports[`write file with --write + unformatted file (stdout) 1`] = `"unformatted.js 0ms"`; exports[`write file with --write + unformatted file (write) 1`] = ` [ @@ -38,10 +28,7 @@ exports[`write file with --write + unformatted file (write) 1`] = ` exports[`write file with -w + unformatted file (stderr) 1`] = `""`; -exports[`write file with -w + unformatted file (stdout) 1`] = ` -"unformatted.js 0ms -" -`; +exports[`write file with -w + unformatted file (stdout) 1`] = `"unformatted.js 0ms"`; exports[`write file with -w + unformatted file (write) 1`] = ` [ diff --git a/tests/integration/__tests__/arg-parsing.js b/tests/integration/__tests__/arg-parsing.js index 8d5939a26..b62c79d4e 100644 --- a/tests/integration/__tests__/arg-parsing.js +++ b/tests/integration/__tests__/arg-parsing.js @@ -59,7 +59,7 @@ describe("allow overriding flags", () => { ["--tab-width=1", "--tab-width=3", "--parser=babel"], { input: "function a() { b }" } ).test({ - stdout: "function a() {\n b;\n}\n", + stdout: "function a() {\n b;\n}", status: 0, }); }); diff --git a/tests/integration/__tests__/check.js b/tests/integration/__tests__/check.js index 1b40713bc..bbca422e6 100644 --- a/tests/integration/__tests__/check.js +++ b/tests/integration/__tests__/check.js @@ -2,7 +2,7 @@ describe("checks stdin with --check", () => { runPrettier("cli/with-shebang", ["--check", "--parser", "babel"], { input: "0", }).test({ - stdout: "(stdin)\n", + stdout: "(stdin)", stderr: "", status: "non-zero", }); @@ -12,7 +12,7 @@ describe("checks stdin with -c (alias for --check)", () => { runPrettier("cli/with-shebang", ["-c", "--parser", "babel"], { input: "0", }).test({ - stdout: "(stdin)\n", + stdout: "(stdin)", stderr: "", status: "non-zero", }); diff --git a/tests/integration/__tests__/cursor-offset.js b/tests/integration/__tests__/cursor-offset.js index 9a18330c3..bd605d6f0 100644 --- a/tests/integration/__tests__/cursor-offset.js +++ b/tests/integration/__tests__/cursor-offset.js @@ -28,7 +28,7 @@ describe("cursorOffset should not be affected by full-width character", () => { * "中文" * ]; */ - stderr: "26\n", + stderr: "26", status: 0, }); }); diff --git a/tests/integration/__tests__/debug-check.js b/tests/integration/__tests__/debug-check.js index 7f55ac4cd..c4bc9a4b1 100644 --- a/tests/integration/__tests__/debug-check.js +++ b/tests/integration/__tests__/debug-check.js @@ -1,6 +1,6 @@ describe("doesn't crash when --debug-check is passed", () => { runPrettier("cli/with-shebang", ["issue1890.js", "--debug-check"]).test({ - stdout: "issue1890.js\n", + stdout: "issue1890.js", stderr: "", status: 0, }); @@ -10,7 +10,7 @@ describe("checks stdin with --debug-check", () => { runPrettier("cli/with-shebang", ["--debug-check", "--parser", "babel"], { input: "0", }).test({ - stdout: "(stdin)\n", + stdout: "(stdin)", stderr: "", status: 0, }); diff --git a/tests/integration/__tests__/debug-print-doc.js b/tests/integration/__tests__/debug-print-doc.js index 3a00d22f1..8d5a5be55 100644 --- a/tests/integration/__tests__/debug-print-doc.js +++ b/tests/integration/__tests__/debug-print-doc.js @@ -2,7 +2,7 @@ describe("prints doc with --debug-print-doc", () => { runPrettier("cli/with-shebang", ["--debug-print-doc", "--parser", "babel"], { input: "0", }).test({ - stdout: '["0", ";", hardline]\n', + stdout: '["0", ";", hardline]', stderr: "", status: 0, write: [], diff --git a/tests/integration/__tests__/early-exit.js b/tests/integration/__tests__/early-exit.js index 60888d0fd..0dfb2b459 100644 --- a/tests/integration/__tests__/early-exit.js +++ b/tests/integration/__tests__/early-exit.js @@ -2,7 +2,7 @@ import prettier from "../../config/prettier-entry.js"; describe("show version with --version", () => { runPrettier("cli/with-shebang", ["--version"]).test({ - stdout: prettier.version + "\n", + stdout: prettier.version, status: 0, }); }); diff --git a/tests/integration/__tests__/ignore-in-subdirectories.js b/tests/integration/__tests__/ignore-in-subdirectories.js index 7679def66..312388717 100644 --- a/tests/integration/__tests__/ignore-in-subdirectories.js +++ b/tests/integration/__tests__/ignore-in-subdirectories.js @@ -69,7 +69,7 @@ describe("formats files when executing in a subdirectory and using stdin", () => input: "hello_world( );", } ).test({ - stdout: "hello_world();\n", + stdout: "hello_world();", status: 0, }); }); diff --git a/tests/integration/__tests__/infer-parser.js b/tests/integration/__tests__/infer-parser.js index 736afb6ba..ed8b38b7a 100644 --- a/tests/integration/__tests__/infer-parser.js +++ b/tests/integration/__tests__/infer-parser.js @@ -109,7 +109,7 @@ describe("--list-different with unknown path and no parser", () => { describe("multiple files", () => { runPrettier("cli/infer-parser/", ["--list-different", "*"]).test({ status: 1, - stdout: "foo.js\n", + stdout: "foo.js", write: [], }); }); diff --git a/tests/integration/__tests__/list-different.js b/tests/integration/__tests__/list-different.js index e72d279e3..34d9ad896 100644 --- a/tests/integration/__tests__/list-different.js +++ b/tests/integration/__tests__/list-different.js @@ -2,7 +2,7 @@ describe("checks stdin with --list-different", () => { runPrettier("cli/with-shebang", ["--list-different", "--parser", "babel"], { input: "0", }).test({ - stdout: "(stdin)\n", + stdout: "(stdin)", stderr: "", status: "non-zero", }); @@ -12,7 +12,7 @@ describe("checks stdin with -l (alias for --list-different)", () => { runPrettier("cli/with-shebang", ["-l", "--parser", "babel"], { input: "0", }).test({ - stdout: "(stdin)\n", + stdout: "(stdin)", stderr: "", status: "non-zero", }); diff --git a/tests/integration/__tests__/log-level.js b/tests/integration/__tests__/log-level.js index 02eba8d71..9b7f32084 100644 --- a/tests/integration/__tests__/log-level.js +++ b/tests/integration/__tests__/log-level.js @@ -69,7 +69,7 @@ describe("log-level should not effect information print", () => { { argv: ["--find-config-path", "any-file"], assertOptions: { - stdout: ".prettierrc\n", + stdout: ".prettierrc", }, }, { @@ -96,7 +96,7 @@ describe("log-level should not effect information print", () => { { argv: ["--parser", "babel"], runOptions: { input: "foo" }, - assertOptions: { stdout: "foo;\n" }, + assertOptions: { stdout: "foo;" }, }, ]) { runPrettier("cli/log-level", ["--log-level", "silent", ...argv], { diff --git a/tests/integration/__tests__/patterns-dirs.js b/tests/integration/__tests__/patterns-dirs.js index 9df936273..f39dbc6b0 100644 --- a/tests/integration/__tests__/patterns-dirs.js +++ b/tests/integration/__tests__/patterns-dirs.js @@ -143,13 +143,13 @@ if (path.sep === "/") { fs.rmdirSync(path.resolve(base, "test-b\\?")); }); - testPatterns("", ["test-a\\/test.js"], { stdout: "test-a\\/test.js\n" }); - testPatterns("", ["test-a\\"], { stdout: "test-a\\/test.js\n" }); - testPatterns("", ["test-a*/*"], { stdout: "test-a\\/test.js\n" }); + testPatterns("", ["test-a\\/test.js"], { stdout: "test-a\\/test.js" }); + testPatterns("", ["test-a\\"], { stdout: "test-a\\/test.js" }); + testPatterns("", ["test-a*/*"], { stdout: "test-a\\/test.js" }); - testPatterns("", ["test-b\\?/test.js"], { stdout: "test-b\\?/test.js\n" }); - testPatterns("", ["test-b\\?"], { stdout: "test-b\\?/test.js\n" }); - testPatterns("", ["test-b*/*"], { stdout: "test-b\\?/test.js\n" }); + testPatterns("", ["test-b\\?/test.js"], { stdout: "test-b\\?/test.js" }); + testPatterns("", ["test-b\\?"], { stdout: "test-b\\?/test.js" }); + testPatterns("", ["test-b*/*"], { stdout: "test-b\\?/test.js" }); }); } diff --git a/tests/integration/__tests__/performance-flags.js b/tests/integration/__tests__/performance-flags.js index 7fbccd426..008eb27a0 100644 --- a/tests/integration/__tests__/performance-flags.js +++ b/tests/integration/__tests__/performance-flags.js @@ -15,7 +15,7 @@ describe("should not write file or print code when `--debug-benchmark` or `--deb ).test({ stderr: assertStderr, status: 0, - stdout: "'--debug-repeat' option found, skipped print code to screen.\n", + stdout: "'--debug-repeat' option found, skipped print code to screen.", write: [], }); @@ -28,7 +28,7 @@ describe("should not write file or print code when `--debug-benchmark` or `--deb ).test({ stderr: assertStderr, status: 0, - stdout: "'--debug-repeat' option found, skipped print code to screen.\n", + stdout: "'--debug-repeat' option found, skipped print code to screen.", write: [], }); } @@ -42,8 +42,7 @@ describe("should not write file or print code when `--debug-benchmark` or `--deb ]).test({ stderr: assertStderr, status: 0, - stdout: - "'--debug-repeat' option found, skipped print code or write files.\n", + stdout: "'--debug-repeat' option found, skipped print code or write files.", write: [], }); @@ -57,8 +56,7 @@ describe("should not write file or print code when `--debug-benchmark` or `--deb ]).test({ stderr: assertStderr, status: 0, - stdout: - "'--debug-repeat' option found, skipped print code or write files.\n", + stdout: "'--debug-repeat' option found, skipped print code or write files.", write: [], }); @@ -72,8 +70,7 @@ describe("should not write file or print code when `--debug-benchmark` or `--deb ]).test({ stderr: assertStderr, status: 0, - stdout: - "'--debug-repeat' option found, skipped print code or write files.\n", + stdout: "'--debug-repeat' option found, skipped print code or write files.", write: [], }); }); diff --git a/tests/integration/__tests__/plugin-extensions.js b/tests/integration/__tests__/plugin-extensions.js index 9aa419973..14dcd8732 100644 --- a/tests/integration/__tests__/plugin-extensions.js +++ b/tests/integration/__tests__/plugin-extensions.js @@ -1,11 +1,10 @@ import runPrettier from "../run-prettier.js"; -const EOL = "\n"; describe("uses 'extensions' from languages to determine parser", () => { runPrettier("plugins/extensions", ["*.foo", "--plugin=./plugin.cjs"], { ignoreLineEndings: true, }).test({ - stdout: "!contents" + EOL, + stdout: "!contents", stderr: "", status: 0, write: [], diff --git a/tests/integration/__tests__/plugin-precedence.js b/tests/integration/__tests__/plugin-precedence.js index b2780b726..af95d1548 100644 --- a/tests/integration/__tests__/plugin-precedence.js +++ b/tests/integration/__tests__/plugin-precedence.js @@ -4,7 +4,7 @@ describe("json-stringify takes precedence over json for package.json", () => { '{ "a": "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong" }', }).test({ stdout: - '{\n "a": "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong"\n}\n', + '{\n "a": "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong"\n}', stderr: "", status: 0, write: [], diff --git a/tests/integration/__tests__/plugin-preprocess.js b/tests/integration/__tests__/plugin-preprocess.js index c60536e6e..72ba36ff8 100644 --- a/tests/integration/__tests__/plugin-preprocess.js +++ b/tests/integration/__tests__/plugin-preprocess.js @@ -1,11 +1,10 @@ import runPrettier from "../run-prettier.js"; -const EOL = "\n"; describe("parser preprocess function is used to reshape input text", () => { runPrettier("plugins/preprocess", ["*.foo", "--plugin=./plugin.cjs"], { ignoreLineEndings: true, }).test({ - stdout: "preprocessed:contents" + EOL, + stdout: "preprocessed:contents", stderr: "", status: 0, write: [], diff --git a/tests/integration/__tests__/plugin-resolution.js b/tests/integration/__tests__/plugin-resolution.js index 434613849..7c8e44fcd 100644 --- a/tests/integration/__tests__/plugin-resolution.js +++ b/tests/integration/__tests__/plugin-resolution.js @@ -1,9 +1,8 @@ import runPrettier from "../run-prettier.js"; -const EOL = "\n"; describe("automatically loads 'prettier-plugin-*'", () => { runPrettier("plugins/automatic", ["file.txt", "--parser=bar"]).test({ - stdout: "content from `prettier-plugin-bar` package + contents" + EOL, + stdout: "content from `prettier-plugin-bar` package + contents", stderr: "", status: 0, write: [], @@ -12,7 +11,7 @@ describe("automatically loads 'prettier-plugin-*'", () => { describe("automatically loads '@prettier/plugin-*'", () => { runPrettier("plugins/automatic", ["file.txt", "--parser=foo"]).test({ - stdout: "foo+contents" + EOL, + stdout: "foo+contents", stderr: "", status: 0, write: [], @@ -21,7 +20,7 @@ describe("automatically loads '@prettier/plugin-*'", () => { describe("automatically loads '@/prettier-plugin-*'", () => { runPrettier("plugins/automatic", ["file.txt", "--parser=foobar"]).test({ - stdout: "foobar+contents" + EOL, + stdout: "foobar+contents", stderr: "", status: 0, write: [], @@ -34,7 +33,7 @@ describe("automatically loads 'prettier-plugin-*' from --plugin-search-dir (same "--parser=foo", "--plugin-search-dir=.", ]).test({ - stdout: "foo+contents" + EOL, + stdout: "foo+contents", stderr: "", status: 0, write: [], @@ -47,7 +46,7 @@ describe("automatically loads '@prettier/plugin-*' from --plugin-search-dir (sam "--parser=bar", "--plugin-search-dir=.", ]).test({ - stdout: "content from `prettier-plugin-bar` package + contents" + EOL, + stdout: "content from `prettier-plugin-bar` package + contents", stderr: "", status: 0, write: [], @@ -60,7 +59,7 @@ describe("automatically loads '@/prettier-plugin-*' from --plugin-search-d "--parser=foobar", "--plugin-search-dir=.", ]).test({ - stdout: "foobar+contents" + EOL, + stdout: "foobar+contents", stderr: "", status: 0, write: [], @@ -73,7 +72,7 @@ describe("automatically loads 'prettier-plugin-*' from --plugin-search-dir (diff "--parser=foo", "--plugin-search-dir=automatic", ]).test({ - stdout: "foo+contents" + EOL, + stdout: "foo+contents", stderr: "", status: 0, write: [], @@ -86,7 +85,7 @@ describe("automatically loads '@prettier/plugin-*' from --plugin-search-dir (dif "--parser=bar", "--plugin-search-dir=automatic", ]).test({ - stdout: "content from `prettier-plugin-bar` package + contents" + EOL, + stdout: "content from `prettier-plugin-bar` package + contents", stderr: "", status: 0, write: [], @@ -105,7 +104,7 @@ describe("does not crash when --plugin-search-dir does not contain node_modules" ], { ignoreLineEndings: true } ).test({ - stdout: "!contents" + EOL, + stdout: "!contents", stderr: "", status: 0, write: [], @@ -120,7 +119,7 @@ describe("crashes when one of --plugin-search-dir does not exist", () => { "--plugin-search-dir=.", ]).test({ stdout: "", - stderr: "[error] non-existing-dir does not exist or is not a directory\n", + stderr: "[error] non-existing-dir does not exist or is not a directory", status: 1, write: [], }); @@ -132,7 +131,7 @@ describe("loads --plugin by its relative path", () => { "--parser=bar", "--plugin=./automatic/node_modules/prettier-plugin-bar/index.js", ]).test({ - stdout: "content from `prettier-plugin-bar` package + contents" + EOL, + stdout: "content from `prettier-plugin-bar` package + contents", stderr: "", status: 0, write: [], @@ -145,7 +144,7 @@ describe("loads --plugin by its relative path without leading ./", () => { "--parser=bar", "--plugin=automatic/node_modules/prettier-plugin-bar/index.js", ]).test({ - stdout: "content from `prettier-plugin-bar` package + contents" + EOL, + stdout: "content from `prettier-plugin-bar` package + contents", stderr: "", status: 0, write: [], @@ -158,7 +157,7 @@ describe("loads --plugin by package name", () => { "--parser=foobar", "--plugin=@user/prettier-plugin-foobar", ]).test({ - stdout: "foobar+contents" + EOL, + stdout: "foobar+contents", stderr: "", status: 0, write: [], @@ -171,7 +170,7 @@ describe("loads --plugin by filename without leading ./, should resolve to file, "--parser=baz", "--plugin=prettier-plugin-baz.js", ]).test({ - stdout: "content from `prettier-plugin-baz.js` file + contents" + EOL, + stdout: "content from `prettier-plugin-baz.js` file + contents", stderr: "", status: 0, write: [], @@ -184,7 +183,7 @@ describe("loads --plugin by bespoke plugin name (assuming it is installed in cwd "--parser=bespoke", "--plugin=@company/prettier-plugin-bespoke/main.js", ]).test({ - stdout: "bespoke+contents" + EOL, + stdout: "bespoke+contents", stderr: "", status: 0, write: [], @@ -248,8 +247,7 @@ test("--no-plugin-search together with --plugin-search-dir", async () => { expect(result1).toMatchInlineSnapshot(` { "status": 1, - "stderr": "[error] Cannot use --no-plugin-search and --plugin-search-dir together. - ", + "stderr": "[error] Cannot use --no-plugin-search and --plugin-search-dir together.", "stdout": "", "write": [], } diff --git a/tests/integration/__tests__/stdin-filepath.js b/tests/integration/__tests__/stdin-filepath.js index d68f7a427..ff6c190e8 100644 --- a/tests/integration/__tests__/stdin-filepath.js +++ b/tests/integration/__tests__/stdin-filepath.js @@ -89,7 +89,7 @@ if (isCI) { input: code, // js }).test({ status: 0, - stdout: code + "\n", + stdout: code, stderr: "", write: [], }); diff --git a/tests/integration/__tests__/with-config-precedence.js b/tests/integration/__tests__/with-config-precedence.js index f4a307a6d..668e043bc 100644 --- a/tests/integration/__tests__/with-config-precedence.js +++ b/tests/integration/__tests__/with-config-precedence.js @@ -1,17 +1,15 @@ import { outdent } from "outdent"; -const TAB_WIDTH_3_OUTPUT = - outdent` - function foo() { - ${" ".repeat(3)}return bar; - } - ` + "\n"; -const TAB_WIDTH_5_OUTPUT = - outdent` - function foo() { - ${" ".repeat(5)}return bar; - } - ` + "\n"; +const TAB_WIDTH_3_OUTPUT = outdent` + function foo() { + ${" ".repeat(3)}return bar; + } +`; +const TAB_WIDTH_5_OUTPUT = outdent` + function foo() { + ${" ".repeat(5)}return bar; + } +`; test("CLI overrides take precedence --config-precedence", async () => { const withoutFlag = await runPrettier("cli/config-precedence/valid-config", [ diff --git a/tests/integration/run-prettier.js b/tests/integration/run-prettier.js index d82f0e6d8..4399be52a 100644 --- a/tests/integration/run-prettier.js +++ b/tests/integration/run-prettier.js @@ -24,6 +24,9 @@ const streamToString = (stream) => }); }); +const removeFinalNewLine = (string) => + string.endsWith("\n") ? string.slice(0, -1) : string; + function runCliWorker(dir, args, options) { const result = { status: undefined, @@ -57,8 +60,8 @@ function runCliWorker(dir, args, options) { return new Promise((resolve, reject) => { worker.on("exit", async (code) => { result.status = code; - result.stdout = await streamToString(worker.stdout); - result.stderr = await streamToString(worker.stderr); + result.stdout = removeFinalNewLine(await streamToString(worker.stdout)); + result.stderr = removeFinalNewLine(await streamToString(worker.stderr)); resolve(result); });