2017-10-02 11:08:34 -05:00
|
|
|
describe("checks stdin with --list-different", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/with-shebang", ["--list-different", "--parser", "babel"], {
|
2017-07-04 14:41:46 -04:00
|
|
|
input: "0",
|
2017-10-02 11:08:34 -05:00
|
|
|
}).test({
|
2023-03-30 14:25:28 +08:00
|
|
|
stdout: "(stdin)",
|
2017-10-02 11:08:34 -05:00
|
|
|
stderr: "",
|
|
|
|
|
status: "non-zero",
|
2017-07-04 14:41:46 -04:00
|
|
|
});
|
|
|
|
|
});
|
2018-12-19 14:03:30 +00:00
|
|
|
|
|
|
|
|
describe("checks stdin with -l (alias for --list-different)", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
runCli("cli/with-shebang", ["-l", "--parser", "babel"], {
|
2018-12-19 14:03:30 +00:00
|
|
|
input: "0",
|
|
|
|
|
}).test({
|
2023-03-30 14:25:28 +08:00
|
|
|
stdout: "(stdin)",
|
2018-12-19 14:03:30 +00:00
|
|
|
stderr: "",
|
|
|
|
|
status: "non-zero",
|
|
|
|
|
});
|
|
|
|
|
});
|
2019-01-30 06:08:03 +00:00
|
|
|
|
|
|
|
|
describe("--list-different works in CI just as in a non-TTY mode", () => {
|
2023-04-11 08:44:23 +08:00
|
|
|
const result0 = runCli(
|
2019-01-30 06:08:03 +00:00
|
|
|
"cli/write",
|
|
|
|
|
["--list-different", "formatted.js", "unformatted.js"],
|
|
|
|
|
{
|
|
|
|
|
stdoutIsTTY: true,
|
2020-04-08 02:37:57 +03:00
|
|
|
ci: true,
|
2019-01-30 06:08:03 +00:00
|
|
|
},
|
|
|
|
|
).test({
|
|
|
|
|
status: 1,
|
|
|
|
|
});
|
|
|
|
|
|
2023-04-11 08:44:23 +08:00
|
|
|
const result1 = runCli(
|
2019-01-30 06:08:03 +00:00
|
|
|
"cli/write",
|
|
|
|
|
["--list-different", "formatted.js", "unformatted.js"],
|
|
|
|
|
{
|
|
|
|
|
stdoutIsTTY: false,
|
|
|
|
|
},
|
|
|
|
|
).test({
|
|
|
|
|
status: 1,
|
|
|
|
|
});
|
|
|
|
|
|
2021-05-09 20:43:10 +08:00
|
|
|
test("Should be the same", async () => {
|
2026-01-22 23:53:24 +08:00
|
|
|
expect(await result0.stdout).toBe(await result1.stdout);
|
2021-05-09 20:43:10 +08:00
|
|
|
});
|
2019-01-30 06:08:03 +00:00
|
|
|
});
|