Skip to content

Commit da2e8b3

Browse files
authored
Merge branch 'next' into fix/finance/maskedNumber-defaults
2 parents 1f29b8a + 813a34d commit da2e8b3

42 files changed

Lines changed: 150 additions & 565 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = defineConfig({
1515
reportUnusedDisableDirectives: true,
1616
extends: [
1717
'eslint:recommended',
18-
'plugin:@typescript-eslint/recommended-type-checked',
18+
'plugin:@typescript-eslint/strict-type-checked',
1919
'plugin:prettier/recommended',
2020
'plugin:deprecation/recommended',
2121
'plugin:jsdoc/recommended-typescript-error',
@@ -59,7 +59,6 @@ module.exports = defineConfig({
5959
'unicorn/prefer-code-point': 'off',
6060
'unicorn/prefer-export-from': 'off',
6161
'unicorn/prefer-module': 'off',
62-
'unicorn/prefer-negative-index': 'off',
6362
'unicorn/prefer-string-slice': 'off',
6463
'unicorn/prevent-abbreviations': 'off',
6564
'unicorn/require-array-join-separator': 'off',
@@ -91,6 +90,7 @@ module.exports = defineConfig({
9190
'error',
9291
{ ignoreParameters: true },
9392
],
93+
'@typescript-eslint/no-unnecessary-condition': 'off', // requires `strictNullChecks` to be enabled
9494
'@typescript-eslint/no-unsafe-assignment': 'off',
9595
'@typescript-eslint/no-unsafe-call': 'off',
9696
'@typescript-eslint/no-unsafe-member-access': 'off',
@@ -104,6 +104,11 @@ module.exports = defineConfig({
104104
{ allowNumber: true, allowBoolean: true },
105105
],
106106
'@typescript-eslint/unbound-method': 'off',
107+
'@typescript-eslint/unified-signatures': 'off', // incompatible with our api docs generation
108+
109+
// TODO @ST-DDT 2023-10-10: The following rules currently conflict with our code.
110+
// Each rule should be checked whether it should be enabled/configured and the problems fixed, or stay disabled permanently.
111+
'@typescript-eslint/no-confusing-void-expression': 'off',
107112

108113
'jsdoc/require-jsdoc': 'off', // Enabled only for src/**/*.ts
109114
'jsdoc/require-returns': 'off',

docs/guide/frameworks.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,39 @@ describe('Testing the application', () => {
9898
});
9999
});
100100
```
101+
102+
## Playwright
103+
104+
Integration with [Playwright](https://playwright.dev/) is also easy:
105+
106+
```ts
107+
import { faker } from '@faker-js/faker/locale/en';
108+
import { expect, test } from '@playwright/test';
109+
110+
test.describe('Testing the application', () => {
111+
test('should create an account with username and password', async ({
112+
page,
113+
}) => {
114+
const username = faker.internet.userName();
115+
const password = faker.internet.password();
116+
const email = faker.internet.exampleEmail();
117+
118+
// Visit the webpage and create an account.
119+
await page.goto('https://www.example.com/register');
120+
await page.getByLabel('email').fill(email);
121+
await page.getByLabel('username').fill(username);
122+
await page.getByLabel('password', { exact: true }).fill(password);
123+
await page.getByLabel('confirm password').fill(password);
124+
await page.getByRole('button', { name: 'Register' }).click();
125+
126+
// Now, we try to login with these credentials.
127+
await page.goto('https://www.example.com/login');
128+
await page.getByLabel('email').fill(email);
129+
await page.getByLabel('password').fill(password);
130+
await page.getByRole('button', { name: 'Login' }).click();
131+
132+
// We should have logged in successfully to the dashboard page.
133+
await expect(page).toHaveURL(/.*dashboard/);
134+
});
135+
});
136+
```

scripts/apidoc/signature.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ function extractDefaultFromComment(comment?: Comment): string | undefined {
342342
throw new Error(`Found description text after the default value:\n${text}`);
343343
}
344344

345-
summary.splice(summary.length - 2, 2);
345+
summary.splice(-2, 2);
346346
const lastSummaryPart = summary[summary.length - 1];
347347
lastSummaryPart.text = lastSummaryPart.text.replace(/[ \n]Defaults to $/, '');
348348
return result[2];

src/internal/module-base.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { Faker } from '../faker';
2+
import type { SimpleFaker } from '../simple-faker';
3+
import { bindThisToMemberFunctions } from './bind-this-to-member-functions';
4+
5+
/**
6+
* Base class for all modules that use a `SimpleFaker` instance.
7+
*
8+
* @internal
9+
*/
10+
export abstract class SimpleModuleBase {
11+
constructor(protected readonly faker: SimpleFaker) {
12+
bindThisToMemberFunctions(this);
13+
}
14+
}
15+
16+
/**
17+
* Base class for all modules that use a `Faker` instance.
18+
*
19+
* @internal
20+
*/
21+
export abstract class ModuleBase extends SimpleModuleBase {
22+
constructor(protected readonly faker: Faker) {
23+
super(faker);
24+
}
25+
}

src/locales/cs_CZ/person/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import male_prefix from './male_prefix';
1616
import name_ from './name';
1717
import prefix from './prefix';
1818
import suffix from './suffix';
19-
import title from './title';
2019

2120
const person: PersonDefinition = {
2221
female_first_name,
@@ -32,7 +31,6 @@ const person: PersonDefinition = {
3231
name: name_,
3332
prefix,
3433
suffix,
35-
title,
3634
};
3735

3836
export default person;

src/locales/cs_CZ/person/title.ts

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/locales/he/person/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import male_first_name from './male_first_name';
1212
import male_prefix from './male_prefix';
1313
import name_ from './name';
1414
import prefix from './prefix';
15-
import title from './title';
1615

1716
const person: PersonDefinition = {
1817
female_first_name,
@@ -24,7 +23,6 @@ const person: PersonDefinition = {
2423
male_prefix,
2524
name: name_,
2625
prefix,
27-
title,
2826
};
2927

3028
export default person;

src/locales/he/person/title.ts

Lines changed: 0 additions & 91 deletions
This file was deleted.

src/locales/pl/person/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import male_prefix from './male_prefix';
1414
import name_ from './name';
1515
import prefix from './prefix';
1616
import sex from './sex';
17-
import title from './title';
1817

1918
const person: PersonDefinition = {
2019
female_first_name,
@@ -28,7 +27,6 @@ const person: PersonDefinition = {
2827
name: name_,
2928
prefix,
3029
sex,
31-
title,
3230
};
3331

3432
export default person;

0 commit comments

Comments
 (0)