Skip to content

Commit 19c0661

Browse files
test update for eslint-vitest-rule-tester v2
1 parent 1d8f913 commit 19c0661

24 files changed

+854
-852
lines changed

tests/rules/functional-parameters.test.ts

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -14,67 +14,67 @@ describe(name, () => {
1414
configs: esLatestConfig,
1515
});
1616

17-
it("doesn't report non-issues", () => {
18-
valid(dedent`
17+
it("doesn't report non-issues", async () => {
18+
await valid(dedent`
1919
var foo = {
2020
arguments: 2
2121
};
2222
foo.arguments = 3
2323
`);
2424

25-
valid(dedent`
25+
await valid(dedent`
2626
(function() {
2727
console.log("hello world");
2828
})();
2929
`);
3030

31-
valid(dedent`
31+
await valid(dedent`
3232
(() => {
3333
console.log("hello world");
3434
})();
3535
`);
3636

37-
valid(dedent`
37+
await valid(dedent`
3838
function foo([bar, ...baz]) {
3939
console.log(bar, baz);
4040
}
4141
`);
4242
});
4343

44-
it("reports rest parameter violations", () => {
44+
it("reports rest parameter violations", async () => {
4545
const code = dedent`
4646
function foo(...bar) {
4747
console.log(bar);
4848
}
4949
`;
5050

51-
const result = invalid({
51+
const result = await invalid({
5252
code,
5353
errors: ["restParam"],
5454
});
5555

56-
expect(result.messages).toMatchSnapshot();
56+
expect(result.result.messages).toMatchSnapshot();
5757
});
5858

59-
it("reports arguments keyword violations", () => {
59+
it("reports arguments keyword violations", async () => {
6060
const code = dedent`
6161
function foo(bar) {
6262
console.log(arguments);
6363
}
6464
`;
6565

66-
const result = invalid({
66+
const result = await invalid({
6767
code,
6868
errors: ["arguments"],
6969
});
7070

71-
expect(result.messages).toMatchSnapshot();
71+
expect(result.result.messages).toMatchSnapshot();
7272
});
7373

7474
describe("options", () => {
7575
describe("enforceParameterCount", () => {
76-
it("atLeastOne", () => {
77-
valid({
76+
it("atLeastOne", async () => {
77+
await valid({
7878
code: dedent`
7979
function foo(bar) {
8080
console.log(bar);
@@ -83,7 +83,7 @@ describe(name, () => {
8383
options: [{ enforceParameterCount: "atLeastOne" }],
8484
});
8585

86-
valid({
86+
await valid({
8787
code: dedent`
8888
function foo(bar, baz) {
8989
console.log(bar, baz);
@@ -92,7 +92,7 @@ describe(name, () => {
9292
options: [{ enforceParameterCount: "atLeastOne" }],
9393
});
9494

95-
valid({
95+
await valid({
9696
code: dedent`
9797
const foo = {
9898
get bar() {
@@ -110,7 +110,7 @@ describe(name, () => {
110110
],
111111
});
112112

113-
valid({
113+
await valid({
114114
code: dedent`
115115
const foo = {
116116
set bar(baz) {
@@ -128,7 +128,7 @@ describe(name, () => {
128128
],
129129
});
130130

131-
const invalidResult = invalid({
131+
const invalidResult = await invalid({
132132
code: dedent`
133133
function foo() {
134134
console.log("hello world");
@@ -137,11 +137,11 @@ describe(name, () => {
137137
options: [{ enforceParameterCount: "atLeastOne" }],
138138
errors: ["paramCountAtLeastOne"],
139139
});
140-
expect(invalidResult.messages).toMatchSnapshot();
140+
expect(invalidResult.result.messages).toMatchSnapshot();
141141
});
142142

143-
it("exactlyOne", () => {
144-
valid({
143+
it("exactlyOne", async () => {
144+
await valid({
145145
code: dedent`
146146
function foo(bar) {
147147
console.log(bar);
@@ -150,7 +150,7 @@ describe(name, () => {
150150
options: [{ enforceParameterCount: "exactlyOne" }],
151151
});
152152

153-
valid({
153+
await valid({
154154
code: dedent`
155155
const foo = {
156156
get bar() {
@@ -168,7 +168,7 @@ describe(name, () => {
168168
],
169169
});
170170

171-
valid({
171+
await valid({
172172
code: dedent`
173173
const foo = {
174174
set bar(baz) {
@@ -186,7 +186,7 @@ describe(name, () => {
186186
],
187187
});
188188

189-
const invalidResult1 = invalid({
189+
const invalidResult1 = await invalid({
190190
code: dedent`
191191
function foo(bar, baz) {
192192
console.log(bar, baz);
@@ -195,9 +195,9 @@ describe(name, () => {
195195
options: [{ enforceParameterCount: "exactlyOne" }],
196196
errors: ["paramCountExactlyOne"],
197197
});
198-
expect(invalidResult1.messages).toMatchSnapshot();
198+
expect(invalidResult1.result.messages).toMatchSnapshot();
199199

200-
const invalidResult2 = invalid({
200+
const invalidResult2 = await invalid({
201201
code: dedent`
202202
function foo() {
203203
console.log("hello world");
@@ -206,27 +206,27 @@ describe(name, () => {
206206
options: [{ enforceParameterCount: "exactlyOne" }],
207207
errors: ["paramCountExactlyOne"],
208208
});
209-
expect(invalidResult2.messages).toMatchSnapshot();
209+
expect(invalidResult2.result.messages).toMatchSnapshot();
210210
});
211211

212-
it("ignoreLambdaExpression", () => {
213-
valid({
212+
it("ignoreLambdaExpression", async () => {
213+
await valid({
214214
code: dedent`
215215
function foo(param) {}
216216
foo(function () {});
217217
`,
218218
options: [{ enforceParameterCount: { ignoreLambdaExpression: true } }],
219219
});
220220

221-
valid({
221+
await valid({
222222
code: dedent`
223223
function foo(param) {}
224224
foo(() => 1);
225225
`,
226226
options: [{ enforceParameterCount: { ignoreLambdaExpression: true } }],
227227
});
228228

229-
const invalidResult = invalid({
229+
const invalidResult = await invalid({
230230
code: dedent`
231231
function foo() {}
232232
`,
@@ -240,11 +240,11 @@ describe(name, () => {
240240
],
241241
errors: ["paramCountAtLeastOne"],
242242
});
243-
expect(invalidResult.messages).toMatchSnapshot();
243+
expect(invalidResult.result.messages).toMatchSnapshot();
244244
});
245245

246-
it("ignoreIIFE", () => {
247-
valid({
246+
it("ignoreIIFE", async () => {
247+
await valid({
248248
code: dedent`
249249
(() => {
250250
console.log("hello world");
@@ -260,7 +260,7 @@ describe(name, () => {
260260
],
261261
});
262262

263-
const invalidResult = invalid({
263+
const invalidResult = await invalid({
264264
code: dedent`
265265
(() => {
266266
console.log("hello world");
@@ -276,12 +276,12 @@ describe(name, () => {
276276
],
277277
errors: ["paramCountAtLeastOne"],
278278
});
279-
expect(invalidResult.messages).toMatchSnapshot();
279+
expect(invalidResult.result.messages).toMatchSnapshot();
280280
});
281281
});
282282

283-
it("ignoreIdentifierPattern", () => {
284-
valid({
283+
it("ignoreIdentifierPattern", async () => {
284+
await valid({
285285
code: dedent`
286286
function foo(...bar) {
287287
console.log(bar);
@@ -290,7 +290,7 @@ describe(name, () => {
290290
options: [{ ignoreIdentifierPattern: "^foo" }],
291291
});
292292

293-
valid({
293+
await valid({
294294
code: dedent`
295295
const baz = {
296296
foo(...bar) {
@@ -301,7 +301,7 @@ describe(name, () => {
301301
options: [{ ignoreIdentifierPattern: "^foo" }],
302302
});
303303

304-
const invalidResult = invalid({
304+
const invalidResult = await invalid({
305305
code: dedent`
306306
function foo(...bar) {
307307
console.log(bar);
@@ -310,11 +310,11 @@ describe(name, () => {
310310
options: [{ ignoreIdentifierPattern: "^bar" }],
311311
errors: ["restParam"],
312312
});
313-
expect(invalidResult.messages).toMatchSnapshot();
313+
expect(invalidResult.result.messages).toMatchSnapshot();
314314
});
315315

316-
it("ignorePrefixSelector", () => {
317-
valid({
316+
it("ignorePrefixSelector", async () => {
317+
await valid({
318318
code: dedent`
319319
[1, 2, 3].reduce(
320320
function(carry, current) {
@@ -331,7 +331,7 @@ describe(name, () => {
331331
],
332332
});
333333

334-
valid({
334+
await valid({
335335
code: dedent`
336336
[1, 2, 3].map(
337337
function(element, index) {
@@ -348,7 +348,7 @@ describe(name, () => {
348348
],
349349
});
350350

351-
valid({
351+
await valid({
352352
code: dedent`
353353
[1, 2, 3]
354354
.map(
@@ -374,7 +374,7 @@ describe(name, () => {
374374
],
375375
});
376376

377-
valid({
377+
await valid({
378378
code: dedent`
379379
[1, 2, 3].reduce(
380380
(carry, current) => carry + current,
@@ -389,7 +389,7 @@ describe(name, () => {
389389
],
390390
});
391391

392-
valid({
392+
await valid({
393393
code: dedent`
394394
[1, 2, 3].map(
395395
(element, index) => element + index,
@@ -404,7 +404,7 @@ describe(name, () => {
404404
],
405405
});
406406

407-
valid({
407+
await valid({
408408
code: dedent`
409409
[1, 2, 3]
410410
.map(
@@ -436,14 +436,14 @@ describe(name, () => {
436436
});
437437

438438
describe("overrides", () => {
439-
it('override value works - "allowRestParameter"', () => {
439+
it('override value works - "allowRestParameter"', async () => {
440440
const code = dedent`
441441
function foo(...bar: string[]) {
442442
console.log(bar);
443443
}
444444
`;
445445

446-
valid({
446+
await valid({
447447
code,
448448
options: {
449449
allowRestParameter: false,
@@ -461,14 +461,14 @@ describe(name, () => {
461461
});
462462
});
463463

464-
it('override value works - "allowArgumentsKeyword"', () => {
464+
it('override value works - "allowArgumentsKeyword"', async () => {
465465
const code = dedent`
466466
function foo(bar: string[]) {
467467
console.log(arguments);
468468
}
469469
`;
470470

471-
valid({
471+
await valid({
472472
code,
473473
options: {
474474
allowArgumentsKeyword: false,
@@ -486,14 +486,14 @@ describe(name, () => {
486486
});
487487
});
488488

489-
it('disbale override works - "allowRestParameter"', () => {
489+
it('disbale override works - "allowRestParameter"', async () => {
490490
const code = dedent`
491491
function foo(...bar: string[]) {
492492
console.log(bar);
493493
}
494494
`;
495495

496-
valid({
496+
await valid({
497497
code,
498498
options: {
499499
allowRestParameter: false,
@@ -509,14 +509,14 @@ describe(name, () => {
509509
});
510510
});
511511

512-
it('disbale override works - "allowArgumentsKeyword"', () => {
512+
it('disbale override works - "allowArgumentsKeyword"', async () => {
513513
const code = dedent`
514514
function foo(bar: string[]) {
515515
console.log(arguments);
516516
}
517517
`;
518518

519-
valid({
519+
await valid({
520520
code,
521521
options: {
522522
allowArgumentsKeyword: false,

0 commit comments

Comments
 (0)