Skip to content

Commit

Permalink
Merge branch 'next' into locale/introduce-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Apr 1, 2023
2 parents af4cd08 + dbbc785 commit 314ec7d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/modules/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Faker } from '../..';
import { FakerError } from '../../errors/faker-error';
import { deprecated } from '../../internal/deprecated';
import { luhnCheckValue } from './luhn-check';
import type { RecordKey } from './unique';
import * as uniqueExec from './unique';
Expand Down Expand Up @@ -1238,10 +1239,15 @@ export class HelpersModule {
* @param options.compare The function used to determine whether a value was already returned. Defaults to check the existence of the key.
* @param options.store The store of unique entries. Defaults to a global store.
*
* @see https://github.com/faker-js/faker/issues/1785#issuecomment-1407773744
*
* @example
* faker.helpers.unique(faker.person.firstName) // 'Corbin'
*
* @since 7.5.0
*
* @deprecated Please find a dedicated npm package instead, or even create one on your own if you want to.
* More info can be found in issue [faker-js/faker #1785](https://github.com/faker-js/faker/issues/1785).
*/
unique<
Method extends (
Expand Down Expand Up @@ -1299,6 +1305,14 @@ export class HelpersModule {
store?: Record<RecordKey, RecordKey>;
} = {}
): ReturnType<Method> {
deprecated({
deprecated: 'faker.helpers.unique',
proposed:
'https://github.com/faker-js/faker/issues/1785#issuecomment-1407773744',
since: '8.0',
until: '9.0',
});

const { maxTime = 50, maxRetries = 50 } = options;
return uniqueExec.exec(method, args, {
...options,
Expand Down
1 change: 0 additions & 1 deletion test/finance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ describe('finance', () => {
it('should return a random credit card number', () => {
let number = faker.finance.creditCardNumber();
number = number.replace(/\D/g, ''); // remove formatting
console.log('version:', process.version, number, number.length);

expect(number.length).toBeGreaterThanOrEqual(13);
expect(number.length).toBeLessThanOrEqual(20);
Expand Down
4 changes: 2 additions & 2 deletions test/scripts/apidoc/verify-jsdoc-tags.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdirSync, rmdirSync, writeFileSync } from 'node:fs';
import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import validator from 'validator';
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
Expand Down Expand Up @@ -26,7 +26,7 @@ const tempDir = resolve(__dirname, 'temp');

afterAll(() => {
// Remove temp folder
rmdirSync(tempDir, { recursive: true });
rmSync(tempDir, { recursive: true });
});

describe('verify JSDoc tags', () => {
Expand Down

0 comments on commit 314ec7d

Please sign in to comment.