Skip to content

Commit 2081992

Browse files
committed
test(napi/oxlint): add test case with many files
1 parent 6b12f27 commit 2081992

File tree

24 files changed

+321
-0
lines changed

24 files changed

+321
-0
lines changed

napi/oxlint2/test/__snapshots__/e2e.test.ts.snap

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,272 @@ Found 1 warning and 1 error.
5656
Finished in Xms on 1 file using X threads."
5757
`;
5858

59+
exports[`cli options for bundling > should load a custom plugin with multiple files 1`] = `
60+
"
61+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
62+
,-[files/01.js:1:1]
63+
1 | debugger;
64+
: ^^^^^^^^^
65+
\`----
66+
help: Remove the debugger statement
67+
68+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
69+
,-[files/01.js:1:1]
70+
1 | debugger;
71+
: ^
72+
\`----
73+
74+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
75+
,-[files/02.js:1:1]
76+
1 | debugger;
77+
: ^^^^^^^^^
78+
\`----
79+
help: Remove the debugger statement
80+
81+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
82+
,-[files/02.js:1:1]
83+
1 | debugger;
84+
: ^
85+
\`----
86+
87+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
88+
,-[files/03.js:1:1]
89+
1 | debugger;
90+
: ^^^^^^^^^
91+
\`----
92+
help: Remove the debugger statement
93+
94+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
95+
,-[files/03.js:1:1]
96+
1 | debugger;
97+
: ^
98+
\`----
99+
100+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
101+
,-[files/04.js:1:1]
102+
1 | debugger;
103+
: ^^^^^^^^^
104+
\`----
105+
help: Remove the debugger statement
106+
107+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
108+
,-[files/04.js:1:1]
109+
1 | debugger;
110+
: ^
111+
\`----
112+
113+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
114+
,-[files/05.js:1:1]
115+
1 | debugger;
116+
: ^^^^^^^^^
117+
\`----
118+
help: Remove the debugger statement
119+
120+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
121+
,-[files/05.js:1:1]
122+
1 | debugger;
123+
: ^
124+
\`----
125+
126+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
127+
,-[files/06.js:1:1]
128+
1 | debugger;
129+
: ^^^^^^^^^
130+
\`----
131+
help: Remove the debugger statement
132+
133+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
134+
,-[files/06.js:1:1]
135+
1 | debugger;
136+
: ^
137+
\`----
138+
139+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
140+
,-[files/07.js:1:1]
141+
1 | debugger;
142+
: ^^^^^^^^^
143+
\`----
144+
help: Remove the debugger statement
145+
146+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
147+
,-[files/07.js:1:1]
148+
1 | debugger;
149+
: ^
150+
\`----
151+
152+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
153+
,-[files/08.js:1:1]
154+
1 | debugger;
155+
: ^^^^^^^^^
156+
\`----
157+
help: Remove the debugger statement
158+
159+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
160+
,-[files/08.js:1:1]
161+
1 | debugger;
162+
: ^
163+
\`----
164+
165+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
166+
,-[files/09.js:1:1]
167+
1 | debugger;
168+
: ^^^^^^^^^
169+
\`----
170+
help: Remove the debugger statement
171+
172+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
173+
,-[files/09.js:1:1]
174+
1 | debugger;
175+
: ^
176+
\`----
177+
178+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
179+
,-[files/10.js:1:1]
180+
1 | debugger;
181+
: ^^^^^^^^^
182+
\`----
183+
help: Remove the debugger statement
184+
185+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
186+
,-[files/10.js:1:1]
187+
1 | debugger;
188+
: ^
189+
\`----
190+
191+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
192+
,-[files/11.js:1:1]
193+
1 | debugger;
194+
: ^^^^^^^^^
195+
\`----
196+
help: Remove the debugger statement
197+
198+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
199+
,-[files/11.js:1:1]
200+
1 | debugger;
201+
: ^
202+
\`----
203+
204+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
205+
,-[files/12.js:1:1]
206+
1 | debugger;
207+
: ^^^^^^^^^
208+
\`----
209+
help: Remove the debugger statement
210+
211+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
212+
,-[files/12.js:1:1]
213+
1 | debugger;
214+
: ^
215+
\`----
216+
217+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
218+
,-[files/13.js:1:1]
219+
1 | debugger;
220+
: ^^^^^^^^^
221+
\`----
222+
help: Remove the debugger statement
223+
224+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
225+
,-[files/13.js:1:1]
226+
1 | debugger;
227+
: ^
228+
\`----
229+
230+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
231+
,-[files/14.js:1:1]
232+
1 | debugger;
233+
: ^^^^^^^^^
234+
\`----
235+
help: Remove the debugger statement
236+
237+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
238+
,-[files/14.js:1:1]
239+
1 | debugger;
240+
: ^
241+
\`----
242+
243+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
244+
,-[files/15.js:1:1]
245+
1 | debugger;
246+
: ^^^^^^^^^
247+
\`----
248+
help: Remove the debugger statement
249+
250+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
251+
,-[files/15.js:1:1]
252+
1 | debugger;
253+
: ^
254+
\`----
255+
256+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
257+
,-[files/16.js:1:1]
258+
1 | debugger;
259+
: ^^^^^^^^^
260+
\`----
261+
help: Remove the debugger statement
262+
263+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
264+
,-[files/16.js:1:1]
265+
1 | debugger;
266+
: ^
267+
\`----
268+
269+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
270+
,-[files/17.js:1:1]
271+
1 | debugger;
272+
: ^^^^^^^^^
273+
\`----
274+
help: Remove the debugger statement
275+
276+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
277+
,-[files/17.js:1:1]
278+
1 | debugger;
279+
: ^
280+
\`----
281+
282+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
283+
,-[files/18.js:1:1]
284+
1 | debugger;
285+
: ^^^^^^^^^
286+
\`----
287+
help: Remove the debugger statement
288+
289+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
290+
,-[files/18.js:1:1]
291+
1 | debugger;
292+
: ^
293+
\`----
294+
295+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
296+
,-[files/19.js:1:1]
297+
1 | debugger;
298+
: ^^^^^^^^^
299+
\`----
300+
help: Remove the debugger statement
301+
302+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
303+
,-[files/19.js:1:1]
304+
1 | debugger;
305+
: ^
306+
\`----
307+
308+
! ]8;;https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-debugger.html\\eslint(no-debugger)]8;;\\: \`debugger\` statement is not allowed
309+
,-[files/20.js:1:1]
310+
1 | debugger;
311+
: ^^^^^^^^^
312+
\`----
313+
help: Remove the debugger statement
314+
315+
x basic-custom-plugin(no-debugger): Unexpected Debugger Statement
316+
,-[files/20.js:1:1]
317+
1 | debugger;
318+
: ^
319+
\`----
320+
321+
Found 20 warnings and 20 errors.
322+
Finished in Xms on 20 files using X threads."
323+
`;
324+
59325
exports[`cli options for bundling > should report an error if a custom plugin cannot be loaded 1`] = `
60326
"Failed to parse configuration file.
61327

napi/oxlint2/test/e2e.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ describe('cli options for bundling', () => {
4848
expect(normalizeOutput(stdout)).toMatchSnapshot();
4949
});
5050

51+
it('should load a custom plugin with multiple files', async () => {
52+
const { stdout, exitCode } = await runOxlint(
53+
'test/fixtures/basic_custom_plugin_many_files',
54+
);
55+
56+
expect(exitCode).toBe(1);
57+
expect(normalizeOutput(stdout)).toMatchSnapshot();
58+
});
59+
5160
it('should load a custom plugin when configured in overrides', async () => {
5261
const { stdout, exitCode } = await runOxlint(
5362
'test/fixtures/custom_plugin_via_overrides',
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"plugins": ["./test_plugin"],
3+
"rules": {
4+
"basic-custom-plugin/no-debugger": "error"
5+
},
6+
"ignorePatterns": ["test_plugin"]
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
debugger;

0 commit comments

Comments
 (0)