vitest-pool-assemblyscript 0.8.0 → 0.9.1

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 (95) hide show
  1. package/BINARYEN_VERSION +1 -1
  2. package/README.md +10 -13
  3. package/assembly/compare.ts +453 -95
  4. package/assembly/expect.ts +113 -62
  5. package/assembly/index.ts +0 -10
  6. package/assembly/utils.ts +168 -0
  7. package/binding.gyp +4 -4
  8. package/dist/{addon-interface-_pNXcbib.mjs → addon-interface-CYFXMbK7.mjs} +4 -3
  9. package/dist/addon-interface-CYFXMbK7.mjs.map +1 -0
  10. package/dist/{ast-visitor-C5gQqWD2.mjs → ast-visitor-CWEOd3UH.mjs} +15 -2
  11. package/dist/ast-visitor-CWEOd3UH.mjs.map +1 -0
  12. package/dist/{compile-runner-DOMhsLQE.mjs → compile-runner-BNFHRGZO.mjs} +8 -7
  13. package/dist/compile-runner-BNFHRGZO.mjs.map +1 -0
  14. package/dist/compiler/transforms/deep-equals.d.mts +14 -0
  15. package/dist/compiler/transforms/deep-equals.d.mts.map +1 -0
  16. package/dist/compiler/transforms/deep-equals.mjs +245 -0
  17. package/dist/compiler/transforms/deep-equals.mjs.map +1 -0
  18. package/dist/compiler/transforms/strip-inline.mjs +2 -2
  19. package/dist/{compiler-CIXpfKq0.mjs → compiler-Dqs-qd3I.mjs} +18 -8
  20. package/dist/compiler-Dqs-qd3I.mjs.map +1 -0
  21. package/dist/config/index-v3.d.mts +33 -3
  22. package/dist/config/index-v3.d.mts.map +1 -1
  23. package/dist/config/index-v3.mjs.map +1 -1
  24. package/dist/config/index.d.mts +29 -4
  25. package/dist/config/index.d.mts.map +1 -0
  26. package/dist/config/index.mjs +6 -6
  27. package/dist/{constants-DuBLuMjt.mjs → constants-DbxJ3hzg.mjs} +10 -97
  28. package/dist/constants-DbxJ3hzg.mjs.map +1 -0
  29. package/dist/coverage-provider/index.mjs +30 -10
  30. package/dist/coverage-provider/index.mjs.map +1 -1
  31. package/dist/{debug-Cm1VFmaz.mjs → debug-DtRAL4rM.mjs} +38 -4
  32. package/dist/debug-DtRAL4rM.mjs.map +1 -0
  33. package/dist/{feature-check-ELxw_Mji.mjs → feature-check-Bje3ntpV.mjs} +2 -2
  34. package/dist/{feature-check-ELxw_Mji.mjs.map → feature-check-Bje3ntpV.mjs.map} +1 -1
  35. package/dist/index-internal.d.mts +1 -1
  36. package/dist/index-internal.d.mts.map +1 -1
  37. package/dist/index-internal.mjs +4 -4
  38. package/dist/index-v3.d.mts.map +1 -1
  39. package/dist/index-v3.mjs +8 -7
  40. package/dist/index-v3.mjs.map +1 -1
  41. package/dist/index.d.mts +1 -2
  42. package/dist/index.mjs +6 -6
  43. package/dist/{load-user-imports-B3Iy_K8k.mjs → load-user-imports-Bx5ZlhSm.mjs} +9 -9
  44. package/dist/load-user-imports-Bx5ZlhSm.mjs.map +1 -0
  45. package/dist/{pool-runner-init-BDQtAGwQ.mjs → pool-runner-init-BqkwQ2tk.mjs} +7 -7
  46. package/dist/pool-runner-init-BqkwQ2tk.mjs.map +1 -0
  47. package/dist/{pool-runner-init-CvnB0-iN.d.mts → pool-runner-init-CNpRdA5u.d.mts} +2 -2
  48. package/dist/pool-runner-init-CNpRdA5u.d.mts.map +1 -0
  49. package/dist/pool-thread/compile-worker-thread.d.mts +1 -1
  50. package/dist/pool-thread/compile-worker-thread.d.mts.map +1 -1
  51. package/dist/pool-thread/compile-worker-thread.mjs +10 -13
  52. package/dist/pool-thread/compile-worker-thread.mjs.map +1 -1
  53. package/dist/pool-thread/test-worker-thread.d.mts +1 -1
  54. package/dist/pool-thread/test-worker-thread.d.mts.map +1 -1
  55. package/dist/pool-thread/test-worker-thread.mjs +8 -11
  56. package/dist/pool-thread/test-worker-thread.mjs.map +1 -1
  57. package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
  58. package/dist/pool-thread/v3-tinypool-thread.d.mts.map +1 -1
  59. package/dist/pool-thread/v3-tinypool-thread.mjs +12 -18
  60. package/dist/pool-thread/v3-tinypool-thread.mjs.map +1 -1
  61. package/dist/{resolve-config-DhZ4lOSK.mjs → resolve-config-s9gSJSMc.mjs} +14 -5
  62. package/dist/resolve-config-s9gSJSMc.mjs.map +1 -0
  63. package/dist/{test-runner-C4I9VknR.mjs → test-runner-BGqc9uCK.mjs} +4 -4
  64. package/dist/{test-runner-C4I9VknR.mjs.map → test-runner-BGqc9uCK.mjs.map} +1 -1
  65. package/dist/{types-D0nprJo1.d.mts → types-DHVk5iAx.d.mts} +17 -11
  66. package/dist/types-DHVk5iAx.d.mts.map +1 -0
  67. package/dist/vitest-file-tasks-D8sOClGX.mjs +149 -0
  68. package/dist/vitest-file-tasks-D8sOClGX.mjs.map +1 -0
  69. package/dist/{vitest-tasks--ow4pacR.mjs → vitest-tasks-BZ24sghI.mjs} +6 -4
  70. package/dist/vitest-tasks-BZ24sghI.mjs.map +1 -0
  71. package/package.json +11 -14
  72. package/prebuilds/darwin-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  73. package/prebuilds/darwin-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  74. package/prebuilds/linux-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  75. package/prebuilds/linux-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  76. package/prebuilds/linux-x64/vitest-pool-assemblyscript.musl.node +0 -0
  77. package/prebuilds/win32-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  78. package/prebuilds/win32-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  79. package/src/instrumentation/native/addon.cpp +29 -3
  80. package/dist/addon-interface-_pNXcbib.mjs.map +0 -1
  81. package/dist/ast-visitor-C5gQqWD2.mjs.map +0 -1
  82. package/dist/compile-runner-DOMhsLQE.mjs.map +0 -1
  83. package/dist/compiler-CIXpfKq0.mjs.map +0 -1
  84. package/dist/constants-DuBLuMjt.mjs.map +0 -1
  85. package/dist/custom-provider-options-YTk1m7At.d.mts +0 -26
  86. package/dist/custom-provider-options-YTk1m7At.d.mts.map +0 -1
  87. package/dist/debug-Cm1VFmaz.mjs.map +0 -1
  88. package/dist/load-user-imports-B3Iy_K8k.mjs.map +0 -1
  89. package/dist/pool-runner-init-BDQtAGwQ.mjs.map +0 -1
  90. package/dist/pool-runner-init-CvnB0-iN.d.mts.map +0 -1
  91. package/dist/resolve-config-DhZ4lOSK.mjs.map +0 -1
  92. package/dist/types-D0nprJo1.d.mts.map +0 -1
  93. package/dist/vitest-file-tasks-Bn9CrWt_.mjs +0 -61
  94. package/dist/vitest-file-tasks-Bn9CrWt_.mjs.map +0 -1
  95. package/dist/vitest-tasks--ow4pacR.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"compile-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/compile-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Compile Worker (vitest v4)\n */\nimport { threadId, workerData } from 'node:worker_threads';\nimport { highlight } from '@vitest/utils/highlight';\n\nimport type {\n WorkerThreadInitData,\n RunCompileAndDiscoverTask,\n ThreadSpec,\n ThreadImports,\n WasmImportsFactory,\n} from '../types/types.js';\nimport { runCompileAndDiscover } from './runner/compile-runner.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient } from './rpc-reporter.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\n\nconst logModule = `WorkerThread` as const;\nconst [_unused, initData] = workerData;\nconst { projectRoot, asPoolOptions, asCoverageOptions } = initData as WorkerThreadInitData;\n\nsetGlobalDebugMode(asPoolOptions.debug);\ndebug(`[${logModule}] New compile pool thread created`);\n\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nconst createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n projectRoot,\n logModule\n);\n\nexport async function runCompileAndDiscoverSpec(data: RunCompileAndDiscoverTask): Promise<ThreadSpec> {\n const { dispatchStart, workerId, file, port, config } = data;\n\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;\n \n const rpc = createRpcClient(port);\n port.unref();\n\n debug(`[${logModuleWithId}] -------- compile and discover starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n debug(`[${logModuleWithId}] Awaiting compilation | projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n\n const compilation = await runCompileAndDiscover(\n file,\n logModuleWithId,\n rpc,\n asPoolOptions,\n config.root,\n config.coverage.enabled && COVERAGE_SUPPORTED,\n asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [],\n { highlight, createUserWasmImports } satisfies ThreadImports,\n typeof config.diff === 'object' ? config.diff : undefined,\n config.testNamePattern,\n config.allowOnly,\n );\n\n debug(`[${logModuleWithId}] -------- compile and discover completed run --------`);\n\n port.close();\n\n return { compilation, file };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,YAAY;AAClB,MAAM,CAAC,SAAS,YAAY;AAC5B,MAAM,EAAE,aAAa,eAAe,sBAAsB;AAE1D,mBAAmB,cAAc,MAAM;AACvC,MAAM,IAAI,UAAU,mCAAmC;AAEvD,MAAM,qBAAqB,mCAAmC;AAE9D,MAAM,wBAAwD,MAAM,2BAClE,cAAc,oBACd,aACA,UACD;AAED,eAAsB,0BAA0B,MAAsD;CACpG,MAAM,EAAE,eAAe,UAAU,MAAM,MAAM,WAAW;CAExD,MAAM,iBAAiB,KAAK,KAAK,GAAG;CACpC,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,MAAM,SAAS;CAEhE,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAK,OAAO;AAEZ,OAAM,IAAI,gBAAgB,sEAAsE,eAAe,QAAQ,EAAE,CAAC,IAAI;AAC9H,OAAM,IAAI,gBAAgB,yCAAyC,OAAO,KAAK,aAAa,KAAK,SAAS,GAAG;CAE7G,MAAM,cAAc,MAAM,sBACxB,MACA,iBACA,KACA,eACA,OAAO,MACP,OAAO,SAAS,WAAW,oBAC3B,kBAAkB,mDAAmD,EAAE,EACvE;EAAE;EAAW;EAAuB,EACpC,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO,QAChD,OAAO,iBACP,OAAO,UACR;AAED,OAAM,IAAI,gBAAgB,wDAAwD;AAElF,MAAK,OAAO;AAEZ,QAAO;EAAE;EAAa;EAAM"}
1
+ {"version":3,"file":"compile-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/compile-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Compile Worker (vitest v4)\n */\nimport { threadId, workerData } from 'node:worker_threads';\n\nimport type {\n WorkerThreadInitData,\n RunCompileAndDiscoverTask,\n ThreadSpec,\n ThreadImports,\n WasmImportsFactory,\n} from '../types/types.js';\nimport { runCompileAndDiscover } from './runner/compile-runner.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient } from './rpc-reporter.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\n\nconst logModule = `WorkerThread` as const;\nconst [_unused, initData] = workerData;\nconst { projectRoot, asPoolOptions, asCoverageOptions } = initData as WorkerThreadInitData;\n\nsetGlobalDebugMode(asPoolOptions.debug);\ndebug(`[${logModule}] New compile pool thread created`);\n\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nconst createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n projectRoot,\n logModule\n);\n\nexport async function runCompileAndDiscoverSpec(data: RunCompileAndDiscoverTask): Promise<ThreadSpec> {\n const { dispatchStart, workerId, file, port, config } = data;\n\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;\n \n const rpc = createRpcClient(port);\n port.unref();\n\n debug(`[${logModuleWithId}] -------- compile and discover starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n debug(`[${logModuleWithId}] Awaiting compilation | projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n\n const compilation = await runCompileAndDiscover(\n file,\n logModuleWithId,\n rpc,\n asPoolOptions,\n config.root,\n config.coverage.enabled && COVERAGE_SUPPORTED,\n asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [],\n { createUserWasmImports } satisfies ThreadImports,\n typeof config.diff === 'object' ? config.diff : undefined,\n config.testNamePattern,\n config.allowOnly,\n );\n\n debug(`[${logModuleWithId}] -------- compile and discover completed run --------`);\n\n port.close();\n\n return { compilation, file };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAM,YAAY;AAClB,MAAM,CAAC,SAAS,YAAY;AAC5B,MAAM,EAAE,aAAa,eAAe,sBAAsB;AAE1D,mBAAmB,cAAc,MAAM;AACvC,MAAM,IAAI,UAAU,mCAAmC;AAEvD,MAAM,qBAAqB,mCAAmC;AAE9D,MAAM,wBAAwD,MAAM,2BAClE,cAAc,oBACd,aACA,UACD;AAED,eAAsB,0BAA0B,MAAsD;CACpG,MAAM,EAAE,eAAe,UAAU,MAAM,MAAM,WAAW;CAExD,MAAM,iBAAiB,KAAK,KAAK,GAAG;CACpC,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,MAAM,SAAS;CAEhE,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAK,OAAO;AAEZ,OAAM,IAAI,gBAAgB,sEAAsE,eAAe,QAAQ,EAAE,CAAC,IAAI;AAC9H,OAAM,IAAI,gBAAgB,yCAAyC,OAAO,KAAK,aAAa,KAAK,SAAS,GAAG;CAE7G,MAAM,cAAc,MAAM,sBACxB,MACA,iBACA,KACA,eACA,OAAO,MACP,OAAO,SAAS,WAAW,oBAC3B,kBAAkB,mDAAmD,EAAE,EACvE,EAAE,uBAAuB,EACzB,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO,QAChD,OAAO,iBACP,OAAO,UACR;AAED,OAAM,IAAI,gBAAgB,wDAAwD;AAElF,MAAK,OAAO;AAEZ,QAAO;EAAE;EAAa;EAAM"}
@@ -1,4 +1,4 @@
1
- import { RunTestsTask } from "../types-D0nprJo1.mjs";
1
+ import { RunTestsTask } from "../types-DHVk5iAx.mjs";
2
2
 
