Skip to content

Commit 1abbde6

Browse files
authored
Merge branch 'next' into za-cities
2 parents 5bc55b1 + aab69c9 commit 1abbde6

16 files changed

+213
-170
lines changed

.eslintrc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ module.exports = defineConfig({
2929
rules: {
3030
// We may want to use this in the future
3131
'no-useless-escape': 'off',
32-
'deprecation/deprecation': 'error',
3332
eqeqeq: ['error', 'always', { null: 'ignore' }],
3433
'no-else-return': 'error',
3534
'prefer-template': 'error',
35+
36+
'deprecation/deprecation': 'error',
37+
3638
'@typescript-eslint/array-type': [
3739
'error',
3840
{ default: 'array-simple', readonly: 'generic' },
@@ -112,8 +114,10 @@ module.exports = defineConfig({
112114
},
113115
{
114116
files: ['test/*.spec.ts'],
117+
extends: ['plugin:vitest/recommended'],
115118
rules: {
116119
'deprecation/deprecation': 'off',
120+
117121
'@typescript-eslint/restrict-template-expressions': [
118122
'error',
119123
{
@@ -122,6 +126,9 @@ module.exports = defineConfig({
122126
allowAny: true,
123127
},
124128
],
129+
130+
'vitest/expect-expect': 'off',
131+
'vitest/valid-expect': ['error', { maxArgs: 2 }],
125132
},
126133
},
127134
],

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@
104104
"@types/validator": "~13.7.16",
105105
"@typescript-eslint/eslint-plugin": "~5.59.2",
106106
"@typescript-eslint/parser": "~5.59.2",
107-
"@vitest/coverage-c8": "~0.30.1",
108-
"@vitest/ui": "~0.30.1",
107+
"@vitest/coverage-c8": "~0.31.0",
108+
"@vitest/ui": "~0.31.0",
109109
"@vueuse/core": "~10.1.2",
110110
"c8": "~7.13.0",
111111
"conventional-changelog-cli": "~2.2.2",
@@ -118,6 +118,7 @@
118118
"eslint-plugin-deprecation": "~1.4.1",
119119
"eslint-plugin-jsdoc": "~44.0.0",
120120
"eslint-plugin-prettier": "~4.2.1",
121+
"eslint-plugin-vitest": "~0.2.2",
121122
"glob": "~10.2.2",
122123
"npm-run-all": "~4.1.5",
123124
"picocolors": "~1.0.0",
@@ -135,7 +136,7 @@
135136
"validator": "~13.9.0",
136137
"vite": "~4.3.5",
137138
"vitepress": "1.0.0-alpha.75",
138-
"vitest": "~0.30.1",
139+
"vitest": "~0.31.0",
139140
"vue": "~3.2.47"
140141
},
141142
"packageManager": "[email protected]",

pnpm-lock.yaml

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

test/all_functional.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('BROKEN_LOCALE_METHODS test', () => {
138138
});
139139

140140
Object.keys(modules).forEach((module) => {
141-
describe(module, () => {
141+
describe(`${module}`, () => {
142142
it('should not contain obsolete configuration (methods)', () => {
143143
const existingMethods = modules[module];
144144
const configuredMethods = Object.keys(
@@ -157,14 +157,14 @@ describe('BROKEN_LOCALE_METHODS test', () => {
157157

158158
describe('functional tests', () => {
159159
for (const [locale, faker] of Object.entries(allFakers)) {
160-
describe(locale, () => {
160+
describe(`${locale}`, () => {
161161
if (locale === 'base') {
162162
it.skip('base locale is checked by other tests');
163163
return;
164164
}
165165

166166
Object.keys(modules).forEach((module) => {
167-
describe(module, () => {
167+
describe(`${module}`, () => {
168168
modules[module].forEach((meth) => {
169169
const testAssertion = () => {
170170
// TODO @ST-DDT 2022-03-28: Use random seed once there are no more failures
@@ -195,14 +195,14 @@ describe('functional tests', () => {
195195

196196
describe('faker.helpers.fake functional tests', () => {
197197
for (const [locale, faker] of Object.entries(allFakers)) {
198-
describe(locale, () => {
198+
describe(`${locale}`, () => {
199199
if (locale === 'base') {
200200
it.skip('base locale is checked by other tests');
201201
return;
202202
}
203203

204204
Object.keys(modules).forEach((module) => {
205-
describe(module, () => {
205+
describe(`${module}`, () => {
206206
modules[module].forEach((meth) => {
207207
const testAssertion = () => {
208208
// TODO @ST-DDT 2022-03-28: Use random seed once there are no more failures

test/commerce.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,14 @@ describe('commerce', () => {
110110
const price = faker.commerce.price(100, 100, 1);
111111

112112
expect(price).toBeTruthy();
113-
expect(price, 'the price should be equal 100.0').toStrictEqual(
114-
'100.0'
115-
);
113+
expect(price, 'the price should be equal 100.0').toBe('100.0');
116114
});
117115

118116
it('should handle argument dec = 0', () => {
119117
const price = faker.commerce.price(100, 100, 0);
120118

121119
expect(price).toBeTruthy();
122-
expect(price, 'the price should be equal 100').toStrictEqual('100');
120+
expect(price, 'the price should be equal 100').toBe('100');
123121
});
124122
});
125123

test/datatype.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from 'vitest';
2-
import { faker } from '../src';
2+
import { faker, FakerError } from '../src';
33
import { seededTests } from './support/seededRuns';
44

55
const NON_SEEDED_BASED_RUN = 25;
@@ -226,7 +226,9 @@ describe('datatype', () => {
226226

227227
expect(() => {
228228
faker.datatype.number({ min, max });
229-
}).toThrowError(`Max ${max} should be greater than min ${min}.`);
229+
}).toThrow(
230+
new FakerError(`Max ${max} should be greater than min ${min}.`)
231+
);
230232
});
231233
});
232234

0 commit comments

Comments
 (0)