Fix exit code and result message when parser can not infer (#17505)
This commit is contained in:
1 parent
6fffbdf7c4
commit
d8ab2b1f66
7 files changed
+77
-36
No files matched your search
@@ -3,9 +3,9 @@
|
||||
exports[`--check with unknown path and no parser multiple files 1`] = `
|
||||
{
|
||||
"stderr": "[error] No parser could be inferred for file "<cli>/infer-parser/FOO".
|
||||
[warn] foo.js
|
||||
[warn] Code style issues found in the above file. Run Prettier with --write to fix.",
|
||||
"stdout": "Checking formatting...",
|
||||
[warn] foo.js",
|
||||
"stdout": "Checking formatting...
|
||||
Error occurred when checking code style in the above file.",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -13,7 +13,7 @@ exports[`--check with unknown path and no parser specific file 1`] = `
|
||||
{
|
||||
"stderr": "[error] No parser could be inferred for file "<cli>/infer-parser/FOO".",
|
||||
"stdout": "Checking formatting...
|
||||
All matched files use Prettier code style!",
|
||||
Error occurred when checking code style in the above file.",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -32,9 +32,9 @@ exports[`--list-different with unknown path and no parser specific file 1`] = `
|
||||
exports[`--write and --check with unknown path and no parser multiple files 1`] = `
|
||||
{
|
||||
"stderr": "[error] No parser could be inferred for file "<cli>/infer-parser/FOO".
|
||||
[warn] foo.js
|
||||
[warn] Code style issues fixed in the above file.",
|
||||
"stdout": "Checking formatting...",
|
||||
[warn] foo.js",
|
||||
"stdout": "Checking formatting...
|
||||
Error occurred when checking code style in the above file.",
|
||||
"write": [
|
||||
{
|
||||
"content": "foo();
|
||||
@@ -49,7 +49,7 @@ exports[`--write and --check with unknown path and no parser specific file 1`]
|
||||
{
|
||||
"stderr": "[error] No parser could be inferred for file "<cli>/infer-parser/FOO".",
|
||||
"stdout": "Checking formatting...
|
||||
All matched files use Prettier code style!",
|
||||
Error occurred when checking code style in the above file.",
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ invalid-2.js
|
||||
invalid-2.unknown
|
||||
valid-1.js
|
||||
[[Clear text(process.stdout): valid-1.js]]
|
||||
All matched files use Prettier code style!",
|
||||
Error occurred when checking code style in 3 files.",
|
||||
"write": [],
|
||||
}
|
||||
`;
|
||||
@@ -77,7 +77,6 @@ exports[`Line breaking after filepath with errors 4`] = `
|
||||
"stdout": "invalid-1.js
|
||||
invalid-2.js
|
||||
invalid-2.unknown
|
||||
[[Clear text(process.stdout): invalid-2.unknown]]
|
||||
valid-1.js
|
||||
[[Clear text(process.stdout): valid-1.js]]
|
||||
valid-1.js 0ms (unchanged)",
|
||||
|
||||
@@ -88,14 +88,14 @@ describe("unknown path and no parser", () => {
|
||||
describe("--check with unknown path and no parser", () => {
|
||||
describe("specific file", () => {
|
||||
runCli("cli/infer-parser/", ["--check", "FOO"]).test({
|
||||
status: 0,
|
||||
status: 2,
|
||||
write: [],
|
||||
});
|
||||
});
|
||||
|
||||
describe("multiple files", () => {
|
||||
runCli("cli/infer-parser/", ["--check", "*"]).test({
|
||||
status: 1,
|
||||
status: 2,
|
||||
write: [],
|
||||
});
|
||||
});
|
||||
@@ -104,7 +104,7 @@ describe("--check with unknown path and no parser", () => {
|
||||
describe("--list-different with unknown path and no parser", () => {
|
||||
describe("specific file", () => {
|
||||
runCli("cli/infer-parser/", ["--list-different", "FOO"]).test({
|
||||
status: 0,
|
||||
status: 2,
|
||||
stdout: "",
|
||||
write: [],
|
||||
});
|
||||
@@ -112,7 +112,7 @@ describe("--list-different with unknown path and no parser", () => {
|
||||
|
||||
describe("multiple files", () => {
|
||||
runCli("cli/infer-parser/", ["--list-different", "*"]).test({
|
||||
status: 1,
|
||||
status: 2,
|
||||
stdout: "foo.js",
|
||||
write: [],
|
||||
});
|
||||
@@ -138,14 +138,14 @@ describe("--write with unknown path and no parser", () => {
|
||||
describe("--write and --check with unknown path and no parser", () => {
|
||||
describe("specific file", () => {
|
||||
runCli("cli/infer-parser/", ["--check", "--write", "FOO"]).test({
|
||||
status: 0,
|
||||
status: 2,
|
||||
write: [],
|
||||
});
|
||||
});
|
||||
|
||||
describe("multiple files", () => {
|
||||
runCli("cli/infer-parser/", ["--check", "--write", "*"]).test({
|
||||
status: 0,
|
||||
status: 2,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -153,7 +153,7 @@ describe("--write and --check with unknown path and no parser", () => {
|
||||
describe("--write and --list-different with unknown path and no parser", () => {
|
||||
describe("specific file", () => {
|
||||
runCli("cli/infer-parser/", ["--list-different", "--write", "FOO"]).test({
|
||||
status: 0,
|
||||
status: 2,
|
||||
stdout: "",
|
||||
write: [],
|
||||
});
|
||||
@@ -161,7 +161,7 @@ describe("--write and --list-different with unknown path and no parser", () => {
|
||||
|
||||
describe("multiple files", () => {
|
||||
runCli("cli/infer-parser/", ["--list-different", "--write", "*"]).test({
|
||||
status: 0,
|
||||
status: 2,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ testPatterns("1b - special characters in dir name", ["dir1", "!dir"], {
|
||||
});
|
||||
testPatterns("1c", ["dir1", "empty"], { status: 1 });
|
||||
|
||||
testPatterns("2", ["dir1", "dir2/**/*"], { status: 1 });
|
||||
testPatterns("2", ["dir1", "dir2/**/*"], { status: 2 });
|
||||
|
||||
testPatterns("3", ["nonexistent-dir", "dir2/**/*"], { status: 2 });
|
||||
|
||||
@@ -122,7 +122,7 @@ describe("plugins `*`", () => {
|
||||
uppercaseRocksPlugin,
|
||||
]).test({
|
||||
write: [],
|
||||
status: 1,
|
||||
status: 2,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user