3
3
  //#region src/pool-thread/test-worker-thread.d.ts
4
4
  declare function runFileSpec(data: RunTestsTask): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"test-worker-thread.d.mts","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"mappings":";;;iBA6BsB,WAAA,CAAY,IAAA,EAAM,YAAA,GAAe,OAAA"}
1
+ {"version":3,"file":"test-worker-thread.d.mts","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"mappings":";;;iBA4BsB,WAAA,CAAY,IAAA,EAAM,YAAA,GAAe,OAAA"}
@@ -1,12 +1,12 @@
1
- import "../constants-DuBLuMjt.mjs";
2
- import { debug, setGlobalDebugMode } from "../debug-Cm1VFmaz.mjs";
3
- import "../vitest-tasks--ow4pacR.mjs";
4
- import { createRpcClient, loadUserWasmImportsFactory } from "../load-user-imports-B3Iy_K8k.mjs";
5
- import { isNodeVersionSupportedForCoverage } from "../feature-check-ELxw_Mji.mjs";
6
- import { runSuite } from "../test-runner-C4I9VknR.mjs";
1
+ import "../constants-DbxJ3hzg.mjs";
2
+ import "../resolve-config-s9gSJSMc.mjs";
3
+ import { debug, setGlobalDebugMode } from "../debug-DtRAL4rM.mjs";
4
+ import "../vitest-tasks-BZ24sghI.mjs";
5
+ import { createRpcClient, loadUserWasmImportsFactory } from "../load-user-imports-Bx5ZlhSm.mjs";
6
+ import { isNodeVersionSupportedForCoverage } from "../feature-check-Bje3ntpV.mjs";
7
+ import { runSuite } from "../test-runner-BGqc9uCK.mjs";
7
8
  import { basename } from "node:path";
8
9
  import { threadId, workerData } from "node:worker_threads";
9
- import { highlight } from "@vitest/utils/highlight";
10
10
 
11
11
  //#region src/pool-thread/test-worker-thread.ts
12
12
  /**
@@ -29,10 +29,7 @@ async function runFileSpec(data) {
29
29
  debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);
30
30
  debug(`[${logModuleWithId}] projectName: "${config.name}" | file: "${file.filepath}"`);
31
31
  debug(`[${logModuleWithId}] ${mode} | awaiting file run`);
32
- await runSuite(rpc, port, basename(file.filepath), config.coverage.enabled && COVERAGE_SUPPORTED, compilation, file, logModuleWithId, asPoolOptions, {
33
- highlight,
34
- createUserWasmImports
35
- }, "v4", config.bail, typeof config.diff === "object" ? config.diff : void 0, timedOutTest);
32
+ await runSuite(rpc, port, basename(file.filepath), config.coverage.enabled && COVERAGE_SUPPORTED, compilation, file, logModuleWithId, asPoolOptions, { createUserWasmImports }, "v4", config.bail, typeof config.diff === "object" ? config.diff : void 0, timedOutTest);
36
33
  debug(`[${logModuleWithId}] -------- ${mode} completed file run --------`);
37
34
  port.close();
38
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"test-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Node Worker (vitest v4)\n */\nimport { basename } from 'node:path';\nimport { threadId, workerData } from 'node:worker_threads';\nimport { highlight } from '@vitest/utils/highlight';\n\nimport type { RunTestsTask, ThreadImports, WasmImportsFactory, WorkerThreadInitData } from '../types/types.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient } from './rpc-reporter.js';\nimport { runSuite } from './runner/test-runner.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\n\nconst logModule = `WorkerThread` as const;\nconst [_unused, initData] = workerData;\nconst { asPoolOptions, projectRoot } = initData as WorkerThreadInitData;\n\nsetGlobalDebugMode(asPoolOptions.debug);\ndebug(`[${logModule}] New test run pool thread created`);\n\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nconst createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n projectRoot,\n logModule\n);\n\nexport async function runFileSpec(data: RunTestsTask): Promise<void> {\n const {\n dispatchStart, workerId, file, port, config,\n isCollectTestsMode, compilation, timedOutTest\n } = data;\n\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;\n \n const rpc = createRpcClient(port);\n port.unref();\n\n const mode = isCollectTestsMode ? 'collectTests' : 'runTests';\n\n debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n debug(`[${logModuleWithId}] projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n\n debug(`[${logModuleWithId}] ${mode} | awaiting file run`);\n\n await runSuite(\n rpc,\n port,\n basename(file.filepath),\n config.coverage.enabled && COVERAGE_SUPPORTED,\n compilation,\n file,\n logModuleWithId,\n asPoolOptions,\n { highlight, createUserWasmImports } satisfies ThreadImports,\n 'v4',\n config.bail,\n typeof config.diff === 'object' ? config.diff : undefined,\n timedOutTest,\n );\n\n debug(`[${logModuleWithId}] -------- ${mode} completed file run --------`);\n\n port.close();\n\n return;\n}\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAM,YAAY;AAClB,MAAM,CAAC,SAAS,YAAY;AAC5B,MAAM,EAAE,eAAe,gBAAgB;AAEvC,mBAAmB,cAAc,MAAM;AACvC,MAAM,IAAI,UAAU,oCAAoC;AAExD,MAAM,qBAAqB,mCAAmC;AAE9D,MAAM,wBAAwD,MAAM,2BAClE,cAAc,oBACd,aACA,UACD;AAED,eAAsB,YAAY,MAAmC;CACnE,MAAM,EACJ,eAAe,UAAU,MAAM,MAAM,QACrC,oBAAoB,aAAa,iBAC/B;CAEJ,MAAM,iBAAiB,KAAK,KAAK,GAAG;CACpC,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,MAAM,SAAS;CAEhE,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAK,OAAO;CAEZ,MAAM,OAAO,qBAAqB,iBAAiB;AAEnD,OAAM,IAAI,gBAAgB,aAAa,KAAK,uCAAuC,eAAe,QAAQ,EAAE,CAAC,IAAI;AACjH,OAAM,IAAI,gBAAgB,kBAAkB,OAAO,KAAK,aAAa,KAAK,SAAS,GAAG;AAEtF,OAAM,IAAI,gBAAgB,IAAI,KAAK,sBAAsB;AAEzD,OAAM,SACJ,KACA,MACA,SAAS,KAAK,SAAS,EACvB,OAAO,SAAS,WAAW,oBAC3B,aACA,MACA,iBACA,eACA;EAAE;EAAW;EAAuB,EACpC,MACA,OAAO,MACP,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO,QAChD,aACD;AAED,OAAM,IAAI,gBAAgB,aAAa,KAAK,8BAA8B;AAE1E,MAAK,OAAO"}
1
+ {"version":3,"file":"test-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Node Worker (vitest v4)\n */\nimport { basename } from 'node:path';\nimport { threadId, workerData } from 'node:worker_threads';\n\nimport type { RunTestsTask, ThreadImports, WasmImportsFactory, WorkerThreadInitData } from '../types/types.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient } from './rpc-reporter.js';\nimport { runSuite } from './runner/test-runner.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\n\nconst logModule = `WorkerThread` as const;\nconst [_unused, initData] = workerData;\nconst { asPoolOptions, projectRoot } = initData as WorkerThreadInitData;\n\nsetGlobalDebugMode(asPoolOptions.debug);\ndebug(`[${logModule}] New test run pool thread created`);\n\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nconst createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n projectRoot,\n logModule\n);\n\nexport async function runFileSpec(data: RunTestsTask): Promise<void> {\n const {\n dispatchStart, workerId, file, port, config,\n isCollectTestsMode, compilation, timedOutTest\n } = data;\n\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;\n \n const rpc = createRpcClient(port);\n port.unref();\n\n const mode = isCollectTestsMode ? 'collectTests' : 'runTests';\n\n debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n debug(`[${logModuleWithId}] projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n\n debug(`[${logModuleWithId}] ${mode} | awaiting file run`);\n\n await runSuite(\n rpc,\n port,\n basename(file.filepath),\n config.coverage.enabled && COVERAGE_SUPPORTED,\n compilation,\n file,\n logModuleWithId,\n asPoolOptions,\n { createUserWasmImports } satisfies ThreadImports,\n 'v4',\n config.bail,\n typeof config.diff === 'object' ? config.diff : undefined,\n timedOutTest,\n );\n\n debug(`[${logModuleWithId}] -------- ${mode} completed file run --------`);\n\n port.close();\n\n return;\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,YAAY;AAClB,MAAM,CAAC,SAAS,YAAY;AAC5B,MAAM,EAAE,eAAe,gBAAgB;AAEvC,mBAAmB,cAAc,MAAM;AACvC,MAAM,IAAI,UAAU,oCAAoC;AAExD,MAAM,qBAAqB,mCAAmC;AAE9D,MAAM,wBAAwD,MAAM,2BAClE,cAAc,oBACd,aACA,UACD;AAED,eAAsB,YAAY,MAAmC;CACnE,MAAM,EACJ,eAAe,UAAU,MAAM,MAAM,QACrC,oBAAoB,aAAa,iBAC/B;CAEJ,MAAM,iBAAiB,KAAK,KAAK,GAAG;CACpC,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,MAAM,SAAS;CAEhE,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAK,OAAO;CAEZ,MAAM,OAAO,qBAAqB,iBAAiB;AAEnD,OAAM,IAAI,gBAAgB,aAAa,KAAK,uCAAuC,eAAe,QAAQ,EAAE,CAAC,IAAI;AACjH,OAAM,IAAI,gBAAgB,kBAAkB,OAAO,KAAK,aAAa,KAAK,SAAS,GAAG;AAEtF,OAAM,IAAI,gBAAgB,IAAI,KAAK,sBAAsB;AAEzD,OAAM,SACJ,KACA,MACA,SAAS,KAAK,SAAS,EACvB,OAAO,SAAS,WAAW,oBAC3B,aACA,MACA,iBACA,eACA,EAAE,uBAAuB,EACzB,MACA,OAAO,MACP,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO,QAChD,aACD;AAED,OAAM,IAAI,gBAAgB,aAAa,KAAK,8BAA8B;AAE1E,MAAK,OAAO"}
@@ -1,4 +1,4 @@
1
- import { ProcessPoolRunFileTask } from "../types-D0nprJo1.mjs";
1
+ import { ProcessPoolRunFileTask } from "../types-DHVk5iAx.mjs";
2
2
 
3
3
  //#region src/pool-thread/v3-tinypool-thread.d.ts
4
4
  declare function runTestFile(taskData: ProcessPoolRunFileTask): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"v3-tinypool-thread.d.mts","names":[],"sources":["../../src/pool-thread/v3-tinypool-thread.ts"],"mappings":";;;iBAiCsB,WAAA,CAAY,QAAA,EAAU,sBAAA,GAAyB,OAAA"}
1
+ {"version":3,"file":"v3-tinypool-thread.d.mts","names":[],"sources":["../../src/pool-thread/v3-tinypool-thread.ts"],"mappings":";;;iBA+BsB,WAAA,CAAY,QAAA,EAAU,sBAAA,GAAyB,OAAA"}
@@ -1,16 +1,16 @@
1
- import "../constants-DuBLuMjt.mjs";
2
- import { debug, setGlobalDebugMode } from "../debug-Cm1VFmaz.mjs";
3
- import "../vitest-file-tasks-Bn9CrWt_.mjs";
4
- import "../vitest-tasks--ow4pacR.mjs";
5
- import { createRpcClient, loadUserWasmImportsFactory } from "../load-user-imports-B3Iy_K8k.mjs";
6
- import { isNodeVersionSupportedForCoverage } from "../feature-check-ELxw_Mji.mjs";
7
- import "../compiler-CIXpfKq0.mjs";
8
- import { runCompileAndDiscover } from "../compile-runner-DOMhsLQE.mjs";
9
- import { runSuite } from "../test-runner-C4I9VknR.mjs";
1
+ import "../constants-DbxJ3hzg.mjs";
2
+ import "../resolve-config-s9gSJSMc.mjs";
3
+ import { debug, setGlobalDebugMode } from "../debug-DtRAL4rM.mjs";
4
+ import "../vitest-file-tasks-D8sOClGX.mjs";
5
+ import "../vitest-tasks-BZ24sghI.mjs";
6
+ import { createRpcClient, loadUserWasmImportsFactory } from "../load-user-imports-Bx5ZlhSm.mjs";
7
+ import { isNodeVersionSupportedForCoverage } from "../feature-check-Bje3ntpV.mjs";
8
+ import "../compiler-Dqs-qd3I.mjs";
9
+ import { runCompileAndDiscover } from "../compile-runner-BNFHRGZO.mjs";
10
+ import { runSuite } from "../test-runner-BGqc9uCK.mjs";
10
11
  import { basename } from "node:path";
11
12
  import { workerId } from "tinypool";
12
13
  import { threadId, workerData } from "node:worker_threads";
13
- import { highlight } from "@vitest/utils";
14
14
 
15
15
  //#region src/pool-thread/v3-tinypool-thread.ts
16
16
  /**
@@ -32,10 +32,7 @@ async function runTestFile(taskData) {
32
32
  const mode = isCollectTestsMode ? "collectTests" : "runTests";
33
33
  debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);
34
34
  debug(`[${logModuleWithId}] projectName: "${config.name}" | file: "${file.filepath}"`);
35
- const compilation = timedOutCompilation ?? await runCompileAndDiscover(file, logModuleWithId, rpc, asPoolOptions, config.root, config.coverage.enabled && COVERAGE_SUPPORTED, asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [], {
36
- highlight,
37
- createUserWasmImports
38
- }, typeof config.diff === "object" ? config.diff : void 0, config.testNamePattern, config.allowOnly);
35
+ const compilation = timedOutCompilation ?? await runCompileAndDiscover(file, logModuleWithId, rpc, asPoolOptions, config.root, config.coverage.enabled && COVERAGE_SUPPORTED, asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [], { createUserWasmImports }, typeof config.diff === "object" ? config.diff : void 0, config.testNamePattern, config.allowOnly);
39
36
  if (compilation && !timedOutCompilation) {
40
37
  port.postMessage({
41
38
  compilation,
@@ -46,10 +43,7 @@ async function runTestFile(taskData) {
46
43
  }
47
44
  if (compilation && !isCollectTestsMode) {
48
45
  debug(`[${logModuleWithId}] Running file suite`);
49
- await runSuite(rpc, port, basename(file.filepath), config.coverage.enabled && COVERAGE_SUPPORTED, compilation, file, logModuleWithId, asPoolOptions, {
50
- highlight,
51
- createUserWasmImports
52
- }, "v3", config.bail, typeof config.diff === "object" ? config.diff : void 0, timedOutTest);
46
+ await runSuite(rpc, port, basename(file.filepath), config.coverage.enabled && COVERAGE_SUPPORTED, compilation, file, logModuleWithId, asPoolOptions, { createUserWasmImports }, "v3", config.bail, typeof config.diff === "object" ? config.diff : void 0, timedOutTest);
53
47
  } else debug(`[${logModuleWithId}] Skipping file suite run`);
54
48
  debug(`[${logModuleWithId}] -------- ${mode} completed file run --------`);
55
49
  port.close();
@@ -1 +1 @@
1
- {"version":3,"file":"v3-tinypool-thread.mjs","names":[],"sources":["../../src/pool-thread/v3-tinypool-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Tinypool (vitest v3)\n */\nimport { basename } from 'node:path';\nimport { threadId, workerData } from 'node:worker_threads';\nimport { workerId } from 'tinypool';\n// @ts-ignore - we build with v4, but this is correct for v3 runtime\nimport { highlight } from '@vitest/utils';\n\nimport type { ProcessPoolRunFileTask, TestFileCompiled, ThreadImports, WasmImportsFactory, WorkerThreadInitData } from '../types/types.js';\nimport { AS_POOL_WORKER_MSG_FLAG } from '../types/constants.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient } from './rpc-reporter.js';\nimport { runCompileAndDiscover } from './runner/compile-runner.js';\nimport { runSuite } from './runner/test-runner.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\n\nconst logModule = `WorkerThread` as const;\nconst [_unused, initData] = workerData;\nconst { asPoolOptions, asCoverageOptions, projectRoot } = initData as WorkerThreadInitData;\n\nsetGlobalDebugMode(asPoolOptions.debug);\ndebug(`[${logModule}] New pool thread created`);\n\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nconst createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n projectRoot,\n logModule\n);\n\nexport async function runTestFile(taskData: ProcessPoolRunFileTask): Promise<void> {\n const {\n dispatchStart, port, file, config, isCollectTestsMode,\n timedOutTest, timedOutCompilation\n } = taskData;\n\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `WorkerThread ${workerId} (t ${threadId})`;\n const rpc = createRpcClient(port);\n port.unref();\n\n const mode = isCollectTestsMode ? 'collectTests' : 'runTests';\n debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n debug(`[${logModuleWithId}] projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n \n const compilation = timedOutCompilation ?? await runCompileAndDiscover(\n file,\n logModuleWithId,\n rpc,\n asPoolOptions,\n config.root,\n config.coverage.enabled && COVERAGE_SUPPORTED,\n asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [],\n { highlight, createUserWasmImports } satisfies ThreadImports,\n typeof config.diff === 'object' ? config.diff : undefined,\n config.testNamePattern,\n config.allowOnly,\n );\n\n if (compilation && !timedOutCompilation) {\n port.postMessage({\n compilation,\n type: 'file-compiled',\n [AS_POOL_WORKER_MSG_FLAG]: true\n } satisfies TestFileCompiled);\n debug(`[${logModuleWithId}] sent compilation to pool for \"${compilation.filePath}\"`);\n }\n \n if (compilation && !isCollectTestsMode) {\n\t\tdebug(`[${logModuleWithId}] Running file suite`);\n await runSuite(\n rpc,\n port,\n basename(file.filepath),\n config.coverage.enabled && COVERAGE_SUPPORTED,\n compilation,\n file,\n logModuleWithId,\n asPoolOptions,\n { highlight, createUserWasmImports } satisfies ThreadImports,\n 'v3',\n config.bail,\n typeof config.diff === 'object' ? config.diff : undefined,\n timedOutTest,\n );\n } else {\n\t\tdebug(`[${logModuleWithId}] Skipping file suite run`);\n\t}\n\n debug(`[${logModuleWithId}] -------- ${mode} completed file run --------`);\n port.close();\n\n return;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,YAAY;AAClB,MAAM,CAAC,SAAS,YAAY;AAC5B,MAAM,EAAE,eAAe,mBAAmB,gBAAgB;AAE1D,mBAAmB,cAAc,MAAM;AACvC,MAAM,IAAI,UAAU,2BAA2B;AAE/C,MAAM,qBAAqB,mCAAmC;AAE9D,MAAM,wBAAwD,MAAM,2BAClE,cAAc,oBACd,aACA,UACD;AAED,eAAsB,YAAY,UAAiD;CACjF,MAAM,EACJ,eAAe,MAAM,MAAM,QAAQ,oBACnC,cAAc,wBACZ;CAEJ,MAAM,iBAAiB,KAAK,KAAK,GAAG;CACpC,MAAM,kBAAkB,gBAAgB,SAAS,MAAM,SAAS;CAChE,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAK,OAAO;CAEZ,MAAM,OAAO,qBAAqB,iBAAiB;AACnD,OAAM,IAAI,gBAAgB,aAAa,KAAK,uCAAuC,eAAe,QAAQ,EAAE,CAAC,IAAI;AACjH,OAAM,IAAI,gBAAgB,kBAAkB,OAAO,KAAK,aAAa,KAAK,SAAS,GAAG;CAEtF,MAAM,cAAc,uBAAuB,MAAM,sBAC/C,MACA,iBACA,KACA,eACA,OAAO,MACP,OAAO,SAAS,WAAW,oBAC3B,kBAAkB,mDAAmD,EAAE,EACvE;EAAE;EAAW;EAAuB,EACpC,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO,QAChD,OAAO,iBACP,OAAO,UACR;AAED,KAAI,eAAe,CAAC,qBAAqB;AACvC,OAAK,YAAY;GACf;GACA,MAAM;oBACqB;GAC5B,CAA4B;AAC7B,QAAM,IAAI,gBAAgB,kCAAkC,YAAY,SAAS,GAAG;;AAGtF,KAAI,eAAe,CAAC,oBAAoB;AACxC,QAAM,IAAI,gBAAgB,sBAAsB;AAC9C,QAAM,SACJ,KACA,MACA,SAAS,KAAK,SAAS,EACvB,OAAO,SAAS,WAAW,oBAC3B,aACA,MACA,iBACA,eACA;GAAE;GAAW;GAAuB,EACpC,MACA,OAAO,MACP,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO,QAChD,aACD;OAEH,OAAM,IAAI,gBAAgB,2BAA2B;AAGrD,OAAM,IAAI,gBAAgB,aAAa,KAAK,8BAA8B;AAC1E,MAAK,OAAO"}
1
+ {"version":3,"file":"v3-tinypool-thread.mjs","names":[],"sources":["../../src/pool-thread/v3-tinypool-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Tinypool (vitest v3)\n */\nimport { basename } from 'node:path';\nimport { threadId, workerData } from 'node:worker_threads';\nimport { workerId } from 'tinypool';\n\nimport type { ProcessPoolRunFileTask, TestFileCompiled, ThreadImports, WasmImportsFactory, WorkerThreadInitData } from '../types/types.js';\nimport { AS_POOL_WORKER_MSG_FLAG } from '../types/constants.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient } from './rpc-reporter.js';\nimport { runCompileAndDiscover } from './runner/compile-runner.js';\nimport { runSuite } from './runner/test-runner.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\n\nconst logModule = `WorkerThread` as const;\nconst [_unused, initData] = workerData;\nconst { asPoolOptions, asCoverageOptions, projectRoot } = initData as WorkerThreadInitData;\n\nsetGlobalDebugMode(asPoolOptions.debug);\ndebug(`[${logModule}] New pool thread created`);\n\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nconst createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n projectRoot,\n logModule\n);\n\nexport async function runTestFile(taskData: ProcessPoolRunFileTask): Promise<void> {\n const {\n dispatchStart, port, file, config, isCollectTestsMode,\n timedOutTest, timedOutCompilation\n } = taskData;\n\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `WorkerThread ${workerId} (t ${threadId})`;\n const rpc = createRpcClient(port);\n port.unref();\n\n const mode = isCollectTestsMode ? 'collectTests' : 'runTests';\n debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n debug(`[${logModuleWithId}] projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n \n const compilation = timedOutCompilation ?? await runCompileAndDiscover(\n file,\n logModuleWithId,\n rpc,\n asPoolOptions,\n config.root,\n config.coverage.enabled && COVERAGE_SUPPORTED,\n asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [],\n { createUserWasmImports } satisfies ThreadImports,\n typeof config.diff === 'object' ? config.diff : undefined,\n config.testNamePattern,\n config.allowOnly,\n );\n\n if (compilation && !timedOutCompilation) {\n port.postMessage({\n compilation,\n type: 'file-compiled',\n [AS_POOL_WORKER_MSG_FLAG]: true\n } satisfies TestFileCompiled);\n debug(`[${logModuleWithId}] sent compilation to pool for \"${compilation.filePath}\"`);\n }\n \n if (compilation && !isCollectTestsMode) {\n\t\tdebug(`[${logModuleWithId}] Running file suite`);\n await runSuite(\n rpc,\n port,\n basename(file.filepath),\n config.coverage.enabled && COVERAGE_SUPPORTED,\n compilation,\n file,\n logModuleWithId,\n asPoolOptions,\n { createUserWasmImports } satisfies ThreadImports,\n 'v3',\n config.bail,\n typeof config.diff === 'object' ? config.diff : undefined,\n timedOutTest,\n );\n } else {\n\t\tdebug(`[${logModuleWithId}] Skipping file suite run`);\n\t}\n\n debug(`[${logModuleWithId}] -------- ${mode} completed file run --------`);\n port.close();\n\n return;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,MAAM,YAAY;AAClB,MAAM,CAAC,SAAS,YAAY;AAC5B,MAAM,EAAE,eAAe,mBAAmB,gBAAgB;AAE1D,mBAAm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8B;AAC1E,MAAK,OAAO"}
@@ -1,5 +1,5 @@
1
- import { POOL_ERROR_NAMES } from "./constants-DuBLuMjt.mjs";
2
- import { createPoolError } from "./debug-Cm1VFmaz.mjs";
1
+ import { POOL_ERROR_NAMES } from "./constants-DbxJ3hzg.mjs";
2
+ import { createPoolError } from "./debug-DtRAL4rM.mjs";
3
3
  import { availableParallelism } from "node:os";
4
4
 
5
5
  //#region src/types/types.ts
@@ -41,6 +41,15 @@ function resolvePoolOptions(userPoolOptions) {
41
41
  if (resolved.testMemoryPagesInitial < 1 || resolved.testMemoryPagesMax !== void 0 && resolved.testMemoryPagesMax < 1) throw createPoolError(`Test memory page size options must be positive - testMemoryPagesMin: ${resolved.testMemoryPagesInitial} | testMemoryPagesMax: ${resolved.testMemoryPagesMax}`, POOL_ERROR_NAMES.PoolConfigError);
42
42
  return resolved;
43
43
  }
44
+ function retryCompat(retry) {
45
+ return typeof retry === "number" ? retry : retry?.count ?? 0;
46
+ }
47
+ function getCompatConfig(config) {
48
+ return {
49
+ ...config,
50
+ retry: retryCompat(config.retry)
51
+ };
52
+ }
44
53
  function getProjectSerializedOrGlobalConfig(ctx) {
45
54
  let testProject;
46
55
  let foundProjectSerializedConfig = false;
@@ -53,7 +62,7 @@ function getProjectSerializedOrGlobalConfig(ctx) {
53
62
  }
54
63
  }
55
64
  const config = !!testProject ? {
56
- ...testProject.serializedConfig,
65
+ ...getCompatConfig(testProject.serializedConfig),
57
66
  coverage: {
58
67
  ...testProject.serializedConfig.coverage,
59
68
  ...ctx.config.coverage
@@ -72,5 +81,5 @@ function getProjectSerializedOrGlobalConfig(ctx) {
72
81
  }
73
82
 
74
83
  //#endregion
75
- export { getProjectSerializedOrGlobalConfig, resolvePoolOptions };
76
- //# sourceMappingURL=resolve-config-DhZ4lOSK.mjs.map
84
+ export { getCompatConfig, getProjectSerializedOrGlobalConfig, resolvePoolOptions, retryCompat };
85
+ //# sourceMappingURL=resolve-config-s9gSJSMc.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-config-s9gSJSMc.mjs","names":[],"sources":["../src/types/types.ts","../src/util/resolve-config.ts"],"sourcesContent":["/*\n * Shared TypeScript types and interfaces\n */\n\nimport type { MessagePort } from 'node:worker_threads';\nimport type { BirpcReturn } from 'birpc';\nimport type { RunnerRPC, RuntimeRPC, SerializedConfig, SerializedCoverageConfig } from 'vitest';\nimport type { TestError } from '@vitest/utils';\nimport type { ResolvedConfig, ResolvedCoverageOptions } from 'vitest/node';\nimport type { File, Test, TaskMeta, TestOptions } from '@vitest/runner/types';\n\nimport {\n AS_POOL_WORKER_MSG_FLAG,\n AS_POOL_ERROR_TYPE_FLAG,\n COVERAGE_PAYLOAD_FORMATS,\n POOL_ERROR_NAMES,\n TEST_ERROR_NAMES,\n} from './constants.js';\n\n// ============================================================================\n// Errors\n// ============================================================================\n\n/** Error name type derived from TEST_ERROR_NAMES values */\nexport type TestErrorName = typeof TEST_ERROR_NAMES[keyof typeof TEST_ERROR_NAMES];\n\n/** Error name type derived from POOL_ERROR_NAMES values */\nexport type PoolErrorName = typeof POOL_ERROR_NAMES[keyof typeof POOL_ERROR_NAMES];\n\n/**\n * Conforms to Error interface but with required, strictly-typed name field.\n * Thrown internally for all pool errors.\n * \n * Must be thrown as a POJO (not using the Error() constructor!) to be properly\n * serialized across worker-pool boundery.\n */\nexport interface AssemblyScriptPoolError extends Error {\n readonly [AS_POOL_ERROR_TYPE_FLAG]: true;\n name: PoolErrorName;\n rawCallStack?: NodeJS.CallSite[];\n causeIsEnhancedError?: boolean;\n}\n\n/**\n * Extended vitest TestError with required, strictly-typed name field.\n * This is an explicitly serializable error format constructred to report\n * Test/Suite failures to vitest.\n */\nexport type AssemblyScriptTestError = TestError & { name: TestErrorName | PoolErrorName };\n\n/**\n * Native build error marker file content.\n * Written by install script when native addon compilation fails.\n * Read at runtime to display detailed error information to users.\n */\nexport interface NativeBuildError {\n stage: 'binaryen-download' | 'native-compile';\n error: string;\n platform: string;\n timestamp: string;\n}\n\n// ============================================================================\n// User Configuration\n// ============================================================================\n\n/**\n * AssemblyScript pool configuration options\n */\nexport interface AssemblyScriptPoolOptions {\n /** Enable verbose debug logging */\n debug?: boolean;\n debugNative?: boolean;\n debugCoverageExtract?: boolean;\n\n /** enable to collect coverage instrumentation on the pool's assembly/* files */\n _instrumentPoolInternals?: boolean;\n\n /**\n * Strip `@inline` decorators during compilation to improve error message and coverage accuracy\n *\n * - When true (default): `@inline` decorators removed, functions become visible in coverage\n * and source mapped errors point to the correct lines\n * - When false: `@inline` functions are inlined by compiler, missing from coverage, and \n * error line numbers don't match the non-inlined source\n * @default true\n */\n stripInline?: boolean;\n\n /**\n * Maximum number of worker threads to spawn with vitest 3.x.\n * Defaults to os.availableParallelism() - 1\n * \n * Use project config `test.maxWorkers` with vitest 4.x to control\n * the number of cuncurrently executing tests. \n */\n maxThreadsV3?: number;\n\n coverageMemoryPagesInitial?: number;\n coverageMemoryPagesMax?: number;\n\n testMemoryPagesInitial?: number;\n testMemoryPagesMax?: number;\n\n extraCompilerFlags?: string[];\n\n wasmImportsFactory?: string;\n}\n\n/**\n * AssemblyScript-specific coverage fields contributed by the hybrid coverage\n * provider on top of vitest's standard coverage options.\n *\n * Single source of truth for these field declarations: extended by the\n * vitest module augmentation files in `src/config/` so users get autocomplete\n * on these fields in their `vitest.config.ts` coverage block, and consumed\n * internally via `Required<HybridProviderOptions>` in\n * `ResolvedHybridProviderOptions`.\n */\nexport interface HybridProviderOptions {\n debugIstanbul?: boolean;\n\n /**\n * Glob patterns for AssemblyScript source files to include in coverage.\n * Used to build the complete AS coverage map.\n *\n * The standard `include` patterns are used by the v8 provider for JS/TS files.\n *\n * @example ['assembly/**\\/*.as.ts']\n */\n assemblyScriptInclude?: string[];\n\n /**\n * Glob patterns for AssemblyScript files to exclude from coverage.\n *\n * @example ['**\\/*.as.test.ts']\n */\n assemblyScriptExclude?: string[];\n}\n\nexport interface WasmImportsFactoryInfo {\n module: WebAssembly.Module;\n memory: WebAssembly.Memory;\n utils: {\n liftString: (stringPtr: number) => string | undefined;\n }\n}\n\nexport type WasmImportsFactory = (moduleInfo: WasmImportsFactoryInfo) => WebAssembly.Imports;\n\n// define these constants here so they make sense in context\nexport const AS_POOL_FIELDS_WITH_DEFAULTS = [\n 'debug',\n 'debugNative',\n 'debugCoverageExtract',\n '_instrumentPoolInternals',\n 'stripInline',\n 'maxThreadsV3',\n 'coverageMemoryPagesInitial',\n 'coverageMemoryPagesMax',\n 'testMemoryPagesInitial',\n 'extraCompilerFlags'\n] as const;\nexport const AS_POOL_OPTIONAL_FIELDS = ['testMemoryPagesMax', 'wasmImportsFactory'] as const;\n\n/** Fields that have default values. Internally these will always be defined. */\nexport type ASPoolOptionsFieldsWithDefaultValues = typeof AS_POOL_FIELDS_WITH_DEFAULTS[number];\n\n/** Fields with optional values and NO defaults */\nexport type ASPoolOptionsOptionalFields = typeof AS_POOL_OPTIONAL_FIELDS[number];\n\n// compatibility type for internal consumption - configs from all versions\n// of Vitest are converted to this format for internal consumption\nexport type SerializedConfigCompat = SerializedConfig & {\n retry: number;\n};\n\nexport type AssemblyScriptProjectConfig = (SerializedConfigCompat & {\n coverage: SerializedCoverageConfig & ResolvedHybridProviderOptions;\n}) | ResolvedConfig & {\n coverage: ResolvedHybridProviderOptions;\n};\n\n /**\n * Pool options resolved so that all fields are filled with user values preferentially, \n * with required fields being guaranteed to be populated with defaults otherwise.\n */\nexport type ResolvedAssemblyScriptPoolOptions =\n Required<Pick<AssemblyScriptPoolOptions, ASPoolOptionsFieldsWithDefaultValues>>\n & Partial<Pick<AssemblyScriptPoolOptions, ASPoolOptionsOptionalFields>>\n & { readonly isResolved: true };\n\nexport type ResolvedHybridProviderOptions =\n Required<HybridProviderOptions>\n & Omit<ResolvedCoverageOptions, 'provider'>\n & {\n provider: 'custom';\n customProviderModule: string;\n globbedAssemblyScriptInclude: GlobResult[];\n globbedAssemblyScriptProjectRelativeExcludeOnly: string[];\n };\n\n// vitest TestOptions fields that are supported by AssemblyScript tests in this pool\nexport type AssemblyScriptTestOptions = Required<Pick<TestOptions, 'timeout' | 'retry' | 'skip' | 'only' | 'fails'>>;\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\nexport type VitestVersion = 'v3' | 'v4';\n\nexport interface ThreadImports {\n createUserWasmImports?: WasmImportsFactory;\n}\n\nexport interface GlobResult {\n absolute: string;\n projectRootRelative: string;\n}\n\n// ============================================================================\n// Compilation & Results\n// ============================================================================\n\nexport interface AssemblyScriptCompilerOptions {\n shouldInstrument: boolean;\n projectRoot: string;\n instrumentationOptions?: InstrumentationOptions;\n stripInline?: boolean;\n extraFlags?: string[];\n}\n\nexport interface AssemblyScriptCompilerResult {\n binary: Uint8Array;\n sourceMap: string;\n debugInfo?: BinaryDebugInfo;\n isInstrumented: boolean;\n compileTiming: number;\n}\n\nexport interface InstrumentationOptions {\n /** Project root for resolving source map paths to absolute paths */\n projectRoot: string;\n /** List of relative file paths to exclude from instrumentation */\n relativeExcludedFiles: string[];\n excludedLibraryFilePrefix: string;\n excludedLibraryFileOverridePrefix?: string;\n excludedInternalFunctionSubstring: string;\n coverageMemoryPagesMin: number;\n coverageMemoryPagesMax: number;\n debug?: boolean;\n}\n\n/**\n * Result of instrumenting a WASM binary for coverage\n */\nexport interface InstrumentationResult {\n /** Instrumented WASM binary with coverage counter increments */\n instrumentedWasm: Buffer;\n /** Regenerated source map (offsets adjusted for instrumentation) */\n sourceMap: string;\n /** Debug info with coverageMemoryIndex assigned to each function */\n debugInfo: BinaryDebugInfo;\n}\n\n// ============================================================================\n// Error Source Mapping\n// ============================================================================\n\n/**\n * Source location in original AssemblyScript code (a point, not a range)\n *\n * All values are 1-based for internal consistency.\n * Conversion to 0-based columns happens at Istanbul output boundary.\n */\nexport interface SourceLocation {\n /** Absolute file path (normalized from source map during debug info extraction) */\n filePath: string;\n line: number;\n column: number;\n}\n\n/**\n * WebAssembly call site with mapped source location\n */\nexport interface WebAssemblyCallSite {\n functionName: string;\n location: SourceLocation;\n}\n\n// ============================================================================\n// Coverage Data (Runtime Hit Counts)\n// ============================================================================\n\n/**\n * Coverage data collected during test execution\n *\n * Simple hit count storage using position-based keys for stable merging.\n * Note: Function source metadata (names, ranges) comes from ParsedSourceInfo.\n *\n * Outer Record: keyed by absolute file path\n * Inner Record: keyed by position (\"line:column\") → hit count\n */\nexport interface CoverageData {\n hitCountsByFileAndPosition: Record<string, Record<string, number>>;\n}\n\n/**\n * Coverage payload sent via RPC from worker to hybrid coverage provider\n *\n * The __format marker distinguishes AS coverage from JS coverage in onAfterSuiteRun.\n */\nexport interface AssemblyScriptCoveragePayload {\n readonly __format: typeof COVERAGE_PAYLOAD_FORMATS.AssemblyScript;\n coverageData: CoverageData;\n suiteLogLabel: string;\n}\n\n\n// ============================================================================\n// Binary Debug Info (returned from native instrumentation addon)\n// ============================================================================\n//\n// These types represent debug information extracted from compiled WASM binaries\n// via the native addon. Binary debug info only has POINTS (from source map),\n// not ranges. Ranges come from source parsing (ParsedSource* types below).\n//\n// Naming convention: *DebugInfo suffix indicates binary-extracted data.\n\n/**\n * Source range in original AssemblyScript code (start and end points)\n *\n * All values are 1-based for internal consistency.\n * Conversion to 0-based columns happens at Istanbul output boundary.\n */\nexport interface SourceRange {\n /** Relative file path */\n filePath: string;\n startLine: number;\n startColumn: number;\n endLine: number;\n endColumn: number;\n}\n\n/**\n * Branch edge in control flow graph\n */\nexport interface BranchEdgeDebugInfo {\n /** Target basic block index */\n targetBlockIndex: number;\n /** Index of the expression that creates this branch (e.g., if condition) */\n sourceExpressionIndex?: number;\n}\n\n/**\n * Expression debug info extracted from WASM binary\n *\n * Expressions are the smallest unit of execution in WASM.\n * In v2, each expression can be mapped to a source statement for line-level coverage.\n */\nexport interface ExpressionDebugInfo {\n /** WASM expression type (e.g., \"call\", \"if\", \"block\") */\n type: string;\n /** Source location (POINT, not range) from source map */\n location?: SourceLocation;\n /** Whether this expression is a branch point (if, switch, select) */\n isBranch: boolean;\n /** Number of branch paths (for branch coverage) */\n branchPaths?: number;\n /**\n * Index into coverage memory counters\n * v2 only: Propagated from containing BasicBlockDebugInfo by TS wrapper\n */\n coverageMemoryIndex?: number;\n}\n\n/**\n * Basic block debug info from CFG analysis\n *\n * Basic blocks are sequences of expressions with single entry/exit points.\n * In v2, counters are placed at basic block boundaries for efficient coverage.\n */\nexport interface BasicBlockDebugInfo {\n /** Block index within the function */\n index: number;\n /** Indices of expressions contained in this block */\n expressionIndices: number[];\n /** Outgoing branch edges */\n branches: BranchEdgeDebugInfo[];\n /**\n * Index into coverage memory counters\n * v2 only: Source of truth for block-level coverage\n */\n coverageMemoryIndex?: number;\n}\n\n/**\n * Function debug info extracted from WASM binary via native addon\n */\nexport interface FunctionDebugInfo {\n /** WASM function index */\n wasmIndex: number;\n /** Function name from WASM (informational) */\n name: string;\n /**\n * Representative source location (a point within the function).\n * Used for containment matching to find the parsedsource function.\n */\n representativeLocation: SourceLocation;\n /** Index into coverage memory counters */\n coverageMemoryIndex: number;\n /** All expressions in this function */\n expressions: ExpressionDebugInfo[];\n /** Basic blocks from CFG analysis */\n basicBlocks: BasicBlockDebugInfo[];\n}\n\n/**\n * Binary debug info extracted from WASM + source map via native addon\n *\n * This is the processed output after TS wrapper transforms NativeDebugInfoOutput.\n * Functions are grouped by file and keyed by position for stable identity.\n */\nexport interface BinaryDebugInfo {\n /** All source files represented in extracted debug info (directly or inlined) */\n debugSourceFiles: string[];\n /**\n * Functions grouped by file path, then keyed by position (\"line:column\").\n * Position key enables stable identity across compilations.\n * Array value accommodates generic monomorphizations that share a source position.\n */\n functionsByFileAndPosition: Record<string, Record<string, FunctionDebugInfo[]>>;\n\n instrumentedFunctionCount: number;\n}\n\n/**\n * Raw output from native addon's instrumentForCoverage() C++ function\n */\nexport interface NativeInstrumentationResult {\n instrumentedWasm: Buffer;\n sourceMap: string;\n debugInfo: NativeDebugInfoOutput;\n errors?: string[];\n}\n\nexport interface NativeDebugInfoOutput {\n /** All source files represented in extracted debug info (directly or inlined) */\n debugSourceFiles: string[];\n /** Flat list of all functions with their debug info */\n functions: NativeFunctionDebugInfo[];\n}\n\nexport interface NativeFunctionDebugInfo extends Omit<FunctionDebugInfo, 'expressions' | 'representativeLocation'> {\n representativeLocation: NativeSourceLocation;\n expressions: NativeExpressionDebugInfo[];\n}\n\nexport interface NativeExpressionDebugInfo extends Omit<ExpressionDebugInfo, 'location'> {\n location?: NativeSourceLocation;\n}\n\nexport interface NativeSourceLocation extends Omit<SourceLocation, 'filePath'> {\n /** Index into NativeDebugInfoOutput.debugSourceFiles */\n fileIndex: number;\n}\n\nexport interface NativeInstrumentationOptions extends Omit<InstrumentationOptions, 'relativeExcludedFiles' | 'projectRoot'> {\n excludedFiles?: string[];\n logPrefix?: string;\n}\n\nexport type InstrumentForCoverageFunc = (\n wasmBuffer: Buffer,\n sourceMapBuffer: Buffer,\n instrumentationOptions: InstrumentationOptions,\n logModule: string,\n logLabel: string,\n) => InstrumentationResult;\n\nexport interface NativeAddonInterface {\n instrumentForCoverage: InstrumentForCoverageFunc;\n}\n\n/**\n * Typed interface for the native addon's exported methods.\n * The addon is loaded via node-gyp-build at runtime (CJS .node binary).\n */\nexport interface NativeAddon {\n instrumentForCoverage(\n wasmBuffer: Buffer,\n sourceMapBuffer: Buffer,\n options: NativeInstrumentationOptions,\n ): NativeInstrumentationResult;\n}\n\n// ============================================================================\n// Parsed Source Info (from AST Parser)\n// ============================================================================\n//\n// These types represent information parsed from source files via AST.\n// Parsed source info has *ranges* (start and end positions) for containment matching.\n\n/**\n * Function info parsed from AssemblyScript source via AST\n */\nexport interface ParsedSourceFunctionInfo {\n /** Fully \"qualified\" (WASM debug) name */\n qualifiedName: string;\n /** Short name for display */\n shortName: string;\n /** Source range for containment matching */\n range: SourceRange;\n}\n\n/**\n * Statement info parsed from AssemblyScript source via AST\n *\n * v2 only: Used for line-level statement coverage.\n * Binary expression points are matched to source statement ranges.\n */\nexport interface ParsedSourceStatementInfo {\n /** Source range for containment matching */\n range: SourceRange;\n /** Statement type (e.g., \"variable\", \"expression\", \"return\") */\n statementType?: string;\n}\n\n/**\n * Branch info parsed from AssemblyScript source via AST\n *\n * v2 only: Used for branch coverage.\n * Binary branch expressions are matched to source branch ranges.\n */\nexport interface ParsedSourceBranchInfo {\n /** Source range for containment matching */\n range: SourceRange;\n /** Type of branch construct */\n branchType: 'if' | 'ternary' | 'switch' | 'logical';\n}\n\n/**\n * Complete parsed source info from AST parser\n *\n * Generated by coverage provider when processing coverage (not during compilation).\n * Provides the \"what SHOULD be covered\" view from source code.\n */\nexport interface ParsedSourceInfo {\n /**\n * Functions grouped by file path, then by start line for containment matching.\n * Multiple functions can start on the same line, but limiting matching to checking\n * only the functions grouped on the input position's line is very performant.\n */\n functionsByFileAndStartLine: Record<string, Record<number, ParsedSourceFunctionInfo[]>>;\n /**\n * Statements grouped by file path, then keyed by position (\"line:column\")\n * v2 only: For line-level statement coverage\n */\n statementsByFileAndPosition: Record<string, Record<string, ParsedSourceStatementInfo>>;\n /**\n * Branches grouped by file path, then keyed by position (\"line:column\")\n * v2 only: For branch coverage\n */\n branchesByFileAndPosition: Record<string, Record<string, ParsedSourceBranchInfo>>;\n}\n\n// ============================================================================\n// Worker Communication & RPC\n// ============================================================================\n\nexport interface AssemblyScriptConsoleLog {\n msg: string;\n time: number;\n isError: boolean;\n}\n\nexport type AssemblyScriptConsoleLogHandler = (msg: string, isError?: boolean) => void;\n\nexport interface FailedAssertion {\n expected?: string;\n actual?: string;\n valuesProvided?: boolean;\n typeName?: string;\n message?: string;\n}\n\nexport interface AssemblyScriptSuiteTaskMeta extends TaskMeta {\n idxInParentTasks: number;\n defaultTestOptions: AssemblyScriptTestOptions;\n suitePreparedSent: boolean;\n resultFinal: boolean;\n coverageData?: CoverageData;\n}\n\nexport interface AssemblyScriptTestTaskMeta extends TaskMeta {\n idxInParentTasks: number;\n fnIndex: number;\n assertionsPassedCount: number;\n assertionsFailed: FailedAssertion[];\n resultFinal: boolean;\n coverageData?: CoverageData;\n lastError?: AssemblyScriptTestError;\n lastErrorValuesProvided?: boolean;\n lastErrorRawCallStack?: NodeJS.CallSite[];\n lastTimeoutTerminationTime?: number;\n};\n\nexport interface WASMExecutorPerfTimings {\n /** function start */\n fnInit: number;\n /** test start: execStart - fnInit = env init time */\n execStart: number;\n /** test end: execEnd - execStart = test duration */\n execEnd: number;\n /** function end: fnFinal - execEnd = error prep and/or coverage extraction time */\n fnfinal: number;\n}\n\nexport type WorkerRPC = BirpcReturn<RuntimeRPC, RunnerRPC>;\n\n/**\n * Worker channel with RPC for suite-level communication\n */\nexport interface WorkerChannel {\n /** Port to send to worker for RPC communication */\n workerPort: MessagePort;\n /** Pool-side port for cleanup */\n poolPort: MessagePort;\n /** RPC client for calling Vitest methods (only remote functions matter for our usage) */\n rpc: WorkerRPC;\n}\n\nexport interface WorkerThreadInitData {\n projectRoot: string,\n asPoolOptions: ResolvedAssemblyScriptPoolOptions;\n asCoverageOptions: ResolvedHybridProviderOptions;\n}\n\nexport interface AssemblyScriptPoolWorkerMessageBase {\n readonly [AS_POOL_WORKER_MSG_FLAG]: true;\n readonly type: string;\n}\n\nexport interface TestFileCompiled extends AssemblyScriptPoolWorkerMessageBase {\n readonly type: 'file-compiled';\n compilation: WASMCompilation;\n}\n\n\nexport interface TestExecutionStart extends AssemblyScriptPoolWorkerMessageBase {\n readonly type: 'execution-start';\n executionStart: number;\n test: Test;\n}\n\nexport interface TestExecutionEnd extends AssemblyScriptPoolWorkerMessageBase {\n readonly type: 'execution-end';\n executionEnd: number;\n testTaskId: string;\n}\n\nexport type AssemblyScriptPoolWorkerMessage = TestExecutionStart | TestExecutionEnd | TestFileCompiled;\n\nexport interface WASMCompilation {\n filePath: string;\n binary: Uint8Array;\n sourceMap: string;\n debugInfo?: BinaryDebugInfo;\n}\n\nexport interface TestRunRecord {\n test: Test;\n executionStart: number;\n timeoutId: NodeJS.Timeout;\n}\n\nexport interface ThreadSpec {\n file: File;\n compilation?: WASMCompilation;\n}\n\nexport interface RunCompileAndDiscoverTask {\n dispatchStart: number;\n workerId: number;\n port: MessagePort;\n file: File;\n config: SerializedConfigCompat;\n isCollectTestsMode: boolean;\n}\n\nexport interface RunTestsTask {\n dispatchStart: number;\n workerId: number;\n port: MessagePort;\n file: File;\n compilation: WASMCompilation;\n config: SerializedConfigCompat;\n isCollectTestsMode: boolean;\n timedOutTest?: Test;\n}\n\nexport interface ProcessPoolRunFileTask {\n dispatchStart: number;\n port: MessagePort;\n file: File;\n config: SerializedConfigCompat;\n isCollectTestsMode: boolean;\n timedOutTest?: Test;\n timedOutCompilation?: WASMCompilation;\n}\n","import { availableParallelism } from 'node:os';\nimport type { SerializedConfig } from 'vitest';\nimport type { Retry, SerializableRetry } from '@vitest/runner';\nimport type { TestProject, Vitest } from 'vitest/node';\n\nimport type {\n AssemblyScriptPoolOptions,\n ASPoolOptionsFieldsWithDefaultValues,\n ResolvedAssemblyScriptPoolOptions,\n ResolvedHybridProviderOptions,\n AssemblyScriptProjectConfig,\n SerializedConfigCompat,\n} from '../types/types.js';\nimport { AS_POOL_FIELDS_WITH_DEFAULTS } from '../types/types.js';\nimport { ASSEMBLYSCRIPT_POOL_NAME, POOL_ERROR_NAMES } from '../types/constants.js';\nimport { createPoolError } from '../util/pool-errors.js';\n\nconst DEFAULT_ASSEMBLYSCRIPT_POOL_OTIONS: Required<Pick<AssemblyScriptPoolOptions, ASPoolOptionsFieldsWithDefaultValues>> = {\n debug: false,\n debugNative: false,\n debugCoverageExtract: false,\n _instrumentPoolInternals: false,\n stripInline: true,\n maxThreadsV3: availableParallelism() - 1,\n coverageMemoryPagesInitial: 1,\n coverageMemoryPagesMax: 4,\n testMemoryPagesInitial: 1,\n extraCompilerFlags: [],\n} as const;\n\n// v4: used in runner init to parse user-provided param directly\nexport function resolvePoolOptions(userPoolOptions?: any): ResolvedAssemblyScriptPoolOptions {\n const poolOptions: AssemblyScriptPoolOptions = userPoolOptions ?? DEFAULT_ASSEMBLYSCRIPT_POOL_OTIONS;\n\n // resolve fields with defaults if user hasn't provided them\n for (const configKey of AS_POOL_FIELDS_WITH_DEFAULTS) {\n if (poolOptions[configKey] === undefined) {\n poolOptions[configKey] = DEFAULT_ASSEMBLYSCRIPT_POOL_OTIONS[configKey] as any;\n }\n }\n\n const resolved = { ...poolOptions, isResolved: true } as ResolvedAssemblyScriptPoolOptions;\n\n if (resolved.coverageMemoryPagesInitial < 1 || resolved.coverageMemoryPagesMax < 1) {\n throw createPoolError(\n `Coverage memory page size options must be positive - coverageMemoryPagesMin: ${resolved.coverageMemoryPagesInitial}`\n + ` | coverageMemoryPagesMax: ${resolved.coverageMemoryPagesMax}`,\n POOL_ERROR_NAMES.PoolConfigError\n );\n }\n \n if (resolved.testMemoryPagesInitial < 1 || (resolved.testMemoryPagesMax !== undefined && resolved.testMemoryPagesMax < 1)) {\n throw createPoolError(\n `Test memory page size options must be positive - testMemoryPagesMin: ${resolved.testMemoryPagesInitial}`\n + ` | testMemoryPagesMax: ${resolved.testMemoryPagesMax}`,\n POOL_ERROR_NAMES.PoolConfigError\n );\n }\n\n return resolved;\n}\n\nexport function retryCompat(retry?: SerializableRetry | Retry): number {\n return typeof retry === 'number' ? retry : retry?.count ?? 0;\n}\n\nexport function getCompatConfig(config: SerializedConfig): SerializedConfigCompat {\n return {\n ...config,\n retry: retryCompat(config.retry)\n };\n}\n\n// v3 & hybrid coverage provider: used to get project config & poolOptions, with global coverage on project config\n// poolOptions will be undefined for v4 in coverage provider, but it doesn't need them\nexport function getProjectSerializedOrGlobalConfig(ctx: Vitest): {\n config: AssemblyScriptProjectConfig;\n foundProjectSerializedConfig: boolean;\n v3PoolOptions?: ResolvedAssemblyScriptPoolOptions;\n} {\n let testProject: TestProject | undefined;\n let foundProjectSerializedConfig: boolean = false;\n let v3PoolOptions: ResolvedAssemblyScriptPoolOptions | undefined;\n\n // In multi-project mode, ctx.config is the global config, not the project-specific config\n // We need to find our project in ctx.projects to get project-specific config at the \"pool level\" in v3,\n // and in the hybrid coverage provider regardless of version (specifically the project root)\n if (ctx.projects && ctx.projects.length > 0) {\n // Multi-project mode: find the first project using this pool\n // Use string.includes because project.config.pool resolves to the *path* of the dist file\n const project = ctx.projects.find(p => p.config.pool.includes(ASSEMBLYSCRIPT_POOL_NAME));\n\n if (project) {\n testProject = project;\n foundProjectSerializedConfig = true;\n }\n }\n\n const config = !!testProject ? {\n ...getCompatConfig(testProject.serializedConfig),\n coverage: {\n ...testProject.serializedConfig.coverage,\n ...(ctx.config.coverage as unknown as ResolvedHybridProviderOptions)\n }\n } : {\n ...ctx.config,\n coverage: ctx.config.coverage as unknown as ResolvedHybridProviderOptions\n };\n\n // @ts-ignore - we build with v4, but this is correct for v3 (has config.poolOptions)\n const maybeOptions: any = !!testProject ? testProject.config?.poolOptions?.assemblyScript : config?.poolOptions?.assemblyScript;\n if (maybeOptions) {\n v3PoolOptions = resolvePoolOptions(maybeOptions);\n }\n\n return {\n config,\n foundProjectSerializedConfig,\n v3PoolOptions\n };\n}"],"mappings":";;;;;AAuJA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;ACjJD,MAAM,qCAAsH;CAC1H,OAAO;CACP,aAAa;CACb,sBAAsB;CACtB,0BAA0B;CAC1B,aAAa;CACb,cAAc,sBAAsB,GAAG;CACvC,4BAA4B;CAC5B,wBAAwB;CACxB,wBAAwB;CACxB,oBAAoB,EAAE;CACvB;AAGD,SAAgB,mBAAmB,iBAA0D;CAC3F,MAAM,cAAyC,mBAAmB;AAGlE,MAAK,MAAM,aAAa,6BACtB,KAAI,YAAY,eAAe,OAC7B,aAAY,aAAa,mCAAmC;CAIhE,MAAM,WAAW;EAAE,GAAG;EAAa,YAAY;EAAM;AAErD,KAAI,SAAS,6BAA6B,KAAK,SAAS,yBAAyB,EAC/E,OAAM,gBACJ,gFAAgF,SAAS,wDACzD,SAAS,0BACzC,iBAAiB,gBAClB;AAGH,KAAI,SAAS,yBAAyB,KAAM,SAAS,uBAAuB,UAAa,SAAS,qBAAqB,EACrH,OAAM,gBACJ,wEAAwE,SAAS,gDACrD,SAAS,sBACrC,iBAAiB,gBAClB;AAGH,QAAO;;AAGT,SAAgB,YAAY,OAA2C;AACrE,QAAO,OAAO,UAAU,WAAW,QAAQ,OAAO,SAAS;;AAG7D,SAAgB,gBAAgB,QAAkD;AAChF,QAAO;EACL,GAAG;EACH,OAAO,YAAY,OAAO,MAAM;EACjC;;AAKH,SAAgB,mCAAmC,KAIjD;CACA,IAAI;CACJ,IAAI,+BAAwC;CAC5C,IAAI;AAKJ,KAAI,IAAI,YAAY,IAAI,SAAS,SAAS,GAAG;EAG3C,MAAM,UAAU,IAAI,SAAS,MAAK,MAAK,EAAE,OAAO,KAAK,0BAAkC,CAAC;AAExF,MAAI,SAAS;AACX,iBAAc;AACd,kCAA+B;;;CAInC,MAAM,SAAS,CAAC,CAAC,cAAc;EAC7B,GAAG,gBAAgB,YAAY,iBAAiB;EAChD,UAAU;GACR,GAAG,YAAY,iBAAiB;GAChC,GAAI,IAAI,OAAO;GAChB;EACF,GAAG;EACF,GAAG,IAAI;EACP,UAAU,IAAI,OAAO;EACtB;CAGD,MAAM,eAAoB,CAAC,CAAC,cAAc,YAAY,QAAQ,aAAa,iBAAiB,QAAQ,aAAa;AACjH,KAAI,aACF,iBAAgB,mBAAmB,aAAa;AAGlD,QAAO;EACL;EACA;EACA;EACD"}
@@ -1,6 +1,6 @@
1
- import { debug } from "./debug-Cm1VFmaz.mjs";
2
- import { checkFailsAndInvertResult, finalizeSuiteResult, flagTestFinalized, getRunnableTasks, getTaskLogPrefix, isSuiteOwnFile, resetTestForRetry, setSuitePrepareResult, setTestResultForTestPrepare, shouldRetryTask, updateSuiteFinishedResult, updateTestResultAfterRun } from "./vitest-tasks--ow4pacR.mjs";
3
- import { executeWASMTest, reportSuiteFinished, reportSuitePrepare, reportTestFinished, reportTestPrepare, reportTestRetried, reportUserConsoleLogs } from "./load-user-imports-B3Iy_K8k.mjs";
1
+ import { debug } from "./debug-DtRAL4rM.mjs";
2
+ import { checkFailsAndInvertResult, finalizeSuiteResult, flagTestFinalized, getRunnableTasks, getTaskLogPrefix, isSuiteOwnFile, resetTestForRetry, setSuitePrepareResult, setTestResultForTestPrepare, shouldRetryTask, updateSuiteFinishedResult, updateTestResultAfterRun } from "./vitest-tasks-BZ24sghI.mjs";
3
+ import { executeWASMTest, reportSuiteFinished, reportSuitePrepare, reportTestFinished, reportTestPrepare, reportTestRetried, reportUserConsoleLogs } from "./load-user-imports-Bx5ZlhSm.mjs";
4
4
  import { mergeCoverageData } from "./coverage-merge-CBXkpM1O.mjs";
5
5
 
6
6
  //#region src/pool-thread/runner/test-runner.ts
@@ -135,4 +135,4 @@ async function runSuite(rpc, port, base, collectCoverage, compilation, suite, lo
135
135
 
136
136
  //#endregion
137
137
  export { runSuite };
138
- //# sourceMappingURL=test-runner-C4I9VknR.mjs.map
138
+ //# sourceMappingURL=test-runner-BGqc9uCK.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-runner-C4I9VknR.mjs","names":[],"sources":["../src/pool-thread/runner/test-runner.ts"],"sourcesContent":["/**\n * Worker thread test runner logic for AssemblyScript Pool\n */\n\nimport type { MessagePort } from 'node:worker_threads';\nimport type { File, Suite, Task, Test } from '@vitest/runner/types';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\n\nimport type {\n AssemblyScriptConsoleLog,\n AssemblyScriptConsoleLogHandler,\n AssemblyScriptSuiteTaskMeta,\n AssemblyScriptTestTaskMeta,\n ResolvedAssemblyScriptPoolOptions,\n TestExecutionEnd,\n TestExecutionStart,\n ThreadImports,\n VitestVersion,\n WASMCompilation,\n WorkerRPC,\n} from '../../types/types.js';\nimport { AS_POOL_WORKER_MSG_FLAG } from '../../types/constants.js';\nimport { executeWASMTest } from '../../wasm-executor/index.js';\nimport { debug } from '../../util/debug.js';\nimport {\n reportTestPrepare,\n reportTestFinished,\n reportTestRetried,\n reportUserConsoleLogs,\n reportSuitePrepare,\n reportSuiteFinished,\n} from '../rpc-reporter.js';\nimport {\n checkFailsAndInvertResult,\n finalizeSuiteResult,\n flagTestFinalized,\n getRunnableTasks,\n getTaskLogPrefix,\n resetTestForRetry,\n setSuitePrepareResult,\n setTestResultForTestPrepare,\n shouldRetryTask,\n updateSuiteFinishedResult,\n updateTestResultAfterRun,\n isSuiteOwnFile\n} from '../../util/vitest-tasks.js';\nimport { mergeCoverageData } from '../../coverage-provider/coverage-merge.js';\n\nasync function bailIfNeeded(\n rpc: WorkerRPC,\n bailConfig: number | undefined,\n testWithResult: Test,\n logPrefix: string,\n logModule: string,\n): Promise<void> {\n if (bailConfig && testWithResult.result?.state !== 'pass') {\n const previousFailures = await rpc.getCountOfFailedTests();\n const currentFailures = 1 + previousFailures;\n\n if (currentFailures >= bailConfig) {\n debug(`${logPrefix} bailing: ${currentFailures} failures >= ${bailConfig} to bail`);\n debug(`[${logModule}] -------- BAIL! ${currentFailures} failures >= ${bailConfig} to bail --------`);\n return rpc.onCancel('test-failure');\n }\n }\n}\n\nasync function postProcessTestResult(\n rpc: WorkerRPC,\n bailConfig: number | undefined,\n testWithResult: Test,\n logPrefix: string,\n logModule: string,\n): Promise<void> {\n // invert result if test configured as 'fails'\n checkFailsAndInvertResult(testWithResult, logPrefix);\n\n // bail now if this is a failed test above bail threshold\n return bailIfNeeded(rpc, bailConfig, testWithResult, logPrefix, logModule);\n}\n\nfunction notifyTestStart(port: MessagePort, test: Test): void {\n port.postMessage({\n executionStart: Date.now(),\n test,\n type: 'execution-start',\n [AS_POOL_WORKER_MSG_FLAG]: true\n } satisfies TestExecutionStart);\n}\n\nfunction notifyTestEnd(port: MessagePort, test: Test): void {\n port.postMessage({\n executionEnd: Date.now(),\n testTaskId: test.id,\n type: 'execution-end',\n [AS_POOL_WORKER_MSG_FLAG]: true\n } satisfies TestExecutionEnd);\n}\n\nasync function runTest(\n rpc: WorkerRPC,\n port: MessagePort,\n base: string,\n collectCoverage: boolean,\n compilation: WASMCompilation,\n test: Test,\n logModule: string,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n threadImports: ThreadImports,\n bail?: number,\n diffOptions?: SerializedDiffOptions,\n): Promise<void> {\n const testLogPrefix = getTaskLogPrefix(logModule, base, test);\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 executionStart = Date.now();\n\n let thisRunIsARetry: boolean = false;\n let testPreparePromise: Promise<void> = Promise.resolve();\n \n if (!test.retry || !test.result) {\n debug(`${testLogPrefix} - Beginning test run`);\n\n // first/only attempt: create test result and report test-prepare\n setTestResultForTestPrepare(test, executionStart);\n testPreparePromise = reportTestPrepare(rpc, test, logModule, base);\n } else if (test.retry && test.result ) {\n debug(`${testLogPrefix} - Beginning test retry run`);\n thisRunIsARetry = true;\n\n // this is a retry, reset the result state and meta\n resetTestForRetry(test, executionStart);\n }\n \n // inform pool of test task start so it can enforce timeouts\n notifyTestStart(port, test);\n\n const [_reported, { testTimings }] = await Promise.all([\n testPreparePromise,\n executeWASMTest(\n test,\n compilation,\n base,\n poolOptions,\n collectCoverage,\n handleLog,\n logModule,\n threadImports,\n diffOptions\n )\n ]);\n\n // inform pool of test task end to stop timeout if under threshold\n notifyTestEnd(port, test);\n\n // update run->pass if appropriate, accumulate duration using executor timings\n updateTestResultAfterRun(test, testTimings);\n\n let willRetry = shouldRetryTask(test);\n\n await Promise.all([\n reportUserConsoleLogs(rpc, logMessages, logModule, base, test),\n\n willRetry ? reportTestRetried(rpc, test, logModule, base) : Promise.resolve(),\n ]);\n\n if (thisRunIsARetry) {\n debug(`${testLogPrefix} - Completed test retry run`);\n return;\n }\n\n // non-timeout retry handling\n while (willRetry) {\n // increment the retry count\n test.result!.retryCount = (test.result?.retryCount ?? 0) + 1;\n\n debug(`${testLogPrefix} - Retrying after failure`\n + ` | Retry ${test.result?.retryCount || 0} / ${test.retry} ` \n + ` | ${test.result?.errors?.length ?? 0} errors`\n );\n\n await runTest(\n rpc, port, base, collectCoverage, compilation,\n test, logModule, poolOptions, threadImports, bail, diffOptions\n );\n\n willRetry = shouldRetryTask(test);\n\n if (!willRetry) {\n debug(`${testLogPrefix} - Max retries ${test.result?.retryCount || 0} / ${test.retry} ` \n + ` | ${test.result?.errors?.length ?? 0} errors`\n );\n }\n }\n\n await Promise.all([\n // as needed: invert if `fails`, bail\n postProcessTestResult(rpc, bail, test, testLogPrefix, logModule),\n\n reportTestFinished(rpc, test, logModule, base),\n ]);\n\n // ensure completed test will not be run again if another test\n // times out later and the file worker thread gets re-launched\n flagTestFinalized(test);\n\n debug(`${testLogPrefix} - Completed test run`);\n}\n\nexport async function runSuite(\n rpc: WorkerRPC,\n port: MessagePort,\n base: string,\n collectCoverage: boolean,\n compilation: WASMCompilation,\n suite: Suite | File,\n logModule: string,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n threadImports: ThreadImports,\n vitestVersion: VitestVersion,\n bail?: number,\n diffOptions?: SerializedDiffOptions,\n timedOutTest?: Test,\n): Promise<Suite> {\n const suiteStart = performance.now();\n const suiteMeta = suite.meta as AssemblyScriptSuiteTaskMeta;\n const suiteLogPrefix = getTaskLogPrefix(logModule, base, suite);\n const isTimedOutTestInSuite: boolean = timedOutTest?.suite?.id === suite.id;\n\n if (suiteMeta.resultFinal) {\n debug(`${suiteLogPrefix} - Skipping completed suite | state: \"${suite.result?.state}\"`);\n\n return suite;\n } else {\n const threadRestartTime = Date.now() - ((timedOutTest?.meta as AssemblyScriptTestTaskMeta)?.lastTimeoutTerminationTime ?? 0);\n const showRestart = !!timedOutTest && isSuiteOwnFile(suite)\n debug(`${showRestart ? `(thread resumed in ${threadRestartTime} ms) ` : ''}${suiteLogPrefix} - runSuite ${!!timedOutTest\n ? `resuming after timeout \"${timedOutTest.name}\" | isTestInSuite: ${isTimedOutTestInSuite}`\n : 'beginning'\n }`);\n }\n\n if (!suiteMeta.suitePreparedSent) {\n setSuitePrepareResult(suite);\n await reportSuitePrepare(rpc, suite, logModule, base);\n\n // ensure suite-prepare will only be sent once if a test\n // times out and the file worker thread gets re-launched\n suiteMeta.suitePreparedSent = true;\n }\n\n // initialize aggregated coverage data for suite, which gets updated as each subtask completes\n suiteMeta.coverageData = { hitCountsByFileAndPosition: {} };\n debug(`${suiteLogPrefix} - Initialized empty suite coverage data`);\n\n let tasksToRun: Task[] = getRunnableTasks(suite);\n debug(`${suiteLogPrefix} - Runnable tasks:`, tasksToRun.length);\n\n for (const task of tasksToRun) {\n if (task.type === 'suite') {\n const suiteTaskMeta = task.meta as AssemblyScriptSuiteTaskMeta;\n\n await runSuite(\n rpc, port, base, collectCoverage, compilation, task, logModule,\n poolOptions, threadImports, vitestVersion, bail, diffOptions, timedOutTest\n );\n\n // merge suite task coverage into parent suite coverage\n if (suiteMeta.coverageData && suiteTaskMeta.coverageData) {\n mergeCoverageData(suiteMeta.coverageData, suiteTaskMeta.coverageData);\n }\n \n } else {\n const testLogPrefix = getTaskLogPrefix(logModule, base, task);\n const testTaskMeta = task.meta as AssemblyScriptTestTaskMeta;\n\n const testCompleted = testTaskMeta.resultFinal;\n const testTimedOutPreviously = !!timedOutTest && task.id === timedOutTest.id;\n\n if (testCompleted) {\n debug(`${testLogPrefix} - Skipping completed test | state: \"${task.result?.state}\"`);\n } else if (testTimedOutPreviously) {\n if (shouldRetryTask(task)) {\n const previousRetryCount = task.result?.retryCount ?? 0;\n const newRetryCount = previousRetryCount + 1;\n\n debug(`${testLogPrefix} - Retrying after test timeout`\n + ` | retry attempt ${newRetryCount} / ${task.retry} ` \n + ` | ${task.result?.errors?.length ?? 0} errors`\n + ` | state: \"${task.result?.state}\"`\n );\n \n // report retried for the previous timeout failure, which won't\n // have been reported because the thread was killed to timeout\n await reportTestRetried(rpc, task, logModule, base);\n\n // increment the retry count (after reporting retried)\n task.result!.retryCount = newRetryCount;\n \n // retry timed out test\n // - if it passes, process as normal\n // - if it fails again, it will end up in the else block below\n await runTest(\n rpc, port, base, collectCoverage, compilation,\n task, logModule, poolOptions, threadImports, bail, diffOptions\n );\n } else {\n debug(`${testLogPrefix} - Timed-out test has no retries left`\n + ` | retries attempted ${task.result?.retryCount || 0} / ${task.retry} ` \n + ` | ${task.result?.errors?.length ?? 0} errors`\n + ` | state: \"${task.result?.state}\"`\n );\n\n await Promise.all([\n // as needed: invert if `fails`, bail\n postProcessTestResult(rpc, bail, task, testLogPrefix, logModule),\n \n reportTestFinished(rpc, task, logModule, base),\n ]);\n\n // ensure completed test will not be run again if another test\n // times out later and the file worker thread gets re-launched\n flagTestFinalized(task);\n\n debug(`${testLogPrefix} - Completed timed out test run`);\n }\n } else {\n debug(`${testLogPrefix} - Running test task | state: \"${task.result?.state}\"`);\n await runTest(\n rpc, port, base, collectCoverage, compilation,\n task, logModule, poolOptions, threadImports, bail, diffOptions\n );\n }\n\n // merge test coverage into suite coverage\n if (suiteMeta.coverageData && testTaskMeta.coverageData) {\n mergeCoverageData(suiteMeta.coverageData, testTaskMeta.coverageData);\n }\n }\n }\n\n // update suite result based on its tasks, report coverage data, report suite task result\n updateSuiteFinishedResult(suite, suiteLogPrefix);\n await reportSuiteFinished(rpc, suite, logModule, base, vitestVersion);\n\n // ensure completed test will not be run again if another test\n // times out later and the file worker thread gets re-launched\n finalizeSuiteResult(suite);\n\n const suiteTime = performance.now() - suiteStart;\n debug(`${suiteLogPrefix} - Suite Run Complete | TIMING ${suiteTime.toFixed(2)} ms`);\n\n return suite;\n}\n"],"mappings":";;;;;;AAgDA,eAAe,aACb,KACA,YACA,gBACA,WACA,WACe;AACf,KAAI,cAAc,eAAe,QAAQ,UAAU,QAAQ;EAEzD,MAAM,kBAAkB,IADC,MAAM,IAAI,uBAAuB;AAG1D,MAAI,mBAAmB,YAAY;AACjC,SAAM,GAAG,UAAU,YAAY,gBAAgB,eAAe,WAAW,UAAU;AACnF,SAAM,IAAI,UAAU,mBAAmB,gBAAgB,eAAe,WAAW,mBAAmB;AACpG,UAAO,IAAI,SAAS,eAAe;;;;A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iBAAiB,aAClC,MAAM,WAAW,aAAa,eAAe,MAAM,YACpD;SACI;AACL,SAAM,GAAG,cAAc,4DACK,KAAK,QAAQ,cAAc,EAAE,KAAK,KAAK,MAAM,MAC/D,KAAK,QAAQ,QAAQ,UAAU,EAAE,oBACzB,KAAK,QAAQ,MAAM,GACpC;AAED,SAAM,QAAQ,IAAI,CAEhB,sBAAsB,KAAK,MAAM,MAAM,eAAe,UAAU,EAEhE,mBAAmB,KAAK,MAAM,WAAW,KAAK,CAC/C,CAAC;AAIF,qBAAkB,KAAK;AAEvB,SAAM,GAAG,cAAc,iCAAiC;;OAErD;AACL,SAAM,GAAG,cAAc,iCAAiC,KAAK,QAAQ,MAAM,GAAG;AAC9E,SAAM,QACJ,KAAK,MAAM,MAAM,iBAAiB,aAClC,MAAM,WAAW,aAAa,eAAe,MAAM,YACpD;;AAIH,MAAI,UAAU,gBAAgB,aAAa,aACzC,mBAAkB,UAAU,cAAc,aAAa,aAAa;;AAM1E,2BAA0B,OAAO,eAAe;AAChD,OAAM,oBAAoB,KAAK,OAAO,WAAW,MAAM,cAAc;AAIrE,qBAAoB,MAAM;AAG1B,OAAM,GAAG,eAAe,kCADN,YAAY,KAAK,GAAG,YAC6B,QAAQ,EAAE,CAAC,KAAK;AAEnF,QAAO"}
1
+ {"version":3,"file":"test-runner-BGqc9uCK.mjs","names":[],"sources":["../src/pool-thread/runner/test-runner.ts"],"sourcesContent":["/**\n * Worker thread test runner logic for AssemblyScript Pool\n */\n\nimport type { MessagePort } from 'node:worker_threads';\nimport type { File, Suite, Task, Test } from '@vitest/runner/types';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\n\nimport type {\n AssemblyScriptConsoleLog,\n AssemblyScriptConsoleLogHandler,\n AssemblyScriptSuiteTaskMeta,\n AssemblyScriptTestTaskMeta,\n ResolvedAssemblyScriptPoolOptions,\n TestExecutionEnd,\n TestExecutionStart,\n ThreadImports,\n VitestVersion,\n WASMCompilation,\n WorkerRPC,\n} from '../../types/types.js';\nimport { AS_POOL_WORKER_MSG_FLAG } from '../../types/constants.js';\nimport { executeWASMTest } from '../../wasm-executor/index.js';\nimport { debug } from '../../util/debug.js';\nimport {\n reportTestPrepare,\n reportTestFinished,\n reportTestRetried,\n reportUserConsoleLogs,\n reportSuitePrepare,\n reportSuiteFinished,\n} from '../rpc-reporter.js';\nimport {\n checkFailsAndInvertResult,\n finalizeSuiteResult,\n flagTestFinalized,\n getRunnableTasks,\n getTaskLogPrefix,\n resetTestForRetry,\n setSuitePrepareResult,\n setTestResultForTestPrepare,\n shouldRetryTask,\n updateSuiteFinishedResult,\n updateTestResultAfterRun,\n isSuiteOwnFile\n} from '../../util/vitest-tasks.js';\nimport { mergeCoverageData } from '../../coverage-provider/coverage-merge.js';\n\nasync function bailIfNeeded(\n rpc: WorkerRPC,\n bailConfig: number | undefined,\n testWithResult: Test,\n logPrefix: string,\n logModule: string,\n): Promise<void> {\n if (bailConfig && testWithResult.result?.state !== 'pass') {\n const previousFailures = await rpc.getCountOfFailedTests();\n const currentFailures = 1 + previousFailures;\n\n if (currentFailures >= bailConfig) {\n debug(`${logPrefix} bailing: ${currentFailures} failures >= ${bailConfig} to bail`);\n debug(`[${logModule}] -------- BAIL! ${currentFailures} failures >= ${bailConfig} to bail --------`);\n return rpc.onCancel('test-failure');\n }\n }\n}\n\nasync function postProcessTestResult(\n rpc: WorkerRPC,\n bailConfig: number | undefined,\n testWithResult: Test,\n logPrefix: string,\n logModule: string,\n): Promise<void> {\n // invert result if test configured as 'fails'\n checkFailsAndInvertResult(testWithResult, logPrefix);\n\n // bail now if this is a failed test above bail threshold\n return bailIfNeeded(rpc, bailConfig, testWithResult, logPrefix, logModule);\n}\n\nfunction notifyTestStart(port: MessagePort, test: Test): void {\n port.postMessage({\n executionStart: Date.now(),\n test,\n type: 'execution-start',\n [AS_POOL_WORKER_MSG_FLAG]: true\n } satisfies TestExecutionStart);\n}\n\nfunction notifyTestEnd(port: MessagePort, test: Test): void {\n port.postMessage({\n executionEnd: Date.now(),\n testTaskId: test.id,\n type: 'execution-end',\n [AS_POOL_WORKER_MSG_FLAG]: true\n } satisfies TestExecutionEnd);\n}\n\nasync function runTest(\n rpc: WorkerRPC,\n port: MessagePort,\n base: string,\n collectCoverage: boolean,\n compilation: WASMCompilation,\n test: Test,\n logModule: string,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n threadImports: ThreadImports,\n bail?: number,\n diffOptions?: SerializedDiffOptions,\n): Promise<void> {\n const testLogPrefix = getTaskLogPrefix(logModule, base, test);\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 executionStart = Date.now();\n\n let thisRunIsARetry: boolean = false;\n let testPreparePromise: Promise<void> = Promise.resolve();\n \n if (!test.retry || !test.result) {\n debug(`${testLogPrefix} - Beginning test run`);\n\n // first/only attempt: create test result and report test-prepare\n setTestResultForTestPrepare(test, executionStart);\n testPreparePromise = reportTestPrepare(rpc, test, logModule, base);\n } else if (test.retry && test.result ) {\n debug(`${testLogPrefix} - Beginning test retry run`);\n thisRunIsARetry = true;\n\n // this is a retry, reset the result state and meta\n resetTestForRetry(test, executionStart);\n }\n \n // inform pool of test task start so it can enforce timeouts\n notifyTestStart(port, test);\n\n const [_reported, { testTimings }] = await Promise.all([\n testPreparePromise,\n executeWASMTest(\n test,\n compilation,\n base,\n poolOptions,\n collectCoverage,\n handleLog,\n logModule,\n threadImports,\n diffOptions\n )\n ]);\n\n // inform pool of test task end to stop timeout if under threshold\n notifyTestEnd(port, test);\n\n // update run->pass if appropriate, accumulate duration using executor timings\n updateTestResultAfterRun(test, testTimings);\n\n let willRetry = shouldRetryTask(test);\n\n await Promise.all([\n reportUserConsoleLogs(rpc, logMessages, logModule, base, test),\n\n willRetry ? reportTestRetried(rpc, test, logModule, base) : Promise.resolve(),\n ]);\n\n if (thisRunIsARetry) {\n debug(`${testLogPrefix} - Completed test retry run`);\n return;\n }\n\n // non-timeout retry handling\n while (willRetry) {\n // increment the retry count\n test.result!.retryCount = (test.result?.retryCount ?? 0) + 1;\n\n debug(`${testLogPrefix} - Retrying after failure`\n + ` | Retry ${test.result?.retryCount || 0} / ${test.retry} ` \n + ` | ${test.result?.errors?.length ?? 0} errors`\n );\n\n await runTest(\n rpc, port, base, collectCoverage, compilation,\n test, logModule, poolOptions, threadImports, bail, diffOptions\n );\n\n willRetry = shouldRetryTask(test);\n\n if (!willRetry) {\n debug(`${testLogPrefix} - Max retries ${test.result?.retryCount || 0} / ${test.retry} ` \n + ` | ${test.result?.errors?.length ?? 0} errors`\n );\n }\n }\n\n await Promise.all([\n // as needed: invert if `fails`, bail\n postProcessTestResult(rpc, bail, test, testLogPrefix, logModule),\n\n reportTestFinished(rpc, test, logModule, base),\n ]);\n\n // ensure completed test will not be run again if another test\n // times out later and the file worker thread gets re-launched\n flagTestFinalized(test);\n\n debug(`${testLogPrefix} - Completed test run`);\n}\n\nexport async function runSuite(\n rpc: WorkerRPC,\n port: MessagePort,\n base: string,\n collectCoverage: boolean,\n compilation: WASMCompilation,\n suite: Suite | File,\n logModule: string,\n poolOptions: ResolvedAssemblyScriptPoolOptions,\n threadImports: ThreadImports,\n vitestVersion: VitestVersion,\n bail?: number,\n diffOptions?: SerializedDiffOptions,\n timedOutTest?: Test,\n): Promise<Suite> {\n const suiteStart = performance.now();\n const suiteMeta = suite.meta as AssemblyScriptSuiteTaskMeta;\n const suiteLogPrefix = getTaskLogPrefix(logModule, base, suite);\n const isTimedOutTestInSuite: boolean = timedOutTest?.suite?.id === suite.id;\n\n if (suiteMeta.resultFinal) {\n debug(`${suiteLogPrefix} - Skipping completed suite | state: \"${suite.result?.state}\"`);\n\n return suite;\n } else {\n const threadRestartTime = Date.now() - ((timedOutTest?.meta as AssemblyScriptTestTaskMeta)?.lastTimeoutTerminationTime ?? 0);\n const showRestart = !!timedOutTest && isSuiteOwnFile(suite)\n debug(`${showRestart ? `(thread resumed in ${threadRestartTime} ms) ` : ''}${suiteLogPrefix} - runSuite ${!!timedOutTest\n ? `resuming after timeout \"${timedOutTest.name}\" | isTestInSuite: ${isTimedOutTestInSuite}`\n : 'beginning'\n }`);\n }\n\n if (!suiteMeta.suitePreparedSent) {\n setSuitePrepareResult(suite);\n await reportSuitePrepare(rpc, suite, logModule, base);\n\n // ensure suite-prepare will only be sent once if a test\n // times out and the file worker thread gets re-launched\n suiteMeta.suitePreparedSent = true;\n }\n\n // initialize aggregated coverage data for suite, which gets updated as each subtask completes\n suiteMeta.coverageData = { hitCountsByFileAndPosition: {} };\n debug(`${suiteLogPrefix} - Initialized empty suite coverage data`);\n\n let tasksToRun: Task[] = getRunnableTasks(suite);\n debug(`${suiteLogPrefix} - Runnable tasks:`, tasksToRun.length);\n\n for (const task of tasksToRun) {\n if (task.type === 'suite') {\n const suiteTaskMeta = task.meta as AssemblyScriptSuiteTaskMeta;\n\n await runSuite(\n rpc, port, base, collectCoverage, compilation, task, logModule,\n poolOptions, threadImports, vitestVersion, bail, diffOptions, timedOutTest\n );\n\n // merge suite task coverage into parent suite coverage\n if (suiteMeta.coverageData && suiteTaskMeta.coverageData) {\n mergeCoverageData(suiteMeta.coverageData, suiteTaskMeta.coverageData);\n }\n \n } else {\n const testLogPrefix = getTaskLogPrefix(logModule, base, task);\n const testTaskMeta = task.meta as AssemblyScriptTestTaskMeta;\n\n const testCompleted = testTaskMeta.resultFinal;\n const testTimedOutPreviously = !!timedOutTest && task.id === timedOutTest.id;\n\n if (testCompleted) {\n debug(`${testLogPrefix} - Skipping completed test | state: \"${task.result?.state}\"`);\n } else if (testTimedOutPreviously) {\n if (shouldRetryTask(task)) {\n const previousRetryCount = task.result?.retryCount ?? 0;\n const newRetryCount = previousRetryCount + 1;\n\n debug(`${testLogPrefix} - Retrying after test timeout`\n + ` | retry attempt ${newRetryCount} / ${task.retry} ` \n + ` | ${task.result?.errors?.length ?? 0} errors`\n + ` | state: \"${task.result?.state}\"`\n );\n \n // report retried for the previous timeout failure, which won't\n // have been reported because the thread was killed to timeout\n await reportTestRetried(rpc, task, logModule, base);\n\n // increment the retry count (after reporting retried)\n task.result!.retryCount = newRetryCount;\n \n // retry timed out test\n // - if it passes, process as normal\n // - if it fails again, it will end up in the else block below\n await runTest(\n rpc, port, base, collectCoverage, compilation,\n task, logModule, poolOptions, threadImports, bail, diffOptions\n );\n } else {\n debug(`${testLogPrefix} - Timed-out test has no retries left`\n + ` | retries attempted ${task.result?.retryCount || 0} / ${task.retry} ` \n + ` | ${task.result?.errors?.length ?? 0} errors`\n + ` | state: \"${task.result?.state}\"`\n );\n\n await Promise.all([\n // as needed: invert if `fails`, bail\n postProcessTestResult(rpc, bail, task, testLogPrefix, logModule),\n \n reportTestFinished(rpc, task, logModule, base),\n ]);\n\n // ensure completed test will not be run again if another test\n // times out later and the file worker thread gets re-launched\n flagTestFinalized(task);\n\n debug(`${testLogPrefix} - Completed timed out test run`);\n }\n } else {\n debug(`${testLogPrefix} - Running test task | state: \"${task.result?.state}\"`);\n await runTest(\n rpc, port, base, collectCoverage, compilation,\n task, logModule, poolOptions, threadImports, bail, diffOptions\n );\n }\n\n // merge test coverage into suite coverage\n if (suiteMeta.coverageData && testTaskMeta.coverageData) {\n mergeCoverageData(suiteMeta.coverageData, testTaskMeta.coverageData);\n }\n }\n }\n\n // update suite result based on its tasks, report coverage data, report suite task result\n updateSuiteFinishedResult(suite, suiteLogPrefix);\n await reportSuiteFinished(rpc, suite, logModule, base, vitestVersion);\n\n // ensure completed test will not be run again if another test\n // times out later and the file worker thread gets re-launched\n finalizeSuiteResult(suite);\n\n const suiteTime = performance.now() - suiteStart;\n debug(`${suiteLogPrefix} - Suite Run Complete | TIMING ${suiteTime.toFixed(2)} ms`);\n\n return suite;\n}\n"],"mappings":";;;;;;AAgDA,eAAe,aACb,KACA,YACA,gBACA,WACA,WACe;AACf,KAAI,cAAc,eAAe,QAAQ,UAAU,QAAQ;EAEzD,MAAM,kBAAkB,IADC,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Ac,KAAK,KAAK,MAAM,MAC5C,KAAK,QAAQ,QAAQ,UAAU,EAAE,oBACzB,KAAK,QAAQ,MAAM,GACpC;AAID,SAAM,kBAAkB,KAAK,MAAM,WAAW,KAAK;AAGnD,QAAK,OAAQ,aAAa;AAK1B,SAAM,QACJ,KAAK,MAAM,MAAM,iBAAiB,aAClC,MAAM,WAAW,aAAa,eAAe,MAAM,YACpD;SACI;AACL,SAAM,GAAG,cAAc,4DACK,KAAK,QAAQ,cAAc,EAAE,KAAK,KAAK,MAAM,MAC/D,KAAK,QAAQ,QAAQ,UAAU,EAAE,oBACzB,KAAK,QAAQ,MAAM,GACpC;AAED,SAAM,QAAQ,IAAI,CAEhB,sBAAsB,KAAK,MAAM,MAAM,eAAe,UAAU,EAEhE,mBAAmB,KAAK,MAAM,WAAW,KAAK,CAC/C,CAAC;AAIF,qBAAkB,KAAK;AAEvB,SAAM,GAAG,cAAc,iCAAiC;;OAErD;AACL,SAAM,GAAG,cAAc,iCAAiC,KAAK,QAAQ,MAAM,GAAG;AAC9E,SAAM,QACJ,KAAK,MAAM,MAAM,iBAAiB,aAClC,MAAM,WAAW,aAAa,eAAe,MAAM,YACpD;;AAIH,MAAI,UAAU,gBAAgB,aAAa,aACzC,mBAAkB,UAAU,cAAc,aAAa,aAAa;;AAM1E,2BAA0B,OAAO,eAAe;AAChD,OAAM,oBAAoB,KAAK,OAAO,WAAW,MAAM,cAAc;AAIrE,qBAAoB,MAAM;AAG1B,OAAM,GAAG,eAAe,kCADN,YAAY,KAAK,GAAG,YAC6B,QAAQ,EAAE,CAAC,KAAK;AAEnF,QAAO"}
@@ -1,7 +1,4 @@
1
- import "tinyrainbow";
2
1
  import { MessagePort } from "node:worker_threads";
3
- import "birpc";
4
- import "@vitest/utils";
5
2
  import { SerializedConfig } from "vitest";
6
3
  import { File, Test } from "@vitest/runner/types";
7
4
 
@@ -42,11 +39,16 @@ interface AssemblyScriptPoolOptions {
42
39
  wasmImportsFactory?: string;
43
40
  }
44
41
  /**
45
- * HybridCoverageProvider configuration options.
42
+ * AssemblyScript-specific coverage fields contributed by the hybrid coverage
43
+ * provider on top of vitest's standard coverage options.
44
+ *
45
+ * Single source of truth for these field declarations: extended by the
46
+ * vitest module augmentation files in `src/config/` so users get autocomplete
47
+ * on these fields in their `vitest.config.ts` coverage block, and consumed
48
+ * internally via `Required<HybridProviderOptions>` in
49
+ * `ResolvedHybridProviderOptions`.
46
50
  */
47
51
  interface HybridProviderOptions {
48
- provider: "custom";
49
- customProviderModule: string;
50
52
  debugIstanbul?: boolean;
51
53
  /**
52
54
  * Glob patterns for AssemblyScript source files to include in coverage.
@@ -72,6 +74,9 @@ interface WasmImportsFactoryInfo {
72
74
  };
73
75
  }
74
76
  type WasmImportsFactory = (moduleInfo: WasmImportsFactoryInfo) => WebAssembly.Imports;
77
+ type SerializedConfigCompat = SerializedConfig & {
78
+ retry: number;
79
+ };
75
80
  interface AssemblyScriptCompilerOptions {
76
81
  shouldInstrument: boolean;
77
82
  projectRoot: string;
@@ -92,9 +97,10 @@ interface InstrumentationOptions {
92
97
  /** List of relative file paths to exclude from instrumentation */
93
98
  relativeExcludedFiles: string[];
94
99
  excludedLibraryFilePrefix: string;
100
+ excludedLibraryFileOverridePrefix?: string;
101
+ excludedInternalFunctionSubstring: string;
95
102
  coverageMemoryPagesMin: number;
96
103
  coverageMemoryPagesMax: number;
97
- excludedLibraryFileOverridePrefix?: string;
98
104
  debug?: boolean;
99
105
  }
100
106
  /**
@@ -210,7 +216,7 @@ interface RunCompileAndDiscoverTask {
210
216
  workerId: number;
211
217
  port: MessagePort;
212
218
  file: File;
213
- config: SerializedConfig;
219
+ config: SerializedConfigCompat;
214
220
  isCollectTestsMode: boolean;
215
221
  }
216
222
  interface RunTestsTask {
@@ -219,7 +225,7 @@ interface RunTestsTask {
219
225
  port: MessagePort;
220
226
  file: File;
221
227
  compilation: WASMCompilation;
222
- config: SerializedConfig;
228
+ config: SerializedConfigCompat;
223
229
  isCollectTestsMode: boolean;
224
230
  timedOutTest?: Test;
225
231
  }
@@ -227,11 +233,11 @@ interface ProcessPoolRunFileTask {
227
233
  dispatchStart: number;
228
234
  port: MessagePort;
229
235
  file: File;
230
- config: SerializedConfig;
236
+ config: SerializedConfigCompat;
231
237
  isCollectTestsMode: boolean;
232
238
  timedOutTest?: Test;
233
239
  timedOutCompilation?: WASMCompilation;
234
240
  }
235
241
  //#endregion
236
242
  export { AssemblyScriptCompilerOptions, AssemblyScriptCompilerResult, AssemblyScriptPoolOptions, HybridProviderOptions, ProcessPoolRunFileTask, RunCompileAndDiscoverTask, RunTestsTask, ThreadSpec, WasmImportsFactory, WasmImportsFactoryInfo };
237
- //# sourceMappingURL=types-D0nprJo1.d.mts.map
243
+ //# sourceMappingURL=types-DHVk5iAx.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-DHVk5iAx.d.mts","names":[],"sources":["../src/types/types.ts"],"mappings":";;;;;;;;UAqEiB,yBAAA;;EAEf,KAAA;EACA,WAAA;EACA,oBAAA;;EAGA,wBAAA;;;;;;;AAiGF;;;EAtFE,WAAA;EAuFA;AAkDF;;;;;;EAhIE,YAAA;EAEA,0BAAA;EACA,sBAAA;EAEA,sBAAA;EACA,kBAAA;EAEA,kBAAA;EAEA,kBAAA;AAAA;;;;;;;;;;;UAae,qBAAA;EACf,aAAA;EAwHe;;;;;;;;EA9Gf,qBAAA;;;;;AAiJF;EA1IE,qBAAA;AAAA;AAAA,UAGe,sBAAA;EACf,MAAA,EAAQ,WAAA,CAAY,MAAA;EACpB,MAAA,EAAQ,WAAA,CAAY,MAAA;EACpB,KAAA;IACE,UAAA,GAAa,SAAA;EAAA;AAAA;AAAA,KAIL,kBAAA,IAAsB,UAAA,EAAY,sBAAA,KAA2B,WAAA,CAAY,OAAA;AAAA,KAyBzE,sBAAA,GAAyB,gBAAA;EACnC,KAAA;AAAA;AAAA,UAkDe,6BAAA;EACf,gBAAA;EACA,WAAA;EACA,sBAAA,GAAyB,sBAAA;EACzB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