CLI: Skip print code or write file when performance flags found (#12682)
This commit is contained in:
1 parent
2ef33f143d
commit
85e6e4f73f
4 files changed
+97
-2
No files matched your search
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
|
||||
const runPrettier = require("../run-prettier.js");
|
||||
|
||||
describe("should not write file or print code when `--debug-benchmark` or `--debug-repeat` found", () => {
|
||||
// Can't test `--debug-benchmark`, since it requires `benchmark` package
|
||||
runPrettier(
|
||||
"cli/performance-flags",
|
||||
["--debug-repeat", "2", "--parser", "babel"],
|
||||
{
|
||||
input: "foo( bar )",
|
||||
}
|
||||
).test({
|
||||
stderr: "",
|
||||
status: 0,
|
||||
stdout: "'--debug-repeat' option found, skipped print code to screen.\n",
|
||||
write: [],
|
||||
});
|
||||
|
||||
runPrettier("cli/performance-flags", [
|
||||
"fixture.js",
|
||||
"--debug-repeat",
|
||||
"2",
|
||||
"--parser",
|
||||
"babel",
|
||||
]).test({
|
||||
stderr: "",
|
||||
status: 0,
|
||||
stdout:
|
||||
"'--debug-repeat' option found, skipped print code or write files.\n",
|
||||
write: [],
|
||||
});
|
||||
|
||||
runPrettier("cli/performance-flags", [
|
||||
"fixture.js",
|
||||
"--debug-repeat",
|
||||
"2",
|
||||
"--parser",
|
||||
"babel",
|
||||
"--write",
|
||||
]).test({
|
||||
stderr: "",
|
||||
status: 0,
|
||||
stdout:
|
||||
"'--debug-repeat' option found, skipped print code or write files.\n",
|
||||
write: [],
|
||||
});
|
||||
|
||||
runPrettier("cli/performance-flags", [
|
||||
"fixture.js",
|
||||
"--debug-repeat",
|
||||
"2",
|
||||
"--parser",
|
||||
"babel",
|
||||
"--check",
|
||||
]).test({
|
||||
stderr: "",
|
||||
status: 0,
|
||||
stdout:
|
||||
"'--debug-repeat' option found, skipped print code or write files.\n",
|
||||
write: [],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
foo( bar )
|
||||
Reference in new issue
Block a user