Skip to content

Commit d656a82

Browse files
chore(deps): update dependency @vitest/eslint-plugin to v1.6.3 (#3645)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: xDivisionByZerox <leyla.jaehnig@gmx.de>
1 parent 8794cac commit d656a82

20 files changed

Lines changed: 177 additions & 364 deletions

eslint.config.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,7 @@ export default defineConfig(
255255
{
256256
name: 'test/**/*.ts overrides',
257257
files: ['test/**/*.spec.ts', 'test/**/*.spec.cts', 'test/**/*.spec.d.ts'],
258-
plugins: {
259-
// @ts-expect-error: weird type error
260-
vitest: eslintPluginVitest,
261-
},
258+
extends: [eslintPluginVitest.configs.recommended],
262259
rules: {
263260
'@typescript-eslint/no-deprecated': 'off',
264261

@@ -271,10 +268,9 @@ export default defineConfig(
271268
},
272269
],
273270

274-
...eslintPluginVitest.configs.recommended.rules,
275-
276271
'vitest/expect-expect': 'off',
277272
'vitest/no-alias-methods': 'error',
273+
'vitest/no-conditional-expect': 'off', // we require conditional logic when iterating over faker instances or instances in diffent versions (for the docs)
278274
'vitest/prefer-each': 'error',
279275
'vitest/prefer-to-have-length': 'error',
280276
'vitest/valid-expect': ['error', { maxArgs: 2 }],

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"@types/semver": "7.7.1",
107107
"@types/validator": "13.15.10",
108108
"@vitest/coverage-v8": "3.2.4",
109-
"@vitest/eslint-plugin": "1.3.20",
109+
"@vitest/eslint-plugin": "1.6.3",
110110
"@vitest/ui": "3.2.4",
111111
"@vueuse/core": "13.9.0",
112112
"commit-and-tag-version": "12.6.1",

pnpm-lock.yaml

Lines changed: 10 additions & 218 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/faker.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ describe('faker', () => {
5555
// Non-existing module
5656
expect(faker.definitions.missing).toBeDefined();
5757
// Non-existing definition in a non-existing module
58-
expect(() => faker.definitions.missing?.missing).toThrow();
58+
expect(() => faker.definitions.missing?.missing).toThrowError();
5959
// Non-existing definition in an existing module
60-
expect(() => faker.definitions.location.missing).toThrow();
60+
expect(() => faker.definitions.location.missing).toThrowError();
6161
});
6262
});
6363

6464
describe('constructor()', () => {
6565
describe('locale', () => {
6666
it('should throw error if no locales passed', () => {
67-
expect(() => new Faker({ locale: [] })).toThrow(
67+
expect(() => new Faker({ locale: [] })).toThrowError(
6868
new FakerError(
6969
'The locale option must contain at least one locale definition.'
7070
)

test/integration/modules/image.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { faker } from '../../../src';
2323
async function assertWorkingUrl(address: string): Promise<void> {
2424
expect(address).toBeTypeOf('string');
2525
expect(address).toMatch(/^https:\/\//);
26-
expect(() => new URL(address)).not.toThrow();
26+
expect(() => new URL(address)).not.toThrowError();
2727

2828
await expect(
2929
new Promise((resolve, reject) => {

test/internal/bind-this-to-member-functions.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ describe('internal', () => {
1818

1919
const someMethodWithoutBind = someModule.someMethod;
2020

21-
expect(() => someMethodWithoutBind()).toThrow(
21+
expect(() => someMethodWithoutBind()).toThrowError(
2222
new TypeError("Cannot read properties of undefined (reading 'faker')")
2323
);
2424

2525
bindThisToMemberFunctions(someModule);
2626

2727
const someMethod = someModule.someMethod;
2828

29-
expect(() => someMethod()).not.toThrow();
29+
expect(() => someMethod()).not.toThrowError();
3030
});
3131
});
3232
});

test/internal/date.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('toDate()', () => {
1515

1616
it('should throw a FakerError for an invalid date string', () => {
1717
const timestamp = 'aaaa-07-05T15:49:19+0000';
18-
expect(() => toDate(timestamp)).toThrow(
18+
expect(() => toDate(timestamp)).toThrowError(
1919
new FakerError(`Invalid refDate date: ${timestamp}`)
2020
);
2121
});

test/internal/locale-proxy.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('LocaleProxy', () => {
3737
expect(() => {
3838
// @ts-expect-error: LocaleProxy is read-only.
3939
locale.category = {};
40-
}).toThrow(
40+
}).toThrowError(
4141
new FakerError('You cannot edit the locale data on the faker instance')
4242
);
4343
});
@@ -46,7 +46,7 @@ describe('LocaleProxy', () => {
4646
expect(() => {
4747
// @ts-expect-error: LocaleProxy is read-only.
4848
locale.airline = {};
49-
}).toThrow(
49+
}).toThrowError(
5050
new FakerError('You cannot edit the locale data on the faker instance')
5151
);
5252
});
@@ -55,7 +55,7 @@ describe('LocaleProxy', () => {
5555
expect(() => {
5656
// @ts-expect-error: LocaleProxy is read-only.
5757
delete locale.category;
58-
}).toThrow(
58+
}).toThrowError(
5959
new FakerError('You cannot edit the locale data on the faker instance')
6060
);
6161
});
@@ -64,7 +64,7 @@ describe('LocaleProxy', () => {
6464
expect(() => {
6565
// @ts-expect-error: LocaleProxy is read-only.
6666
delete locale.airline;
67-
}).toThrow(
67+
}).toThrowError(
6868
new FakerError('You cannot edit the locale data on the faker instance')
6969
);
7070
});
@@ -94,7 +94,7 @@ describe('LocaleProxy', () => {
9494
});
9595

9696
it('should not be possible to access a missing entry in a missing category', () => {
97-
expect(() => locale.category.missing).toThrow(
97+
expect(() => locale.category.missing).toThrowError(
9898
new FakerError(
9999
`The locale data for 'category.missing' are missing in this locale.
100100
If this is a custom Faker instance, please make sure all required locales are used e.g. '[de_AT, de, en, base]'.
@@ -105,7 +105,7 @@ describe('LocaleProxy', () => {
105105
});
106106

107107
it('should not be possible to access a missing entry in a present category', () => {
108-
expect(() => locale.airline.missing).toThrow(
108+
expect(() => locale.airline.missing).toThrowError(
109109
new FakerError(
110110
`The locale data for 'airline.missing' are missing in this locale.
111111
If this is a custom Faker instance, please make sure all required locales are used e.g. '[de_AT, de, en, base]'.
@@ -124,7 +124,7 @@ describe('LocaleProxy', () => {
124124
airline: { airline: null },
125125
});
126126

127-
expect(() => unavailable.airline.airline).toThrow(
127+
expect(() => unavailable.airline.airline).toThrowError(
128128
new FakerError(
129129
`The locale data for 'airline.airline' aren't applicable to this locale.
130130
If you think this is a bug, please report it at: https://github.com/faker-js/faker`
@@ -136,7 +136,7 @@ describe('LocaleProxy', () => {
136136
expect(() => {
137137
// @ts-expect-error: LocaleProxy is read-only.
138138
locale.category.missing = {};
139-
}).toThrow(
139+
}).toThrowError(
140140
new FakerError('You cannot edit the locale data on the faker instance')
141141
);
142142
});
@@ -145,7 +145,7 @@ describe('LocaleProxy', () => {
145145
expect(() => {
146146
// @ts-expect-error: LocaleProxy is read-only.
147147
locale.airline.missing = {};
148-
}).toThrow(
148+
}).toThrowError(
149149
new FakerError('You cannot edit the locale data on the faker instance')
150150
);
151151
});
@@ -154,7 +154,7 @@ describe('LocaleProxy', () => {
154154
expect(() => {
155155
// @ts-expect-error: LocaleProxy is read-only.
156156
locale.airline.airline = ['dummy'];
157-
}).toThrow(
157+
}).toThrowError(
158158
new FakerError('You cannot edit the locale data on the faker instance')
159159
);
160160
});
@@ -163,7 +163,7 @@ describe('LocaleProxy', () => {
163163
expect(() => {
164164
// @ts-expect-error: LocaleProxy is read-only.
165165
delete locale.category.missing;
166-
}).toThrow(
166+
}).toThrowError(
167167
new FakerError('You cannot edit the locale data on the faker instance')
168168
);
169169
});
@@ -172,7 +172,7 @@ describe('LocaleProxy', () => {
172172
expect(() => {
173173
// @ts-expect-error: LocaleProxy is read-only.
174174
delete locale.airline.missing;
175-
}).toThrow(
175+
}).toThrowError(
176176
new FakerError('You cannot edit the locale data on the faker instance')
177177
);
178178
});
@@ -181,7 +181,7 @@ describe('LocaleProxy', () => {
181181
expect(() => {
182182
// @ts-expect-error: LocaleProxy is read-only.
183183
delete locale.airline.airline;
184-
}).toThrow(
184+
}).toThrowError(
185185
new FakerError('You cannot edit the locale data on the faker instance')
186186
);
187187
});

test/modules/commerce.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,39 +376,39 @@ describe('commerce', () => {
376376
it('should throw FakerError when prefix contains non-digit characters', () => {
377377
expect(() => {
378378
faker.commerce.upc({ prefix: 'abc' });
379-
}).toThrow('Prefix must contain only numeric digits');
379+
}).toThrowError('Prefix must contain only numeric digits');
380380

381381
expect(() => {
382382
faker.commerce.upc({ prefix: '123abc' });
383-
}).toThrow('Prefix must contain only numeric digits');
383+
}).toThrowError('Prefix must contain only numeric digits');
384384

385385
expect(() => {
386386
faker.commerce.upc({ prefix: '12-34' });
387-
}).toThrow('Prefix must contain only numeric digits');
387+
}).toThrowError('Prefix must contain only numeric digits');
388388

389389
expect(() => {
390390
faker.commerce.upc({ prefix: ' 123' });
391-
}).toThrow('Prefix must contain only numeric digits');
391+
}).toThrowError('Prefix must contain only numeric digits');
392392
});
393393

394394
it('should throw FakerError when prefix is longer than 11 digits', () => {
395395
expect(() => {
396396
faker.commerce.upc({ prefix: '012345678901' });
397-
}).toThrow('Prefix must be at most 11 numeric digits');
397+
}).toThrowError('Prefix must be at most 11 numeric digits');
398398

399399
expect(() => {
400400
faker.commerce.upc({ prefix: '012345678901234' });
401-
}).toThrow('Prefix must be at most 11 numeric digits');
401+
}).toThrowError('Prefix must be at most 11 numeric digits');
402402
});
403403

404404
it('should throw FakerError with correct error message for invalid prefix types', () => {
405405
expect(() => {
406406
faker.commerce.upc({ prefix: '12a' });
407-
}).toThrow('Prefix must contain only numeric digits');
407+
}).toThrowError('Prefix must contain only numeric digits');
408408

409409
expect(() => {
410410
faker.commerce.upc({ prefix: '012345678901' });
411-
}).toThrow('Prefix must be at most 11 numeric digits');
411+
}).toThrowError('Prefix must be at most 11 numeric digits');
412412
});
413413

414414
it('should generate valid UPCs that pass check digit validation for multiple calls', () => {

test/modules/datatype.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ describe('datatype', () => {
6868
const filledOptions: { probability?: number } = Object.freeze({
6969
probability: 1,
7070
});
71-
expect(() => faker.datatype.boolean(filledOptions)).not.toThrow();
71+
expect(() =>
72+
faker.datatype.boolean(filledOptions)
73+
).not.toThrowError();
7274

7375
const emptyOptions: { probability?: number } = Object.freeze({});
74-
expect(() => faker.datatype.boolean(emptyOptions)).not.toThrow();
76+
expect(() => faker.datatype.boolean(emptyOptions)).not.toThrowError();
7577
});
7678
});
7779
}

0 commit comments

Comments
 (0)