/
list-different.js
48 lines (42 loc) · 1.02 KB
/
list-different.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"use strict";
const runPrettier = require("../runPrettier");
describe("checks stdin with --list-different", () => {
runPrettier("cli/with-shebang", ["--list-different", "--parser", "babel"], {
input: "0",
}).test({
stdout: "(stdin)\n",
stderr: "",
status: "non-zero",
});
});
describe("checks stdin with -l (alias for --list-different)", () => {
runPrettier("cli/with-shebang", ["-l", "--parser", "babel"], {
input: "0",
}).test({
stdout: "(stdin)\n",
stderr: "",
status: "non-zero",
});
});
describe("--list-different works in CI just as in a non-TTY mode", () => {
const result0 = runPrettier(
"cli/write",
["--list-different", "formatted.js", "unformatted.js"],
{
stdoutIsTTY: true,
ci: true,
}
).test({
status: 1,
});
const result1 = runPrettier(
"cli/write",
["--list-different", "formatted.js", "unformatted.js"],
{
stdoutIsTTY: false,
}
).test({
status: 1,
});
expect(result0.stdout).toEqual(result1.stdout);
});