Skip to content

Commit 69f2d93

Browse files
committed
Add tests
1 parent 08fde17 commit 69f2d93

12 files changed

+1151
-82
lines changed

test/__snapshots__/cli.spec.js.snap

+248-50
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,321 @@
11
// Bun Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`prettier-formatter-gitlab cli should create a code quality report file 1`] = `
4-
"[
4+
[
55
{
6-
"type": "issue",
76
"check_name": "prettier",
87
"description": "Replace ·arg·· with arg",
9-
"severity": "minor",
108
"fingerprint": "ea70e2ae0144c16efa5df45bf52a33de",
119
"location": {
12-
"path": "test/__stubs__/dirty-2.js",
1310
"lines": {
1411
"begin": 3,
15-
"end": 3
16-
}
17-
}
12+
"end": 3,
13+
},
14+
"path": "test/__stubs__/dirty-2.js",
15+
},
16+
"severity": "minor",
17+
"type": "issue",
1818
},
1919
{
20-
"type": "issue",
2120
"check_name": "prettier",
2221
"description": "Insert ;",
23-
"severity": "minor",
2422
"fingerprint": "d88816112daed6a61fd9d81e964a484b",
2523
"location": {
26-
"path": "test/__stubs__/dirty-2.js",
2724
"lines": {
2825
"begin": 5,
29-
"end": 5
30-
}
31-
}
26+
"end": 5,
27+
},
28+
"path": "test/__stubs__/dirty-2.js",
29+
},
30+
"severity": "minor",
31+
"type": "issue",
3232
},
3333
{
34-
"type": "issue",
3534
"check_name": "prettier",
3635
"description": "Replace ⏎⏎⏎⏎⏎⏎function·foo(·arg··)·{⏎⏎ with function·foo(arg)·{",
37-
"severity": "minor",
3836
"fingerprint": "c38522eb22f56c446d6b78774d940d24",
3937
"location": {
40-
"path": "test/__stubs__/dirty.js",
4138
"lines": {
4239
"begin": 3,
43-
"end": 11
44-
}
45-
}
40+
"end": 11,
41+
},
42+
"path": "test/__stubs__/dirty.js",
43+
},
44+
"severity": "minor",
45+
"type": "issue",
4646
},
4747
{
48-
"type": "issue",
4948
"check_name": "prettier",
5049
"description": "Delete ⏎⏎⏎",
51-
"severity": "minor",
5250
"fingerprint": "f312c866f5c2332c733d2de24b9efa0f",
5351
"location": {
54-
"path": "test/__stubs__/dirty.js",
5552
"lines": {
5653
"begin": 12,
57-
"end": 15
58-
}
59-
}
60-
}
61-
]"
54+
"end": 15,
55+
},
56+
"path": "test/__stubs__/dirty.js",
57+
},
58+
"severity": "minor",
59+
"type": "issue",
60+
},
61+
{
62+
"check_name": "prettier",
63+
"description":
64+
"SyntaxError: Unexpected token, expected "(" (3:13)
65+
1 | /* eslint-disable */
66+
2 |
67+
> 3 | function foo#####( arg ) {
68+
| ^
69+
4 | return arg;
70+
5 | }
71+
6 |"
72+
,
73+
"fingerprint": "2c7e0de9e9eff8b589318b043ed783db",
74+
"location": {
75+
"path": "test/__stubs__/syntax-error.js",
76+
},
77+
"severity": "major",
78+
"type": "issue",
79+
},
80+
]
6281
`;
6382
6483
exports[`prettier-formatter-gitlab cli should create a code quality report file 2`] = `
65-
"[
84+
[
6685
{
67-
"type": "issue",
6886
"check_name": "prettier",
6987
"description": "Replace ·arg·· with arg",
70-
"severity": "minor",
7188
"fingerprint": "ea70e2ae0144c16efa5df45bf52a33de",
7289
"location": {
90+
"lines": {
91+
"begin": 3,
92+
"end": 3,
93+
},
7394
"path": "test/__stubs__/dirty-2.js",
95+
},
96+
"severity": "minor",
97+
"type": "issue",
98+
},
99+
{
100+
"check_name": "prettier",
101+
"description": "Insert ;",
102+
"fingerprint": "d88816112daed6a61fd9d81e964a484b",
103+
"location": {
104+
"lines": {
105+
"begin": 5,
106+
"end": 5,
107+
},
108+
"path": "test/__stubs__/dirty-2.js",
109+
},
110+
"severity": "minor",
111+
"type": "issue",
112+
},
113+
{
114+
"check_name": "prettier",
115+
"description": "Replace ⏎⏎⏎⏎⏎⏎function·foo(·arg··)·{⏎⏎ with function·foo(arg)·{",
116+
"fingerprint": "c38522eb22f56c446d6b78774d940d24",
117+
"location": {
74118
"lines": {
75119
"begin": 3,
76-
"end": 3
77-
}
78-
}
120+
"end": 11,
121+
},
122+
"path": "test/__stubs__/dirty.js",
123+
},
124+
"severity": "minor",
125+
"type": "issue",
126+
},
127+
{
128+
"check_name": "prettier",
129+
"description": "Delete ⏎⏎⏎",
130+
"fingerprint": "f312c866f5c2332c733d2de24b9efa0f",
131+
"location": {
132+
"lines": {
133+
"begin": 12,
134+
"end": 15,
135+
},
136+
"path": "test/__stubs__/dirty.js",
137+
},
138+
"severity": "minor",
139+
"type": "issue",
79140
},
80141
{
142+
"check_name": "prettier",
143+
"description":
144+
"SyntaxError: Unexpected token, expected "(" (3:13)
145+
1 | /* eslint-disable */
146+
2 |
147+
> 3 | function foo#####( arg ) {
148+
| ^
149+
4 | return arg;
150+
5 | }
151+
6 |"
152+
,
153+
"fingerprint": "2c7e0de9e9eff8b589318b043ed783db",
154+
"location": {
155+
"path": "test/__stubs__/syntax-error.js",
156+
},
157+
"severity": "major",
81158
"type": "issue",
159+
},
160+
]
161+
`;
162+
163+
exports[`prettier-formatter-gitlab cli should create a code quality report file with prettier -l 1`] = `
164+
[
165+
{
82166
"check_name": "prettier",
83-
"description": "Insert ;",
167+
"description": "Replace ·arg·· with arg",
168+
"fingerprint": "ea70e2ae0144c16efa5df45bf52a33de",
169+
"location": {
170+
"lines": {
171+
"begin": 3,
172+
"end": 3,
173+
},
174+
"path": "test/__stubs__/dirty-2.js",
175+
},
84176
"severity": "minor",
177+
"type": "issue",
178+
},
179+
{
180+
"check_name": "prettier",
181+
"description": "Insert ;",
85182
"fingerprint": "d88816112daed6a61fd9d81e964a484b",
86183
"location": {
87-
"path": "test/__stubs__/dirty-2.js",
88184
"lines": {
89185
"begin": 5,
90-
"end": 5
91-
}
92-
}
186+
"end": 5,
187+
},
188+
"path": "test/__stubs__/dirty-2.js",
189+
},
190+
"severity": "minor",
191+
"type": "issue",
93192
},
94193
{
95-
"type": "issue",
96194
"check_name": "prettier",
97195
"description": "Replace ⏎⏎⏎⏎⏎⏎function·foo(·arg··)·{⏎⏎ with function·foo(arg)·{",
98-
"severity": "minor",
99196
"fingerprint": "c38522eb22f56c446d6b78774d940d24",
100197
"location": {
198+
"lines": {
199+
"begin": 3,
200+
"end": 11,
201+
},
101202
"path": "test/__stubs__/dirty.js",
203+
},
204+
"severity": "minor",
205+
"type": "issue",
206+
},
207+
{
208+
"check_name": "prettier",
209+
"description": "Delete ⏎⏎⏎",
210+
"fingerprint": "f312c866f5c2332c733d2de24b9efa0f",
211+
"location": {
212+
"lines": {
213+
"begin": 12,
214+
"end": 15,
215+
},
216+
"path": "test/__stubs__/dirty.js",
217+
},
218+
"severity": "minor",
219+
"type": "issue",
220+
},
221+
{
222+
"check_name": "prettier",
223+
"description":
224+
"SyntaxError: Unexpected token, expected "(" (3:13)
225+
1 | /* eslint-disable */
226+
2 |
227+
> 3 | function foo#####( arg ) {
228+
| ^
229+
4 | return arg;
230+
5 | }
231+
6 |"
232+
,
233+
"fingerprint": "2c7e0de9e9eff8b589318b043ed783db",
234+
"location": {
235+
"path": "test/__stubs__/syntax-error.js",
236+
},
237+
"severity": "major",
238+
"type": "issue",
239+
},
240+
]
241+
`;
242+
243+
exports[`prettier-formatter-gitlab cli should create a code quality report file with prettier -c 1`] = `
244+
[
245+
{
246+
"check_name": "prettier",
247+
"description": "Replace ·arg·· with arg",
248+
"fingerprint": "ea70e2ae0144c16efa5df45bf52a33de",
249+
"location": {
102250
"lines": {
103251
"begin": 3,
104-
"end": 11
105-
}
106-
}
252+
"end": 3,
253+
},
254+
"path": "test/__stubs__/dirty-2.js",
255+
},
256+
"severity": "minor",
257+
"type": "issue",
107258
},
108259
{
260+
"check_name": "prettier",
261+
"description": "Insert ;",
262+
"fingerprint": "d88816112daed6a61fd9d81e964a484b",
263+
"location": {
264+
"lines": {
265+
"begin": 5,
266+
"end": 5,
267+
},
268+
"path": "test/__stubs__/dirty-2.js",
269+
},
270+
"severity": "minor",
109271
"type": "issue",
272+
},
273+
{
110274
"check_name": "prettier",
111-
"description": "Delete ⏎⏎⏎",
275+
"description": "Replace ⏎⏎⏎⏎⏎⏎function·foo(·arg··)·{⏎⏎ with function·foo(arg)·{",
276+
"fingerprint": "c38522eb22f56c446d6b78774d940d24",
277+
"location": {
278+
"lines": {
279+
"begin": 3,
280+
"end": 11,
281+
},
282+
"path": "test/__stubs__/dirty.js",
283+
},
112284
"severity": "minor",
285+
"type": "issue",
286+
},
287+
{
288+
"check_name": "prettier",
289+
"description": "Delete ⏎⏎⏎",
113290
"fingerprint": "f312c866f5c2332c733d2de24b9efa0f",
114291
"location": {
115-
"path": "test/__stubs__/dirty.js",
116292
"lines": {
117293
"begin": 12,
118-
"end": 15
119-
}
120-
}
121-
}
122-
]"
294+
"end": 15,
295+
},
296+
"path": "test/__stubs__/dirty.js",
297+
},
298+
"severity": "minor",
299+
"type": "issue",
300+
},
301+
{
302+
"check_name": "prettier",
303+
"description":
304+
"SyntaxError: Unexpected token, expected "(" (3:13)
305+
1 | /* eslint-disable */
306+
2 |
307+
> 3 | function foo#####( arg ) {
308+
| ^
309+
4 | return arg;
310+
5 | }
311+
6 |"
312+
,
313+
"fingerprint": "2c7e0de9e9eff8b589318b043ed783db",
314+
"location": {
315+
"path": "test/__stubs__/syntax-error.js",
316+
},
317+
"severity": "major",
318+
"type": "issue",
319+
},
320+
]
123321
`;

0 commit comments

Comments
 (0)