Skip to content

Commit 85fa57d

Browse files
infer-parser test suite: update formatting to match the other test suites
1 parent 373bc15 commit 85fa57d

1 file changed

Lines changed: 56 additions & 17 deletions

File tree

test/__tests__/infer-parser.js

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { color } from "specialist";
33

44
describe("stdin no path and no parser", () => {
55
describe("logs error and exits with 2", () => {
6-
runCli("infer-parser/", [], { input: "foo" }).test({
6+
runCli("infer-parser/", [], {
7+
input: "foo"
8+
}).test({
79
status: 1,
810
stdout: "",
911
write: [],
@@ -13,7 +15,9 @@ describe("stdin no path and no parser", () => {
1315
// TODO (43081j): in prettier, this tests that it exits with 0 for
1416
// whatever reason. should we do the same?
1517
describe("--check logs error but exits with 1", () => {
16-
runCli("infer-parser/", ["--check"], {
18+
runCli("infer-parser/", [
19+
"--check"
20+
], {
1721
input: "foo",
1822
}).test({
1923
status: 1,
@@ -37,7 +41,10 @@ describe("stdin no path and no parser", () => {
3741

3842
describe("stdin with unknown path and no parser", () => {
3943
describe("logs error and exits with 2", () => {
40-
runCli("infer-parser/", ["--stdin-filepath", "foo"], {
44+
runCli("infer-parser/", [
45+
"--stdin-filepath",
46+
"foo"
47+
], {
4148
input: "foo",
4249
}).test({
4350
status: 1,
@@ -49,7 +56,11 @@ describe("stdin with unknown path and no parser", () => {
4956
// TODO (43081j): in prettier, this tests that it exits with 0 for
5057
// whatever reason. should we do the same?
5158
describe("--check logs error but exits with 1", () => {
52-
runCli("infer-parser/", ["--check", "--stdin-filepath", "foo"], {
59+
runCli("infer-parser/", [
60+
"--check",
61+
"--stdin-filepath",
62+
"foo"
63+
], {
5364
input: "foo",
5465
}).test({
5566
status: 1,
@@ -61,11 +72,13 @@ describe("stdin with unknown path and no parser", () => {
6172
// TODO (43081j): in prettier, this tests that it exits with 0 for
6273
// whatever reason. should we do the same?
6374
describe("--list-different logs error but exits with 1", () => {
64-
runCli(
65-
"infer-parser/",
66-
["--list-different", "--stdin-filepath", "foo"],
67-
{ input: "foo" },
68-
).test({
75+
runCli("infer-parser/", [
76+
"--list-different",
77+
"--stdin-filepath",
78+
"foo"
79+
], {
80+
input: "foo"
81+
}).test({
6982
status: 1,
7083
stdout: "",
7184
write: [],
@@ -75,15 +88,23 @@ describe("stdin with unknown path and no parser", () => {
7588

7689
describe("unknown path and no parser", () => {
7790
describe("specific file is ignored", () => {
78-
runCli("infer-parser/", ["--end-of-line", "lf", "FOO"]).test({
91+
runCli("infer-parser/", [
92+
"--end-of-line",
93+
"lf",
94+
"FOO"
95+
]).test({
7996
status: 0,
8097
stdout: "",
8198
write: [],
8299
});
83100
});
84101

85102
describe("multiple files are ignored", () => {
86-
runCli("infer-parser/", ["--end-of-line", "lf", "*"]).test({
103+
runCli("infer-parser/", [
104+
"--end-of-line",
105+
"lf",
106+
"*"
107+
]).test({
87108
status: 1,
88109
write: [],
89110
});
@@ -92,14 +113,20 @@ describe("unknown path and no parser", () => {
92113

93114
describe("--check with unknown path and no parser", () => {
94115
describe("specific file is ignored", () => {
95-
runCli("infer-parser/", ["--check", "FOO"]).test({
116+
runCli("infer-parser/", [
117+
"--check",
118+
"FOO"
119+
]).test({
96120
status: 0,
97121
write: [],
98122
});
99123
});
100124

101125
describe("multiple files", () => {
102-
runCli("infer-parser/", ["--check", "*"]).test({
126+
runCli("infer-parser/", [
127+
"--check",
128+
"*"
129+
]).test({
103130
status: 1,
104131
write: [],
105132
stderr: `[${color.red('error')}] FOO: UndefinedParserError: No parser could be inferred for file "$CWD/FOO".
@@ -111,15 +138,21 @@ describe("--check with unknown path and no parser", () => {
111138

112139
describe("--list-different with unknown path and no parser", () => {
113140
describe("specific file should be ignored", () => {
114-
runCli("infer-parser/", ["--list-different", "FOO"]).test({
141+
runCli("infer-parser/", [
142+
"--list-different",
143+
"FOO"
144+
]).test({
115145
status: 0,
116146
stdout: "",
117147
write: [],
118148
});
119149
});
120150

121151
describe("multiple files", () => {
122-
runCli("infer-parser/", ["--list-different", "*"]).test({
152+
runCli("infer-parser/", [
153+
"--list-different",
154+
"*"
155+
]).test({
123156
status: 1,
124157
stdout: "foo.js",
125158
write: [],
@@ -129,15 +162,21 @@ describe("--list-different with unknown path and no parser", () => {
129162

130163
describe("--write with unknown path and no parser", () => {
131164
describe("specific file should be ignored", () => {
132-
runCli("infer-parser/", ["--write", "FOO"]).test({
165+
runCli("infer-parser/", [
166+
"--write",
167+
"FOO"
168+
]).test({
133169
status: 0,
134170
stdout: "",
135171
write: [],
136172
});
137173
});
138174

139175
describe("multiple files", () => {
140-
runCli("infer-parser/", ["--write", "*"]).test({
176+
runCli("infer-parser/", [
177+
"--write",
178+
"*"
179+
]).test({
141180
status: 1,
142181
stderr: `[${color.red('error')}] FOO: UndefinedParserError: No parser could be inferred for file "$CWD/FOO".`,
143182
});

0 commit comments

Comments
 (0)