{"version":3,"file":"load-user-imports-0kVlLG94.mjs","names":[],"sources":["../src/wasm-executor/wasm-console.ts","../src/wasm-executor/collect-options.ts","../src/wasm-executor/wasm-imports.ts","../src/wasm-executor/coverage-extraction.ts","../src/wasm-executor/index.ts","../src/pool-thread/rpc-reporter.ts","../src/pool-thread/load-user-imports.ts"],"sourcesContent":["import type { AssemblyScriptConsoleLogHandler } from '../types/types.js';\nimport { liftString } from '../util/assemblyscript/binding-helpers.js';\n\nexport function createWasmConsole(\n  memory: WebAssembly.Memory,\n  handleLog: AssemblyScriptConsoleLogHandler\n) {\n  const getMessage = (msgPtr: number, memory: WebAssembly.Memory, prefix: string = ''): string => {\n    return `${prefix}${msgPtr ? liftString(memory, msgPtr) : '<no message>'}`;\n  };\n\n  const timersByLabel: { [label: string]: number } = {};\n\n  // provides the AssemblyScript \"brower-like console\" from AS std lib\n  // see https://github.com/AssemblyScript/assemblyscript/blob/v0.28.9/std/assembly/index.d.ts#L2609\n  return {\n    'console.assert': <T>(assertion: T, msgPtr: number): void => {\n      if (!assertion) {\n        const msg = getMessage(msgPtr, memory);\n        handleLog(`Assertion failed${msg ? `: ${msg}` : ''}`);\n      }\n    },\n    'console.log': (msgPtr: number): void => {\n      handleLog(getMessage(msgPtr, memory));\n    },\n    'console.debug': (msgPtr: number): void => {\n      handleLog(getMessage(msgPtr, memory, 'Debug: '));\n    },\n    'console.info': (msgPtr: number): void => {\n      handleLog(getMessage(msgPtr, memory, 'Info: '));\n    },\n    'console.warn': (msgPtr: number): void => {\n      handleLog(getMessage(msgPtr, memory, 'Warning: '), true);\n    },\n    'console.error': (msgPtr: number): void => {\n      handleLog(getMessage(msgPtr, memory, 'Error: '), true);\n    },\n    'console.time': (labelPtr?: number): void => {\n      const label = labelPtr ? liftString(memory, labelPtr) ?? 'default' : 'default';\n      timersByLabel[label] = performance.now();\n    },\n    'console.timeLog': (labelPtr?: number): void => {\n      const label = labelPtr ? liftString(memory, labelPtr) ?? 'default' : 'default';\n      const start = timersByLabel[label];\n      let msg = '';\n      if (start === undefined) {\n        msg = `Warning: No such label '${label}' for console.timeLog()`;\n      } else {\n        msg = `${label}: ${(performance.now() - start).toFixed(3)}ms`;\n      }\n      handleLog(msg);\n    },\n    'console.timeEnd': (labelPtr?: number): void => {\n      const label = labelPtr ? liftString(memory, labelPtr) ?? 'default' : 'default';\n      const start = timersByLabel[label];\n      let msg = '';\n      if (start === undefined) {\n        msg = `Warning: No such label '${label}' for console.timeLog()`;\n      } else {\n        msg = `${label}: ${(performance.now() - start).toFixed(3)}ms`;\n      }\n      handleLog(msg);\n      delete timersByLabel[label];\n    },\n\n    trace(msgPtr: number, n: number, a0: any, a1: any, a2: any, a3: any): void {\n      const msg = liftString(memory, msgPtr);\n      const args: any[] = [a0, a1, a2, a3];\n      const nArgs: any[] = n && n > 0 ? args.slice(0, n) : args;\n\n      console.trace(`WASM Trace:${msg ? ` ${msg}` : ''}`, ...nArgs);\n    },\n  };\n}\n","import { AssemblyScriptTestOptions } from '../types/types.js';\n\nconst TEST_OPTION_UNDEFINED: number = -1;\nconst TEST_OPTION_TRUE: number = 1;\n\nexport function mergeAssemblyScriptTestOptions(\n  baseOptions: AssemblyScriptTestOptions,\n  timeout: number,\n  retry: number,\n  skip: number,\n  only: number,\n  fails: number,\n): AssemblyScriptTestOptions {\n  const options: AssemblyScriptTestOptions = { ...baseOptions };\n  \n  // numerical options\n  if (timeout > TEST_OPTION_UNDEFINED) {\n    options.timeout = timeout;\n  }\n  if (retry > TEST_OPTION_UNDEFINED) {\n    options.retry = retry;\n  }\n\n  // boolean options\n  if (skip > TEST_OPTION_UNDEFINED) {\n    options.skip = skip === TEST_OPTION_TRUE ? true : false;\n  }\n  if (only > TEST_OPTION_UNDEFINED) {\n    options.only = only === TEST_OPTION_TRUE ? true : false;\n  }\n  if (fails > TEST_OPTION_UNDEFINED) {\n    options.fails = fails === TEST_OPTION_TRUE ? true : false;\n  }\n\n  return options;\n}\n","import type { File, Suite, Test } from '@vitest/runner/types';\n\nimport type {\n  AssemblyScriptConsoleLogHandler,\n  AssemblyScriptSuiteTaskMeta,\n  AssemblyScriptTestError,\n  AssemblyScriptTestTaskMeta,\n  FailedAssertion,\n  WasmImportsFactory,\n} from '../types/types.js';\nimport {\n  AS_POOL_WASM_COVERAGE_MEM_IMPORT_NAME,\n  AS_POOL_WASM_IMPORTS_MODULE_NAME,\n  POOL_ERROR_NAMES,\n  TEST_ERROR_NAMES\n} from '../types/constants.js';\nimport { debug } from '../util/debug.js';\nimport { abortWASMExecution, abortWASMExecutionOnSuccess, createPoolError, getExpectedMessageOrAny } from '../util/pool-errors.js';\nimport { liftString } from '../util/assemblyscript/binding-helpers.js';\nimport { decodeAbortInfo } from './wasm-memory.js';\nimport { createWasmConsole } from './wasm-console.js';\nimport { mergeAssemblyScriptTestOptions } from './collect-options.js';\nimport { createSuiteTask, createTestTask, failTestAssertionError, failTestRuntimeError } from '../util/vitest-tasks.js';\n\nfunction createUserWasmImports(\n  createWasmImports: WasmImportsFactory | undefined,\n  memory: WebAssembly.Memory,\n  module: WebAssembly.Module,\n  logPrefix: string\n) {\n  let userEnvImports: WebAssembly.ModuleImports | undefined;\n  let userCustomEnvImports: WebAssembly.Imports | undefined;\n\n  if (createWasmImports) {\n    try {\n      const start = performance.now();\n      const userImports: WebAssembly.Imports = createWasmImports({\n        memory,\n        module,\n        utils: {\n          liftString: (stringPtr: number) => liftString(memory, stringPtr)\n        }\n      });\n      debug(`${logPrefix} Created user WASM imports for test execution in ${(performance.now() - start).toFixed(2)} ms`);\n\n      userEnvImports = userImports?.env;\n      userCustomEnvImports = { ...userImports };\n      \n      if (userEnvImports) {\n        delete userCustomEnvImports.env;\n      }\n    } catch (error) {\n      const msg = `Could not create user WasmImportsFactory.`\n        + ` Ensure that your module has a default export matching () => WebAssembly.Imports`;\n      throw createPoolError(\n        POOL_ERROR_NAMES.WASMUserImportsError,\n        msg,\n        error,\n        true\n      );\n    }\n  }\n\n  return { userEnvImports, userCustomEnvImports };\n}\n\n/**\n * Create import object for test discovery\n */\nexport function createDiscoveryImports(\n  memory: WebAssembly.Memory,\n  module: WebAssembly.Module,\n  file: File,\n  handleLog: AssemblyScriptConsoleLogHandler,\n  logPrefix: string,\n  coverageMemory?: WebAssembly.Memory,\n  createWasmImports?: WasmImportsFactory,\n): WebAssembly.Imports {\n  const suiteStack: Suite[] = [file];\n\n  const {\n    userEnvImports,\n    userCustomEnvImports\n  } = createUserWasmImports(createWasmImports, memory, module, logPrefix);\n  \n  return {\n    env: {\n      // users can choose to hide these with their own\n      ...createWasmConsole(memory, handleLog),\n\n      // user imports for \"env\"\n      ...(userEnvImports ?? {}),\n\n      memory,\n\n      // handle runtime aborts, which are always unexpected during discovery\n      abort(msgPtr: number, filePtr: number, line: number, column: number) {\n        const { message, location } = decodeAbortInfo(memory, msgPtr, filePtr, line, column);\n        const msgAtLoc = `${message}${location ? ` at ${location}` : ''}`;\n        \n        debug(`${logPrefix} - Unexpected abort during test discovery: ${msgAtLoc}`);\n\n        const testError: AssemblyScriptTestError = {\n          message,\n          name: TEST_ERROR_NAMES.WASMRuntimeError,\n        };\n\n        throw abortWASMExecution(testError, new Error());\n      },\n    },\n\n    [AS_POOL_WASM_IMPORTS_MODULE_NAME]: {\n\n      ...(coverageMemory ? { [AS_POOL_WASM_COVERAGE_MEM_IMPORT_NAME]: coverageMemory } : {}),\n\n      // stubs during discovery\n      __assertion_pass() {},\n      __assertion_fail() {},\n      __expect_throw() {},\n      __end_expect_throw() {},\n\n      __begin_register_suite(\n        namePtr: number,\n        timeout: number,\n        retry: number,\n        skip: number,\n        only: number,\n        fails: number,\n      ) {\n        const parentSuite = suiteStack[suiteStack.length - 1]!;\n        const defaultTestOptions = (parentSuite.meta as AssemblyScriptSuiteTaskMeta).defaultTestOptions;\n        const suiteName = liftString(memory, namePtr) ?? 'unknown suite';\n        const options = mergeAssemblyScriptTestOptions(defaultTestOptions, timeout, retry, skip, only, fails);\n        const suite = createSuiteTask(suiteName, file, parentSuite, options);\n        suiteStack.push(suite);\n\n        debug(\n          `${logPrefix} - Registering Suite \"${suite.name}\" | timeout: ${options.timeout} ms | retry: ${options.retry}`\n          + ` | skip: ${options.skip} | only: ${options.only} | fails: ${options.fails} `\n          + ` | parent: \"${suite.suite?.name}\" (parent idx: ${(suite.meta as AssemblyScriptSuiteTaskMeta).idxInParentTasks})`\n        );\n      },\n      \n      __end_register_suite(_namePtr: number) {\n        const suite = suiteStack.pop();\n\n        debug(\n          `${logPrefix} - Registered Suite \"${suite?.name}\" | ${suite?.tasks.length} top-level tasks | mode: \"${suite?.mode}\"`\n          + ` | parent: \"${suite?.suite?.name}\" (parent idx: ${(suite?.meta as AssemblyScriptSuiteTaskMeta)?.idxInParentTasks})`\n        );\n      },\n\n      // called by test() to register test names and function indices\n      __register_test(\n        namePtr: number,\n        fnIndex: number,\n        timeout: number,\n        retry: number,\n        skip: number,\n        only: number,\n        fails: number,\n      ) {\n        const parentSuite = suiteStack[suiteStack.length - 1]!;\n        const defaultTestOptions = (parentSuite.meta as AssemblyScriptSuiteTaskMeta).defaultTestOptions;\n        const testName = liftString(memory, namePtr) ?? 'unknown test';\n        const options = mergeAssemblyScriptTestOptions(defaultTestOptions, timeout, retry, skip, only, fails);\n        const test = createTestTask(testName, fnIndex, file, parentSuite, options);\n        \n        debug(`${logPrefix} - Registered test \"${test.name}\" | mode (pre-interp): \"${test.mode}\"`\n          + ` | fnIndex ${fnIndex} | timeout: ${options.timeout} ms | retry: ${options.retry} | skip: ${options.skip}`\n          + ` | only: ${options.only} | fails: ${options.fails} | suite: \"${test.suite?.name}\"`\n          + ` (parent idx: ${(test.meta as AssemblyScriptTestTaskMeta).idxInParentTasks})`\n        );\n      },\n    },\n\n    // user imports for any other environments they defined\n    ...(userCustomEnvImports ?? {}),\n  };\n}\n\n/**\n * Create import object for test execution\n *\n * Used during test execution to capture test results / assertions, and to handle\n * runtime aborts as expected cases for test execution by capturing the error on the test meta.\n */\nexport function createTestExecutionImports(\n  memory: WebAssembly.Memory,\n  module: WebAssembly.Module,\n  test: Test,\n  handleLog: AssemblyScriptConsoleLogHandler,\n  logPrefix: string,\n  coverageMemory?: WebAssembly.Memory,\n  createWasmImports?: WasmImportsFactory,\n): { imports: WebAssembly.Imports; provideFunctionTable: (table: WebAssembly.Table) => void; } {\n  // execution imports are created per-test, so these represent per-test state\n  let lastFailedAssertion: FailedAssertion | undefined;\n  let isExpectingError: boolean = false;\n  let expectedErrorMsgStr: string | undefined;\n  let wasmFunctionTable: WebAssembly.Table | undefined;\n\n  const {\n    userEnvImports,\n    userCustomEnvImports\n  } = createUserWasmImports(createWasmImports, memory, module, logPrefix);\n\n  const imports = {\n    env: {\n      // users can choose to hide these with their own\n      ...createWasmConsole(memory, handleLog),\n\n      // user imports for \"env\"\n      ...(userEnvImports ?? {}),\n\n      memory,\n\n      abort(msgPtr: number, filePtr: number, line: number, column: number) {\n        const { message, location } = decodeAbortInfo(memory, msgPtr, filePtr, line, column);\n        const msgAtLoc = `${message}${location ? ` at ${location}` : ''}`;\n        \n        debug(`${logPrefix} - Handling test execution abort: ${msgAtLoc}`);\n\n        let failureMessage = message;\n\n        // handle expected aborts for thrown errors\n        if (isExpectingError) {\n          // TODO: decide if .includes is correct here or not\n          if (!expectedErrorMsgStr || message.includes(expectedErrorMsgStr)) {\n            // either no specifically expected error (any error), or error message matches\n            (test.meta as AssemblyScriptTestTaskMeta).assertionsPassedCount++;\n            \n            debug(`${logPrefix} - Thrown error matches expected - assertion passes`);\n\n            // abort without failing the test\n            throw abortWASMExecutionOnSuccess();\n          } else {\n            const expected = getExpectedMessageOrAny(expectedErrorMsgStr);\n\n            // error message mismatch\n            failureMessage = `expected function to throw error ${expected}, but received error \"${message}\"`;\n\n            lastFailedAssertion = {\n              message: failureMessage,\n              actualTypeName: 'string',\n              expectedTypeName: 'string',\n              valuesProvided: true,\n              actual: message,\n              expected: expectedErrorMsgStr\n            };\n\n            const errStr = `Thrown error does not match expected | Expected: ${expected} | Actual: \"${message}\"`;\n            debug(`${logPrefix} - Assertion failed: ${errStr}`);\n          }\n        }\n\n        const testError = lastFailedAssertion\n          ? failTestAssertionError(test, lastFailedAssertion)\n          : failTestRuntimeError(test, '', failureMessage);\n\n        throw abortWASMExecution(testError, new Error());\n      },\n    },\n\n    [AS_POOL_WASM_IMPORTS_MODULE_NAME]: {\n      \n      ...(coverageMemory ? { [AS_POOL_WASM_COVERAGE_MEM_IMPORT_NAME]: coverageMemory } : {}),\n\n      // stubs during execution\n      __register_test() {},\n      __begin_register_suite() {},\n      __end_register_suite() {},\n\n      __assertion_pass() {\n        (test.meta as AssemblyScriptTestTaskMeta).assertionsPassedCount++;\n      },\n\n      __assertion_fail(msgPtr: number, actualTypeNamePtr: number, expectedTypeNamePtr: number, valuesProvided: boolean, actualPtr?: number, expectedPtr?: number) {\n        const errorMsg = liftString(memory, msgPtr) ?? '';\n        const actualTypeName = liftString(memory, actualTypeNamePtr) ?? '';\n        const expectedTypeName = liftString(memory, expectedTypeNamePtr) ?? '';\n        let valuesMsg = ' | No Values Provided';\n        \n        lastFailedAssertion = {\n          actualTypeName,\n          expectedTypeName,\n          message: errorMsg,\n          valuesProvided: Boolean(valuesProvided)\n        };\n\n        (test.meta as AssemblyScriptTestTaskMeta).assertionsFailed.push(lastFailedAssertion);\n        \n        if (valuesProvided && actualPtr && expectedPtr) {\n          lastFailedAssertion.actual = liftString(memory, actualPtr);\n          lastFailedAssertion.expected = liftString(memory, expectedPtr);\n          valuesMsg = ` | Actual Type: ${actualTypeName} | Expected Type: ${expectedTypeName}`\n            + ` | Actual Value: \\`${lastFailedAssertion.actual}\\` | Expected Value: \\`${lastFailedAssertion.expected}\\``;\n        }\n        \n        debug(`${logPrefix} - Assertion failed: ${errorMsg}${valuesMsg}`);\n      },\n\n      __expect_throw(fnIndex: number, expectedErrorMsgPtr?: number) {\n        isExpectingError = true;\n        if (expectedErrorMsgPtr) {\n          expectedErrorMsgStr = liftString(memory, expectedErrorMsgPtr);\n        }\n\n        debug(`${logPrefix} - Registered expected error throw: ${getExpectedMessageOrAny(expectedErrorMsgStr)}`);\n\n        if (wasmFunctionTable && typeof wasmFunctionTable.get === 'function') {\n          const fn = wasmFunctionTable.get(fnIndex);\n          if (!fn) {\n            throw createPoolError(\n              POOL_ERROR_NAMES.WASMExecutionHarnessError,\n              `Could not access function (fnPtr ${fnIndex}) which is expected to throw in test \"${test.name}\"`,\n            );\n          }\n\n          // successful:\n          //   - throws in WASM, calls abort handler\n          //   - abort handler confirms error matches expected, does NOT fail test, halts execution with WASMExecutionAbortError\n          //   - executor catches WASMExecutionAbortError as 'known' and proceeds to process & report passed test\n          // failure (wrong error):\n          //   - throws in WASM, calls abort handler\n          //   - abort handler confirms error matches mismatch, failTest packages up an appropriate test error\n          //   - abort handler halts execution with WASMExecutionAbortError containing test error\n          //   - executor catches WASMExecutionAbortError as 'known' and proceeds to process & report test error\n          // failure (no error):\n          //   - does NOT throw in WASM\n          //   - WASM continues executing and calls __end_expect_throw\n          //   - __end_expect_throw sees it is STILL expecting an error, failTest packages up an appropriate test error\n          //   - __end_expect_throw halts execution with WASMExecutionAbortError containing test error\n          //   - executor catches WASMExecutionAbortError as 'known' and proceeds to process & report test error\n          debug(`${logPrefix} - Calling function (idx ${fnIndex})`);\n          fn();\n        } else {\n          throw createPoolError(\n            POOL_ERROR_NAMES.WASMExecutionHarnessError,\n            `Could not access WASM function table to call function expected to throw`,\n          );\n        }\n      },\n\n      __end_expect_throw() {\n        if (isExpectingError) {\n          const errStr = `Expected thrown error but got none | Expected: \"${expectedErrorMsgStr}\"`;\n          debug(`${logPrefix} - Assertion failed: ${errStr}`);\n          \n          const failureMessage = `function did not throw, but was expected to throw error: ${getExpectedMessageOrAny(expectedErrorMsgStr)}`;\n          const testError = failTestAssertionError(test, {\n            message: failureMessage,\n            actualTypeName: 'undefined',\n            expectedTypeName: 'string',\n            valuesProvided: true,\n            actual: undefined,\n            expected: expectedErrorMsgStr\n          });\n\n          // Must throw here to halt WASM execution on an assertion or runtime failure for this test.\n          // This will be caught by the executor and reported as an appropriate test error\n          throw abortWASMExecution(testError);\n        }\n      },\n    },\n\n    // user imports for any other environments they defined\n    ...(userCustomEnvImports ?? {}),\n  };\n\n  return {\n    imports,\n    provideFunctionTable:  (table: WebAssembly.Table) => {\n      debug(`${logPrefix} - Got WASM function table | length: ${table.length}`);\n      wasmFunctionTable = table;\n    },\n  };\n}\n","/**\n * Executor-side coverage extraction\n *\n * Converts raw WASM coverage counters into positional coverage data, run per\n * test in the test worker (where the binary's debug info is in hand).\n */\n\nimport type {\n  BasicBlockDebugInfo,\n  BinaryDebugInfo,\n  BranchHits,\n  BranchTargetHits,\n  CoverageData,\n  DecisionPositions,\n  FunctionDebugInfo,\n  SourceLocation,\n} from '../types/types.js';\nimport { mergeBranchPathHits } from '../coverage-provider/coverage-merge.js';\n\n/**\n * Build statement/expression-level coverage from block counters.\n *\n * Attributes each instrumented block's hit count to the source positions of the\n * located expressions it contains, applying this aggregation:\n *   - within one function instance: a source position's hit count is the MAX\n *     over the blocks at that position. One source position can land in two\n *     blocks of a single instance (compiler-split blocks, or a dead trailing\n *     `Unreachable` carrying the last real statement's location); since the\n *     count means \"times the position was reached,\" summing would double-count\n *     one logical execution, so we take the max.\n *   - across monomorphizations of the same source function (distinct compiled\n *     functions sharing a source position): SUM — each is a real execution.\n *\n * Cross-test SUM is applied later by merging these per-test results up the suite\n * tree. Applying the per-instance MAX per test *first* is what keeps the counts\n * exact: MAX-of-summed-counters would understate a position hit by two reachable\n * blocks across different tests.\n *\n * @param debugInfo - processed binary debug info (functions grouped by file + position)\n * @param counters - coverage counter values, indexed by coverageMemoryIndex\n * @returns positional statement/expression hit map (CoverageData shape)\n */\nexport function buildExpressionHits(\n  debugInfo: BinaryDebugInfo,\n  counters: ArrayLike<number>,\n): CoverageData {\n  const expressionHits: CoverageData = { hitCountsByFileAndPosition: {} };\n\n  for (const debugFunctions of Object.values(debugInfo.functionsByFileAndPosition)) {\n    for (const funcInfos of Object.values(debugFunctions)) {\n      for (const funcInfo of funcInfos) {\n        // Per-instance: source position -> MAX block hit count\n        const instanceHits: Record<string, Record<string, number>> = {};\n        for (const block of funcInfo.basicBlocks) {\n          if (block.coverageMemoryIndex === undefined) {\n            continue;\n          }\n          const blockHit = counters[block.coverageMemoryIndex] ?? 0;\n          for (const exprIndex of block.expressionIndices) {\n            const location = funcInfo.expressions[exprIndex]?.location;\n            if (!location) {\n              continue;\n            }\n            const positionKey = `${location.line}:${location.column}`;\n            const fileHits = (instanceHits[location.filePath] ??= {});\n            fileHits[positionKey] = Math.max(fileHits[positionKey] ?? 0, blockHit);\n          }\n        }\n        // SUM this instance into the result (across monomorphizations)\n        for (const [filePath, positions] of Object.entries(instanceHits)) {\n          const accFile = (expressionHits.hitCountsByFileAndPosition[filePath] ??= {});\n          for (const [positionKey, hit] of Object.entries(positions)) {\n            accFile[positionKey] = (accFile[positionKey] ?? 0) + hit;\n          }\n        }\n      }\n    }\n  }\n\n  return expressionHits;\n}\n\n/**\n * A branch arm's representative entry position: the first located expression in\n * the block that lies in the function's OWN (home) file, in expression order\n * (≈ execution order).\n *\n * The home-file preference matters because a block can contain cross-file inlined\n * expressions — most commonly a default-param `Const` inlined from another file's\n * constructor (e.g. `new Counter()` applying the default), located at the\n * constructor's definition site. That foreign location is NOT where this arm lives\n * in source; using it would file the whole decision under the foreign file and put\n * the arm outside its source range, so the arm would never containment-match and\n * would read 0. We skip foreign locations and use the first home-file one, falling\n * back to the first foreign location only when an arm has no home-file expression\n * at all (a purely-inlined arm — no worse than before). Returns undefined for a\n * block with no located expression (an implicit arm, derived provider-side).\n *\n * The home file comes from `representativeLocation`, which is guaranteed local to\n * the function (see coverage-architecture.md → Representative Location).\n */\nfunction firstLocatedExpressionLocation(\n  funcInfo: FunctionDebugInfo,\n  block: BasicBlockDebugInfo,\n): SourceLocation | undefined {\n  const homeFile = funcInfo.representativeLocation.filePath;\n  let firstForeign: SourceLocation | undefined;\n  for (const exprIndex of block.expressionIndices) {\n    const location = funcInfo.expressions[exprIndex]?.location;\n    if (!location) {\n      continue;\n    }\n    if (location.filePath === homeFile) {\n      return location;\n    }\n    if (!firstForeign) {\n      firstForeign = location;\n    }\n  }\n  return firstForeign;\n}\n\n/**\n * Canonical decision key: the sorted composite of the decision's located\n * arm-target positions (e.g. \"47:9|49:3\"). Source-derived, so it is stable\n * across binaries and across monomorphizations of the same source branch.\n *\n * Stability across monomorphizations relies on an arm's target position coming\n * from the arm's SOURCE content, which is identical for every specialization —\n * so an arm doesn't drop from (or shift within) the key for some types only. Even\n * a type-conditionally-folded inner construct keeps a located marker at its own\n * source position (a folded `if (isInteger<T>()) {…}` still anchors the arm at the\n * inner `if`), so a surviving decision's arms stay located in every instance and\n * the per-instance keys match and merge.\n */\nfunction buildDecisionKey(targets: BranchTargetHits[]): string {\n  return targets\n    .map(t => `${t.location.line}:${t.location.column}`)\n    .sort()\n    .join('|');\n}\n\n/**\n * Build branch-level coverage from block counters.\n *\n * For each decision block (CFG out-degree ≥ 2), records per-arm hit counts — the\n * counter of each located out-edge target block — plus the decision's own hit\n * count (`decisionHits`):\n *   - `decisionHits` = the decision block's counter, or `null` when the decision\n *     block has no counter (a fused-logical `if`/loop/ternary whose condition is\n *     a synthetic `&&`/`||` result, with no located expression to anchor on). The\n *     provider derives a null decisionHits from the condition's leftmost-atom hit.\n *   - `targets` carries only LOCATED out-edge targets (arms with source code).\n *     Unlocated targets (implicit else/default arms) are omitted; the provider\n *     derives their hits as decisionHits − Σ(located arm hits).\n *\n * Decisions are keyed by their located arm-target positions, so the same source\n * branch across monomorphizations resolves to one key and its arm hits SUM. The\n * cross-test SUM is applied later by merging these per-test results up the suite\n * tree (mergeBranchHits).\n *\n * @param debugInfo - processed binary debug info\n * @param counters - coverage counter values, indexed by coverageMemoryIndex\n * @returns branch hit map keyed by file + decision key\n */\nexport function buildBranchHits(\n  debugInfo: BinaryDebugInfo,\n  counters: ArrayLike<number>,\n): BranchHits {\n  const branchHits: BranchHits = { hitsByFileAndDecision: {} };\n\n  for (const debugFunctions of Object.values(debugInfo.functionsByFileAndPosition)) {\n    for (const funcInfos of Object.values(debugFunctions)) {\n      for (const funcInfo of funcInfos) {\n        // Index blocks by their CFG index so out-edges can resolve target blocks.\n        const blockByIndex = new Map<number, BasicBlockDebugInfo>();\n        for (const block of funcInfo.basicBlocks) {\n          blockByIndex.set(block.index, block);\n        }\n\n        for (const block of funcInfo.basicBlocks) {\n          if (!block.isDecision) {\n            continue;\n          }\n\n          // Located arm targets: each out-edge target block's first located\n          // expression position + its counter value.\n          const targets: BranchTargetHits[] = [];\n          for (const edge of block.branches) {\n            const targetBlock = blockByIndex.get(edge.targetBlockIndex);\n            if (!targetBlock) {\n              continue;\n            }\n            const location = firstLocatedExpressionLocation(funcInfo, targetBlock);\n            if (!location) {\n              continue; // unlocated arm — implicit, derived provider-side\n            }\n            const hits = targetBlock.coverageMemoryIndex === undefined\n              ? 0\n              : (counters[targetBlock.coverageMemoryIndex] ?? 0);\n            targets.push({ hits, location });\n          }\n\n          // A decision with no located arms is unmatchable to a source branch\n          // (both arms implicit) — nothing to report.\n          if (targets.length === 0) {\n            continue;\n          }\n\n          const decisionHits = block.coverageMemoryIndex === undefined\n            ? null\n            : (counters[block.coverageMemoryIndex] ?? 0);\n\n          const decisionKey = buildDecisionKey(targets);\n          const filePath = targets[0]!.location.filePath;\n          const fileDecisions = (branchHits.hitsByFileAndDecision[filePath] ??= {});\n\n          const existing = fileDecisions[decisionKey];\n          if (existing) {\n            // SUM across monomorphizations of the same source branch.\n            mergeBranchPathHits(existing, { decisionHits, targets });\n          } else {\n            fileDecisions[decisionKey] = { decisionHits, targets };\n          }\n        }\n      }\n    }\n  }\n\n  return branchHits;\n}\n\n/**\n * The last located expression in a block, in expression (≈ execution) order. For\n * a switch comparison decision (`day == <case-label>`), this is the case-label\n * `Const` — the discriminant `LocalGet` precedes it, and on the first comparison\n * the switch preamble precedes it too (the eq/br_if that follow carry no location).\n * Returns undefined for a block with no located expressions.\n */\nfunction lastLocatedExpressionLocation(\n  funcInfo: FunctionDebugInfo,\n  block: BasicBlockDebugInfo,\n): SourceLocation | undefined {\n  for (let i = block.expressionIndices.length - 1; i >= 0; i--) {\n    const location = funcInfo.expressions[block.expressionIndices[i]!]?.location;\n    if (location) {\n      return location;\n    }\n  }\n  return undefined;\n}\n\n/**\n * The decision block that branches into the given block (its in-edge). For an\n * empty fall-through switch case, this is the comparison decision whose matched\n * (true) edge targets the empty case region. Returns the first decision whose\n * out-edges include the target index.\n */\nfunction findInEdgeDecision(\n  funcInfo: FunctionDebugInfo,\n  targetBlockIndex: number,\n): BasicBlockDebugInfo | undefined {\n  for (const block of funcInfo.basicBlocks) {\n    if (!block.isDecision) {\n      continue;\n    }\n    for (const edge of block.branches) {\n      if (edge.targetBlockIndex === targetBlockIndex) {\n        return block;\n      }\n    }\n  }\n  return undefined;\n}\n\n/**\n * Build empty fall-through switch-case coverage from post-anchored block counters.\n *\n * An empty fall-through case (`case A: case B: <body>`, where `case A` has no\n * statements of its own) carries its \"entered\" count on a post-anchored block —\n * one with a counter but NO located expression, so it is invisible to both\n * buildExpressionHits and buildBranchHits. Here we surface it: for each such block\n * (counted, no located expression, not a decision), find its in-edge decision (the\n * comparison block that branches into it) and borrow that decision's case-label\n * position (its last located expression — the `case X:` literal), recording\n * `{caseLabelPosition: counter}`.\n *\n * This goes in a DEDICATED map rather than expressionHits/branchHits because the\n * case-label position is already occupied in BOTH shared maps — by the comparison\n * block's own case-label `Const` (expressionHits) and by the previous comparison's\n * false-edge arm (branchHits) — each carrying the wrong comparison-chain count. The\n * dedicated map holds only empty-case entries, so it is collision-free.\n *\n * Cross-test / cross-monomorphization SUM is applied later by merging up the suite\n * tree (mergeCoverageData). There is at most one empty-case entry per case-label\n * per function instance, so no within-instance aggregation is needed.\n *\n * @param debugInfo - processed binary debug info\n * @param counters - coverage counter values, indexed by coverageMemoryIndex\n * @returns positional empty-case hit map (CoverageData shape, keyed by case-label position)\n */\nexport function buildCaseHits(\n  debugInfo: BinaryDebugInfo,\n  counters: ArrayLike<number>,\n): CoverageData {\n  const caseHits: CoverageData = { hitCountsByFileAndPosition: {} };\n\n  for (const debugFunctions of Object.values(debugInfo.functionsByFileAndPosition)) {\n    for (const funcInfos of Object.values(debugFunctions)) {\n      for (const funcInfo of funcInfos) {\n        for (const block of funcInfo.basicBlocks) {\n          // Only the addon's post-anchored empty fall-through switch cases feed\n          // emptyCaseHits — the flag identifies them by construction, so no structural\n          // inference here. (A post-anchored block always has a counter; the index\n          // check just narrows the type for the read below.)\n          if (!block.isPostAnchored || block.coverageMemoryIndex === undefined) {\n            continue;\n          }\n\n          const inEdgeDecision = findInEdgeDecision(funcInfo, block.index);\n          if (!inEdgeDecision) {\n            continue;\n          }\n          const location = lastLocatedExpressionLocation(funcInfo, inEdgeDecision);\n          if (!location) {\n            continue;\n          }\n\n          const hits = counters[block.coverageMemoryIndex] ?? 0;\n          const positionKey = `${location.line}:${location.column}`;\n          const fileHits = (caseHits.hitCountsByFileAndPosition[location.filePath] ??= {});\n          fileHits[positionKey] = (fileHits[positionKey] ?? 0) + hits;\n        }\n      }\n    }\n  }\n\n  return caseHits;\n}\n\n/**\n * Build the set of binary decision-block source positions, per file — the robust\n * signal for detecting compiler-folded branches.\n *\n * For every decision block (CFG out-degree ≥ 2), record its representative source\n * position (the home-file-aware first located expression — the condition, or for a\n * fused-logical `&&`/`||` the located short-circuit operand). A source branch whose\n * condition range contains NONE of these positions was folded: a constant condition\n * is evaluated at compile time and emits no decision block. Unlike \"no arm matched\",\n * this can't be confused with a real branch whose empty/unlocated arms got its\n * decision dropped from branchHits.\n *\n * Purely structural — independent of execution (no counters). Deduplicated per file;\n * accumulated by UNION across tests and files (mergeDecisionPositions).\n *\n * @param debugInfo - processed binary debug info\n * @returns decision positions keyed by file (\"line:column\")\n */\nexport function buildDecisionPositions(debugInfo: BinaryDebugInfo): DecisionPositions {\n  const sets: Record<string, Set<string>> = {};\n\n  for (const debugFunctions of Object.values(debugInfo.functionsByFileAndPosition)) {\n    for (const funcInfos of Object.values(debugFunctions)) {\n      for (const funcInfo of funcInfos) {\n        for (const block of funcInfo.basicBlocks) {\n          if (!block.isDecision) {\n            continue;\n          }\n          const location = firstLocatedExpressionLocation(funcInfo, block);\n          if (!location) {\n            continue;\n          }\n          (sets[location.filePath] ??= new Set()).add(`${location.line}:${location.column}`);\n        }\n      }\n    }\n  }\n\n  const positionsByFile: Record<string, string[]> = {};\n  for (const [filePath, set] of Object.entries(sets)) {\n    positionsByFile[filePath] = [...set];\n  }\n  return { positionsByFile };\n}\n","import { basename } from 'node:path';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\nimport type { File, Test } from '@vitest/runner/types';\n\nimport type {\n  AssemblyScriptConsoleLogHandler,\n  AssemblyScriptPoolError,\n  AssemblyScriptTestError,\n  AssemblyScriptTestTaskMeta,\n  CoverageData,\n  ResolvedAssemblyScriptPoolOptions,\n  ThreadImports,\n  WASMCompilation,\n  WASMExecutorPerfTimings,\n} from '../types/types.js';\nimport { AS_POOL_ERROR_FLAG, POOL_ERROR_NAMES } from '../types/constants.js';\nimport { debug, debugOverride } from '../util/debug.js';\nimport { createMemory } from './wasm-memory.js';\nimport { createDiscoveryImports, createTestExecutionImports } from './wasm-imports.js';\nimport { enhanceTestError } from './wasm-errors.js';\nimport { createPoolError, wrapPoolError } from '../util/pool-errors.js';\nimport { failTestRuntimeError, getTaskLogLabel } from '../util/vitest-tasks.js';\nimport { extractCallStack } from './source-maps.js';\nimport { buildExpressionHits, buildBranchHits, buildCaseHits, buildDecisionPositions } from './coverage-extraction.js';\n\nconst SIG_MISMATCH_ERROR_MSG = `WASM function signature type mismatch during test collection.`\n  + ` This is most likely caused by passing a type-inferred, non-void callback to expect().`\n  + ` To fix, either explicitly define the non-void return type on the callback`\n  + `  e.g. \\`expect((): i32 => failingFunction()).toThrowError()\\``\n  + ` or use braces to make it void  e.g. \\`expect(() => { failingFunction(); }).toThrowError()\\`.`\n  + ` Look for the failing expect() within the describe() block indicated in the stack trace.`;\n\nfunction verifyMemoryRequirements(\n  compilation: WASMCompilation,\n  poolOptions: ResolvedAssemblyScriptPoolOptions,\n) {\n  if (poolOptions.testMemoryPagesInitial && poolOptions.testMemoryPagesInitial < compilation.requiredMemory.testMemory.initialPages) {\n    throw createPoolError(\n        POOL_ERROR_NAMES.PoolConfigError,\n        `WASM binary requires initial test memory pages (${compilation.requiredMemory.testMemory.initialPages}) exceeding configured \"testMemoryPagesInitial\"`\n      + ` (${poolOptions.testMemoryPagesInitial}). Increase value, or remove for auto sizing.`,\n      );\n  }\n  \n  if (poolOptions.testMemoryPagesMax && compilation.requiredMemory.testMemory.maximumPages\n    && poolOptions.testMemoryPagesMax < compilation.requiredMemory.testMemory.maximumPages\n  ) {\n    throw createPoolError(\n      POOL_ERROR_NAMES.PoolConfigError,\n      `WASM binary requires maximum test memory pages (${compilation.requiredMemory.testMemory.maximumPages}) exceeding configured \"testMemoryPagesMax\"`\n      + ` (${poolOptions.testMemoryPagesMax}). Increase value, or remove for auto sizing.`,\n    );\n  }\n}\n\nfunction createExecutorMemories(\n  compilation: WASMCompilation,\n  poolOptions: ResolvedAssemblyScriptPoolOptions,\n  includeCoverageMemory: boolean,\n): { testMemory: WebAssembly.Memory; coverageMemory?: WebAssembly.Memory } {\n  verifyMemoryRequirements(compilation, poolOptions);\n\n  const testMemory = createMemory(\n    poolOptions.testMemoryPagesInitial ?? compilation.requiredMemory.testMemory.initialPages,\n    poolOptions.testMemoryPagesMax ?? compilation.requiredMemory.testMemory.maximumPages\n  );\n  const coverageMemory = includeCoverageMemory ?\n    createMemory(\n      compilation.requiredMemory.coverageMemory.initialPages,\n      compilation.requiredMemory.coverageMemory.maximumPages\n    )\n    : undefined;\n\n  return { testMemory, coverageMemory };\n}\n\n/**\n * Discover tests via test() and suites via describe() registration calls\n */\nexport async function executeWASMDiscovery(\n  compilation: WASMCompilation,\n  poolOptions: ResolvedAssemblyScriptPoolOptions,\n  isBinaryInstrumented: boolean,\n  handleLog: AssemblyScriptConsoleLogHandler,\n  file: File,\n  moduleLabel: string,\n  threadImports: ThreadImports,\n): Promise<void> {\n  const base = basename(file.filepath);\n  const logPrefix = `[${moduleLabel} Exec] ${getTaskLogLabel(base, file)}`;\n  \n  try {\n    const { testMemory, coverageMemory } = createExecutorMemories(compilation, poolOptions, isBinaryInstrumented);\n\n    const importObject = createDiscoveryImports(\n      testMemory,\n      compilation.compiledModule,\n      file,\n      handleLog,\n      logPrefix,\n      coverageMemory,\n      threadImports.createUserWasmImports\n    );\n\n    // Instantiate WASM module\n    const instance = new WebAssembly.Instance(compilation.compiledModule, importObject);\n    const exports = instance.exports as Record<string, unknown>;\n\n    // Call _start to run top-level test() and describe()\n    if (typeof exports._start === 'function') {\n      exports._start();\n    } else {\n      throw createPoolError(\n        POOL_ERROR_NAMES.WASMExecutionHarnessError,\n        'no _start() export found on compiled WASM binary'\n      );\n    }\n  } catch (error: any) {\n    if (error && error[AS_POOL_ERROR_FLAG]) {\n      throw error;\n    }\n\n    // void type inference issue\n    if (error instanceof WebAssembly.RuntimeError && error.message.includes('null function or function signature mismatch')) {\n      throw createPoolError(POOL_ERROR_NAMES.PoolSyntaxError, SIG_MISMATCH_ERROR_MSG, error);\n    }\n\n    if (error instanceof Error) {\n      let match: RegExpExecArray | null = null;\n      let moduleName: string | undefined;\n      let functionName: string | undefined;\n      let errorMessage: string | undefined;\n      \n      if (match = /\"(.+)\": module is not an object or function/.exec(error.message)) {\n        // module import error\n        moduleName = match[1];\n        errorMessage = `Expected module \"${moduleName}\" to be defined as an object`\n          + ` or function within user WASM imports (returned by WasmImportsFactory).`;\n      } else if (match = /\"(.+)\" (function=)?\"(.+)\": function import requires a callable/.exec(error.message)) {\n        // function import error\n        moduleName = match[1];\n        functionName = match[3];\n        errorMessage = `Expected function \"${functionName}\" to be defined in module \"${moduleName}\"`\n          + ` within user WASM imports (returned by WasmImportsFactory).`;\n      }\n\n      if (errorMessage) {\n        throw createPoolError(POOL_ERROR_NAMES.WASMUserImportsError, errorMessage, error);\n      }\n    }\n    \n    // any other error\n    throw wrapPoolError(POOL_ERROR_NAMES.WASMExecutionHarnessError, error, true);\n  }\n\n  debug(`${logPrefix} - Discovered ${file.tasks.length} top-level tasks`);\n  return;\n}\n\n/**\n * Execute a single test with crash isolation\n */\nexport async function executeWASMTest(\n  test: Test,\n  compilation: WASMCompilation,\n  poolOptions: ResolvedAssemblyScriptPoolOptions,\n  collectCoverage: boolean,\n  handleLog: AssemblyScriptConsoleLogHandler,\n  moduleLabel: string,\n  threadImports: ThreadImports,\n  projectRoot: string,\n  diffOptions?: SerializedDiffOptions,\n): Promise<{ test: Test, testTimings: WASMExecutorPerfTimings }> {\n  const testTimings: WASMExecutorPerfTimings = {\n    fnInit: performance.now(),\n    execStart: 0,\n    execEnd: 0,\n    fnfinal: 0\n  };\n  const base = basename(test.file.filepath);\n  const fullModuleLabel = `${moduleLabel} Exec`;\n  const taskLabel = getTaskLogLabel(base, test);\n  const logPrefix = `[${fullModuleLabel}] ${taskLabel}`;\n\n  function covDebug(...args: any[]): void {\n    if (poolOptions.debugCoverageExtract) {\n      debugOverride(...args);\n    }\n  };\n\n  const { testMemory, coverageMemory } = createExecutorMemories(compilation, poolOptions, collectCoverage);\n\n  // Create import object with pool-side functions for capturing test execution results\n  const { imports, provideFunctionTable } = createTestExecutionImports(\n    testMemory,\n    compilation.compiledModule,\n    test,\n    handleLog,\n    logPrefix,\n    coverageMemory,\n    threadImports.createUserWasmImports\n  );\n\n  // Instantiate fresh WASM instance for this test\n  const instance = new WebAssembly.Instance(compilation.compiledModule, imports);\n  const exports = instance.exports as Record<string, unknown>;\n\n  // Func table accessable because we're using the AS compiler --exportTable flag\n  const table = exports.table as WebAssembly.Table | undefined;\n  \n  // allow imports to access table\n  if (table && typeof table.get === 'function') {\n    provideFunctionTable(table);\n  }\n\n  // Call _start to run top-level code. Test registration is stubbed/noop duing execution,\n  // but this call is still needed to initialize any user-defined globals / other top level code.\n  if (typeof exports._start === 'function') {\n    // Not explicitly handling with try-catch here because failures in _start should be\n    // caught during discovery and source-mapped. If this somehow fails, the worker still catches it.\n    exports._start();\n  } else {\n    throw createPoolError(\n      POOL_ERROR_NAMES.WASMExecutionHarnessError,\n      'no _start() export found on compiled WASM binary'\n    );\n  }\n\n  let testFn: ((retryCount?: number) => void) | null | undefined;\n  \n  if (table && typeof table.get === 'function') {\n    const idx = (test.meta as AssemblyScriptTestTaskMeta).fnIndex;\n    testFn = table.get(idx) as ((retryCount?: number) => void) | null;\n\n    if (!testFn) {\n      throw createPoolError(\n        POOL_ERROR_NAMES.WASMExecutionHarnessError,\n        `Test function at index ${idx} not found in function table`\n      );\n    }\n  } else {\n    throw createPoolError(\n      POOL_ERROR_NAMES.WASMExecutionHarnessError,\n      'Function table not found in WASM exports (missing --exportTable flag?)'\n    );\n  }\n\n  // try-catch to ensure we capture known test errors to report\n  // as AssemblyScriptTestErrors to vitest\n  try {\n    // Execute this test\n    testTimings.execStart = performance.now();\n    testFn(test?.result?.retryCount);\n    testTimings.execEnd = performance.now();\n\n    // If we reach here, test passed, i.e. No abort occurred.\n    // Proceed below to prepare the test result\n  } catch (error: any) {\n    testTimings.execEnd = performance.now();\n\n    let testError: AssemblyScriptTestError;\n    let stack: NodeJS.CallSite[];\n    let allowStackJS: boolean;\n    let applyStackToTestErrorCause: boolean;\n\n    if (error && error[AS_POOL_ERROR_FLAG]) {\n      const wrapper = error as AssemblyScriptPoolError;\n      testError = wrapper.testError;\n      stack = wrapper.originalErrorRawStack;\n      allowStackJS = wrapper.originalErrorMayContainJS;\n      applyStackToTestErrorCause = wrapper.applyStackToTestErrorCause;\n    } else if (error instanceof Error) {\n      testError = failTestRuntimeError(test, error.name, error.message);\n      stack = extractCallStack(error);\n      allowStackJS = true;\n      applyStackToTestErrorCause = false;\n    } else {\n      testError = failTestRuntimeError(test, '', `Unexpected WASM test execution error: ${String(error)}`);\n      stack = extractCallStack(new Error());\n      allowStackJS = true;\n      applyStackToTestErrorCause = false;\n    }\n\n    await enhanceTestError(\n      testError,\n      test,\n      compilation.sourceMap,\n      logPrefix,\n      allowStackJS,\n      projectRoot,\n      applyStackToTestErrorCause,\n      stack,\n      diffOptions\n    );\n  }\n\n  const meta = test.meta as AssemblyScriptTestTaskMeta;\n\n  // Extract coverage hits from coverage memory\n  if (collectCoverage && compilation.debugInfo) {\n    if (!coverageMemory) {\n      throw createPoolError(\n        POOL_ERROR_NAMES.WASMExecutionHarnessError,\n        'Coverage memory not created despite collectCoverage=true'\n      );\n    }\n\n    const coverage: CoverageData = {\n      hitCountsByFileAndPosition: {},\n    };\n\n    // Read all coverage counters\n    // region 1: function-entry counters [0, F)\n    // region 2: block counters [F, total))\n    const counterCount = compilation.debugInfo.totalInstrumentationCounters;\n    const extractedHitCounters = new Uint32Array(coverageMemory.buffer, 0, counterCount);\n    covDebug(`${logPrefix} - Read ${counterCount} coverage counters`);\n\n    // Iterate all instrumented functions and build coverage data with hit counts extracted from coverage memory\n    let functionsHit = 0;\n    for (const [filePath, debugFunctions] of Object.entries(compilation.debugInfo.functionsByFileAndPosition)) {\n      if (!coverage.hitCountsByFileAndPosition[filePath]) {\n        coverage.hitCountsByFileAndPosition[filePath] = {};\n        covDebug(`${logPrefix} - Extracting hits for source file \"${filePath}\"`);\n      }\n\n      for (const [positionKey, funcInfos] of Object.entries(debugFunctions)) {\n        // Sum hit counts across all functions at this position (multiple for generic monomorphizations)\n        let positionHitCount = 0;\n        for (const funcInfo of funcInfos) {\n          if (funcInfo.coverageMemoryIndex === undefined) {\n            debug(`${logPrefix} - WARNING: NO COVERAGE MEMORY INDEX`\n              + ` - func \"${funcInfo.name}\" (${positionKey}) Skipping hit extraction`\n            );\n            continue;\n          }\n\n          const hitCount = extractedHitCounters[funcInfo.coverageMemoryIndex] ?? 0;\n          covDebug(`${logPrefix} - func \"${funcInfo.name}\" (${positionKey}) `\n            + `[idx: ${funcInfo.coverageMemoryIndex}]: ${hitCount} hits`\n          );\n          positionHitCount += hitCount;\n        }\n\n        coverage.hitCountsByFileAndPosition[filePath][positionKey] = positionHitCount;\n\n        if (positionHitCount > 0) {\n          functionsHit++;\n        }\n      }\n    }\n\n    meta.coverage = {\n      // Function-level hits, keyed by each function's representative source position.\n      functionHits: coverage,\n      // Statement/expression coverage from block counters (aggregation: per-instance\n      // MAX over same-position blocks, then SUM across monomorphizations).\n      expressionHits: buildExpressionHits(compilation.debugInfo, extractedHitCounters),\n      // Branch coverage from decision/arm block counters (per-decision arm hits +\n      // decisionHits; SUM across monomorphizations).\n      branchHits: buildBranchHits(compilation.debugInfo, extractedHitCounters),\n      // Empty fall-through switch-case coverage from post-anchored block counters\n      // (keyed by case-label position; not visible in expression/branch hits).\n      emptyCaseHits: buildCaseHits(compilation.debugInfo, extractedHitCounters),\n      // Decision-block positions (structural; for detecting folded branches).\n      decisionPositions: buildDecisionPositions(compilation.debugInfo),\n      // Per-file property, not per-test — set on the file suite before sending to provider.\n      loadedSourceFiles: [],\n    };\n\n    debug(`${logPrefix} - Extracted coverage data | ${functionsHit} functions hit`\n      + ` | ${Object.keys(meta.coverage.expressionHits.hitCountsByFileAndPosition).length} file(s) with statement hits`\n      + ` | ${Object.keys(meta.coverage.branchHits.hitsByFileAndDecision).length} file(s) with branch hits`\n      + ` | ${Object.keys(meta.coverage.emptyCaseHits.hitCountsByFileAndPosition).length} file(s) with empty-case hits`);\n  }\n\n  testTimings.fnfinal = performance.now();\n\n  return { test, testTimings };\n}\n","/**\n * RPC Reporting Helpers\n *\n * This module provides helper functions for reporting test lifecycle events\n * to Vitest via RPC. All helpers are designed to be composable and reusable.\n */\n\nimport type { MessagePort } from 'node:worker_threads';\nimport { createBirpc } from 'birpc';\nimport type { RunnerRPC, RuntimeRPC, UserConsoleLog } from 'vitest';\nimport type {\n  File,\n  Suite,\n  Test,\n  Task,\n  TaskEventPack, \n  TaskResultPack,\n  CancelReason,\n} from '@vitest/runner/types';\n\nimport type {\n  AssemblyScriptConsoleLog,\n  AssemblyScriptCoveragePayload,\n  AssemblyScriptSuiteTaskMeta,\n  VitestVersion,\n  WASMCompilation,\n  WorkerRPC\n} from '../types/types.js';\nimport { debug } from '../util/debug.js';\nimport { COVERAGE_PAYLOAD_FORMATS } from '../types/constants.js';\nimport {\n  createAfterSuiteRunMeta,\n  getTaskLogLabel,\n  isSuiteOwnFile\n} from '../util/vitest-tasks.js';\n\n// ============================================================================\n// RPC Client Factory\n// ============================================================================\n\n/** Create RPC client from MessagePort */\nexport function createRpcClient(port: MessagePort): WorkerRPC {\n  return createBirpc<RuntimeRPC, RunnerRPC>(\n    {\n      onCancel: (_reason: CancelReason) => void { }\n    },\n    {\n      post: (v) => port.postMessage(v),\n      on: (fn) => port.on('message', fn),\n    }\n  );\n}\n\n// ============================================================================\n// File Task Reporting\n// ============================================================================\n\n/** Report file as queued (before compilation & discovery starts) */\nexport async function reportFileQueued(\n  rpc: WorkerRPC,\n  fileTask: File,\n  logModule: string,\n  logLabel: string,\n): Promise<void> {\n  await rpc.onQueued(fileTask);\n  debug(`[${logModule} RPC] ${logLabel} - Reported onQueued for file \"${fileTask.filepath}\"`\n    + ` | mode: \"${fileTask.mode}\" | state: \"${fileTask.result ? fileTask.result.state : '--'}\"`\n  );\n}\n\n/** Report file collection complete with full task tree */\nexport async function reportFileCollected(\n  rpc: WorkerRPC,\n  fileTask: File,\n  logModule: string,\n  logLabel: string,\n): Promise<void> {\n  await rpc.onCollected([fileTask]);\n  debug(`[${logModule} RPC] ${logLabel} - Reported onCollected for file \"${fileTask.filepath}\"`\n    + ` | ${fileTask.tasks.length} tasks | mode: \"${fileTask.mode}\" | state: \"${fileTask.result?.state}\"`\n  );\n}\n\n/** Report file-level error (compilation/discovery failure) as \"suite-failed-early\" */\nexport async function reportFileError(\n  rpc: WorkerRPC,\n  fileTask: File, \n  logModule: string,\n  logLabel: string,\n): Promise<void> {\n  const taskPack: TaskResultPack = [fileTask.id, fileTask.result, {}];\n  const eventPack: TaskEventPack = [fileTask.id, \"suite-failed-early\", undefined];\n  await rpc.onTaskUpdate([taskPack], [eventPack]);\n\n  debug(`[${logModule} RPC] ${logLabel} - Reported \"suite-failed-early\" task update for \"${fileTask.filepath}\"`);\n}\n\n// ============================================================================\n// Suite Lifecycle Reporting\n// ============================================================================\n\n/** Report suite-prepare event */\nexport async function reportSuitePrepare(\n  rpc: WorkerRPC,\n  suite: Suite,\n  logModule: string,\n  base: string,\n): Promise<void> {\n  // Report suite event (without the custom task meta so reporters won't log it)\n  const taskPack: TaskResultPack = [suite.id, suite.result, {}];\n  const eventPack: TaskEventPack = [suite.id, 'suite-prepare', undefined];\n\n  await rpc.onTaskUpdate([taskPack], [eventPack]);\n\n  debug(`[${logModule} RPC] ${getTaskLogLabel(base, suite)} - Reported \"suite-prepare\" task update`\n    + ` | state: \"${suite.result?.state}\"`\n  );\n}\n\n/** Report suite-finished event */\nexport async function reportSuiteFinished(\n  rpc: WorkerRPC,\n  suite: Suite,\n  collectCoverage: boolean,\n  compilation: WASMCompilation,\n  logModule: string,\n  base: string,\n  vitestVersion: VitestVersion = 'v4',\n): Promise<void> {\n  const suiteLabel = getTaskLogLabel(base, suite);\n  const rpcLogPrefix = `[${logModule} RPC] ${suiteLabel}`;\n  const meta = suite.meta as AssemblyScriptSuiteTaskMeta;\n  const coverageBundle = meta.coverage;\n  let coveragePromise: Promise<void> = Promise.resolve();\n\n  // Report coverage if coverage is enabled and this is a file task\n  if (collectCoverage && isSuiteOwnFile(suite) && coverageBundle) {\n    // The set of source files that a binary loaded is a file-level property.\n    // Record it once on the file suite's bundle. The provider uses it to mark\n    // module-level declarations covered for files that loaded but produce no runtime counter.\n    if (compilation.debugInfo) {\n      coverageBundle.loadedSourceFiles = compilation.debugInfo.absoluteDebugSourceFiles;\n    }\n\n    const coverage: AssemblyScriptCoveragePayload = {\n      __format: COVERAGE_PAYLOAD_FORMATS.AssemblyScript,\n      ...coverageBundle,\n      suiteLogLabel: suiteLabel\n    };\n    \n    const afterSuiteMeta = createAfterSuiteRunMeta(\n      coverage,\n      [suite.file.filepath],\n      suite.file.projectName,\n      vitestVersion\n    );\n    coveragePromise = rpc.onAfterSuiteRun(afterSuiteMeta);\n\n    debug(`${rpcLogPrefix} - onAfterSuiteRun: Reported suite coverage`);\n  }\n\n  // Report suite event (without the custom task meta so reporters won't log it)\n  const taskPack: TaskResultPack = [suite.id, suite.result, {}];\n  const eventPack: TaskEventPack = [suite.id, \"suite-finished\", undefined];\n\n  await Promise.all([\n    coveragePromise,\n    rpc.onTaskUpdate([taskPack], [eventPack])\n  ]);\n\n  debug(`${rpcLogPrefix} - Reported \"suite-finished\" task update | state: \"${suite.result?.state}\"`\n    + ` | duration: ${suite.result?.duration?.toFixed(2) ?? '--'} ms`\n  );\n}\n\n// ============================================================================\n// Test Lifecycle Reporting\n// ============================================================================\n\nasync function reportTestTaskUpdate(\n  rpc: WorkerRPC,\n  test: Test,\n  logModule: string,\n  base: string,\n  updateEvent: 'test-prepare' | 'test-finished' | 'test-retried'\n): Promise<void> {\n  // Report test event (without the custom task meta so reporters won't log it)\n  const taskPack: TaskResultPack = [test.id, test.result, {}];\n  const eventPack: TaskEventPack = [test.id, updateEvent, undefined];\n\n  debug(`[${logModule} RPC] ${getTaskLogLabel(base, test)} - Reporting \"${updateEvent}\" task update...`\n    + ` | state: \"${test.result?.state}\"`\n    + `${updateEvent === 'test-prepare' ? '' : ` | duration: ${test.result?.duration?.toFixed(2) ?? '--'} ms`}`\n  );\n  await rpc.onTaskUpdate([taskPack], [eventPack]);\n  debug(`[${logModule} RPC] ${getTaskLogLabel(base, test)} - Reported \"${updateEvent}\" task update`\n    + ` | state: \"${test.result?.state}\"`\n    + `${updateEvent === 'test-prepare' ? '' : ` | duration: ${test.result?.duration?.toFixed(2) ?? '--'} ms`}`\n  );\n}\n\n/** Report test starting execution */\nexport async function reportTestPrepare(\n  rpc: WorkerRPC,\n  test: Test,\n  logModule: string,\n  base: string,\n): Promise<void> {\n  return reportTestTaskUpdate(rpc, test, logModule, base, 'test-prepare');\n}\n\n/** Report test finished execution */\nexport async function reportTestFinished(\n  rpc: WorkerRPC,\n  test: Test,\n  logModule: string,\n  base: string,\n): Promise<void> {\n  return reportTestTaskUpdate(rpc, test, logModule, base, 'test-finished');\n}\n\n/** Report test retried (sent when test failed and is going to be retried) */\nexport async function reportTestRetried(\n  rpc: WorkerRPC,\n  test: Test,\n  logModule: string,\n  base: string,\n): Promise<void> {\n  return reportTestTaskUpdate(rpc, test, logModule, base, 'test-retried');\n}\n\n// ============================================================================\n// Other Reporting\n// ============================================================================\n\n/** Report user console log messages */\nexport async function reportUserConsoleLogs(\n  rpc: WorkerRPC,\n  logs: AssemblyScriptConsoleLog[],\n  logModule: string,\n  base: string,\n  task: Task,\n): Promise<void> {\n  if (logs.length === 0) {\n    return;\n  }\n\n  const stdLogs = logs.filter(l => !l.isError);\n  const errorLogs = logs.filter(l => l.isError);\n\n  const stdContent: string = stdLogs.map(l => `${l.msg}`).join('\\n');\n  const errorContent: string = errorLogs.filter(l => l.isError).map(l => `${l.msg}`).join('\\n');\n\n  const stdLog: UserConsoleLog = {\n    content: `${stdContent}\\n`,\n    size: stdContent.length,\n    browser: false,\n    type: 'stdout',\n    time: stdLogs.length > 0 ? stdLogs[0]!.time : Date.now(),\n    taskId: task.id,\n    origin: task.id\n  };\n  \n  const errorLog: UserConsoleLog = {\n    content: `${errorContent}\\n`,\n    size: errorContent.length,\n    browser: false,\n    type: 'stderr',\n    time: errorLogs.length > 0 ? errorLogs[0]!.time : Date.now(),\n    taskId: task.id,\n    origin: task.id\n  };\n\n  const reportPromises: Promise<void>[] = [];\n  if (stdContent.length > 0) {\n    reportPromises.push(rpc.onUserConsoleLog(stdLog));\n  }\n  if (errorContent.length > 0) {\n    reportPromises.push(rpc.onUserConsoleLog(errorLog));\n  }\n\n  await Promise.all(reportPromises);\n\n  debug(`[${logModule} RPC] ${getTaskLogLabel(base, task)} - Reported onUserConsoleLog | ${logs.length} messages`);\n}\n\n// ============================================================================\n// Final Flush\n// ============================================================================\n\n/** Flush any pending RPC updates */\nexport async function flushRpcUpdates(\n  rpc: WorkerRPC,\n): Promise<void> {\n  await rpc.onTaskUpdate([], []);\n}\n","import { resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport type { WasmImportsFactory } from '../types/types.js';\nimport { debug } from '../util/debug.js';\nimport { POOL_ERROR_NAMES } from '../types/constants.js';\nimport { createPoolError } from '../util/pool-errors.js';\n\nexport async function loadUserWasmImportsFactory(\n  relativePath: string | undefined,\n  projectRoot: string,\n  logModule: string,\n): Promise<WasmImportsFactory | undefined> {\n  if (!relativePath) {\n    return undefined;\n  }\n\n  const path = resolve(projectRoot, relativePath);\n  const safeUrl = pathToFileURL(path).href;\n\n  try {\n    const start = performance.now();\n    const createWasmImports = (await import(safeUrl)).default;\n    debug(`[${logModule}] Imported user WasmImportsFactory \"${safeUrl}\" | TIMING ${(performance.now() - start).toFixed(2)} ms`);\n\n    if (typeof createWasmImports !== 'function') {\n      const msg = `Could not load user WasmImportsFactory from \"${safeUrl}\".`\n        + ` Ensure that your module has a default export matching () => WebAssembly.Imports`\n        + ` \\nDefault export type is currently \"${typeof createWasmImports}\"`;\n      \n      throw createPoolError(POOL_ERROR_NAMES.WASMUserImportsError, msg);\n    } else {\n      return createWasmImports;\n    }\n  } catch (error) {\n    const msg = `Could not load user WasmImportsFactory from \"${safeUrl}\".`\n    + ` Ensure that your module path is relative to the project root`\n    + ` (location of shallowest vitest config), and that it has a`\n    + ` default export matching () => WebAssembly.Imports`;\n    throw createPoolError(\n      POOL_ERROR_NAMES.WASMUserImportsError,\n      msg,\n      error,\n      true\n    );\n  }\n};\n"],"mappings":";;;;;;;;;;AAGA,SAAgB,kBACd,QACA,WACA;CACA,MAAM,cAAc,QAAgB,QAA4B,SAAiB,OAAe;EAC9F,OAAO,GAAG,SAAS,SAAS,WAAW,QAAQ,MAAM,IAAI;CAC3D;CAEA,MAAM,gBAA6C,CAAC;CAIpD,OAAO;EACL,mBAAsB,WAAc,WAAyB;GAC3D,IAAI,CA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