Files
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>fisker
a6bbdad8ca chore(deps): update dependency jest to v30.1.1 (#17819)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: fisker <[email protected]>
2025-08-30 15:36:22 +08:00

373 lines
17 KiB
Plaintext

// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`show detailed usage with --help l (alias) 1`] = `
{
"stderr": "",
"stdout": "-l, --list-different
Print the names of files that are different from Prettier's formatting (see also --check).",
"write": [],
}
`;
exports[`show detailed usage with plugin options (manual resolution) 1`] = `
{
"stderr": "",
"stdout": "--tab-width <int>
Number of spaces per indentation level.
Default: 2
Plugin defaults:
* ../plugins/automatic/node_modules/prettier-plugin-bar/index.js: 4",
"write": [],
}
`;
exports[`show usage with --help 1`] = `
{
"stderr": "",
"stdout": "Usage: prettier [options] [file/dir/glob ...]
By default, output is written to stdout.
Stdin is read if it is piped to Prettier and no files are given.
Output options:
-c, --check Check if the given files are formatted, print a human-friendly summary
message and paths to unformatted files (see also --list-different).
-l, --list-different Print the names of files that are different from Prettier's formatting (see also --check).
-w, --write Edit files in-place. (Beware!)
Format options:
--arrow-parens <always|avoid>
Include parentheses around a sole arrow function parameter.
Defaults to always.
--bracket-same-line Put > of opening tags on the last line instead of on a new line.
Defaults to false.
--no-bracket-spacing Do not print spaces between brackets.
--embedded-language-formatting <auto|off>
Control how Prettier formats quoted code embedded in the file.
Defaults to auto.
--end-of-line <lf|crlf|cr|auto>
Which end of line characters to apply.
Defaults to lf.
--experimental-operator-position <start|end>
Where to print operators when binary expressions wrap lines.
Defaults to end.
--no-experimental-ternaries
Default behavior of ternaries; keep question marks on the same line as the consequent.
--html-whitespace-sensitivity <css|strict|ignore>
How to handle whitespaces in HTML.
Defaults to css.
--jsx-single-quote Use single quotes in JSX.
Defaults to false.
--object-wrap <preserve|collapse>
How to wrap object literals.
Defaults to preserve.
--parser <flow|babel|babel-flow|babel-ts|typescript|acorn|espree|meriyah|css|less|scss|json|json5|jsonc|json-stringify|graphql|markdown|mdx|vue|yaml|glimmer|html|angular|lwc|mjml>
Which parser to use.
--print-width <int> The line length where Prettier will try wrap.
Defaults to 80.
--prose-wrap <always|never|preserve>
How to wrap prose.
Defaults to preserve.
--quote-props <as-needed|consistent|preserve>
Change when properties in objects are quoted.
Defaults to as-needed.
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
--single-attribute-per-line
Enforce single attribute per line in HTML, Vue and JSX.
Defaults to false.
--single-quote Use single quotes instead of double quotes.
Defaults to false.
--tab-width <int> Number of spaces per indentation level.
Defaults to 2.
--trailing-comma <all|es5|none>
Print trailing commas wherever possible when multi-line.
Defaults to all.
--use-tabs Indent with tabs instead of spaces.
Defaults to false.
--vue-indent-script-and-style
Indent script and style tags in Vue files.
Defaults to false.
Config options:
--config <path> Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).
--no-config Do not look for a configuration file.
--config-precedence <cli-override|file-override|prefer-file>
Define in which order config files and CLI options should be evaluated.
Defaults to cli-override.
--no-editorconfig Don't take .editorconfig into account when parsing configuration.
--find-config-path <path>
Find and print the path to a configuration file for the given input file.
--ignore-path <path> Path to a file with patterns describing files to ignore.
Multiple values are accepted.
Defaults to [.gitignore, .prettierignore].
--plugin <path> Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.
Defaults to [].
--with-node-modules Process files inside 'node_modules' directory.
Editor options:
--cursor-offset <int> Print (to stderr) where a cursor at the given position would move to after formatting.
Defaults to -1.
--range-end <int> Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement.
Defaults to Infinity.
--range-start <int> Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement.
Defaults to 0.
Other options:
--cache Only format changed files. Cannot use with --stdin-filepath.
Defaults to false.
--cache-location <path> Path to the cache file.
--cache-strategy <metadata|content>
Strategy for the cache to use for detecting changed files.
--check-ignore-pragma Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.
Defaults to false.
--no-color Do not colorize error messages.
--no-error-on-unmatched-pattern
Prevent errors when pattern is unmatched.
--file-info <path> 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
-h, --help <flag> Show CLI usage, or details about the given flag.
Example: --help write
-u, --ignore-unknown Ignore unknown files.
--insert-pragma Insert @format pragma into file's first docblock comment.
Defaults to false.
--log-level <silent|error|warn|log|debug>
What level of logs to report.
Defaults to log.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.
Defaults to false.
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
--support-info Print support information as JSON.
-v, --version Print Prettier version.
",
"write": [],
}
`;
exports[`show version with --version 1`] = `
{
"stderr": "",
"write": [],
}
`;
exports[`show warning with --help not-found (typo) 1`] = `
{
"stderr": "[warn] Unknown flag "parserr", did you mean "parser"?",
"stdout": "--parser <flow|babel|babel-flow|babel-ts|typescript|acorn|espree|meriyah|css|less|scss|json|json5|jsonc|json-stringify|graphql|markdown|mdx|vue|yaml|glimmer|html|angular|lwc|mjml>
Which parser to use.
Valid options:
flow Flow
babel JavaScript
babel-flow Flow
babel-ts TypeScript
typescript TypeScript
acorn JavaScript
espree JavaScript
meriyah JavaScript
css CSS
less Less
scss SCSS
json JSON
json5 JSON5
jsonc JSON with Comments
json-stringify JSON.stringify
graphql GraphQL
markdown Markdown
mdx MDX
vue Vue
yaml YAML
glimmer Ember / Handlebars
html HTML
angular Angular
lwc Lightning Web Components
mjml MJML",
"write": [],
}
`;
exports[`throw error and show usage with something unexpected 1`] = `
{
"stderr": "",
"stdout": "Usage: prettier [options] [file/dir/glob ...]
By default, output is written to stdout.
Stdin is read if it is piped to Prettier and no files are given.
Output options:
-c, --check Check if the given files are formatted, print a human-friendly summary
message and paths to unformatted files (see also --list-different).
-l, --list-different Print the names of files that are different from Prettier's formatting (see also --check).
-w, --write Edit files in-place. (Beware!)
Format options:
--arrow-parens <always|avoid>
Include parentheses around a sole arrow function parameter.
Defaults to always.
--bracket-same-line Put > of opening tags on the last line instead of on a new line.
Defaults to false.
--no-bracket-spacing Do not print spaces between brackets.
--embedded-language-formatting <auto|off>
Control how Prettier formats quoted code embedded in the file.
Defaults to auto.
--end-of-line <lf|crlf|cr|auto>
Which end of line characters to apply.
Defaults to lf.
--experimental-operator-position <start|end>
Where to print operators when binary expressions wrap lines.
Defaults to end.
--no-experimental-ternaries
Default behavior of ternaries; keep question marks on the same line as the consequent.
--html-whitespace-sensitivity <css|strict|ignore>
How to handle whitespaces in HTML.
Defaults to css.
--jsx-single-quote Use single quotes in JSX.
Defaults to false.
--object-wrap <preserve|collapse>
How to wrap object literals.
Defaults to preserve.
--parser <flow|babel|babel-flow|babel-ts|typescript|acorn|espree|meriyah|css|less|scss|json|json5|jsonc|json-stringify|graphql|markdown|mdx|vue|yaml|glimmer|html|angular|lwc|mjml>
Which parser to use.
--print-width <int> The line length where Prettier will try wrap.
Defaults to 80.
--prose-wrap <always|never|preserve>
How to wrap prose.
Defaults to preserve.
--quote-props <as-needed|consistent|preserve>
Change when properties in objects are quoted.
Defaults to as-needed.
--no-semi Do not print semicolons, except at the beginning of lines which may need them.
--single-attribute-per-line
Enforce single attribute per line in HTML, Vue and JSX.
Defaults to false.
--single-quote Use single quotes instead of double quotes.
Defaults to false.
--tab-width <int> Number of spaces per indentation level.
Defaults to 2.
--trailing-comma <all|es5|none>
Print trailing commas wherever possible when multi-line.
Defaults to all.
--use-tabs Indent with tabs instead of spaces.
Defaults to false.
--vue-indent-script-and-style
Indent script and style tags in Vue files.
Defaults to false.
Config options:
--config <path> Path to a Prettier configuration file (.prettierrc, package.json, prettier.config.js).
--no-config Do not look for a configuration file.
--config-precedence <cli-override|file-override|prefer-file>
Define in which order config files and CLI options should be evaluated.
Defaults to cli-override.
--no-editorconfig Don't take .editorconfig into account when parsing configuration.
--find-config-path <path>
Find and print the path to a configuration file for the given input file.
--ignore-path <path> Path to a file with patterns describing files to ignore.
Multiple values are accepted.
Defaults to [.gitignore, .prettierignore].
--plugin <path> Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.
Defaults to [].
--with-node-modules Process files inside 'node_modules' directory.
Editor options:
--cursor-offset <int> Print (to stderr) where a cursor at the given position would move to after formatting.
Defaults to -1.
--range-end <int> Format code ending at a given character offset (exclusive).
The range will extend forwards to the end of the selected statement.
Defaults to Infinity.
--range-start <int> Format code starting at a given character offset.
The range will extend backwards to the start of the first line containing the selected statement.
Defaults to 0.
Other options:
--cache Only format changed files. Cannot use with --stdin-filepath.
Defaults to false.
--cache-location <path> Path to the cache file.
--cache-strategy <metadata|content>
Strategy for the cache to use for detecting changed files.
--check-ignore-pragma Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.
Defaults to false.
--no-color Do not colorize error messages.
--no-error-on-unmatched-pattern
Prevent errors when pattern is unmatched.
--file-info <path> 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
-h, --help <flag> Show CLI usage, or details about the given flag.
Example: --help write
-u, --ignore-unknown Ignore unknown files.
--insert-pragma Insert @format pragma into file's first docblock comment.
Defaults to false.
--log-level <silent|error|warn|log|debug>
What level of logs to report.
Defaults to log.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.
Defaults to false.
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
--support-info Print support information as JSON.
-v, --version Print Prettier version.
",
"write": [],
}
`;
exports[`throw error with --check + --list-different 1`] = `
{
"stderr": "[error] Cannot use --check and --list-different together.",
"stdout": "",
"write": [],
}
`;
exports[`throw error with --file-info + multiple files 1`] = `
{
"stderr": "[error] Cannot use --file-info with multiple files",
"stdout": "",
"write": [],
}
`;
exports[`throw error with --find-config-path + multiple files 1`] = `
{
"stderr": "[error] Cannot use --find-config-path with multiple files",
"stdout": "",
"write": [],
}
`;
exports[`throw error with --help not-found 1`] = `
{
"stderr": "[error] Invalid --help value. Expected a flag, but received "not-found".",
"stdout": "",
"write": [],
}
`;
exports[`throw error with --write + --debug-check 1`] = `
{
"stderr": "[error] Cannot use --write and --debug-check together.",
"stdout": "",
"write": [],
}
`;