vitest-pool-assemblyscript 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +22 -8
  2. package/assembly/compare.ts +1 -1
  3. package/assembly/expect.ts +2 -2
  4. package/binding.gyp +4 -4
  5. package/dist/{compile-runner-8h0dBwG2.mjs → compile-runner-xGvQwgNf.mjs} +2 -2
  6. package/dist/{compile-runner-8h0dBwG2.mjs.map → compile-runner-xGvQwgNf.mjs.map} +1 -1
  7. package/dist/config/index-v3.d.mts +2 -2
  8. package/dist/config/index.d.mts +3 -3
  9. package/dist/{custom-provider-options-CF5C1kXb.d.mts → custom-provider-options-CVLz0nAp.d.mts} +2 -2
  10. package/dist/{custom-provider-options-CF5C1kXb.d.mts.map → custom-provider-options-CVLz0nAp.d.mts.map} +1 -1
  11. package/dist/index-internal.d.mts +1 -1
  12. package/dist/index.d.mts +2 -2
  13. package/dist/{load-user-imports-J9eaAW0_.mjs → load-user-imports-Bbmpaciu.mjs} +5 -4
  14. package/dist/{load-user-imports-J9eaAW0_.mjs.map → load-user-imports-Bbmpaciu.mjs.map} +1 -1
  15. package/dist/{pool-runner-init-CEwLyNI3.d.mts → pool-runner-init-8vx-5Pb4.d.mts} +2 -2
  16. package/dist/pool-runner-init-8vx-5Pb4.d.mts.map +1 -0
  17. package/dist/pool-thread/compile-worker-thread.d.mts +1 -1
  18. package/dist/pool-thread/compile-worker-thread.mjs +2 -2
  19. package/dist/pool-thread/test-worker-thread.d.mts +1 -1
  20. package/dist/pool-thread/test-worker-thread.mjs +2 -2
  21. package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
  22. package/dist/pool-thread/v3-tinypool-thread.mjs +3 -3
  23. package/dist/{test-runner-B2BpyPNK.mjs → test-runner-BR4XyhMA.mjs} +2 -2
  24. package/dist/{test-runner-B2BpyPNK.mjs.map → test-runner-BR4XyhMA.mjs.map} +1 -1
  25. package/dist/{types-8KKo9Hbf.d.mts → types-DasF0_PX.d.mts} +1 -2
  26. package/dist/types-DasF0_PX.d.mts.map +1 -0
  27. package/package.json +18 -2
  28. package/prebuilds/linux-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  29. package/prebuilds/linux-x64/vitest-pool-assemblyscript.musl.node +0 -0
  30. package/scripts/setup-binaryen.js +253 -79
  31. package/src/native-instrumentation/addon.cpp +2 -2
  32. package/dist/pool-runner-init-CEwLyNI3.d.mts.map +0 -1
  33. package/dist/types-8KKo9Hbf.d.mts.map +0 -1
