diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts index 1b9b5282f69..a5805af8030 100644 --- a/src/modules/helpers/index.ts +++ b/src/modules/helpers/index.ts @@ -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'; @@ -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 ( @@ -1299,6 +1305,14 @@ export class HelpersModule { store?: Record; } = {} ): ReturnType { + 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, diff --git a/test/finance.spec.ts b/test/finance.spec.ts index 41be4a017ff..c71b3d38528 100644 --- a/test/finance.spec.ts +++ b/test/finance.spec.ts @@ -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); diff --git a/test/scripts/apidoc/verify-jsdoc-tags.spec.ts b/test/scripts/apidoc/verify-jsdoc-tags.spec.ts index 602864b13be..410bffc206d 100644 --- a/test/scripts/apidoc/verify-jsdoc-tags.spec.ts +++ b/test/scripts/apidoc/verify-jsdoc-tags.spec.ts @@ -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'; @@ -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', () => {