Files
test-repo/tests/integration/__tests__/piped-output.js
T

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

105 lines
2.6 KiB
JavaScript
Raw Normal View History

2018-12-19 14:03:30 +00:00
describe("output with --check + unformatted differs when piped", () => {
const cli0 = runCli(
2018-12-19 14:03:30 +00:00
"cli/write",
["--write", "--check", "--no-color", "unformatted.js"],
{ stdoutIsTTY: true },
).test({
status: 0,
});
const cli1 = runCli(
2018-12-19 14:03:30 +00:00
"cli/write",
["--write", "--check", "--no-color", "unformatted.js"],
{ stdoutIsTTY: false },
).test({
status: 0,
});
2021-05-09 20:43:10 +08:00
test("Result", async () => {
const result0 = await cli0;
const result1 = await cli1;
expect(result0.stdout.length).toBeGreaterThan(result1.stdout.length);
expect(result0.write).toStrictEqual(result1.write);
2021-05-09 20:43:10 +08:00
});
2018-12-19 14:03:30 +00:00
});
describe("no file diffs with --check + formatted file", () => {
const cli0 = runCli(
2018-12-19 14:03:30 +00:00
"cli/write",
["--write", "--check", "--no-color", "formatted.js"],
{ stdoutIsTTY: true },
).test({
status: 0,
});
const cli1 = runCli(
2018-12-19 14:03:30 +00:00
"cli/write",
["--write", "--check", "--no-color", "formatted.js"],
{ stdoutIsTTY: false },
).test({
status: 0,
});
2021-05-09 20:43:10 +08:00
test("Result", async () => {
const result0 = await cli0;
const result1 = await cli1;
expect(result0.stdout).not.toBe(result1.stdout);
expect(result0.stdout.length).toBeGreaterThan(result1.stdout.length);
expect(result0.write).toStrictEqual(result1.write);
2021-05-09 20:43:10 +08:00
});
2018-12-19 14:03:30 +00:00
});
2017-10-06 14:12:32 +11:00
describe("output with --list-different + unformatted differs when piped", () => {
const cli0 = runCli(
"cli/write",
["--write", "--list-different", "--no-color", "unformatted.js"],
{ stdoutIsTTY: true },
2017-10-06 14:12:32 +11:00
).test({
status: 0,
2017-10-06 14:12:32 +11:00
});
const cli1 = runCli(
"cli/write",
["--write", "--list-different", "--no-color", "unformatted.js"],
{ stdoutIsTTY: false },
2017-10-06 14:12:32 +11:00
).test({
status: 0,
2017-10-06 14:12:32 +11:00
});
2021-05-09 20:43:10 +08:00
test("Result", async () => {
const result0 = await cli0;
const result1 = await cli1;
expect(result0.stdout.length).toBeGreaterThan(result1.stdout.length);
expect(result0.write).toStrictEqual(result1.write);
2021-05-09 20:43:10 +08:00
});
});
2017-10-06 14:12:32 +11:00
describe("no file diffs with --list-different + formatted file", () => {
const cli0 = runCli(
"cli/write",
["--write", "--list-different", "--no-color", "formatted.js"],
{ stdoutIsTTY: true },
2017-10-06 14:12:32 +11:00
).test({
status: 0,
});
const cli1 = runCli(
"cli/write",
["--write", "--list-different", "--no-color", "formatted.js"],
{ stdoutIsTTY: false },
2017-10-06 14:12:32 +11:00
).test({
status: 0,
});
2021-05-09 20:43:10 +08:00
test("Result", async () => {
const result0 = await cli0;
const result1 = await cli1;
expect(result0.stdout).not.toBe(result1.stdout);
expect(result0.stdout.length).toBeGreaterThan(result1.stdout.length);
expect(result0.write).toStrictEqual(result1.write);
2021-05-09 20:43:10 +08:00
});
});