package/README.md CHANGED
@@ -160,7 +160,7 @@ export default defineConfig({
160
160
  ### vitest 3.2.x Multiple-Project Config:
161
161
  ```typescript
162
162
  import { defineConfig, defineProject } from 'vitest/config';
163
- import { defineAssemblyScriptProject } from 'vitest-pool-assemblyscript/config';
163
+ import { defineAssemblyScriptProject } from 'vitest-pool-assemblyscript/v3/config';
164
164
 
165
165
  export default defineConfig({
166
166
  test: {
@@ -193,7 +193,7 @@ export default defineConfig({
193
193
 
194
194
  ### vitest 3.2.x Single-Project Config:
195
195
  ```typescript
196
- import { defineAssemblyScriptConfig } from 'vitest-pool-assemblyscript/config';
196
+ import { defineAssemblyScriptConfig } from 'vitest-pool-assemblyscript/v3/config';
197
197
 
198
198
  export default defineAssemblyScriptConfig({
199
199
  test: {
@@ -396,6 +396,8 @@ expect(1 + 1).toBe(2);
396
396
  expect("hello").toBe("hello");
397
397
  ```
398
398
 
399
+ > ⚠️ IMPORTANT: this matcher is currently too permissive with type comparison - it deems some numeric values of different types to be the same when they shouldn't actually be. The `toEqual()` matcher is more appropriate for these permissive sementics. Fix coming soon!
400
+
399
401
  ### `toBeCloseTo()`
400
402
  Checks if a floating point value is close to what you expect. Using exact equality with floating point numbers often doesn't work correctly, because small internal rounding occurs to be able to represent floats in binary. This rounding means intuitive comparisons will often fail.
401
403
 
@@ -412,7 +414,8 @@ Checks that two values have the same value (deep equality). Currently supports c
412
414
 
413
415
  Primitives, strings, and other object references are compared with `toBe()` rules.
414
416
 
415
- > ⚠️ Warning: Does not yet support user-defined object deep equality checking
417
+ > ⚠️ IMPORTANT: Does not yet support user-defined object deep equality checking. Coming soon!
418
+
416
419
  ```typescript
417
420
  expect([1, 2, 3]).toEqual([1, 2, 3]);
418
421
  expect(["one", "two", "three"]).toEqual(["one", "two", "three"]);
@@ -428,15 +431,22 @@ Alias for `toEqual()`. Currently no differences in AssemblyScript.
428
431
 
429
432
  ### `toBeTruthy()` & `toBeFalsey()`
430
433
  Check that a value is truthy or falsey. Falsey values are `0`, `false`, `""`, and `null`.
434
+
431
435
  ```typescript
432
436
  expect(1).toBeTruthy();
433
- expect(0).toBeFalsey();
434
437
  expect("hello").toBeTruthy();
435
- expect("").toBeFalsey();
438
+ expect("").toBeTruthy(); // <-- Empty String is TRUTHY in AS!
439
+
440
+ expect(0).toBeFalsey();
441
+ expect(NaN).toBeFalsey();
442
+ expect(null).toBeFalsey();
436
443
  ```
437
444
 
445
+ >⚠️ AS Quirk: Unlike in JavaScript, empty string is truthy in AssemblyScript because it is an object reference, not a primitive. An empty string is still an allocated object with a non-zero address, so it evaluates as truthy!
446
+
438
447
  ### `toBeNull()`
439
448
  Checks that a value is null (`usize(0)` in AssemblyScript).
449
+
440
450
  ```typescript
441
451
  const val: string | null = null;
442
452
  expect(val).toBeNull();
@@ -447,6 +457,7 @@ expect(false).not.toBeNull();
447
457
 
448
458
  ### `toBeNullable()`
449
459
  Checks that the type of the value is nullable (can hold `null`). This is a type-level check, not a value check — use `toBeNull()` to check if a value *is* null.
460
+
450
461
  ```typescript
451
462
  const val: string | null = null;
452
463
  expect(val).toBeNullable();
@@ -455,6 +466,7 @@ expect("hello").not.toBeNullable();
455
466
 
456
467
  ### `toBeNaN()`
457
468
  Checks that a floating point value is `NaN`.
469
+
458
470
  ```typescript
459
471
  expect(NaN).toBeNaN();
460
472
  expect(1.0).not.toBeNaN();
@@ -462,6 +474,7 @@ expect(1.0).not.toBeNaN();
462
474
 
463
475
  ### `toHaveLength()`
464
476
  Checks that an array or array-like value has the expected length.
477
+
465
478
  ```typescript
466
479
  expect([1, 2, 3]).toHaveLength(3);
467
480
  expect([]).toHaveLength(0);
@@ -471,14 +484,15 @@ expect("hello world").toHaveLength(11);
471
484
  ### `toThrowError()`
472
485
  Checks that a function throws an error when called. Optionally checks that the error message matches the provided string. Also available as `toThrow()`.
473
486
 
474
- >⚠️ Important: You must provide a void callback to expect() when using `toThrowError()`
475
-
476
- >ℹ️ Note: `toThrowError()` does not accept inversion using `expect().not.toThrowError()`
477
487
  ```typescript
478
488
  expect(() => { throw new Error("boom"); }).toThrowError();
479
489
  expect(() => { throw new Error("boom"); }).toThrowError("boom");
480
490
  ```
481
491
 
492
+ >⚠️ AS Quirk: You must provide a callback with a non-inferred type to expect() when using `toThrowError()`, e.g. `expect(() => { returnsNumber(); })` (definitely void) or `expect((): i32 => returnsNumber())` (explicit type)
493
+
494
+ >ℹ️ Note: `toThrowError()` does not accept inversion using `expect().not.toThrowError()`
495
+
482
496
  ### Planned Matchers
483
497
  `toBeDefined`, `toBeUndefined`, `toBeGreaterThan`, `toBeGreaterThanOrEqual`, `toBeLessThan`, `toBeLessThanOrEqual`, `toContain`, `toContainEqual`
484
498
 
@@ -190,7 +190,7 @@ export function equals<T, U>(actual: T, expected: U): bool {
190
190
  }
191
191
 
192
192
  export function truthyOrFalsey<T>(actual: T, expected: bool): bool {
193
- return !!actual == expected;
193
+ return actual ? expected == true : expected == false;
194
194
  }
195
195
 
196
196
  export function isNull<T>(value: T): bool {
@@ -33,7 +33,7 @@ declare function __end_expect_throw(): void;
33
33
 
34
34
 
35
35
  function itemMessageString<T>(item: T): string {
36
- if (isNull(item)) return "<null>";
36
+ if (isNull(item)) return "null";
37
37
  if (nan(item)) return "NaN";
38
38
 
39
39
  if (isReference<T>()) {
@@ -53,7 +53,7 @@ function itemMessageString<T>(item: T): string {
53
53
 
54
54
  function arrayMessageString<T extends ArrayLike<unknown>>(array: T): string {
55
55
  if (isNullable<T>(array) && array == null) {
56
- return "<null>";
56
+ return "null";
57
57
  }
58
58
 
59
59
  let str = "[";
package/binding.gyp CHANGED
@@ -27,7 +27,7 @@
27
27
  "-lpthread"
28
28
  ],
29
29
  # Enable C++ exceptions (node-gyp disables them by default)
30
- "cflags_cc": ["-std=c++17", "-fexceptions", "-O3"],
30
+ "cflags_cc": ["-std=c++20", "-fexceptions", "-O3"],
31
31
  "cflags!": ["-fno-exceptions"],
32
32
  "cflags_cc!": ["-fno-exceptions"]
33
33
  }],
@@ -38,9 +38,9 @@
38
38
  "xcode_settings": {
39
39
  "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
40
40
  "CLANG_CXX_LIBRARY": "libc++",
41
- # Minimum macOS deployment target for C++17 support
41
+ # Minimum macOS deployment target for C++20 support
42
42
  "MACOSX_DEPLOYMENT_TARGET": "10.15",
43
- "OTHER_CPLUSPLUSFLAGS": ["-std=c++17", "-fexceptions", "-O3"]
43
+ "OTHER_CPLUSPLUSFLAGS": ["-std=c++20", "-fexceptions", "-O3"]
44
44
  }
45
45
  }],
46
46
  ["OS=='win'", {
@@ -52,7 +52,7 @@
52
52
  "VCCLCompilerTool": {
53
53
  # Enable C++ exception handling (/EHsc)
54
54
  "ExceptionHandling": 1,
55
- "AdditionalOptions": ["/std:c++17"]
55
+ "AdditionalOptions": ["/std:c++20"]
56
56
  }
57
57
  }
58
58
  }]
@@ -2,7 +2,7 @@ import { POOL_ERROR_NAMES, POOL_INTERNAL_PATHS } from "./constants-CA50WBdr.mjs"
2
2
  import { createPoolErrorFromAnyError, debug, getTestErrorFromPoolError } from "./debug-IeEHsxy0.mjs";
3
3
  import { failFile, getFullTaskHierarchy, prepareFileTaskForCollection } from "./vitest-file-tasks-BUwzh375.mjs";
4
4
  import { getTaskLogLabel, getTaskLogPrefix } from "./vitest-tasks-BKS7689f.mjs";
5
- import { executeWASMDiscovery, flushRpcUpdates, reportFileCollected, reportFileError, reportFileQueued, reportUserConsoleLogs } from "./load-user-imports-J9eaAW0_.mjs";
5
+ import { executeWASMDiscovery, flushRpcUpdates, reportFileCollected, reportFileError, reportFileQueued, reportUserConsoleLogs } from "./load-user-imports-Bbmpaciu.mjs";
6
6
  import { compileAssemblyScript } from "./compiler-CN6BRK_N.mjs";
7
7
  import { basename, relative } from "node:path";
8
8
 
@@ -77,4 +77,4 @@ async function runCompileAndDiscover(file, logModule, rpc, poolOptions, projectR
77
77
 
78
78
  //#endregion
79
79
  export { runCompileAndDiscover };
80
- //# sourceMappingURL=compile-runner-8h0dBwG2.mjs.map
80
+ //# sourceMappingURL=compile-runner-xGvQwgNf.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-runner-8h0dBwG2.mjs","names":[],"sources":["../src/pool-thread/runner/compile-runner.ts"],"sourcesContent":["/**\n * Worker thread test runner logic for AssemblyScript Pool\n */\n\nimport { basename, relative } from 'node:path';\nimport type { File } from '@vitest/runner/types';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\n\nimport type {\n AssemblyScriptCompilerOptions,\n AssemblyScriptConsoleLog,\n AssemblyScriptConsoleLogHandler,\n InstrumentationOptions,\n ResolvedAssemblyScriptPoolOptions,\n ThreadImports,\n WASMCompilation,\n WorkerRPC,\n} from '../../types/types.js';\nimport {\n ASSEMBLYSCRIPT_LIB_PREFIX,\n POOL_ERROR_NAMES,\n POOL_INTERNAL_PATHS,\n} from '../../types/constants.js';\nimport { executeWASMDiscovery } from '../../wasm-executor/index.js';\nimport { debug } from '../../util/debug.js';\nimport {\n reportFileQueued,\n reportFileCollected,\n reportUserConsoleLogs,\n flushRpcUpdates,\n reportFileError,\n} from '../rpc-reporter.js';\nimport { createPoolErrorFromAnyError, getTestErrorFromPoolError } from '../../util/pool-errors.js';\nimport { compileAssemblyScript } from '../../compiler/index.js';\nimport {\n getTaskLogLabel,\n getTaskLogPrefix,\n} from '../../util/vitest-tasks.js';\nimport {\n failFile,\n getFullTaskHierarchy,\n prepareFileTaskForCollection,\n} from '../../util/vitest-file-tasks.js';\n\nlet threadCompilationCount: number = 0;\n\nexport async function runCompileAndDiscover(\n file: File,\n logModule: string,\n rpc: WorkerRPC,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n projectRoot: string,\n collectCoverage: boolean,\n relativeUserCoverageExclusions: string[],\n threadImports: ThreadImports,\n diffOptions?: SerializedDiffOptions,\n testNamePattern?: RegExp,\n allowOnly?: boolean,\n): Promise<WASMCompilation | undefined> {\n const base = basename(file.filepath);\n const fileLogPrefix = getTaskLogPrefix(logModule, base, file);\n const fileLogLabel = getTaskLogLabel(base, file);\n\n debug(`${fileLogPrefix} - Beginning runCompileAndDiscover for \"${file.filepath}\" at ${Date.now()}`);\n\n const runStart = performance.now();\n let compilation: WASMCompilation | undefined;\n\n try {\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n\n // TODO - move to options helpers\n const relativeTestFilePath = relative(projectRoot, file.filepath);\n const instrumentationOptions: InstrumentationOptions = {\n relativeExcludedFiles: [\n relativeTestFilePath,\n ...POOL_INTERNAL_PATHS,\n ...relativeUserCoverageExclusions,\n ],\n excludedLibraryFilePrefix: ASSEMBLYSCRIPT_LIB_PREFIX,\n coverageMemoryPagesMin: poolOptions.coverageMemoryPagesInitial,\n coverageMemoryPagesMax: poolOptions.coverageMemoryPagesMax,\n };\n const compilerOptions: AssemblyScriptCompilerOptions = {\n stripInline: poolOptions.stripInline,\n projectRoot: projectRoot,\n shouldInstrument: collectCoverage,\n instrumentationOptions,\n extraFlags: poolOptions.extraCompilerFlags\n };\n\n const { binary, sourceMap, debugInfo, compileTiming } = await compileAssemblyScript(\n file.filepath,\n compilerOptions,\n logModule,\n fileLogLabel\n );\n file.setupDuration = compileTiming;\n threadCompilationCount++;\n\n debug(`${fileLogPrefix} - TIMING compileAssemblyScript total `\n + `(thread comp # ${threadCompilationCount}): ${compileTiming.toFixed(2)} ms`\n );\n \n const logMessages: AssemblyScriptConsoleLog[] = [];\n const handleLog: AssemblyScriptConsoleLogHandler = (msg: string, isError: boolean = false): void => {\n logMessages.push({ msg, time: Date.now(), isError });\n };\n \n const discoverStart = performance.now();\n\n await executeWASMDiscovery(\n binary,\n sourceMap,\n base,\n poolOptions,\n collectCoverage,\n handleLog,\n file,\n logModule,\n threadImports,\n diffOptions\n );\n\n // set skips when using only and/or user test name pattern, skip file task if all tests skipped\n prepareFileTaskForCollection(file, testNamePattern, allowOnly);\n\n file.collectDuration = performance.now() - discoverStart;\n debug(`${fileLogPrefix} - TIMING Discovery Phase: ${file.collectDuration.toFixed(2)} ms`);\n\n // vitest collect - report discovery results\n await Promise.all([\n // Report user console logs\n reportUserConsoleLogs(rpc, logMessages, logModule, base, file),\n\n // Report onCollected with collected and filtered tasks\n reportFileCollected(rpc, file, logModule, fileLogLabel),\n ]);\n\n debug(() => `${fileLogPrefix} - Collected Test Suite Hierarchy:\\n${getFullTaskHierarchy(file)}`);\n\n const totalTime = performance.now() - runStart;\n debug(`${fileLogPrefix} - TIMING Compilation and Discovery: ${totalTime.toFixed(2)} ms`);\n\n compilation = {\n filePath: file.filepath,\n binary,\n sourceMap,\n debugInfo,\n };\n } catch (error) {\n const poolError = createPoolErrorFromAnyError(\n `${fileLogLabel} - runCompileAndDiscover failure in worker`,\n POOL_ERROR_NAMES.WASMExecutionHarnessError,\n error\n );\n const testError = getTestErrorFromPoolError(poolError);\n\n failFile(file, testError, runStart);\n\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n await reportFileError(rpc, file, logModule, fileLogLabel);\n\n debug(`${fileLogPrefix} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n debug(`${fileLogPrefix} - runCompileAndDiscover Completed`);\n }\n\n return compilation;\n}\n"],"mappings":";;;;;;;;;;;;AA4CA,IAAI,yBAAiC;AAErC,eAAsB,sBACpB,MACA,WACA,KACA,aACA,aACA,iBACA,gCACA,eACA,aACA,iBACA,WACsC;CACtC,MAAM,OAAO,SAAS,KAAK,SAAS;CACpC,MAAM,gBAAgB,iBAAiB,WAAW,MAAM,KAAK;CAC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G,UACkC,QAAQ,EAAE,CAAC,KAAK;AAExF,gBAAc;GACZ,UAAU,KAAK;GACf;GACA;GACA;GACD;UACM,OAAO;AAQd,WAAS,MAFS,0BALA,4BAChB,GAAG,aAAa,6CAChB,iBAAiB,2BACjB,MACD,CACqD,EAE5B,SAAS;AAEnC,QAAM,iBAAiB,KAAK,MAAM,WAAW,aAAa;AAC1D,QAAM,gBAAgB,KAAK,MAAM,WAAW,aAAa;AAEzD,QAAM,GAAG,cAAc,wBAAwB;WACvC;AACR,QAAM,gBAAgB,IAAI;AAC1B,QAAM,GAAG,cAAc,oCAAoC;;AAG7D,QAAO"}
1
+ {"version":3,"file":"compile-runner-xGvQwgNf.mjs","names":[],"sources":["../src/pool-thread/runner/compile-runner.ts"],"sourcesContent":["/**\n * Worker thread test runner logic for AssemblyScript Pool\n */\n\nimport { basename, relative } from 'node:path';\nimport type { File } from '@vitest/runner/types';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\n\nimport type {\n AssemblyScriptCompilerOptions,\n AssemblyScriptConsoleLog,\n AssemblyScriptConsoleLogHandler,\n InstrumentationOptions,\n ResolvedAssemblyScriptPoolOptions,\n ThreadImports,\n WASMCompilation,\n WorkerRPC,\n} from '../../types/types.js';\nimport {\n ASSEMBLYSCRIPT_LIB_PREFIX,\n POOL_ERROR_NAMES,\n POOL_INTERNAL_PATHS,\n} from '../../types/constants.js';\nimport { executeWASMDiscovery } from '../../wasm-executor/index.js';\nimport { debug } from '../../util/debug.js';\nimport {\n reportFileQueued,\n reportFileCollected,\n reportUserConsoleLogs,\n flushRpcUpdates,\n reportFileError,\n} from '../rpc-reporter.js';\nimport { createPoolErrorFromAnyError, getTestErrorFromPoolError } from '../../util/pool-errors.js';\nimport { compileAssemblyScript } from '../../compiler/index.js';\nimport {\n getTaskLogLabel,\n getTaskLogPrefix,\n} from '../../util/vitest-tasks.js';\nimport {\n failFile,\n getFullTaskHierarchy,\n prepareFileTaskForCollection,\n} from '../../util/vitest-file-tasks.js';\n\nlet threadCompilationCount: number = 0;\n\nexport async function runCompileAndDiscover(\n file: File,\n logModule: string,\n rpc: WorkerRPC,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n projectRoot: string,\n collectCoverage: boolean,\n relativeUserCoverageExclusions: string[],\n threadImports: ThreadImports,\n diffOptions?: SerializedDiffOptions,\n testNamePattern?: RegExp,\n allowOnly?: boolean,\n): Promise<WASMCompilation | undefined> {\n const base = basename(file.filepath);\n const fileLogPrefix = getTaskLogPrefix(logModule, base, file);\n const fileLogLabel = getTaskLogLabel(base, file);\n\n debug(`${fileLogPrefix} - Beginning runCompileAndDiscover for \"${file.filepath}\" at ${Date.now()}`);\n\n const runStart = performance.now();\n let compilation: WASMCompilation | undefined;\n\n try {\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n\n // TODO - move to options helpers\n const relativeTestFilePath = relative(projectRoot, file.filepath);\n const instrumentationOptions: InstrumentationOptions = {\n relativeExcludedFiles: [\n relativeTestFilePath,\n ...POOL_INTERNAL_PATHS,\n ...relativeUserCoverageExclusions,\n ],\n excludedLibraryFilePrefix: ASSEMBLYSCRIPT_LIB_PREFIX,\n coverageMemoryPagesMin: poolOptions.coverageMemoryPagesInitial,\n coverageMemoryPagesMax: poolOptions.coverageMemoryPagesMax,\n };\n const compilerOptions: AssemblyScriptCompilerOptions = {\n stripInline: poolOptions.stripInline,\n projectRoot: projectRoot,\n shouldInstrument: collectCoverage,\n instrumentationOptions,\n extraFlags: poolOptions.extraCompilerFlags\n };\n\n const { binary, sourceMap, debugInfo, compileTiming } = await compileAssemblyScript(\n file.filepath,\n compilerOptions,\n logModule,\n fileLogLabel\n );\n file.setupDuration = compileTiming;\n threadCompilationCount++;\n\n debug(`${fileLogPrefix} - TIMING compileAssemblyScript total `\n + `(thread comp # ${threadCompilationCount}): ${compileTiming.toFixed(2)} ms`\n );\n \n const logMessages: AssemblyScriptConsoleLog[] = [];\n const handleLog: AssemblyScriptConsoleLogHandler = (msg: string, isError: boolean = false): void => {\n logMessages.push({ msg, time: Date.now(), isError });\n };\n \n const discoverStart = performance.now();\n\n await executeWASMDiscovery(\n binary,\n sourceMap,\n base,\n poolOptions,\n collectCoverage,\n handleLog,\n file,\n logModule,\n threadImports,\n diffOptions\n );\n\n // set skips when using only and/or user test name pattern, skip file task if all tests skipped\n prepareFileTaskForCollection(file, testNamePattern, allowOnly);\n\n file.collectDuration = performance.now() - discoverStart;\n debug(`${fileLogPrefix} - TIMING Discovery Phase: ${file.collectDuration.toFixed(2)} ms`);\n\n // vitest collect - report discovery results\n await Promise.all([\n // Report user console logs\n reportUserConsoleLogs(rpc, logMessages, logModule, base, file),\n\n // Report onCollected with collected and filtered tasks\n reportFileCollected(rpc, file, logModule, fileLogLabel),\n ]);\n\n debug(() => `${fileLogPrefix} - Collected Test Suite Hierarchy:\\n${getFullTaskHierarchy(file)}`);\n\n const totalTime = performance.now() - runStart;\n debug(`${fileLogPrefix} - TIMING Compilation and Discovery: ${totalTime.toFixed(2)} ms`);\n\n compilation = {\n filePath: file.filepath,\n binary,\n sourceMap,\n debugInfo,\n };\n } catch (error) {\n const poolError = createPoolErrorFromAnyError(\n `${fileLogLabel} - runCompileAndDiscover failure in worker`,\n POOL_ERROR_NAMES.WASMExecutionHarnessError,\n error\n );\n const testError = getTestErrorFromPoolError(poolError);\n\n failFile(file, testError, runStart);\n\n await reportFileQueued(rpc, file, logModule, fileLogLabel);\n await reportFileError(rpc, file, logModule, fileLogLabel);\n\n debug(`${fileLogPrefix} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n debug(`${fileLogPrefix} - runCompileAndDiscover Completed`);\n }\n\n return compilation;\n}\n"],"mappings":";;;;;;;;;;;;AA4CA,IAAI,yBAAiC;AAErC,eAAsB,sBACpB,MACA,WACA,KACA,aACA,aACA,iBACA,gCACA,eACA,aACA,iBACA,WACsC;CACtC,MAAM,OAAO,SAAS,KAAK,SAAS;CACpC,MAAM,gBAAgB,iBAAiB,WAAW,MAAM,KAAK;CAC7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,UACkC,QAAQ,EAAE,CAAC,KAAK;AAExF,gBAAc;GACZ,UAAU,KAAK;GACf;GACA;GACA;GACD;UACM,OAAO;AAQd,WAAS,MAFS,0BALA,4BAChB,GAAG,aAAa,6CAChB,iBAAiB,2BACjB,MACD,CACqD,EAE5B,SAAS;AAEnC,QAAM,iBAAiB,KAAK,MAAM,WAAW,aAAa;AAC1D,QAAM,gBAAgB,KAAK,MAAM,WAAW,aAAa;AAEzD,QAAM,GAAG,cAAc,wBAAwB;WACvC;AACR,QAAM,gBAAgB,IAAI;AAC1B,QAAM,GAAG,cAAc,oCAAoC;;AAG7D,QAAO"}
@@ -1,5 +1,5 @@
1
- import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-8KKo9Hbf.mjs";
2
- import "../custom-provider-options-CF5C1kXb.mjs";
1
+ import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-DasF0_PX.mjs";
2
+ import "../custom-provider-options-CVLz0nAp.mjs";
3
3
  import { ConfigEnv, UserWorkspaceConfig, ViteUserConfig } from "vitest/config";
4
4
 
5
5
  //#region src/config/config-helpers-v3.d.ts
@@ -1,4 +1,4 @@
1
- import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-8KKo9Hbf.mjs";
2
- import "../custom-provider-options-CF5C1kXb.mjs";
3
- import { createAssemblyScriptPool } from "../pool-runner-init-CEwLyNI3.mjs";
1
+ import { AssemblyScriptPoolOptions, WasmImportsFactory, WasmImportsFactoryInfo } from "../types-DasF0_PX.mjs";
2
+ import "../custom-provider-options-CVLz0nAp.mjs";
3
+ import { createAssemblyScriptPool } from "../pool-runner-init-8vx-5Pb4.mjs";
4
4
  export { type AssemblyScriptPoolOptions, type WasmImportsFactory, type WasmImportsFactoryInfo, createAssemblyScriptPool };
@@ -1,4 +1,4 @@
1
- import { HybridProviderOptions } from "./types-8KKo9Hbf.mjs";
1
+ import { HybridProviderOptions } from "./types-DasF0_PX.mjs";
2
2
  import { CoverageV8Options } from "vitest/node";
3
3
 
4
4
  //#region src/config/custom-provider-options.d.ts
@@ -23,4 +23,4 @@ declare module "vitest/node" {
23
23
  customProviderModule: string;
24
24
  }
25
25
  }
26
- //# sourceMappingURL=custom-provider-options-CF5C1kXb.d.mts.map
26
+ //# sourceMappingURL=custom-provider-options-CVLz0nAp.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"custom-provider-options-CF5C1kXb.d.mts","names":[],"sources":["../src/config/custom-provider-options.ts"],"mappings":";;;;;;AAE2C;;;;;;;;;;;;;YAiB/B,qBAAA,SAA8B,qBAAA,EAAuB,IAAA,CAAK,iBAAA;IAClE,QAAA;IAGD;IAAA,oBAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"custom-provider-options-CVLz0nAp.d.mts","names":[],"sources":["../src/config/custom-provider-options.ts"],"mappings":";;;;;;AAE2C;;;;;;;;;;;;;YAiB/B,qBAAA,SAA8B,qBAAA,EAAuB,IAAA,CAAK,iBAAA;IAClE,QAAA;IAGD;IAAA,oBAAA;EAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { AssemblyScriptCompilerOptions, AssemblyScriptCompilerResult, AssemblyScriptPoolOptions } from "./types-8KKo9Hbf.mjs";
1
+ import { AssemblyScriptCompilerOptions, AssemblyScriptCompilerResult, AssemblyScriptPoolOptions } from "./types-DasF0_PX.mjs";
2
2
 
3
3
  //#region src/compiler/index.d.ts
4
4
  /**
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import "./types-8KKo9Hbf.mjs";
2
- import { createAssemblyScriptPool } from "./pool-runner-init-CEwLyNI3.mjs";
1
+ import "./types-DasF0_PX.mjs";
2
+ import { createAssemblyScriptPool } from "./pool-runner-init-8vx-5Pb4.mjs";
3
3
  export { createAssemblyScriptPool };
@@ -5,6 +5,7 @@ import { basename, resolve } from "node:path";
5
5
  import { createBirpc } from "birpc";
6
6
  import { diff } from "@vitest/utils/diff";
7
7
  import { SourceMapConsumer } from "source-map";
8
+ import { pathToFileURL } from "node:url";
8
9
 
9
10
  //#region src/util/assemblyscript/binding-helpers.ts
10
11
  const STRING_EXTRACT_CHUNK_SIZE = 1024;
@@ -783,19 +784,19 @@ async function flushRpcUpdates(rpc) {
783
784
  //#region src/pool-thread/load-user-imports.ts
784
785
  async function loadUserWasmImportsFactory(relativePath, projectRoot, logModule) {
785
786
  if (!relativePath) return;
786
- const path = resolve(projectRoot, relativePath);
787
+ const safeUrl = pathToFileURL(resolve(projectRoot, relativePath)).href;
787
788
  try {
788
789
  const start = performance.now();
789
- const createWasmImports = (await import(path)).default;
790
+ const createWasmImports = (await import(safeUrl)).default;
790
791
  debug(`[${logModule}] TIMING Imported user WasmImportsFactory in ${(performance.now() - start).toFixed(2)} ms`);
791
792
  if (typeof createWasmImports !== "function") throw new Error(`User config for \`wasmImportsFactor\` must be the path to a module with a default export matching () => WebAssembly.Imports - Imported: "${typeof createWasmImports}": ${String(createWasmImports)}`);
792
793
  else return createWasmImports;
793
794
  } catch (error) {
794
795
  if (error["__as_pool__"]) throw error;
795
- throw new Error(`Could not load user WasmImportsFactory from "${path}". Ensure that your module path is relative to the project root (location of shallowest vitest config), and that it has a default export matching () => WebAssembly.Imports`, { cause: error });
796
+ throw new Error(`Could not load user WasmImportsFactory from "${safeUrl}". Ensure that your module path is relative to the project root (location of shallowest vitest config), and that it has a default export matching () => WebAssembly.Imports`, { cause: error });
796
797
  }
797
798
  }
798
799
 
799
800
  //#endregion
800
801
  export { createRpcClient, executeWASMDiscovery, executeWASMTest, flushRpcUpdates, loadUserWasmImportsFactory, reportFileCollected, reportFileError, reportFileQueued, reportSuiteFinished, reportSuitePrepare, reportTestFinished, reportTestPrepare, reportTestRetried, reportUserConsoleLogs };
801
- //# sourceMappingURL=load-user-imports-J9eaAW0_.mjs.map
802
+ //# sourceMappingURL=load-user-imports-Bbmpaciu.mjs.map