2017-06-02 18:30:39 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
const runPrettier = require("../runPrettier");
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("doesn't crash when --debug-check is passed", () => {
|
|
|
|
|
runPrettier("cli/with-shebang", ["issue1890.js", "--debug-check"]).test({
|
|
|
|
|
stdout: "issue1890.js\n",
|
|
|
|
|
stderr: "",
|
2020-03-21 22:07:52 +02:00
|
|
|
status: 0,
|
2017-10-02 11:08:34 -05:00
|
|
|
});
|
2017-06-06 19:10:24 -04:00
|
|
|
});
|
|
|
|
|
|
2017-10-02 11:08:34 -05:00
|
|
|
describe("checks stdin with --debug-check", () => {
|
2018-12-27 08:05:19 -05:00
|
|
|
runPrettier("cli/with-shebang", ["--debug-check", "--parser", "babel"], {
|
2020-03-21 22:07:52 +02:00
|
|
|
input: "0",
|
2017-10-02 11:08:34 -05:00
|
|
|
}).test({
|
|
|
|
|
stdout: "(stdin)\n",
|
|
|
|
|
stderr: "",
|
2020-03-21 22:07:52 +02:00
|
|
|
status: 0,
|
2017-06-06 19:10:24 -04:00
|
|
|
});
|
2017-06-02 18:30:39 -04:00
|
|
|
});
|
2017-10-07 04:36:43 -05:00
|
|
|
|
|
|
|
|
describe("show diff for 2+ error files with --debug-check", () => {
|
2018-04-25 22:10:22 +08:00
|
|
|
runPrettier("cli/debug-check", [
|
2018-11-14 07:55:50 -05:00
|
|
|
"--end-of-line",
|
|
|
|
|
"lf",
|
2018-04-25 22:10:22 +08:00
|
|
|
"*.debug-check",
|
|
|
|
|
"--debug-check",
|
|
|
|
|
"--plugin",
|
2020-03-21 22:07:52 +02:00
|
|
|
"./plugin-for-testing-debug-check",
|
2018-04-25 22:10:22 +08:00
|
|
|
]).test({
|
2020-03-21 22:07:52 +02:00
|
|
|
status: "non-zero",
|
2017-10-07 04:36:43 -05:00
|
|
|
});
|
|
|
|
|
});
|
2018-05-31 00:42:26 +08:00
|
|
|
|
2018-12-19 14:03:30 +00:00
|
|
|
describe("should not exit non-zero for already prettified code with --debug-check + --check", () => {
|
|
|
|
|
runPrettier("cli/debug-check", [
|
|
|
|
|
"issue-4599.js",
|
|
|
|
|
"--debug-check",
|
2020-03-21 22:07:52 +02:00
|
|
|
"--check",
|
2018-12-19 14:03:30 +00:00
|
|
|
]).test({
|
2020-03-21 22:07:52 +02:00
|
|
|
status: 0,
|
2018-12-19 14:03:30 +00:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2018-05-31 00:42:26 +08:00
|
|
|
describe("should not exit non-zero for already prettified code with --debug-check + --list-different", () => {
|
|
|
|
|
runPrettier("cli/debug-check", [
|
|
|
|
|
"issue-4599.js",
|
|
|
|
|
"--debug-check",
|
2020-03-21 22:07:52 +02:00
|
|
|
"--list-different",
|
2018-05-31 00:42:26 +08:00
|
|
|
]).test({
|
2020-03-21 22:07:52 +02:00
|
|
|
status: 0,
|
2018-05-31 00:42:26 +08:00
|
|
|
});
|
|
|
|
|
});
|