Files
test-repo/tests/integration/__tests__/check.js
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-12-19 14:03:30 +00:00
describe("checks stdin with --check", () => {
runCli("cli/with-shebang", ["--check", "--parser", "babel"], {
2018-12-19 14:03:30 +00:00
input: "0",
}).test({
stdout: "(stdin)",
2018-12-19 14:03:30 +00:00
stderr: "",
status: "non-zero",
});
});
describe("checks stdin with -c (alias for --check)", () => {
runCli("cli/with-shebang", ["-c", "--parser", "babel"], {
2018-12-19 14:03:30 +00:00
input: "0",
}).test({
stdout: "(stdin)",
2018-12-19 14:03:30 +00:00
stderr: "",
status: "non-zero",
});
});
describe("--checks works in CI just as in a non-TTY mode", () => {
const result0 = runCli(
"cli/write",
["--check", "formatted.js", "unformatted.js"],
{
stdoutIsTTY: true,
ci: true,
},
).test({
status: 1,
});
const result1 = runCli(
"cli/write",
["--check", "formatted.js", "unformatted.js"],
{
stdoutIsTTY: false,
},
).test({
status: 1,
});
2021-05-09 20:43:10 +08:00
test("Should have same stdout", async () => {
expect(await result0.stdout).toBe(await result1.stdout);
2021-05-09 20:43:10 +08:00
});
});
describe("--checks should print the number of files that need formatting", () => {
runCli("cli/write", ["--check", "unformatted.js", "unformatted2.js"], {
input: "0",
}).test({
status: 1,
});
});