From 35c6772e56bea003ff003ec676e4637a0380dda4 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Tue, 16 Jul 2024 23:22:15 +0000 Subject: [PATCH 01/23] =?UTF-8?q?=F0=9F=94=A7=20Toggle=20on=20`isolatedDec?= =?UTF-8?q?larations`=20flag=20on=20the=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #5057 --- tsconfig.common.json | 3 ++- tsconfig.publish.json | 1 + tsconfig.publish.types.json | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tsconfig.common.json b/tsconfig.common.json index 7766a5f34e5..a0deb51b2f6 100644 --- a/tsconfig.common.json +++ b/tsconfig.common.json @@ -1,7 +1,8 @@ { "compilerOptions": { "noEmit": true, - "declaration": false, + "declaration": true, + "isolatedDeclarations": true, "incremental": false, "sourceMap": true, "target": "es2017", diff --git a/tsconfig.publish.json b/tsconfig.publish.json index 7abf8de509d..d2632ccb79d 100644 --- a/tsconfig.publish.json +++ b/tsconfig.publish.json @@ -3,6 +3,7 @@ "compilerOptions": { "noEmit": false, "declaration": false, + "isolatedDeclarations": false, "removeComments": true, "sourceMap": false } diff --git a/tsconfig.publish.types.json b/tsconfig.publish.types.json index abb33a7c0f6..4b2addcf4cd 100644 --- a/tsconfig.publish.types.json +++ b/tsconfig.publish.types.json @@ -4,6 +4,7 @@ "noEmit": false, "declaration": true, "emitDeclarationOnly": true, + "isolatedDeclarations": true, "removeComments": false, "sourceMap": false, "stripInternal": true From fcd9d5bf4c76a29ea10d8ce2cb27b409659a0c8b Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Tue, 16 Jul 2024 23:39:09 +0000 Subject: [PATCH 02/23] fix poisoning --- packages/poisoning/src/internals/PoisoningFreeArray.ts | 8 ++++---- packages/poisoning/src/internals/PoisoningFreeMap.ts | 8 ++++---- packages/poisoning/src/internals/PoisoningFreeSet.ts | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/poisoning/src/internals/PoisoningFreeArray.ts b/packages/poisoning/src/internals/PoisoningFreeArray.ts index 9499276363c..b8811a47cf7 100644 --- a/packages/poisoning/src/internals/PoisoningFreeArray.ts +++ b/packages/poisoning/src/internals/PoisoningFreeArray.ts @@ -6,13 +6,13 @@ const safeArraySort = Array.prototype.sort; const safeObjectDefineProperty = Object.defineProperty; /** Alias for Array.prototype.map */ -export const MapSymbol = Symbol('safe.map'); +export const MapSymbol: unique symbol = Symbol('safe.map'); /** Alias for Array.prototype.push */ -export const PushSymbol = Symbol('safe.push'); +export const PushSymbol: unique symbol = Symbol('safe.push'); /** Alias for Array.prototype.shift */ -export const ShiftSymbol = Symbol('safe.shift'); +export const ShiftSymbol: unique symbol = Symbol('safe.shift'); /** Alias for Array.prototype.sort */ -export const SortSymbol = Symbol('safe.sort'); +export const SortSymbol: unique symbol = Symbol('safe.sort'); /** Array instance enriched with aliased methods that cannot be poisoned */ export type PoisoningFreeArray = Array & { diff --git a/packages/poisoning/src/internals/PoisoningFreeMap.ts b/packages/poisoning/src/internals/PoisoningFreeMap.ts index afa5e443077..d00074a6122 100644 --- a/packages/poisoning/src/internals/PoisoningFreeMap.ts +++ b/packages/poisoning/src/internals/PoisoningFreeMap.ts @@ -6,13 +6,13 @@ const safeMapSet = Map.prototype.set; const safeObjectDefineProperty = Object.defineProperty; /** Alias for Map.prototype.get */ -export const GetSymbol = Symbol('safe.get'); +export const GetSymbol: unique symbol = Symbol('safe.get'); /** Alias for Map.prototype.has */ -export const HasSymbol = Symbol('safe.has'); +export const HasSymbol: unique symbol = Symbol('safe.has'); /** Alias for Map.prototype.entries */ -export const EntriesSymbol = Symbol('safe.entries'); +export const EntriesSymbol: unique symbol = Symbol('safe.entries'); /** Alias for Map.prototype.set */ -export const SetSymbol = Symbol('safe.set'); +export const SetSymbol: unique symbol = Symbol('safe.set'); /** Map instance enriched with aliased methods that cannot be poisoned */ export type PoisoningFreeMap = Map & { diff --git a/packages/poisoning/src/internals/PoisoningFreeSet.ts b/packages/poisoning/src/internals/PoisoningFreeSet.ts index 975b4447701..feb4fe0d015 100644 --- a/packages/poisoning/src/internals/PoisoningFreeSet.ts +++ b/packages/poisoning/src/internals/PoisoningFreeSet.ts @@ -4,9 +4,9 @@ const safeSetHas = Set.prototype.has; const safeObjectDefineProperty = Object.defineProperty; /** Alias for Set.prototype.add */ -export const AddSymbol = Symbol('safe.add'); +export const AddSymbol: unique symbol = Symbol('safe.add'); /** Alias for Set.prototype.has */ -export const HasSymbol = Symbol('safe.has'); +export const HasSymbol: unique symbol = Symbol('safe.has'); /** Set instance enriched with aliased methods that cannot be poisoned */ export type PoisoningFreeSet = Set & { From 146beab8a2bee714ef79b45a4e939000032ede77 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Tue, 16 Jul 2024 23:56:41 +0000 Subject: [PATCH 03/23] fix some in fc --- packages/fast-check/src/check/symbols.ts | 2 +- packages/fast-check/src/utils/stringify.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/fast-check/src/check/symbols.ts b/packages/fast-check/src/check/symbols.ts index ef3affef15d..81cdec4d566 100644 --- a/packages/fast-check/src/check/symbols.ts +++ b/packages/fast-check/src/check/symbols.ts @@ -11,7 +11,7 @@ * @remarks Since 1.8.0 * @public */ -export const cloneMethod = Symbol.for('fast-check/cloneMethod'); +export const cloneMethod: unique symbol = Symbol.for('fast-check/cloneMethod'); /** * Object instance that should be cloned from one generation/shrink to another diff --git a/packages/fast-check/src/utils/stringify.ts b/packages/fast-check/src/utils/stringify.ts index 30bd239f639..4fbdd64ed81 100644 --- a/packages/fast-check/src/utils/stringify.ts +++ b/packages/fast-check/src/utils/stringify.ts @@ -28,7 +28,7 @@ const safePositiveInfinity = Number.POSITIVE_INFINITY; * @remarks Since 2.17.0 * @public */ -export const toStringMethod = Symbol.for('fast-check/toStringMethod'); +export const toStringMethod: unique symbol = Symbol.for('fast-check/toStringMethod'); /** * Interface to implement for {@link toStringMethod} * @@ -62,7 +62,7 @@ export function hasToStringMethod(instance: T): instance is T & WithToStringM * @remarks Since 2.17.0 * @public */ -export const asyncToStringMethod = Symbol.for('fast-check/asyncToStringMethod'); +export const asyncToStringMethod: unique symbol = Symbol.for('fast-check/asyncToStringMethod'); /** * Interface to implement for {@link asyncToStringMethod} * From 4dc1f789a7bfd4ce9fc18ad2741ca6bd93d7c9f8 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Tue, 6 Aug 2024 23:11:40 +0000 Subject: [PATCH 04/23] fix stream --- packages/fast-check/src/stream/Stream.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fast-check/src/stream/Stream.ts b/packages/fast-check/src/stream/Stream.ts index 29d49520464..0c29b40a5c9 100644 --- a/packages/fast-check/src/stream/Stream.ts +++ b/packages/fast-check/src/stream/Stream.ts @@ -55,7 +55,7 @@ export class Stream implements IterableIterator { next(): IteratorResult { return this.g.next(); } - [safeSymbolIterator](): IterableIterator { + [Symbol.iterator](): IterableIterator { // /*DEBUG*/ this.closeCurrentStream(); return this.g; } From 9a3c46460276b6c9645f48d1cd4ce2d82ea3704c Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Tue, 6 Aug 2024 23:15:29 +0000 Subject: [PATCH 05/23] fix wrapper --- .../src/check/model/commands/CommandWrapper.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/fast-check/src/check/model/commands/CommandWrapper.ts b/packages/fast-check/src/check/model/commands/CommandWrapper.ts index d859e07b6a0..660b2c9c3e5 100644 --- a/packages/fast-check/src/check/model/commands/CommandWrapper.ts +++ b/packages/fast-check/src/check/model/commands/CommandWrapper.ts @@ -3,6 +3,8 @@ import { hasAsyncToStringMethod, hasToStringMethod, toStringMethod, + WithAsyncToStringMethod, + WithToStringMethod, } from '../../../utils/stringify'; import { cloneMethod, hasCloneMethod } from '../../symbols'; import type { ICommand } from '../command/ICommand'; @@ -14,22 +16,20 @@ import type { ICommand } from '../command/ICommand'; export class CommandWrapper implements ICommand { - [toStringMethod]?: () => string; - [asyncToStringMethod]?: () => Promise; - hasRan = false; constructor(readonly cmd: ICommand) { if (hasToStringMethod(cmd)) { const method = cmd[toStringMethod]; - this[toStringMethod] = function toStringMethod(): string { + (this as unknown as WithToStringMethod)[toStringMethod] = function toStringMethod(): string { return method.call(cmd); }; } if (hasAsyncToStringMethod(cmd)) { const method = cmd[asyncToStringMethod]; - this[asyncToStringMethod] = function asyncToStringMethod(): Promise { - return method.call(cmd); - }; + (this as unknown as WithAsyncToStringMethod)[asyncToStringMethod] = + function asyncToStringMethod(): Promise { + return method.call(cmd); + }; } } check(m: Readonly): CheckAsync extends false ? boolean : Promise { From 1c74c1317ad0f560289254f959f6567ba613fcc8 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Tue, 6 Aug 2024 23:15:51 +0000 Subject: [PATCH 06/23] lint wrapper --- .../fast-check/src/check/model/commands/CommandWrapper.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/fast-check/src/check/model/commands/CommandWrapper.ts b/packages/fast-check/src/check/model/commands/CommandWrapper.ts index 660b2c9c3e5..08524151e90 100644 --- a/packages/fast-check/src/check/model/commands/CommandWrapper.ts +++ b/packages/fast-check/src/check/model/commands/CommandWrapper.ts @@ -1,10 +1,11 @@ +import type { + WithAsyncToStringMethod, + WithToStringMethod} from '../../../utils/stringify'; import { asyncToStringMethod, hasAsyncToStringMethod, hasToStringMethod, - toStringMethod, - WithAsyncToStringMethod, - WithToStringMethod, + toStringMethod } from '../../../utils/stringify'; import { cloneMethod, hasCloneMethod } from '../../symbols'; import type { ICommand } from '../command/ICommand'; From c41a10de55b3a8a988025c8d01a5ef2edad2d50e Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Wed, 7 Aug 2024 08:01:46 +0000 Subject: [PATCH 07/23] trick to pass isolatedDeclarations on unpublished --- .../check/model/commands/CommandsIterable.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/fast-check/src/check/model/commands/CommandsIterable.ts b/packages/fast-check/src/check/model/commands/CommandsIterable.ts index a4b855b4107..ecd9fb7cec8 100644 --- a/packages/fast-check/src/check/model/commands/CommandsIterable.ts +++ b/packages/fast-check/src/check/model/commands/CommandsIterable.ts @@ -1,4 +1,4 @@ -import { cloneMethod } from '../../symbols'; +import { cloneMethod, WithCloneMethod } from '../../symbols'; import type { CommandWrapper } from './CommandWrapper'; /** @@ -14,12 +14,6 @@ export class CommandsIterable> { return this.commands[Symbol.iterator](); } - [cloneMethod](): CommandsIterable { - return new CommandsIterable( - this.commands.map((c) => c.clone()), - this.metadataForReplay, - ); - } toString(): string { const serializedCommands = this.commands .filter((c) => c.hasRan) @@ -29,3 +23,17 @@ export class CommandsIterable)[cloneMethod] = + function ( + this: CommandsIterable, + ): CommandsIterable { + return new CommandsIterable( + this.commands.map((c) => c.clone()), + this.metadataForReplay, + ); + }; From 3c71345b5f6c7f74962c9633ecc26591a4857bbe Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Sat, 10 Aug 2024 08:50:29 +0000 Subject: [PATCH 08/23] fix vitest and jest? --- packages/jest/src/internals/TestBuilder.ts | 6 ++---- packages/vitest/src/internals/TestBuilder.ts | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/jest/src/internals/TestBuilder.ts b/packages/jest/src/internals/TestBuilder.ts index 0e0c344913e..2a4bdacbe7f 100644 --- a/packages/jest/src/internals/TestBuilder.ts +++ b/packages/jest/src/internals/TestBuilder.ts @@ -138,7 +138,7 @@ export type FastCheckItBuilder = T & /** * Build the enriched version of {it,test}, the one with added `.prop` */ -function enrichWithTestProp any>( +export function buildTest any>( testFn: T, jest: JestExtra, fc: FcExtra, @@ -148,7 +148,7 @@ function enrichWithTestProp any>( for (const key in testFn) { if (typeof testFn[key] === 'function') { atLeastOneExtra = true; - extraKeys[key] = key !== 'each' ? enrichWithTestProp(testFn[key] as any, jest, fc) : testFn[key]; + extraKeys[key] = key !== 'each' ? buildTest(testFn[key] as any, jest, fc) : testFn[key]; } } if (!atLeastOneExtra) { @@ -160,5 +160,3 @@ function enrichWithTestProp any>( } return Object.assign(enrichedTestFn, extraKeys) as FastCheckItBuilder; } - -export const buildTest = enrichWithTestProp; diff --git a/packages/vitest/src/internals/TestBuilder.ts b/packages/vitest/src/internals/TestBuilder.ts index 0e5789a1f07..9d9c4d2ec25 100644 --- a/packages/vitest/src/internals/TestBuilder.ts +++ b/packages/vitest/src/internals/TestBuilder.ts @@ -137,7 +137,7 @@ export type FastCheckItBuilder = T & /** * Build the enriched version of {it,test}, the one with added `.prop` */ -function enrichWithTestProp any>( +export function buildTest any>( testFn: T, fc: FcExtra, ancestors: Set = new Set(), @@ -148,8 +148,7 @@ function enrichWithTestProp any>( const key = unsafeKey as keyof typeof testFn & string; if (!ancestors.has(key) && typeof testFn[key] === 'function') { atLeastOneExtra = true; - extraKeys[key] = - key !== 'each' ? enrichWithTestProp(testFn[key] as any, fc, new Set([...ancestors, key])) : testFn[key]; + extraKeys[key] = key !== 'each' ? buildTest(testFn[key] as any, fc, new Set([...ancestors, key])) : testFn[key]; } } if (!atLeastOneExtra) { @@ -161,5 +160,3 @@ function enrichWithTestProp any>( } return Object.assign(enrichedTestFn, extraKeys) as FastCheckItBuilder; } - -export const buildTest = enrichWithTestProp; From 4212214d99183fb0e44432c5921e1018de42579e Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Sat, 10 Aug 2024 09:20:06 +0000 Subject: [PATCH 09/23] Revert breaking parts --- .../check/model/commands/CommandWrapper.ts | 17 +++++++------- .../check/model/commands/CommandsIterable.ts | 22 ++++++------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/packages/fast-check/src/check/model/commands/CommandWrapper.ts b/packages/fast-check/src/check/model/commands/CommandWrapper.ts index 08524151e90..d859e07b6a0 100644 --- a/packages/fast-check/src/check/model/commands/CommandWrapper.ts +++ b/packages/fast-check/src/check/model/commands/CommandWrapper.ts @@ -1,11 +1,8 @@ -import type { - WithAsyncToStringMethod, - WithToStringMethod} from '../../../utils/stringify'; import { asyncToStringMethod, hasAsyncToStringMethod, hasToStringMethod, - toStringMethod + toStringMethod, } from '../../../utils/stringify'; import { cloneMethod, hasCloneMethod } from '../../symbols'; import type { ICommand } from '../command/ICommand'; @@ -17,20 +14,22 @@ import type { ICommand } from '../command/ICommand'; export class CommandWrapper implements ICommand { + [toStringMethod]?: () => string; + [asyncToStringMethod]?: () => Promise; + hasRan = false; constructor(readonly cmd: ICommand) { if (hasToStringMethod(cmd)) { const method = cmd[toStringMethod]; - (this as unknown as WithToStringMethod)[toStringMethod] = function toStringMethod(): string { + this[toStringMethod] = function toStringMethod(): string { return method.call(cmd); }; } if (hasAsyncToStringMethod(cmd)) { const method = cmd[asyncToStringMethod]; - (this as unknown as WithAsyncToStringMethod)[asyncToStringMethod] = - function asyncToStringMethod(): Promise { - return method.call(cmd); - }; + this[asyncToStringMethod] = function asyncToStringMethod(): Promise { + return method.call(cmd); + }; } } check(m: Readonly): CheckAsync extends false ? boolean : Promise { diff --git a/packages/fast-check/src/check/model/commands/CommandsIterable.ts b/packages/fast-check/src/check/model/commands/CommandsIterable.ts index ecd9fb7cec8..a4b855b4107 100644 --- a/packages/fast-check/src/check/model/commands/CommandsIterable.ts +++ b/packages/fast-check/src/check/model/commands/CommandsIterable.ts @@ -1,4 +1,4 @@ -import { cloneMethod, WithCloneMethod } from '../../symbols'; +import { cloneMethod } from '../../symbols'; import type { CommandWrapper } from './CommandWrapper'; /** @@ -14,6 +14,12 @@ export class CommandsIterable> { return this.commands[Symbol.iterator](); } + [cloneMethod](): CommandsIterable { + return new CommandsIterable( + this.commands.map((c) => c.clone()), + this.metadataForReplay, + ); + } toString(): string { const serializedCommands = this.commands .filter((c) => c.hasRan) @@ -23,17 +29,3 @@ export class CommandsIterable)[cloneMethod] = - function ( - this: CommandsIterable, - ): CommandsIterable { - return new CommandsIterable( - this.commands.map((c) => c.clone()), - this.metadataForReplay, - ); - }; From 26861e42c3d98721defbd72899163034e7932dc5 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Sat, 10 Aug 2024 09:21:30 +0000 Subject: [PATCH 10/23] Dropping isolatedDeclarations for fc --- packages/fast-check/tsconfig.json | 5 ++++- packages/fast-check/tsconfig.publish.types.json | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/fast-check/tsconfig.json b/packages/fast-check/tsconfig.json index 51bf44c3454..d9d57199ff6 100644 --- a/packages/fast-check/tsconfig.json +++ b/packages/fast-check/tsconfig.json @@ -1,3 +1,6 @@ { - "extends": "../../tsconfig.common.json" + "extends": "../../tsconfig.common.json", + "compilerOptions": { + "isolatedDeclarations": false + } } diff --git a/packages/fast-check/tsconfig.publish.types.json b/packages/fast-check/tsconfig.publish.types.json index db9f4fc2a17..b691e239a2d 100644 --- a/packages/fast-check/tsconfig.publish.types.json +++ b/packages/fast-check/tsconfig.publish.types.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig.publish.types.json", "compilerOptions": { - "outDir": "lib/types/" + "outDir": "lib/types/", + "isolatedDeclarations": false }, "include": ["src/"] } From 98851bc2c5f9a66b717df65d4f9c1c27ed263295 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 28 Nov 2024 19:11:22 +0000 Subject: [PATCH 11/23] drop useless, targeting next major rather than minor --- packages/fast-check/tsconfig.json | 4 +--- packages/fast-check/tsconfig.publish.types.json | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/fast-check/tsconfig.json b/packages/fast-check/tsconfig.json index d9d57199ff6..8457f39769a 100644 --- a/packages/fast-check/tsconfig.json +++ b/packages/fast-check/tsconfig.json @@ -1,6 +1,4 @@ { "extends": "../../tsconfig.common.json", - "compilerOptions": { - "isolatedDeclarations": false - } + "compilerOptions": {} } diff --git a/packages/fast-check/tsconfig.publish.types.json b/packages/fast-check/tsconfig.publish.types.json index b691e239a2d..db9f4fc2a17 100644 --- a/packages/fast-check/tsconfig.publish.types.json +++ b/packages/fast-check/tsconfig.publish.types.json @@ -1,8 +1,7 @@ { "extends": "../../tsconfig.publish.types.json", "compilerOptions": { - "outDir": "lib/types/", - "isolatedDeclarations": false + "outDir": "lib/types/" }, "include": ["src/"] } From 2d1d7e129fb3ce486cbd984545d36f013be496c8 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 28 Nov 2024 19:13:45 +0000 Subject: [PATCH 12/23] oups useless --- packages/fast-check/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/fast-check/tsconfig.json b/packages/fast-check/tsconfig.json index 8457f39769a..51bf44c3454 100644 --- a/packages/fast-check/tsconfig.json +++ b/packages/fast-check/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "../../tsconfig.common.json", - "compilerOptions": {} + "extends": "../../tsconfig.common.json" } From c18bd707a76f62537150c63bae1d9a8f898261a9 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 00:31:07 +0000 Subject: [PATCH 13/23] fix --- .../src/check/model/commands/CommandWrapper.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/fast-check/src/check/model/commands/CommandWrapper.ts b/packages/fast-check/src/check/model/commands/CommandWrapper.ts index d859e07b6a0..cef31d06a85 100644 --- a/packages/fast-check/src/check/model/commands/CommandWrapper.ts +++ b/packages/fast-check/src/check/model/commands/CommandWrapper.ts @@ -4,6 +4,7 @@ import { hasToStringMethod, toStringMethod, } from '../../../utils/stringify'; +import type { WithToStringMethod, WithAsyncToStringMethod } from '../../../utils/stringify'; import { cloneMethod, hasCloneMethod } from '../../symbols'; import type { ICommand } from '../command/ICommand'; @@ -14,22 +15,20 @@ import type { ICommand } from '../command/ICommand'; export class CommandWrapper implements ICommand { - [toStringMethod]?: () => string; - [asyncToStringMethod]?: () => Promise; - hasRan = false; constructor(readonly cmd: ICommand) { if (hasToStringMethod(cmd)) { const method = cmd[toStringMethod]; - this[toStringMethod] = function toStringMethod(): string { + (this as unknown as WithToStringMethod)[toStringMethod] = function toStringMethod(): string { return method.call(cmd); }; } if (hasAsyncToStringMethod(cmd)) { const method = cmd[asyncToStringMethod]; - this[asyncToStringMethod] = function asyncToStringMethod(): Promise { - return method.call(cmd); - }; + (this as unknown as WithAsyncToStringMethod)[asyncToStringMethod] = + function asyncToStringMethod(): Promise { + return method.call(cmd); + }; } } check(m: Readonly): CheckAsync extends false ? boolean : Promise { From d96ce5c70f364ca4c9df6e120863f5f8562696ff Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 00:37:33 +0000 Subject: [PATCH 14/23] fix --- .../check/model/commands/CommandsIterable.ts | 18 +++++++++++------- packages/fast-check/src/utils/globals.ts | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/fast-check/src/check/model/commands/CommandsIterable.ts b/packages/fast-check/src/check/model/commands/CommandsIterable.ts index a4b855b4107..6b6df54d7e7 100644 --- a/packages/fast-check/src/check/model/commands/CommandsIterable.ts +++ b/packages/fast-check/src/check/model/commands/CommandsIterable.ts @@ -1,4 +1,5 @@ import { cloneMethod } from '../../symbols'; +import type { WithCloneMethod } from '../../symbols'; import type { CommandWrapper } from './CommandWrapper'; /** @@ -10,16 +11,19 @@ export class CommandsIterable[], readonly metadataForReplay: () => string, - ) {} + ) { + (this as unknown as WithCloneMethod)[cloneMethod] = function ( + this: CommandsIterable, + ): CommandsIterable { + return new CommandsIterable( + this.commands.map((c) => c.clone()), + this.metadataForReplay, + ); + }; + } [Symbol.iterator](): Iterator> { return this.commands[Symbol.iterator](); } - [cloneMethod](): CommandsIterable { - return new CommandsIterable( - this.commands.map((c) => c.clone()), - this.metadataForReplay, - ); - } toString(): string { const serializedCommands = this.commands .filter((c) => c.hasRan) diff --git a/packages/fast-check/src/utils/globals.ts b/packages/fast-check/src/utils/globals.ts index eaeaec3eea3..9321cf95df1 100644 --- a/packages/fast-check/src/utils/globals.ts +++ b/packages/fast-check/src/utils/globals.ts @@ -42,9 +42,9 @@ const SUint32Array: typeof Uint32Array = Uint32Array; export { SUint32Array as Uint32Array }; const SencodeURIComponent: typeof encodeURIComponent = encodeURIComponent; export { SencodeURIComponent as encodeURIComponent }; -const SMap = Map; +const SMap: MapConstructor = Map; export { SMap as Map }; -const SSymbol = Symbol; +const SSymbol: SymbolConstructor = Symbol; export { SSymbol as Symbol }; // Various remarks concerning this part of the file: From d06446d2ec26c4a8e3e58ef20c52023c6aad6479 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:53:47 +0100 Subject: [PATCH 15/23] Create blue-glasses-love.md --- .changeset/blue-glasses-love.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/blue-glasses-love.md diff --git a/.changeset/blue-glasses-love.md b/.changeset/blue-glasses-love.md new file mode 100644 index 00000000000..2c2afe30a88 --- /dev/null +++ b/.changeset/blue-glasses-love.md @@ -0,0 +1,5 @@ +--- +"fast-check": major +--- + +🔧 Toggle on `isolatedDeclarations` flag on the project From e6751f053dc0721e388e8c6fe26bdd833b9407a0 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:04:18 +0000 Subject: [PATCH 16/23] doc --- website/docs/migration/from-3.x-to-4.x.md | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/website/docs/migration/from-3.x-to-4.x.md b/website/docs/migration/from-3.x-to-4.x.md index 2ede7b017b9..3e386ed71a9 100644 --- a/website/docs/migration/from-3.x-to-4.x.md +++ b/website/docs/migration/from-3.x-to-4.x.md @@ -310,3 +310,40 @@ stringify(Object.assign(Object.create(null), { a: 1 })); // '{__proto__:null,"a" This change is unlikely to impact most users. However, we are highlighting it for advanced users who might rely on custom reporting capabilities or stringifier behavior to meet specific needs. Related pull requests: [#5603](https://github.com/dubzzz/fast-check/pull/5603) + +### Remove certain Symbol-based typings for commands + +In previous versions, the typings for `CommandWrapper` included methods on the symbols `toStringMethod` and `asyncToStringMethod`. While these methods will still exist in JavaScript in v4, they will no longer be exposed in the TypeScript typings. As a result, the declared type will change as follows: + +```diff +export declare class CommandWrapper + implements ICommand +{ + readonly cmd: ICommand; +- [toStringMethod]?: () => string; +- [asyncToStringMethod]?: () => Promise; + hasRan: boolean; + constructor(cmd: ICommand); + check(m: Readonly): CheckAsync extends false ? boolean : Promise; + run(m: Model, r: Real): RunResult; + clone(): CommandWrapper; + toString(): string; +} +``` + +A similar change affects `CommandsIterable`, where the `cloneMethod` symbol will no longer be included in the typings: + +```diff +export declare class CommandsIterable + implements Iterable> +{ + readonly commands: CommandWrapper[]; + readonly metadataForReplay: () => string; + constructor(commands: CommandWrapper[], metadataForReplay: () => string); + [Symbol.iterator](): Iterator>; +- [cloneMethod](): CommandsIterable; + toString(): string; +} +``` + +Related pull requests: [#5136](https://github.com/dubzzz/fast-check/pull/5136) From c2a2f43d942feda04956bfe2780ccce7ece6f802 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:32:42 +0000 Subject: [PATCH 17/23] fix typecheck --- .../_internals/helpers/FloatHelpers.ts | 6 +++--- .../helpers/NoUndefinedAsContext.ts | 2 +- .../_internals/mappers/IndexToCharString.ts | 2 +- packages/fast-check/test/e2e/seed.ts | 2 +- .../__test-helpers__/FloatingPointHelpers.ts | 20 +++++++++++++++++-- .../arbitrary/__test-helpers__/SizeHelpers.ts | 15 +++++++------- .../model/commands/CommandsIterable.spec.ts | 11 ++++++++-- packages/jest/vitest.config.ts | 4 +++- packages/vitest/vitest.config.ts | 4 +++- 9 files changed, 47 insertions(+), 19 deletions(-) diff --git a/packages/fast-check/src/arbitrary/_internals/helpers/FloatHelpers.ts b/packages/fast-check/src/arbitrary/_internals/helpers/FloatHelpers.ts index de9e3fceea3..075af835c6e 100644 --- a/packages/fast-check/src/arbitrary/_internals/helpers/FloatHelpers.ts +++ b/packages/fast-check/src/arbitrary/_internals/helpers/FloatHelpers.ts @@ -2,11 +2,11 @@ const safeNegativeInfinity = Number.NEGATIVE_INFINITY; const safePositiveInfinity = Number.POSITIVE_INFINITY; /** @internal */ -export const MIN_VALUE_32 = 2 ** -126 * 2 ** -23; +export const MIN_VALUE_32: number = 2 ** -126 * 2 ** -23; /** @internal */ -export const MAX_VALUE_32 = 2 ** 127 * (1 + (2 ** 23 - 1) / 2 ** 23); +export const MAX_VALUE_32: number = 2 ** 127 * (1 + (2 ** 23 - 1) / 2 ** 23); /** @internal */ -export const EPSILON_32 = 2 ** -23; +export const EPSILON_32: number = 2 ** -23; /** @internal */ const INDEX_POSITIVE_INFINITY = 2139095040; // floatToIndex(MAX_VALUE_32) + 1; diff --git a/packages/fast-check/src/arbitrary/_internals/helpers/NoUndefinedAsContext.ts b/packages/fast-check/src/arbitrary/_internals/helpers/NoUndefinedAsContext.ts index 6d2bad22901..187320964d6 100644 --- a/packages/fast-check/src/arbitrary/_internals/helpers/NoUndefinedAsContext.ts +++ b/packages/fast-check/src/arbitrary/_internals/helpers/NoUndefinedAsContext.ts @@ -1,7 +1,7 @@ import { Value } from '../../../check/arbitrary/definition/Value'; /** @internal */ -export const UndefinedContextPlaceholder = Symbol('UndefinedContextPlaceholder'); +export const UndefinedContextPlaceholder: unique symbol = Symbol('UndefinedContextPlaceholder'); /** @internal */ export function noUndefinedAsContext(value: Value): Value { diff --git a/packages/fast-check/src/arbitrary/_internals/mappers/IndexToCharString.ts b/packages/fast-check/src/arbitrary/_internals/mappers/IndexToCharString.ts index 8bb3f3c07ae..69f88719ae2 100644 --- a/packages/fast-check/src/arbitrary/_internals/mappers/IndexToCharString.ts +++ b/packages/fast-check/src/arbitrary/_internals/mappers/IndexToCharString.ts @@ -1,7 +1,7 @@ import { safeCharCodeAt } from '../../../utils/globals'; /** @internal */ -export const indexToCharStringMapper = String.fromCodePoint; +export const indexToCharStringMapper: (...codePoints: number[]) => string = String.fromCodePoint; /** @internal */ export function indexToCharStringUnmapper(c: unknown): number { diff --git a/packages/fast-check/test/e2e/seed.ts b/packages/fast-check/test/e2e/seed.ts index f2a8b47f36d..72c583a3728 100644 --- a/packages/fast-check/test/e2e/seed.ts +++ b/packages/fast-check/test/e2e/seed.ts @@ -7,4 +7,4 @@ const globalSeed = globalConfig.seed; if (process.env.CI && globalSeed === undefined) { throw new Error('seed must be defined globally in CI'); } -export const seed = globalSeed !== undefined ? globalSeed : Date.now(); +export const seed: number = globalSeed !== undefined ? globalSeed : Date.now(); diff --git a/packages/fast-check/test/unit/arbitrary/__test-helpers__/FloatingPointHelpers.ts b/packages/fast-check/test/unit/arbitrary/__test-helpers__/FloatingPointHelpers.ts index b9287e8a4c2..0407ae040e8 100644 --- a/packages/fast-check/test/unit/arbitrary/__test-helpers__/FloatingPointHelpers.ts +++ b/packages/fast-check/test/unit/arbitrary/__test-helpers__/FloatingPointHelpers.ts @@ -17,7 +17,15 @@ export function float64raw(): fc.Arbitrary { .map(([na32, nb32]) => new Float64Array(new Int32Array([na32, nb32]).buffer)[0]); } -export const defaultFloatRecordConstraints = { +export const defaultFloatRecordConstraints: { + min: fc.Arbitrary; + max: fc.Arbitrary; + noDefaultInfinity: fc.Arbitrary; + noNaN: fc.Arbitrary; + noInteger: fc.Arbitrary; + minExcluded: fc.Arbitrary; + maxExcluded: fc.Arbitrary; +} = { min: float32raw(), max: float32raw(), noDefaultInfinity: fc.boolean(), @@ -27,7 +35,15 @@ export const defaultFloatRecordConstraints = { maxExcluded: fc.boolean(), }; -export const defaultDoubleRecordConstraints = { +export const defaultDoubleRecordConstraints: { + min: fc.Arbitrary; + max: fc.Arbitrary; + noDefaultInfinity: fc.Arbitrary; + noNaN: fc.Arbitrary; + noInteger: fc.Arbitrary; + minExcluded: fc.Arbitrary; + maxExcluded: fc.Arbitrary; +} = { min: float64raw(), max: float64raw(), noDefaultInfinity: fc.boolean(), diff --git a/packages/fast-check/test/unit/arbitrary/__test-helpers__/SizeHelpers.ts b/packages/fast-check/test/unit/arbitrary/__test-helpers__/SizeHelpers.ts index ec00902c1f2..6ecdcb4f894 100644 --- a/packages/fast-check/test/unit/arbitrary/__test-helpers__/SizeHelpers.ts +++ b/packages/fast-check/test/unit/arbitrary/__test-helpers__/SizeHelpers.ts @@ -7,20 +7,21 @@ import type { } from '../../../../src/arbitrary/_internals/helpers/MaxLengthFromMinLength'; const allSizeOrdered = ['xsmall', 'small', 'medium', 'large', 'xlarge'] as const; -export const sizeArb = fc.constantFrom(...allSizeOrdered); +export const sizeArb: fc.Arbitrary = fc.constantFrom(...allSizeOrdered); export const isSmallerSize = (sa: Size, sb: Size): boolean => allSizeOrdered.indexOf(sa) < allSizeOrdered.indexOf(sb); const allRelativeSize = ['-4', '-3', '-2', '-1', '=', '+1', '+2', '+3', '+4'] as const; -export const relativeSizeArb = fc.constantFrom(...allRelativeSize); +export const relativeSizeArb: fc.Arbitrary = fc.constantFrom(...allRelativeSize); const allSizeForArbitrary = [...allSizeOrdered, ...allRelativeSize, 'max'] as const; // WARNING: it does not include undefined -export const sizeForArbitraryArb = fc.constantFrom(...allSizeForArbitrary); - -export const sizeRelatedGlobalConfigArb = fc.record( - { baseSize: sizeArb, defaultSizeToMaxWhenMaxSpecified: fc.boolean() }, - { requiredKeys: [] }, +export const sizeForArbitraryArb: fc.Arbitrary = fc.constantFrom( + ...allSizeForArbitrary, ); +export const sizeRelatedGlobalConfigArb: fc.Arbitrary< + Partial<{ baseSize: Size; defaultSizeToMaxWhenMaxSpecified: boolean }> +> = fc.record({ baseSize: sizeArb, defaultSizeToMaxWhenMaxSpecified: fc.boolean() }, { requiredKeys: [] }); + // Type check that helpers are covering all the possibilities const failIfMissingSize: Size extends (typeof allSizeOrdered)[number] ? true : never = true; diff --git a/packages/fast-check/test/unit/check/model/commands/CommandsIterable.spec.ts b/packages/fast-check/test/unit/check/model/commands/CommandsIterable.spec.ts index 6dcde0b15ad..f5d4584c5e1 100644 --- a/packages/fast-check/test/unit/check/model/commands/CommandsIterable.spec.ts +++ b/packages/fast-check/test/unit/check/model/commands/CommandsIterable.spec.ts @@ -4,7 +4,7 @@ import * as fc from 'fast-check'; import { CommandWrapper } from '../../../../../src/check/model/commands/CommandWrapper'; import { CommandsIterable } from '../../../../../src/check/model/commands/CommandsIterable'; import type { Command } from '../../../../../src/check/model/command/Command'; -import { cloneMethod } from '../../../../../src/check/symbols'; +import { cloneMethod, hasCloneMethod } from '../../../../../src/check/symbols'; type Model = Record; type Real = unknown; @@ -38,6 +38,9 @@ describe('CommandsIterable', () => { fc.assert( fc.property(fc.array(fc.boolean()), (runFlags) => { const originalIterable = new CommandsIterable(buildAlreadyRanCommands(runFlags), () => ''); + if (!hasCloneMethod(originalIterable)) { + throw new Error(`Not cloaneable`); + } originalIterable[cloneMethod](); const commands = [...originalIterable]; for (let idx = 0; idx !== runFlags.length; ++idx) { @@ -48,7 +51,11 @@ describe('CommandsIterable', () => { it('Should reset hasRun flag for the clone on clone', () => fc.assert( fc.property(fc.array(fc.boolean()), (runFlags) => { - const commands = [...new CommandsIterable(buildAlreadyRanCommands(runFlags), () => '')[cloneMethod]()]; + const commandsIterable = new CommandsIterable(buildAlreadyRanCommands(runFlags), () => ''); + if (!hasCloneMethod(commandsIterable)) { + throw new Error(`Not cloaneable`); + } + const commands = [...commandsIterable[cloneMethod]()]; for (let idx = 0; idx !== runFlags.length; ++idx) { expect(commands[idx].hasRan).toBe(false); } diff --git a/packages/jest/vitest.config.ts b/packages/jest/vitest.config.ts index f1673dbe922..3b0644e01c0 100644 --- a/packages/jest/vitest.config.ts +++ b/packages/jest/vitest.config.ts @@ -1,11 +1,13 @@ +import { UserConfig } from 'vite'; import { defineConfig } from 'vitest/config'; const major = Number(process.versions.node.split('.')[0]); -export default defineConfig({ +const config: UserConfig = defineConfig({ test: { testTimeout: 60000, // 60s include: ['**/test/*.{test,spec}.?(c|m)[jt]s?(x)'], retry: major === 23 ? 5 : undefined, }, }); +export default config; diff --git a/packages/vitest/vitest.config.ts b/packages/vitest/vitest.config.ts index f1673dbe922..3b0644e01c0 100644 --- a/packages/vitest/vitest.config.ts +++ b/packages/vitest/vitest.config.ts @@ -1,11 +1,13 @@ +import { UserConfig } from 'vite'; import { defineConfig } from 'vitest/config'; const major = Number(process.versions.node.split('.')[0]); -export default defineConfig({ +const config: UserConfig = defineConfig({ test: { testTimeout: 60000, // 60s include: ['**/test/*.{test,spec}.?(c|m)[jt]s?(x)'], retry: major === 23 ? 5 : undefined, }, }); +export default config; From 3bb1ae99ae29187bfcb63db9bbcc4745476ca87e Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:35:38 +0000 Subject: [PATCH 18/23] fix --- .../_internals/implementations/SchedulerImplem.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts b/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts index c5e418afe2b..51e492b872e 100644 --- a/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts +++ b/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts @@ -1,5 +1,5 @@ import { escapeForTemplateString } from '../helpers/TextEscaper'; -import { cloneMethod } from '../../../check/symbols'; +import { cloneMethod, WithCloneMethod } from '../../../check/symbols'; import { stringify } from '../../../utils/stringify'; import type { Scheduler, SchedulerAct, SchedulerReportItem, SchedulerSequenceItem } from '../interfaces/Scheduler'; @@ -49,6 +49,11 @@ export class SchedulerImplem implements Scheduler { this.scheduledTasks = []; this.triggeredTasks = []; this.scheduledWatchers = []; + (this as unknown as WithCloneMethod)[cloneMethod] = function ( + this: SchedulerImplem, + ): Scheduler { + return new SchedulerImplem(this.act, this.sourceTaskSelector); + }; } private static buildLog(reportItem: SchedulerReportItem) { @@ -323,8 +328,4 @@ export class SchedulerImplem implements Scheduler { '`' ); } - - [cloneMethod](): Scheduler { - return new SchedulerImplem(this.act, this.sourceTaskSelector); - } } From e74aea1c2480ae1c5ae6239127d362f64051e6b9 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 02:37:05 +0100 Subject: [PATCH 19/23] Apply suggestions from code review --- packages/jest/vitest.config.ts | 2 +- packages/vitest/vitest.config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jest/vitest.config.ts b/packages/jest/vitest.config.ts index 3b0644e01c0..ef132cdc834 100644 --- a/packages/jest/vitest.config.ts +++ b/packages/jest/vitest.config.ts @@ -1,4 +1,4 @@ -import { UserConfig } from 'vite'; +import type { UserConfig } from 'vite'; import { defineConfig } from 'vitest/config'; const major = Number(process.versions.node.split('.')[0]); diff --git a/packages/vitest/vitest.config.ts b/packages/vitest/vitest.config.ts index 3b0644e01c0..ef132cdc834 100644 --- a/packages/vitest/vitest.config.ts +++ b/packages/vitest/vitest.config.ts @@ -1,4 +1,4 @@ -import { UserConfig } from 'vite'; +import type { UserConfig } from 'vite'; import { defineConfig } from 'vitest/config'; const major = Number(process.versions.node.split('.')[0]); From 6484fc62bfddcf4cb9a3a40c19c380d2a54f0fdb Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:38:54 +0000 Subject: [PATCH 20/23] add missing dep --- packages/jest/package.json | 1 + yarn.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/jest/package.json b/packages/jest/package.json index 4e72a95721c..5befac6d058 100644 --- a/packages/jest/package.json +++ b/packages/jest/package.json @@ -81,6 +81,7 @@ "jest": "^29.7.0", "jest-jasmine2": "^29.7.0", "typescript": "~5.7.3", + "vite": "^6.1.0", "vitest": "^2.1.9" }, "keywords": [ diff --git a/yarn.lock b/yarn.lock index 8538797b279..ed575888f1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3670,6 +3670,7 @@ __metadata: jest: "npm:^29.7.0" jest-jasmine2: "npm:^29.7.0" typescript: "npm:~5.7.3" + vite: "npm:^6.1.0" vitest: "npm:^2.1.9" peerDependencies: "@fast-check/worker": ">=0.0.7 <0.5.0" From ceabecf9d63e50395fc8babd0900e8e5dc91907f Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:44:45 +0000 Subject: [PATCH 21/23] attempt --- packages/jest/vitest.config.ts | 1 + packages/vitest/vitest.config.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/jest/vitest.config.ts b/packages/jest/vitest.config.ts index ef132cdc834..0c672ebb0e0 100644 --- a/packages/jest/vitest.config.ts +++ b/packages/jest/vitest.config.ts @@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'; const major = Number(process.versions.node.split('.')[0]); +// @ts-expect-error - We will fix that one by bumping Vitest to v3 const config: UserConfig = defineConfig({ test: { testTimeout: 60000, // 60s diff --git a/packages/vitest/vitest.config.ts b/packages/vitest/vitest.config.ts index ef132cdc834..0c672ebb0e0 100644 --- a/packages/vitest/vitest.config.ts +++ b/packages/vitest/vitest.config.ts @@ -3,6 +3,7 @@ import { defineConfig } from 'vitest/config'; const major = Number(process.versions.node.split('.')[0]); +// @ts-expect-error - We will fix that one by bumping Vitest to v3 const config: UserConfig = defineConfig({ test: { testTimeout: 60000, // 60s From 2567715e1023d3812e3d648dff944784ef9190fb Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:54:48 +0000 Subject: [PATCH 22/23] type import --- .../arbitrary/_internals/implementations/SchedulerImplem.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts b/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts index 51e492b872e..ca7467a02e2 100644 --- a/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts +++ b/packages/fast-check/src/arbitrary/_internals/implementations/SchedulerImplem.ts @@ -1,5 +1,6 @@ import { escapeForTemplateString } from '../helpers/TextEscaper'; -import { cloneMethod, WithCloneMethod } from '../../../check/symbols'; +import { cloneMethod } from '../../../check/symbols'; +import type { WithCloneMethod } from '../../../check/symbols'; import { stringify } from '../../../utils/stringify'; import type { Scheduler, SchedulerAct, SchedulerReportItem, SchedulerSequenceItem } from '../interfaces/Scheduler'; From bd5ecc886982d093259b987339514fdbed9329a4 Mon Sep 17 00:00:00 2001 From: Nicolas DUBIEN Date: Thu, 6 Feb 2025 01:57:32 +0000 Subject: [PATCH 23/23] fix? --- packages/packaged/package.json | 1 + packages/packaged/vitest.config.ts | 5 ++++- yarn.lock | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/packaged/package.json b/packages/packaged/package.json index db99d107c59..ded732d6848 100644 --- a/packages/packaged/package.json +++ b/packages/packaged/package.json @@ -41,6 +41,7 @@ "@types/npm-packlist": "^7.0.3", "@types/npmcli__arborist": "^6.3.0", "typescript": "~5.7.3", + "vite": "^6.1.0", "vitest": "^2.1.9" }, "keywords": [], diff --git a/packages/packaged/vitest.config.ts b/packages/packaged/vitest.config.ts index 3a6fd784c78..504238436b1 100644 --- a/packages/packaged/vitest.config.ts +++ b/packages/packaged/vitest.config.ts @@ -1,7 +1,10 @@ +import type { UserConfig } from 'vite'; import { defineConfig } from 'vitest/config'; -export default defineConfig({ +// @ts-expect-error - We will fix that one by bumping Vitest to v3 +const config: UserConfig = defineConfig({ test: { include: ['**/test/*.{test,spec}.?(c|m)[jt]s?(x)'], }, }); +export default config; diff --git a/yarn.lock b/yarn.lock index ed575888f1b..b4ae0bd31a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3713,6 +3713,7 @@ __metadata: "@types/npmcli__arborist": "npm:^6.3.0" npm-packlist: "npm:^10.0.0" typescript: "npm:~5.7.3" + vite: "npm:^6.1.0" vitest: "npm:^2.1.9" bin: packaged: ./bin/packaged.js