vitest-pool-assemblyscript 0.10.1 → 0.12.0

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 (39) hide show
  1. package/README.md +3 -3
  2. package/assembly/compare.ts +44 -38
  3. package/assembly/expect.ts +13 -3
  4. package/assembly/utils.ts +4 -1
  5. package/dist/{compile-runner-BGHM_85g.mjs → compile-runner-BGYyiUEf.mjs} +3 -3
  6. package/dist/{compile-runner-BGHM_85g.mjs.map → compile-runner-BGYyiUEf.mjs.map} +1 -1
  7. package/dist/config/index-v3.d.mts +1 -1
  8. package/dist/config/index.d.mts +2 -2
  9. package/dist/config/index.mjs +2 -2
  10. package/dist/coverage-provider/index.mjs.map +1 -1
  11. package/dist/index-internal.d.mts +1 -1
  12. package/dist/index-v3.mjs +1 -1
  13. package/dist/index.d.mts +1 -1
  14. package/dist/index.mjs +2 -2
  15. package/dist/{load-user-imports-Bcx9NOt9.mjs → load-user-imports-iAQUMKAi.mjs} +2 -2
  16. package/dist/{load-user-imports-Bcx9NOt9.mjs.map → load-user-imports-iAQUMKAi.mjs.map} +1 -1
  17. package/dist/{pool-runner-init-CCvnKt5o.d.mts → pool-runner-init-CPQL6pVL.d.mts} +2 -2
  18. package/dist/pool-runner-init-CPQL6pVL.d.mts.map +1 -0
  19. package/dist/{pool-runner-init-DjRCbiX-.mjs → pool-runner-init-CSJt3dHv.mjs} +2 -2
  20. package/dist/{pool-runner-init-DjRCbiX-.mjs.map → pool-runner-init-CSJt3dHv.mjs.map} +1 -1
  21. package/dist/pool-thread/compile-worker-thread.d.mts +1 -1
  22. package/dist/pool-thread/compile-worker-thread.mjs +3 -3
  23. package/dist/pool-thread/test-worker-thread.d.mts +1 -1
  24. package/dist/pool-thread/test-worker-thread.mjs +3 -3
  25. package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
  26. package/dist/pool-thread/v3-tinypool-thread.mjs +4 -4
  27. package/dist/{test-runner-BeP8ClnE.mjs → test-runner-BDcm8vg0.mjs} +3 -3
  28. package/dist/{test-runner-BeP8ClnE.mjs.map → test-runner-BDcm8vg0.mjs.map} +1 -1
  29. package/dist/{types-CoroKYxB.d.mts → types-CRbjiCC7.d.mts} +2 -2
  30. package/dist/{types-CoroKYxB.d.mts.map → types-CRbjiCC7.d.mts.map} +1 -1
  31. package/dist/{vitest-file-tasks-vvZzigcF.mjs → vitest-file-tasks-BBsZ_wS6.mjs} +4 -2
  32. package/dist/vitest-file-tasks-BBsZ_wS6.mjs.map +1 -0
  33. package/package.json +17 -10
  34. package/prebuilds/darwin-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  35. package/prebuilds/darwin-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  36. package/prebuilds/win32-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  37. package/prebuilds/win32-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  38. package/dist/pool-runner-init-CCvnKt5o.d.mts.map +0 -1
  39. package/dist/vitest-file-tasks-vvZzigcF.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"test-runner-BeP8ClnE.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 flushRpcUpdates,\n reportFileError,\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';\nimport { failFile } from '../../util/vitest-file-tasks.js';\nimport { buildEnhancedFileError } from '../../util/pool-errors.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 projectRoot: string,\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 poolOptions,\n collectCoverage,\n handleLog,\n logModule,\n threadImports,\n projectRoot,\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, projectRoot, 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 projectRoot: string,\n bail?: number,\n diffOptions?: SerializedDiffOptions,\n timedOutTest?: Test,\n): Promise<Suite> {\n const suiteStartPerf = 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 try {\n // ensure suite-prepare will only be sent once if a test\n // times out and the file worker thread gets re-launched\n if (!suiteMeta.suitePreparedSent) {\n setSuitePrepareResult(suite);\n await reportSuitePrepare(rpc, suite, logModule, base);\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, projectRoot, 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, projectRoot, 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, projectRoot, 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 suite will not be run again if another test\n // times out later and the file worker thread gets re-launched\n finalizeSuiteResult(suite);\n } catch (error: any) {\n const testError = await buildEnhancedFileError(\n error,\n suite.file,\n compilation.sourceMap,\n suiteLogPrefix,\n projectRoot,\n 'test runner',\n diffOptions\n );\n\n failFile(suite.file, testError, suiteStartPerf);\n\n await reportFileError(rpc, suite.file, logModule, suiteLogPrefix);\n\n debug(`${suiteLogPrefix} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n const suiteTime = performance.now() - suiteStartPerf;\n debug(`${suiteLogPrefix} - runSuite Completed | TIMING ${suiteTime.toFixed(2)} ms`);\n }\n\n return suite;\n}\n"],"mappings":";;;;;;AAoDA,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;;;;AAKzC,eAAe,sBACb,KACA,YACA,gBACA,WACA,WACe;AAEf,2BAA0B,gBAAgB,UAAU;AAGpD,QAAO,aAAa,KAAK,YAAY,gBAAgB,WAAW,UAAU;;AAG5E,SAAS,gBAAgB,MAAmB,MAAkB;AAC5D,MAAK,YAAY;EACf,gBAAgB,KAAK,KAAK;EAC1B;EACA,MAAM;mBACqB;EAC5B,CAA8B;;AAGjC,SAAS,cAAc,MAAmB,MAAkB;AAC1D,MAAK,YAAY;EACf,cAAc,KAAK,KAAK;EACxB,YAAY,KAAK;EACjB,MAAM;mBACqB;EAC5B,CAA4B;;AAG/B,eAAe,QACb,KACA,MACA,MACA,iBACA,aACA,MACA,WACA,aACA,eACA,aACA,MACA,aACe;CACf,MAAM,gBAAgB,iBAAiB,WAAW,MAAM,KAAK;CAC7D,MAAM,cAA0C,EAAE;CAClD,MAAM,aAA8C,KAAa,UAAmB,UAAgB;AAClG,cAAY,KAAK;GAAE;GAAK,MAAM,KAAK,KAAK;GAAE;GAAS,CAAC;;CAGtD,MAAM,iBAAiB,KAAK,KAAK;CAEjC,IAAI,kBAA2B;CAC/B,IAAI,qBAAoC,QAAQ,SAAS;AAEzD,KAAI,CAAC,KAAK,SAAS,CAAC,KAAK,QAAQ;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YAAY,MAAM,uBACtB,OACA,MAAM,MACN,YAAY,WACZ,gBACA,aACA,eACA,YACD;AAED,WAAS,MAAM,MAAM,WAAW,eAAe;AAE/C,QAAM,gBAAgB,KAAK,MAAM,MAAM,WAAW,eAAe;AAEjE,QAAM,GAAG,eAAe,wBAAwB;WACxC;AACR,QAAM,gBAAgB,IAAI;AAE1B,QAAM,GAAG,eAAe,kCADN,YAAY,KAAK,GAAG,gBAC6B,QAAQ,EAAE,CAAC,KAAK;;AAGrF,QAAO"}
1
+ {"version":3,"file":"test-runner-BDcm8vg0.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 flushRpcUpdates,\n reportFileError,\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';\nimport { failFile } from '../../util/vitest-file-tasks.js';\nimport { buildEnhancedFileError } from '../../util/pool-errors.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 projectRoot: string,\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 poolOptions,\n collectCoverage,\n handleLog,\n logModule,\n threadImports,\n projectRoot,\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, projectRoot, 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 projectRoot: string,\n bail?: number,\n diffOptions?: SerializedDiffOptions,\n timedOutTest?: Test,\n): Promise<Suite> {\n const suiteStartPerf = 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 try {\n // ensure suite-prepare will only be sent once if a test\n // times out and the file worker thread gets re-launched\n if (!suiteMeta.suitePreparedSent) {\n setSuitePrepareResult(suite);\n await reportSuitePrepare(rpc, suite, logModule, base);\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, projectRoot, 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, projectRoot, 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, projectRoot, 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 suite will not be run again if another test\n // times out later and the file worker thread gets re-launched\n finalizeSuiteResult(suite);\n } catch (error: any) {\n const testError = await buildEnhancedFileError(\n error,\n suite.file,\n compilation.sourceMap,\n suiteLogPrefix,\n projectRoot,\n 'test runner',\n diffOptions\n );\n\n failFile(suite.file, testError, suiteStartPerf);\n\n await reportFileError(rpc, suite.file, logModule, suiteLogPrefix);\n\n debug(`${suiteLogPrefix} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n const suiteTime = performance.now() - suiteStartPerf;\n debug(`${suiteLogPrefix} - runSuite Completed | TIMING ${suiteTime.toFixed(2)} ms`);\n }\n\n return suite;\n}\n"],"mappings":";;;;;;AAoDA,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,g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interface AssemblyScriptPoolOptions {
28
28
  * Maximum number of worker threads to spawn with vitest 3.x.
29
29
  * Defaults to os.availableParallelism() - 1
30
30
  *
31
- * Use project config `test.maxWorkers` with vitest 4.x to control
31
+ * Use project config `test.maxWorkers` with vitest 5.x and 4.x to control
32
32
  * the number of cuncurrently executing tests.
33
33
  */
34
34
  maxThreadsV3?: number;
@@ -263,4 +263,4 @@ interface ProcessPoolRunFileTask {
263
263
  }
264
264
  //#endregion
265
265
  export { AssemblyScriptCompilerOptions, AssemblyScriptPoolOptions, HybridProviderOptions, ProcessPoolRunFileTask, RunCompileAndDiscoverTask, RunTestsTask, ThreadSpec, WASMCompilation, WasmImportsFactory, WasmImportsFactoryInfo };
266
- //# sourceMappingURL=types-CoroKYxB.d.mts.map
266
+ //# sourceMappingURL=types-CRbjiCC7.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-CoroKYxB.d.mts","names":[],"sources":["../src/types/types.ts"],"mappings":";;;;;;;;;UAsEiB,yBAAA;;EAEf,KAAA;EACA,WAAA;EACA,oBAAA;;EAGA,wBAAA;EAwEF;;;;;;;;;EA7DE,WAAA;EAgEF;;;;;AAUA;;EAjEE,YAAA;EAEA,0BAAA;EACA,sBAAA;EAEA,sBAAA;EACA,kBAAA;EAEA,kBAAA;EAEA,kBAAA;AAAA;AAmEF;;;;;AAGA;;;;;AAHA,UAtDiB,qBAAA;EACf,aAAA;;;;;;;;;EAUA,qBAAA;;;;;;EAOA,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,cAGxE,4BAAA;AAAA,cAUA,uBAAA;;KASD,oCAAA,UAA8C,4BAAA;;KAG9C,2BAAA,UAAqC,uBAAA;AA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f,KAAA;;EAEA,iBAAA;EAoTe;EAlTf,QAAA,EAAU,mBAAA;;;;;EAKV,mBAAA;AAAA;;;;UAMe,iBAAA;;EAEf,SAAA;;EAEA,IAAA;;;AAsSF;;EAjSE,sBAAA,EAAwB,cAAA;;EAExB,mBAAA;;EAEA,WAAA,EAAa,mBAAA;;EAEb,WAAA,EAAa,mBAAA;AAAA;;;;;;;UASE,eAAA;;EAEf,gBAAA;;;;;;EAMA,0BAAA,EAA4B,MAAA,SAAe,MAAA,SAAe,iBAAA;EAE1D,yBAAA;AAAA;AAAA,UA6Oe,UAAA;EACf,IAAA,EAAM,IAAA;EACN,WAAA,GAAc,eAAA;AAAA;AAAA,UAGC,yBAAA;EACf,aAAA;EACA,QAAA;EACA,IAAA,EAAM,WAAA;EACN,IAAA,EAAM,IAAA;EACN,MAAA,EAAQ,sBAAA;EACR,aAAA,EAAe,iCAAA;EACf,kBAAA;AAAA;AAAA,UAGe,YAAA;EACf,aAAA;EACA,QAAA;EACA,IAAA,EAAM,WAAA;EACN,IAAA,EAAM,IAAA;EACN,WAAA,EAAa,eAAA;EACb,MAAA,EAAQ,sBAAA;EACR,aAAA,EAAe,iCAAA;EACf,kBAAA;EACA,YAAA,GAAe,IAAA;AAAA;AAAA,UAGA,sBAAA;EACf,aAAA;EACA,IAAA,EAAM,WAAA;EACN,IAAA,EAAM,IAAA;EACN,MAAA,EAAQ,sBAAA;EACR,aAAA,EAAe,iCAAA;EACf,kBAAA;EACA,YAAA,GAAe,IAAA;EACf,mBAAA,GAAsB,eAAA;AAAA"}
@@ -120,7 +120,7 @@ function createAfterSuiteRunMeta(coverage, testFiles, projectName = "", vitestVe
120
120
  testFiles,
121
121
  projectName
122
122
  };
123
- if (vitestVersion) return {
123
+ if (vitestVersion === "v3") return {
124
124
  ...base,
125
125
  transformMode: "ssr"
126
126
  };
@@ -166,6 +166,7 @@ function createTestTask(name, fnIndex, file, parent, mergedOptions, vitestVersio
166
166
  context: {},
167
167
  annotations: [],
168
168
  artifacts: [],
169
+ benchmarks: [],
169
170
  meta: {},
170
171
  mode: getInitialTaskMode(mergedOptions),
171
172
  timeout: mergedOptions.timeout,
@@ -176,6 +177,7 @@ function createTestTask(name, fnIndex, file, parent, mergedOptions, vitestVersio
176
177
  delete test.fullName;
177
178
  delete test.fullTestName;
178
179
  delete test.artifacts;
180
+ delete test.benchmarks;
179
181
  }
180
182
  parent.tasks.push(test);
181
183
  test.meta = getInitialTestTaskMeta(fnIndex, parent);
@@ -470,4 +472,4 @@ function checkAllowOnly(task, allowOnly) {
470
472
 
471
473
  //#endregion
472
474
  export { checkFailsAndInvertResult, createAfterSuiteRunMeta, createInitialFileTask, createSuiteTask, createTestTask, failFile, failTestAssertionError, failTestRuntimeError, failTestWithTimeoutError, finalizeSuiteResult, flagTestFinalized, flagTestTerminated, getCompatConfig, getConfigs, getFullTaskHierarchy, getRunnableTasks, getTaskLogLabel, getTaskLogPrefix, isSuiteOwnFile, prepareFileTaskForCollection, resetTestForRetry, resolvePoolOptions, setSuitePrepareResult, setTestResultForTestPrepare, shouldRetryTask, updateSuiteFinishedResult, updateTestResultAfterRun };
473
- //# sourceMappingURL=vitest-file-tasks-vvZzigcF.mjs.map
475
+ //# sourceMappingURL=vitest-file-tasks-BBsZ_wS6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest-file-tasks-BBsZ_wS6.mjs","names":[],"sources":["../src/types/types.ts","../src/util/resolve-config.ts","../src/types/typed-constants.ts","../src/util/vitest-tasks.ts","../src/util/vitest-file-tasks.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 } from 'vitest';\nimport type { TestError } from '@vitest/utils';\nimport type { ResolvedCoverageOptions } from 'vitest/node';\nimport type { File, Test, TaskMeta, TestOptions } from '@vitest/runner/types';\nimport type { RawSourceMap } from 'source-map';\n\nimport {\n AS_POOL_WORKER_MSG_FLAG,\n COVERAGE_PAYLOAD_FORMATS,\n POOL_ERROR_NAMES,\n TEST_ERROR_NAMES,\n AS_POOL_ERROR_FLAG,\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\nexport interface AssemblyScriptPoolError {\n readonly [AS_POOL_ERROR_FLAG]: true;\n name: PoolErrorName;\n message?: string;\n originalErrorRawStack: NodeJS.CallSite[];\n originalErrorMayContainJS: boolean;\n applyStackToTestErrorCause: boolean;\n testError: AssemblyScriptTestError;\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 interface AssemblyScriptTestError extends TestError {\n // reported error can originate as a test error (assertion/runtime),\n // or as a pool failnure (harness error due to OOM, other unexpected paths)\n name: TestErrorName | PoolErrorName\n}\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 5.x and 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 'extraCompilerFlags'\n] as const;\n\nexport const AS_POOL_OPTIONAL_FIELDS = [\n 'testMemoryPagesInitial',\n 'testMemoryPagesMax',\n 'coverageMemoryPagesInitial',\n 'coverageMemoryPagesMax',\n 'wasmImportsFactory'\n] 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// 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\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 & { readonly isResolved: true };\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 WASMCompilation {\n filePath: string;\n sourceMap: RawSourceMap;\n debugInfo?: BinaryDebugInfo;\n compiledModule: WebAssembly.Module;\n requiredMemory: WASMModuleMemoryRequirements;\n isInstrumented: boolean;\n compileTiming: number;\n}\n\nexport interface WASMImportMemoryRequirements {\n initialPages: number;\n maximumPages?: number;\n};\n\nexport interface WASMModuleMemoryRequirements {\n testMemory: WASMImportMemoryRequirements;\n coverageMemory: WASMImportMemoryRequirements;\n}\n\nexport interface AssemblyScriptCompilerOptions {\n shouldInstrument: boolean;\n projectRoot: string;\n instrumentationOptions?: InstrumentationOptions;\n stripInline?: boolean;\n extraFlags?: string[];\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 coverageMemoryModule: string;\n coverageMemoryName: string;\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 actualTypeName: string;\n expectedTypeName: 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 lastErrorCallStackRef?: Error;\n lastErrorUnexpected?: boolean;\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 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 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 asPoolOptions: ResolvedAssemblyScriptPoolOptions;\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 asPoolOptions: ResolvedAssemblyScriptPoolOptions;\n isCollectTestsMode: boolean;\n timedOutTest?: Test;\n}\n\nexport interface ProcessPoolRunFileTask {\n dispatchStart: number;\n port: MessagePort;\n file: File;\n config: SerializedConfigCompat;\n asPoolOptions: ResolvedAssemblyScriptPoolOptions;\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 { Vitest } from 'vitest/node';\n\nimport type {\n AssemblyScriptPoolOptions,\n ASPoolOptionsFieldsWithDefaultValues,\n ResolvedAssemblyScriptPoolOptions,\n ResolvedHybridProviderOptions,\n SerializedConfigCompat,\n AssemblyScriptTestError,\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';\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 extraCompilerFlags: [],\n} as const;\n\nfunction createPoolConfigError(message: string): AssemblyScriptTestError {\n return {\n name: POOL_ERROR_NAMES.PoolConfigError,\n message\n };\n}\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 (\n (resolved.testMemoryPagesInitial !== undefined && resolved.testMemoryPagesInitial < 1)\n || (resolved.testMemoryPagesMax !== undefined && resolved.testMemoryPagesMax < 1)\n ) {\n throw createPoolConfigError(\n `AssemblyScript WASM test memory page size options must be positive if defined - testMemoryPagesMin: ${resolved.testMemoryPagesInitial}`\n + ` | testMemoryPagesMax: ${resolved.testMemoryPagesMax}`,\n );\n }\n\n if (\n (resolved.coverageMemoryPagesInitial !== undefined && resolved.coverageMemoryPagesInitial < 1)\n || (resolved.coverageMemoryPagesMax !== undefined && resolved.coverageMemoryPagesMax < 1)\n ) {\n throw createPoolConfigError(\n `AssemblyScript WASM coverage memory page size options must be positive if defined - coverageMemoryPagesMin: ${resolved.coverageMemoryPagesInitial}`\n + ` | coverageMemoryPagesMax: ${resolved.coverageMemoryPagesMax}`,\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\nfunction getProjectConfigs(ctx: Vitest): {\n [key: string]: {\n config: SerializedConfigCompat,\n v3PoolOptions?: ResolvedAssemblyScriptPoolOptions\n }\n} {\n const configs = {} as {\n [key: string]: {\n config: SerializedConfigCompat,\n v3PoolOptions?: ResolvedAssemblyScriptPoolOptions\n }\n };\n\n ctx.projects\n // project.config.pool resolves to the *path of the dist file*\n .filter(p => p.config.pool.includes(ASSEMBLYSCRIPT_POOL_NAME))\n \n .forEach(project => {\n configs[project.name] = {\n config: getCompatConfig(project.serializedConfig),\n };\n\n // @ts-ignore - we build with v4, but this is correct for v3 (has config.poolOptions)\n const maybeOptions: any = project.config?.poolOptions?.assemblyScript;\n if (maybeOptions) {\n configs[project.name]!.v3PoolOptions = resolvePoolOptions(maybeOptions);\n }\n });\n \n return configs;\n}\n\nexport function getConfigs(ctx: Vitest): {\n coverage: ResolvedHybridProviderOptions;\n projects: {\n [key: string]: {\n config: SerializedConfigCompat,\n v3PoolOptions?: ResolvedAssemblyScriptPoolOptions\n }\n };\n fallbackPoolOptions: ResolvedAssemblyScriptPoolOptions;\n} {\n const coverage = ctx.config.coverage as unknown as ResolvedHybridProviderOptions;\n const projects = getProjectConfigs(ctx);\n\n // @ts-ignore - we build with v4, but this is correct for v3 (has config.poolOptions)\n let fallbackPoolOptions: ResolvedAssemblyScriptPoolOptions = resolvePoolOptions(ctx.config.poolOptions?.assemblyScript);\n\n const configs = Object.values(projects);\n if (configs.length > 0) {\n for (const config of configs) {\n if (config.v3PoolOptions?.debug) {\n fallbackPoolOptions.debug = true;\n }\n if (config.v3PoolOptions?.maxThreadsV3 !== undefined\n && config.v3PoolOptions.maxThreadsV3 > fallbackPoolOptions.maxThreadsV3\n ) {\n fallbackPoolOptions.maxThreadsV3 = config.v3PoolOptions.maxThreadsV3;\n }\n }\n }\n\n return {\n coverage,\n projects,\n fallbackPoolOptions\n };\n}\n","/**\n * Typed Constants\n * \n * Constants which require importing ./types\n */\n\nimport { AssemblyScriptTestOptions } from './types.js';\n\n// hard-coded defaults only - timeout and retry defaults always come from vitest config\nexport const DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS: Pick<AssemblyScriptTestOptions, 'fails' | 'skip' | 'only'> = {\n fails: false,\n skip: false,\n only: false\n};\n","import type { File, RunMode, Suite, Task, Test } from '@vitest/runner/types';\n\nimport type {\n AssemblyScriptCoveragePayload,\n AssemblyScriptSuiteTaskMeta,\n AssemblyScriptTestError,\n AssemblyScriptTestOptions,\n AssemblyScriptTestTaskMeta,\n FailedAssertion,\n VitestVersion,\n WASMExecutorPerfTimings\n} from '../types/types.js';\nimport { TEST_ERROR_NAMES } from '../types/constants.js';\nimport { debug } from './debug.js';\nimport { createTestExpectedToFailError, createTestTimeoutError } from './pool-errors.js';\nimport { retryCompat } from './resolve-config.js';\n\n// ============================================================================\n// Util\n// ============================================================================\n\nfunction positiveSum<T>(items: T[], getSummableValue: (_next: T) => number | undefined): number {\n return items.reduce((total, next) => {\n return total + Math.max(getSummableValue(next) || 0, 0)\n }, 0);\n}\n\nfunction hasNonFileParentSuite(suite: Suite): boolean {\n return !!suite.suite?.id && suite.suite.id !== suite.file.id;\n}\n\nfunction getSuiteHierarchyName(suite: Suite): string {\n let name = suite.name;\n let currentSuite = suite;\n \n while (hasNonFileParentSuite(currentSuite)) {\n name = `${currentSuite.suite!.name} > ${name}`;\n currentSuite = currentSuite.suite!;\n }\n \n return name;\n}\n\nexport function isSuiteOwnFile(suite: Suite): boolean {\n return suite.file.id === suite.id;\n}\n\nexport function getTaskLogLabel(base: string, task: Task): string {\n if (task.type === 'suite') {\n return isSuiteOwnFile(task) ?\n `${base}`\n : `${base} - \"${getSuiteHierarchyName(task)}\"`;\n } else {\n return `${base} - \"${getSuiteHierarchyName(task.suite!)} > ${task.name}\"`;\n }\n}\n\nexport function getTaskLogPrefix(logModule: string, base: string, task: Task): string {\n return `[${logModule}] ${getTaskLogLabel(base, task)}`;\n}\n\nexport function createAfterSuiteRunMeta(\n coverage: AssemblyScriptCoveragePayload,\n testFiles: string[],\n projectName: string = '',\n vitestVersion: VitestVersion = 'v4',\n): any {\n const base = { coverage, testFiles, projectName };\n\n if (vitestVersion === 'v3') {\n return { ...base, transformMode: 'ssr' as const };\n } else {\n return { ...base, environment: 'node' as const };\n }\n}\n\n// ============================================================================\n// Task Creation\n// ============================================================================\n\nexport function getInitialTaskMode(options: AssemblyScriptTestOptions): RunMode {\n if (options.skip) {\n return 'skip';\n } else if (options.only) {\n return 'only';\n } else {\n return 'run';\n }\n}\n\nexport function getInitialTestTaskMeta(\n fnIndex: number,\n parentAfterAddingTask: Suite,\n): AssemblyScriptTestTaskMeta {\n return {\n fnIndex,\n idxInParentTasks: parentAfterAddingTask.tasks.length - 1,\n assertionsPassedCount: 0,\n assertionsFailed: [],\n resultFinal: false,\n };\n}\n\nexport function getInitialSuiteTaskMeta(\n parentAfterAddingTask: Suite,\n mergedOptions: AssemblyScriptTestOptions,\n): AssemblyScriptSuiteTaskMeta {\n return {\n idxInParentTasks: parentAfterAddingTask.tasks.length - 1,\n defaultTestOptions: mergedOptions,\n suitePreparedSent: false,\n resultFinal: false,\n };\n}\n\n\nfunction createTaskName(names: readonly (string | undefined)[], separator: string = ' > '): string {\n return names.filter(name => name !== undefined).join(separator);\n}\n\nexport function createTestTask(\n name: string,\n fnIndex: number,\n file: File,\n parent: Suite,\n mergedOptions: AssemblyScriptTestOptions,\n vitestVersion: VitestVersion = 'v4',\n): Test {\n const test: Test = {\n type: 'test',\n name,\n fullName: createTaskName([\n parent?.fullName ?? file?.fullName,\n name,\n ]),\n fullTestName: createTaskName([parent?.fullTestName, name]),\n id: '',\n file,\n suite: parent,\n context: {} as any,\n annotations: [],\n artifacts: [],\n benchmarks: [],\n meta: {},\n mode: getInitialTaskMode(mergedOptions),\n timeout: mergedOptions.timeout,\n retry: mergedOptions.retry,\n fails: mergedOptions.fails,\n };\n\n if (vitestVersion === 'v3') {\n // @ts-ignore\n delete test.fullName;\n // @ts-ignore\n delete test.fullTestName;\n // @ts-ignore\n delete test.artifacts;\n // @ts-ignore\n delete test.benchmarks;\n }\n // else if (vitestVersion === 'v4') {\n // // @ts-ignore\n // delete test.benchmarks;\n // }\n\n parent.tasks.push(test);\n\n // use custom TaskMeta to capture fnIndex, parent task index, etc\n test.meta = getInitialTestTaskMeta(fnIndex, parent);\n\n return test;\n}\n\nexport function createSuiteTask(\n name: string,\n file: File,\n parent: Suite,\n mergedOptions: AssemblyScriptTestOptions,\n vitestVersion: VitestVersion = 'v4',\n): Suite {\n // const suiteIsFile = parent.file.id === parent.id;\n // const prefix = suiteIsFile ? parent.name : `${file.filepath}_${parent.name}`;\n const suite: Suite = {\n type: 'suite',\n name,\n fullName: createTaskName([\n parent?.fullName ?? file?.fullName,\n name,\n ]),\n fullTestName: createTaskName([parent?.fullTestName, name]),\n id: '',\n file,\n suite: parent,\n meta: {},\n tasks: [],\n mode: getInitialTaskMode(mergedOptions),\n };\n\n if (vitestVersion === 'v3') {\n // @ts-ignore\n delete suite.fullName;\n // @ts-ignore\n delete suite.fullTestName;\n }\n\n parent.tasks.push(suite);\n\n // use custom TaskMeta to capture parent task index and default options\n suite.meta = getInitialSuiteTaskMeta(parent, mergedOptions);\n\n return suite;\n}\n\n\n// ============================================================================\n// Dispatch Helpers\n// ============================================================================\n\nexport function getRunnableTasks(suite: Suite): Task[] {\n return suite.tasks.filter(t => t.mode === 'queued' || t.mode === 'run');\n}\n\n\n// ============================================================================\n// Result Handling Helpers\n// ============================================================================\n\nexport function shouldRetryTask(task: Task): boolean {\n const retry = retryCompat(task.retry);\n return task.result?.state === 'fail'\n && task.retry !== undefined\n && retry > 0\n && (\n task.result.retryCount === undefined\n || task.result.retryCount === 0\n || (task.result.retryCount < retry)\n );\n}\n\n/**\n * Invert result if test configured as 'fails'.\n */\nexport function checkFailsAndInvertResult(test: Test, logPrefix: string): void {\n if (test.fails) {\n if (test.result?.state === 'pass') {\n test.result.state = 'fail';\n\n debug(`${logPrefix} - Has 'fails' option set - inverted \"pass\" to \"fail\"`);\n\n const err = createTestExpectedToFailError(test);\n if (test.result.errors) {\n test.result.errors.push(err);\n } else {\n test.result.errors = [err];\n }\n } else if (test.result?.state === 'fail') {\n test.result.state = 'pass';\n test.result.errors = [];\n\n debug(`${logPrefix} - Has 'fails' option set - inverted \"fail\" to \"pass\"`);\n }\n }\n}\n\nexport function setTestResultForTestPrepare(test: Test, startTime: number): void {\n test.result = {\n state: 'run',\n startTime,\n retryCount: 0\n };\n};\n\nexport function updateTestResultAfterRun(test: Test, testTimings?: WASMExecutorPerfTimings): void {\n // while failed tests are actively set to failed, a passed test\n // will still be in the prepared result state (run), so set it to pass\n if (test.result?.state === 'run') {\n test.result.state = 'pass';\n }\n \n if (test.result && testTimings) {\n // accumulate duration for any retries that may be done\n test.result.duration = (test.result.duration ?? 0) + (testTimings.execEnd - testTimings.execStart);\n }\n}\n\nexport function flagTestTerminated(test: Test): void {\n (test.meta as AssemblyScriptTestTaskMeta).lastTimeoutTerminationTime = Date.now();\n}\n\nexport function flagTestFinalized(test: Test): void {\n (test.meta as AssemblyScriptTestTaskMeta).resultFinal = true;\n}\n\nfunction failTest(\n test: Test,\n testError: AssemblyScriptTestError,\n): void {\n if (test.result) {\n test.result.state = 'fail';\n } else {\n test.result = { state: 'fail' };\n }\n\n if (test.result.errors) {\n test.result.errors.push(testError);\n } else {\n test.result.errors = [testError];\n }\n}\n\nexport function failTestRuntimeError(\n test: Test,\n errorMessagePrefix: string,\n errorMessage: string,\n): AssemblyScriptTestError {\n const prefixStr = errorMessagePrefix ? `${errorMessagePrefix}: ` : '';\n const testError: AssemblyScriptTestError = {\n name: TEST_ERROR_NAMES.WASMRuntimeError,\n message: `${prefixStr}${errorMessage}`\n };\n\n failTest(test, testError);\n \n return testError;\n}\n\nexport function failTestAssertionError(\n test: Test,\n assertion: FailedAssertion\n): AssemblyScriptTestError {\n (test.meta as AssemblyScriptTestTaskMeta).assertionsFailed.push(assertion);\n\n const testError: AssemblyScriptTestError = {\n name: TEST_ERROR_NAMES.AssertionError,\n message: assertion.message\n };\n \n if (assertion?.valuesProvided) {\n testError.expected = assertion.expected !== undefined ? String(assertion.expected) : undefined;\n testError.actual = assertion.actual !== undefined ? String(assertion.actual) : undefined;\n }\n\n failTest(test, testError);\n \n return testError;\n}\n\nexport function failTestWithTimeoutError (test: Test, startTime: number, duration: number): void {\n const timeoutErr = createTestTimeoutError(test);\n\n if (test.result) {\n test.result.state = 'fail';\n test.result.startTime = startTime;\n \n // accumulate duration for any retries that may be done\n test.result.duration = (test.result.duration ?? 0) + duration;\n\n if (test.result.errors) {\n test.result.errors.push(timeoutErr)\n } else {\n test.result.errors = [timeoutErr];\n }\n } else {\n test.result = {\n state: 'fail',\n startTime,\n duration,\n errors: [timeoutErr],\n retryCount: 0,\n };\n }\n}\n\nexport function setSuitePrepareResult(suite: Suite): void {\n if (suite.mode === 'skip') {\n suite.result = {\n state: 'skip',\n duration: 0,\n };\n } else {\n suite.result = {\n state: 'run',\n startTime: Date.now(),\n };\n }\n}\n\nexport function updateSuiteFinishedResult(suite: Suite, logPrefix: string): void {\n if (suite.mode === 'skip') {\n suite.result = {\n state: 'skip',\n duration: 0,\n };\n } else {\n // update suite final result based on sub-task results\n const hasFailures = suite.tasks.some(({ result }) => result?.state === 'fail' );\n \n if (suite.result) {\n suite.result.duration = positiveSum(suite.tasks, t => t.result?.duration);\n suite.result.state = hasFailures ? 'fail' : 'pass';\n \n debug(`${logPrefix} - Set suite result: \"${suite.result.state}\" (hasFailures: ${hasFailures})`);\n }\n }\n}\n\nexport function finalizeSuiteResult(suite: Suite): void {\n (suite.meta as AssemblyScriptSuiteTaskMeta).resultFinal = true;\n}\n\nexport function resetTestForRetry(test: Test, startTime: number): void {\n if (test.result) {\n test.result!.state = 'run';\n test.result!.startTime = startTime;\n }\n\n const meta = test.meta as AssemblyScriptTestTaskMeta;\n\n // clear any custom metadata associated with the immediate last run\n meta.assertionsPassedCount = 0;\n meta.assertionsFailed = [];\n delete meta.lastError;\n delete meta.lastErrorValuesProvided;\n delete meta.lastErrorRawCallStack;\n delete meta.lastErrorCallStackRef;\n delete meta.lastTimeoutTerminationTime;\n delete meta.coverageData;\n}\n\n\n","import type { SerializedConfig } from 'vitest';\nimport type { File, Suite, Task, TaskBase } from '@vitest/runner/types';\nimport {\n calculateSuiteHash,\n createFileTask,\n someTasksAreOnly\n} from '@vitest/runner/utils';\nimport { processError } from '@vitest/utils/error';\n\nimport { ASSEMBLYSCRIPT_POOL_NAME } from '../types/constants.js';\nimport { DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS } from '../types/typed-constants.js';\nimport type {\n AssemblyScriptSuiteTaskMeta,\n AssemblyScriptTestError,\n AssemblyScriptTestOptions,\n} from '../types/types.js';\nimport { finalizeSuiteResult } from './vitest-tasks.js';\n\nexport function createInitialFileTask(\n testFile: string,\n projectName: string,\n projectRoot: string,\n configTestTimeout: number,\n configRetry: number,\n): File {\n const file: File = createFileTask(\n testFile,\n projectRoot,\n projectName,\n ASSEMBLYSCRIPT_POOL_NAME\n );\n\n file.mode = 'queued';\n file.environmentLoad = 0; // AS pool has no environment setup\n file.setupDuration = 0; // AS pool has no setup files\n\n const defaultTestOptions: AssemblyScriptTestOptions = {\n ...DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS,\n timeout: configTestTimeout,\n retry: configRetry,\n };\n\n const meta: AssemblyScriptSuiteTaskMeta = {\n idxInParentTasks: -1, // file task has no parent, should never be used anyway\n defaultTestOptions,\n suitePreparedSent: false,\n resultFinal: false,\n }\n file.meta = meta;\n\n return file;\n}\n\nexport function createFailedFileTask(\n testFile: string,\n projectName: string,\n config: SerializedConfig,\n error: AssemblyScriptTestError,\n): File {\n const file: File = createFileTask(\n testFile,\n config.root,\n projectName,\n ASSEMBLYSCRIPT_POOL_NAME\n );\n file.mode = 'run';\n file.result = {\n state: 'fail',\n errors: [error]\n };\n file.environmentLoad = 0;\n file.setupDuration = 0;\n file.collectDuration = 0;\n\n return file;\n}\n\nexport function prepareFileTaskForCollection(\n file: File,\n testNamePattern?: RegExp,\n allowOnly?: boolean,\n): void {\n calculateSuiteHash(file);\n\n // Interpret task modes does the following:\n // 1. If only mode enabled on any test, flip all non-only test.mode to skip\n // 2. Apply test name pattern filtering (from -t flag) to skip if needed\n // 3. If all test modes are skip, set file task mode to skip\n const hasOnly = someTasksAreOnly(file);\n interpretTaskModes(\n file,\n testNamePattern, // user regexp\n undefined, // testLocations\n undefined,\n undefined,\n hasOnly, // onlyMode - true if only is used anywhere\n false, // parentIsOnly - always false for the file task\n allowOnly\n );\n\n // update from queued (onQueued report) to run (onCollected report)\n if (file.mode === 'queued') {\n file.mode = 'run';\n }\n}\n\nexport function failFile(\n file: File,\n testError: AssemblyScriptTestError,\n runStartPerf: number,\n): AssemblyScriptTestError {\n file.mode = 'run';\n if (file.result) {\n file.result.state = 'fail';\n file.result.errors = file.result.errors ? file.result.errors.concat(testError) : [testError];\n } else {\n file.result = {\n state: 'fail',\n errors: [testError]\n };\n }\n file.environmentLoad = file.environmentLoad ?? 0;\n file.setupDuration = performance.now() - runStartPerf;\n file.collectDuration = file.collectDuration ?? 0;\n\n // we can always finalize on failing the file, no other work to do\n finalizeSuiteResult(file);\n\n return testError;\n}\n\nexport function getFullTaskHierarchy(file: File): string {\n function spacesForLevel(level: number): string {\n return new Array(level + 1).fill(' ').join('');\n }\n\n function taskStr(task: Task, level: number): string {\n if (task.type === 'test') {\n return `${spacesForLevel(level)}ID: ${task.id} Mode: \"${task.mode}\" Test: \"${task.name}\"`;\n } else {\n const suiteStr = `${spacesForLevel(level)}ID: ${task.id} Mode: \"${task.mode}\" Suite: \"${task.name}\"\\n`;\n return suiteStr + task.tasks.map(t => taskStr(t, level + 1)).join('\\n');\n }\n };\n\n return taskStr(file, 0);\n}\n\n\n// ============================================================================\n// interpretTaskModes function borrowed from Vitest\n// ============================================================================\n\n/**\n * Function interface changes from vitest 4.0.x -> 4.1.x, so now were' just handling this\n * functionality ourselves to prevent version compat conflicts.\n * \n * @see https://github.com/vitest-dev/vitest/blob/v4.1.0/packages/runner/src/utils/collect.ts#L10\n * \n * Vitest is released under the MIT license, included in this project's root.\n * Copyright (c) 2021-Present Vitest Team\n */\n\nfunction interpretTaskModes(\n file: Suite,\n namePattern?: string | RegExp,\n testLocations?: number[] | undefined,\n testIds?: string[] | undefined,\n testTagsFilter?: ((testTags: string[]) => boolean) | undefined,\n onlyMode?: boolean,\n parentIsOnly?: boolean,\n allowOnly?: boolean,\n): void {\n const matchedLocations: number[] = [];\n\n const traverseSuite = (suite: Suite, parentIsOnly?: boolean, parentMatchedWithLocation?: boolean) => {\n const suiteIsOnly = parentIsOnly || suite.mode === 'only';\n\n // Check if any tasks in this suite have `.only` - if so, only those should run\n const hasSomeTasksOnly = onlyMode && suite.tasks.some(\n t => t.mode === 'only' || (t.type === 'suite' && someTasksAreOnly(t)),\n );\n\n suite.tasks.forEach((t) => {\n // Check if either the parent suite or the task itself are marked as included\n // If there are tasks with `.only` in this suite, only include those (not all tasks from describe.only)\n const includeTask = hasSomeTasksOnly\n ? (t.mode === 'only' || (t.type === 'suite' && someTasksAreOnly(t)))\n : (suiteIsOnly || t.mode === 'only');\n if (onlyMode) {\n if (t.type === 'suite' && (includeTask || someTasksAreOnly(t))) {\n // Don't skip this suite\n if (t.mode === 'only') {\n checkAllowOnly(t, allowOnly);\n t.mode = 'run';\n }\n }\n else if (t.mode === 'run' && !includeTask) {\n t.mode = 'skip';\n }\n else if (t.mode === 'only') {\n checkAllowOnly(t, allowOnly);\n t.mode = 'run';\n }\n }\n\n let hasLocationMatch = parentMatchedWithLocation\n // Match test location against provided locations, only run if present\n // in `testLocations`. Note: if `includeTaskLocation` is not enabled,\n // all test will be skipped.\n if (testLocations !== undefined && testLocations.length !== 0) {\n if (t.location && testLocations?.includes(t.location.line)) {\n t.mode = 'run';\n matchedLocations.push(t.location.line);\n hasLocationMatch = true;\n }\n else if (parentMatchedWithLocation) {\n t.mode = 'run';\n }\n else if (t.type === 'test') {\n t.mode = 'skip';\n }\n }\n\n if (t.type === 'test') {\n if (namePattern && !getTaskFullName(t).match(namePattern)) {\n t.mode = 'skip';\n }\n if (testIds && !testIds.includes(t.id)) {\n t.mode = 'skip';\n }\n if (testTagsFilter && !testTagsFilter(t.tags || [])) {\n t.mode = 'skip';\n }\n }\n else if (t.type === 'suite') {\n if (t.mode === 'skip') {\n skipAllTasks(t);\n }\n else if (t.mode === 'todo') {\n todoAllTasks(t);\n }\n else {\n traverseSuite(t, includeTask, hasLocationMatch);\n }\n }\n })\n\n // if all subtasks are skipped, mark as skip\n if (suite.mode === 'run' || suite.mode === 'queued') {\n if (suite.tasks.length && suite.tasks.every(i => i.mode !== 'run' && i.mode !== 'queued')) {\n suite.mode = 'skip';\n }\n }\n }\n\n traverseSuite(file, parentIsOnly, false);\n\n const nonMatching = testLocations?.filter(loc => !matchedLocations.includes(loc))\n if (nonMatching && nonMatching.length !== 0) {\n const message = nonMatching.length === 1\n ? `line ${nonMatching[0]}`\n : `lines ${nonMatching.join(', ')}`;\n\n if (file.result === undefined) {\n file.result = {\n state: 'fail',\n errors: [],\n };\n }\n if (file.result.errors === undefined) {\n file.result.errors = [];\n }\n\n file.result.errors.push(\n processError(new Error(`No test found in ${file.name} in ${message}`)),\n );\n }\n}\n\nfunction getTaskFullName(task: TaskBase): string {\n return `${task.suite ? `${getTaskFullName(task.suite)} ` : ''}${task.name}`;\n}\n\nfunction skipAllTasks(suite: Suite) {\n suite.tasks.forEach((t) => {\n if (t.mode === 'run' || t.mode === 'queued') {\n t.mode = 'skip';\n if (t.type === 'suite') {\n skipAllTasks(t);\n }\n }\n });\n}\n\nfunction todoAllTasks(suite: Suite) {\n suite.tasks.forEach((t) => {\n if (t.mode === 'run' || t.mode === 'queued') {\n t.mode = 'todo';\n if (t.type === 'suite') {\n todoAllTasks(t);\n }\n }\n });\n}\n\nfunction checkAllowOnly(task: TaskBase, allowOnly?: boolean) {\n if (allowOnly) {\n return;\n }\n const error = processError(\n new Error(\n '[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error',\n ),\n );\n task.result = {\n state: 'fail',\n errors: [error],\n };\n}\n"],"mappings":";;;;;;;AAwJA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AChJD,MAAM,qCAAsH;CAC1H,OAAO;CACP,aAAa;CACb,sBAAsB;CACtB,0BAA0B;CAC1B,aAAa;CACb,cAAc,sBAAsB,GAAG;CACvC,oBAAoB,EAAE;CACvB;AAED,SAAS,sBAAsB,SAA0C;AACvE,QAAO;EACL,MAAM,iBAAiB;EACvB;EACD;;AAIH,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,KACG,SAAS,2B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U,YAAY,WAAW,IACnC,QAAQ,YAAY,OACpB,SAAS,YAAY,KAAK,KAAK;AAEnC,MAAI,KAAK,WAAW,OAClB,MAAK,SAAS;GACZ,OAAO;GACP,QAAQ,EAAE;GACX;AAEH,MAAI,KAAK,OAAO,WAAW,OACzB,MAAK,OAAO,SAAS,EAAE;AAGzB,OAAK,OAAO,OAAO,KACjB,6BAAa,IAAI,MAAM,oBAAoB,KAAK,KAAK,MAAM,UAAU,CAAC,CACvE;;;AAIL,SAAS,gBAAgB,MAAwB;AAC/C,QAAO,GAAG,KAAK,QAAQ,GAAG,gBAAgB,KAAK,MAAM,CAAC,KAAK,KAAK,KAAK;;AAGvE,SAAS,aAAa,OAAc;AAClC,OAAM,MAAM,SAAS,MAAM;AACzB,MAAI,EAAE,SAAS,SAAS,EAAE,SAAS,UAAU;AAC3C,KAAE,OAAO;AACT,OAAI,EAAE,SAAS,QACb,cAAa,EAAE;;GAGnB;;AAGJ,SAAS,aAAa,OAAc;AAClC,OAAM,MAAM,SAAS,MAAM;AACzB,MAAI,EAAE,SAAS,SAAS,EAAE,SAAS,UAAU;AAC3C,KAAE,OAAO;AACT,OAAI,EAAE,SAAS,QACb,cAAa,EAAE;;GAGnB;;AAGJ,SAAS,eAAe,MAAgB,WAAqB;AAC3D,KAAI,UACF;AAOF,MAAK,SAAS;EACZ,OAAO;EACP,QAAQ,CAPI,6BACZ,IAAI,MACF,kGACD,CACF,CAGgB;EAChB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest-pool-assemblyscript",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "AssemblyScript testing with Vitest - Simple, fast, familiar, AS-native, with full coverage output",
5
5
  "author": "Matt Ritter <matthew.d.ritter@gmail.com>",
6
6
  "license": "MIT",
@@ -77,6 +77,7 @@
77
77
  "test:meta:verify": "cross-env RUN_CONTEXT=local vitest run -c vitest.meta-verify.config.ts",
78
78
  "//---- install pool externally and run our tests from there ----": "",
79
79
  "test:ext:setup": "node scripts/setup-test-external.js",
80
+ "test:ext:setup:v4": "cross-env VITEST_VERSION=4 node scripts/setup-test-external.js",
80
81
  "test:ext:setup:v3": "cross-env VITEST_VERSION=3 node scripts/setup-test-external.js",
81
82
  "test:ext:pass": "node scripts/run-vitest-external.js -c vitest.pass.config.ts",
82
83
  "test:ext:pass:no-cov": "node scripts/run-vitest-external.js -c vitest.pass.config.ts --coverage.enabled=false",
@@ -93,12 +94,18 @@
93
94
  "emtest": "npm run test:ext:setup && npm run test:ext:meta",
94
95
  "emvtest": "npm run test:ext:setup && npm run test:ext:meta:verify",
95
96
  "aetest": "npm run eptest && npm run test:ext:meta:verify",
97
+ "//---- external v4 test shortcuts ----": "",
98
+ "ep4test": "npm run test:ext:setup:v4 && npm run test:ext:pass",
99
+ "em4test": "npm run test:ext:setup:v4 && npm run test:ext:meta",
100
+ "emv4test": "npm run test:ext:setup:v4 && npm run test:ext:meta:verify",
101
+ "ae4test": "npm run ep4test && npm run test:ext:meta:verify",
96
102
  "//---- external v3 test shortcuts ----": "",
97
103
  "ep3test": "npm run test:ext:setup:v3 && npm run test:ext:pass",
98
104
  "em3test": "npm run test:ext:setup:v3 && npm run test:ext:meta",
99
105
  "emv3test": "npm run test:ext:setup:v3 && npm run test:ext:meta:verify",
100
106
  "ae3test": "npm run ep3test && npm run test:ext:meta:verify",
101
- "eetest": "npm run aetest && npm run ae3test",
107
+ "//---- external global test shortcuts ----": "",
108
+ "eetest": "npm run aetest && npm run ae4test && npm run ae3test",
102
109
  "//---- compile & test shortcuts ----": "",
103
110
  "tcptest": "npm run tc && npm run build && npm run ptest",
104
111
  "cptest": "npm run build && npm run ptest",
@@ -132,12 +139,12 @@
132
139
  "tinyrainbow": "^3.1.0"
133
140
  },
134
141
  "peerDependencies": {
135
- "@vitest/coverage-v8": "^3.2.0 || ^4.0.0",
136
- "@vitest/runner": "^3.2.0 || ^4.0.0",
137
- "@vitest/utils": "^3.2.0 || ^4.0.0",
142
+ "@vitest/coverage-v8": "^3.2.0 || ^4.0.0 || ^5.0.0-0",
143
+ "@vitest/runner": "^3.2.0 || ^4.0.0 || ^5.0.0-0",
144
+ "@vitest/utils": "^3.2.0 || ^4.0.0 || ^5.0.0-0",
138
145
  "assemblyscript": "~0.28.9",
139
146
  "istanbul-lib-coverage": "^3.2.2",
140
- "vitest": "^3.2.0 || ^4.0.0"
147
+ "vitest": "^3.2.0 || ^4.0.0 || ^5.0.0-0"
141
148
  },
142
149
  "devDependencies": {
143
150
  "@semantic-release/github": "^12.0.3",
@@ -145,9 +152,9 @@
145
152
  "@types/istanbul-lib-coverage": "^2.0.6",
146
153
  "@types/node": "22.19.1",
147
154
  "@types/source-map": "~0.5.2",
148
- "@vitest/coverage-v8": "^4.1.5",
149
- "@vitest/runner": "^4.1.5",
150
- "@vitest/utils": "^4.1.5",
155
+ "@vitest/coverage-v8": "5.0.0-beta.4",
156
+ "@vitest/runner": "5.0.0-beta.4",
157
+ "@vitest/utils": "5.0.0-beta.4",
151
158
  "assemblyscript": "0.28.17",
152
159
  "conventional-changelog-conventionalcommits": "^9.1.0",
153
160
  "cross-env": "^10.1.0",
@@ -158,6 +165,6 @@
158
165
  "tsdown": "^0.20.3",
159
166
  "tsx": "^4.21.0",
160
167
  "typescript": "^5.9.3",
161
- "vitest": "^4.1.5"
168
+ "vitest": "5.0.0-beta.4"
162
169
  }
163
170
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"pool-runner-init-CCvnKt5o.d.mts","names":[],"sources":["../src/pool/pool-runner-init.ts"],"mappings":";;;;iBAUgB,wBAAA,CAAyB,eAAA,GAAkB,yBAAA,GAA4B,qBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest-file-tasks-vvZzigcF.mjs","names":[],"sources":["../src/types/types.ts","../src/util/resolve-config.ts","../src/types/typed-constants.ts","../src/util/vitest-tasks.ts","../src/util/vitest-file-tasks.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 } from 'vitest';\nimport type { TestError } from '@vitest/utils';\nimport type { ResolvedCoverageOptions } from 'vitest/node';\nimport type { File, Test, TaskMeta, TestOptions } from '@vitest/runner/types';\nimport type { RawSourceMap } from 'source-map';\n\nimport {\n AS_POOL_WORKER_MSG_FLAG,\n COVERAGE_PAYLOAD_FORMATS,\n POOL_ERROR_NAMES,\n TEST_ERROR_NAMES,\n AS_POOL_ERROR_FLAG,\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\nexport interface AssemblyScriptPoolError {\n readonly [AS_POOL_ERROR_FLAG]: true;\n name: PoolErrorName;\n message?: string;\n originalErrorRawStack: NodeJS.CallSite[];\n originalErrorMayContainJS: boolean;\n applyStackToTestErrorCause: boolean;\n testError: AssemblyScriptTestError;\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 interface AssemblyScriptTestError extends TestError {\n // reported error can originate as a test error (assertion/runtime),\n // or as a pool failnure (harness error due to OOM, other unexpected paths)\n name: TestErrorName | PoolErrorName\n}\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 'extraCompilerFlags'\n] as const;\n\nexport const AS_POOL_OPTIONAL_FIELDS = [\n 'testMemoryPagesInitial',\n 'testMemoryPagesMax',\n 'coverageMemoryPagesInitial',\n 'coverageMemoryPagesMax',\n 'wasmImportsFactory'\n] 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// 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\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 & { readonly isResolved: true };\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 WASMCompilation {\n filePath: string;\n sourceMap: RawSourceMap;\n debugInfo?: BinaryDebugInfo;\n compiledModule: WebAssembly.Module;\n requiredMemory: WASMModuleMemoryRequirements;\n isInstrumented: boolean;\n compileTiming: number;\n}\n\nexport interface WASMImportMemoryRequirements {\n initialPages: number;\n maximumPages?: number;\n};\n\nexport interface WASMModuleMemoryRequirements {\n testMemory: WASMImportMemoryRequirements;\n coverageMemory: WASMImportMemoryRequirements;\n}\n\nexport interface AssemblyScriptCompilerOptions {\n shouldInstrument: boolean;\n projectRoot: string;\n instrumentationOptions?: InstrumentationOptions;\n stripInline?: boolean;\n extraFlags?: string[];\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 coverageMemoryModule: string;\n coverageMemoryName: string;\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 actualTypeName: string;\n expectedTypeName: 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 lastErrorCallStackRef?: Error;\n lastErrorUnexpected?: boolean;\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 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 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 asPoolOptions: ResolvedAssemblyScriptPoolOptions;\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 asPoolOptions: ResolvedAssemblyScriptPoolOptions;\n isCollectTestsMode: boolean;\n timedOutTest?: Test;\n}\n\nexport interface ProcessPoolRunFileTask {\n dispatchStart: number;\n port: MessagePort;\n file: File;\n config: SerializedConfigCompat;\n asPoolOptions: ResolvedAssemblyScriptPoolOptions;\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 { Vitest } from 'vitest/node';\n\nimport type {\n AssemblyScriptPoolOptions,\n ASPoolOptionsFieldsWithDefaultValues,\n ResolvedAssemblyScriptPoolOptions,\n ResolvedHybridProviderOptions,\n SerializedConfigCompat,\n AssemblyScriptTestError,\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';\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 extraCompilerFlags: [],\n} as const;\n\nfunction createPoolConfigError(message: string): AssemblyScriptTestError {\n return {\n name: POOL_ERROR_NAMES.PoolConfigError,\n message\n };\n}\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 (\n (resolved.testMemoryPagesInitial !== undefined && resolved.testMemoryPagesInitial < 1)\n || (resolved.testMemoryPagesMax !== undefined && resolved.testMemoryPagesMax < 1)\n ) {\n throw createPoolConfigError(\n `AssemblyScript WASM test memory page size options must be positive if defined - testMemoryPagesMin: ${resolved.testMemoryPagesInitial}`\n + ` | testMemoryPagesMax: ${resolved.testMemoryPagesMax}`,\n );\n }\n\n if (\n (resolved.coverageMemoryPagesInitial !== undefined && resolved.coverageMemoryPagesInitial < 1)\n || (resolved.coverageMemoryPagesMax !== undefined && resolved.coverageMemoryPagesMax < 1)\n ) {\n throw createPoolConfigError(\n `AssemblyScript WASM coverage memory page size options must be positive if defined - coverageMemoryPagesMin: ${resolved.coverageMemoryPagesInitial}`\n + ` | coverageMemoryPagesMax: ${resolved.coverageMemoryPagesMax}`,\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\nfunction getProjectConfigs(ctx: Vitest): {\n [key: string]: {\n config: SerializedConfigCompat,\n v3PoolOptions?: ResolvedAssemblyScriptPoolOptions\n }\n} {\n const configs = {} as {\n [key: string]: {\n config: SerializedConfigCompat,\n v3PoolOptions?: ResolvedAssemblyScriptPoolOptions\n }\n };\n\n ctx.projects\n // project.config.pool resolves to the *path of the dist file*\n .filter(p => p.config.pool.includes(ASSEMBLYSCRIPT_POOL_NAME))\n \n .forEach(project => {\n configs[project.name] = {\n config: getCompatConfig(project.serializedConfig),\n };\n\n // @ts-ignore - we build with v4, but this is correct for v3 (has config.poolOptions)\n const maybeOptions: any = project.config?.poolOptions?.assemblyScript;\n if (maybeOptions) {\n configs[project.name]!.v3PoolOptions = resolvePoolOptions(maybeOptions);\n }\n });\n \n return configs;\n}\n\nexport function getConfigs(ctx: Vitest): {\n coverage: ResolvedHybridProviderOptions;\n projects: {\n [key: string]: {\n config: SerializedConfigCompat,\n v3PoolOptions?: ResolvedAssemblyScriptPoolOptions\n }\n };\n fallbackPoolOptions: ResolvedAssemblyScriptPoolOptions;\n} {\n const coverage = ctx.config.coverage as unknown as ResolvedHybridProviderOptions;\n const projects = getProjectConfigs(ctx);\n\n // @ts-ignore - we build with v4, but this is correct for v3 (has config.poolOptions)\n let fallbackPoolOptions: ResolvedAssemblyScriptPoolOptions = resolvePoolOptions(ctx.config.poolOptions?.assemblyScript);\n\n const configs = Object.values(projects);\n if (configs.length > 0) {\n for (const config of configs) {\n if (config.v3PoolOptions?.debug) {\n fallbackPoolOptions.debug = true;\n }\n if (config.v3PoolOptions?.maxThreadsV3 !== undefined\n && config.v3PoolOptions.maxThreadsV3 > fallbackPoolOptions.maxThreadsV3\n ) {\n fallbackPoolOptions.maxThreadsV3 = config.v3PoolOptions.maxThreadsV3;\n }\n }\n }\n\n return {\n coverage,\n projects,\n fallbackPoolOptions\n };\n}\n","/**\n * Typed Constants\n * \n * Constants which require importing ./types\n */\n\nimport { AssemblyScriptTestOptions } from './types.js';\n\n// hard-coded defaults only - timeout and retry defaults always come from vitest config\nexport const DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS: Pick<AssemblyScriptTestOptions, 'fails' | 'skip' | 'only'> = {\n fails: false,\n skip: false,\n only: false\n};\n","import type { File, RunMode, Suite, Task, Test } from '@vitest/runner/types';\n\nimport type {\n AssemblyScriptCoveragePayload,\n AssemblyScriptSuiteTaskMeta,\n AssemblyScriptTestError,\n AssemblyScriptTestOptions,\n AssemblyScriptTestTaskMeta,\n FailedAssertion,\n VitestVersion,\n WASMExecutorPerfTimings\n} from '../types/types.js';\nimport { TEST_ERROR_NAMES } from '../types/constants.js';\nimport { debug } from './debug.js';\nimport { createTestExpectedToFailError, createTestTimeoutError } from './pool-errors.js';\nimport { retryCompat } from './resolve-config.js';\n\n// ============================================================================\n// Util\n// ============================================================================\n\nfunction positiveSum<T>(items: T[], getSummableValue: (_next: T) => number | undefined): number {\n return items.reduce((total, next) => {\n return total + Math.max(getSummableValue(next) || 0, 0)\n }, 0);\n}\n\nfunction hasNonFileParentSuite(suite: Suite): boolean {\n return !!suite.suite?.id && suite.suite.id !== suite.file.id;\n}\n\nfunction getSuiteHierarchyName(suite: Suite): string {\n let name = suite.name;\n let currentSuite = suite;\n \n while (hasNonFileParentSuite(currentSuite)) {\n name = `${currentSuite.suite!.name} > ${name}`;\n currentSuite = currentSuite.suite!;\n }\n \n return name;\n}\n\nexport function isSuiteOwnFile(suite: Suite): boolean {\n return suite.file.id === suite.id;\n}\n\nexport function getTaskLogLabel(base: string, task: Task): string {\n if (task.type === 'suite') {\n return isSuiteOwnFile(task) ?\n `${base}`\n : `${base} - \"${getSuiteHierarchyName(task)}\"`;\n } else {\n return `${base} - \"${getSuiteHierarchyName(task.suite!)} > ${task.name}\"`;\n }\n}\n\nexport function getTaskLogPrefix(logModule: string, base: string, task: Task): string {\n return `[${logModule}] ${getTaskLogLabel(base, task)}`;\n}\n\nexport function createAfterSuiteRunMeta(\n coverage: AssemblyScriptCoveragePayload,\n testFiles: string[],\n projectName: string = '',\n vitestVersion: VitestVersion = 'v4',\n): any {\n const base = { coverage, testFiles, projectName };\n\n if (vitestVersion) {\n return { ...base, transformMode: 'ssr' as const };\n } else {\n return { ...base, environment: 'node' as const };\n }\n}\n\n// ============================================================================\n// Task Creation\n// ============================================================================\n\nexport function getInitialTaskMode(options: AssemblyScriptTestOptions): RunMode {\n if (options.skip) {\n return 'skip';\n } else if (options.only) {\n return 'only';\n } else {\n return 'run';\n }\n}\n\nexport function getInitialTestTaskMeta(\n fnIndex: number,\n parentAfterAddingTask: Suite,\n): AssemblyScriptTestTaskMeta {\n return {\n fnIndex,\n idxInParentTasks: parentAfterAddingTask.tasks.length - 1,\n assertionsPassedCount: 0,\n assertionsFailed: [],\n resultFinal: false,\n };\n}\n\nexport function getInitialSuiteTaskMeta(\n parentAfterAddingTask: Suite,\n mergedOptions: AssemblyScriptTestOptions,\n): AssemblyScriptSuiteTaskMeta {\n return {\n idxInParentTasks: parentAfterAddingTask.tasks.length - 1,\n defaultTestOptions: mergedOptions,\n suitePreparedSent: false,\n resultFinal: false,\n };\n}\n\n\nfunction createTaskName(names: readonly (string | undefined)[], separator: string = ' > '): string {\n return names.filter(name => name !== undefined).join(separator);\n}\n\nexport function createTestTask(\n name: string,\n fnIndex: number,\n file: File,\n parent: Suite,\n mergedOptions: AssemblyScriptTestOptions,\n vitestVersion: VitestVersion = 'v4',\n): Test {\n const test: Test = {\n type: 'test',\n name,\n fullName: createTaskName([\n parent?.fullName ?? file?.fullName,\n name,\n ]),\n fullTestName: createTaskName([parent?.fullTestName, name]),\n id: '',\n file,\n suite: parent,\n context: {} as any,\n annotations: [],\n artifacts: [],\n meta: {},\n mode: getInitialTaskMode(mergedOptions),\n timeout: mergedOptions.timeout,\n retry: mergedOptions.retry,\n fails: mergedOptions.fails,\n };\n\n if (vitestVersion === 'v3') {\n // @ts-ignore\n delete test.fullName;\n // @ts-ignore\n delete test.fullTestName;\n // @ts-ignore\n delete test.artifacts;\n }\n\n parent.tasks.push(test);\n\n // use custom TaskMeta to capture fnIndex, parent task index, etc\n test.meta = getInitialTestTaskMeta(fnIndex, parent);\n\n return test;\n}\n\nexport function createSuiteTask(\n name: string,\n file: File,\n parent: Suite,\n mergedOptions: AssemblyScriptTestOptions,\n vitestVersion: VitestVersion = 'v4',\n): Suite {\n // const suiteIsFile = parent.file.id === parent.id;\n // const prefix = suiteIsFile ? parent.name : `${file.filepath}_${parent.name}`;\n const suite: Suite = {\n type: 'suite',\n name,\n fullName: createTaskName([\n parent?.fullName ?? file?.fullName,\n name,\n ]),\n fullTestName: createTaskName([parent?.fullTestName, name]),\n id: '',\n file,\n suite: parent,\n meta: {},\n tasks: [],\n mode: getInitialTaskMode(mergedOptions),\n };\n\n if (vitestVersion === 'v3') {\n // @ts-ignore\n delete suite.fullName;\n // @ts-ignore\n delete suite.fullTestName;\n }\n\n parent.tasks.push(suite);\n\n // use custom TaskMeta to capture parent task index and default options\n suite.meta = getInitialSuiteTaskMeta(parent, mergedOptions);\n\n return suite;\n}\n\n\n// ============================================================================\n// Dispatch Helpers\n// ============================================================================\n\nexport function getRunnableTasks(suite: Suite): Task[] {\n return suite.tasks.filter(t => t.mode === 'queued' || t.mode === 'run');\n}\n\n\n// ============================================================================\n// Result Handling Helpers\n// ============================================================================\n\nexport function shouldRetryTask(task: Task): boolean {\n const retry = retryCompat(task.retry);\n return task.result?.state === 'fail'\n && task.retry !== undefined\n && retry > 0\n && (\n task.result.retryCount === undefined\n || task.result.retryCount === 0\n || (task.result.retryCount < retry)\n );\n}\n\n/**\n * Invert result if test configured as 'fails'.\n */\nexport function checkFailsAndInvertResult(test: Test, logPrefix: string): void {\n if (test.fails) {\n if (test.result?.state === 'pass') {\n test.result.state = 'fail';\n\n debug(`${logPrefix} - Has 'fails' option set - inverted \"pass\" to \"fail\"`);\n\n const err = createTestExpectedToFailError(test);\n if (test.result.errors) {\n test.result.errors.push(err);\n } else {\n test.result.errors = [err];\n }\n } else if (test.result?.state === 'fail') {\n test.result.state = 'pass';\n test.result.errors = [];\n\n debug(`${logPrefix} - Has 'fails' option set - inverted \"fail\" to \"pass\"`);\n }\n }\n}\n\nexport function setTestResultForTestPrepare(test: Test, startTime: number): void {\n test.result = {\n state: 'run',\n startTime,\n retryCount: 0\n };\n};\n\nexport function updateTestResultAfterRun(test: Test, testTimings?: WASMExecutorPerfTimings): void {\n // while failed tests are actively set to failed, a passed test\n // will still be in the prepared result state (run), so set it to pass\n if (test.result?.state === 'run') {\n test.result.state = 'pass';\n }\n \n if (test.result && testTimings) {\n // accumulate duration for any retries that may be done\n test.result.duration = (test.result.duration ?? 0) + (testTimings.execEnd - testTimings.execStart);\n }\n}\n\nexport function flagTestTerminated(test: Test): void {\n (test.meta as AssemblyScriptTestTaskMeta).lastTimeoutTerminationTime = Date.now();\n}\n\nexport function flagTestFinalized(test: Test): void {\n (test.meta as AssemblyScriptTestTaskMeta).resultFinal = true;\n}\n\nfunction failTest(\n test: Test,\n testError: AssemblyScriptTestError,\n): void {\n if (test.result) {\n test.result.state = 'fail';\n } else {\n test.result = { state: 'fail' };\n }\n\n if (test.result.errors) {\n test.result.errors.push(testError);\n } else {\n test.result.errors = [testError];\n }\n}\n\nexport function failTestRuntimeError(\n test: Test,\n errorMessagePrefix: string,\n errorMessage: string,\n): AssemblyScriptTestError {\n const prefixStr = errorMessagePrefix ? `${errorMessagePrefix}: ` : '';\n const testError: AssemblyScriptTestError = {\n name: TEST_ERROR_NAMES.WASMRuntimeError,\n message: `${prefixStr}${errorMessage}`\n };\n\n failTest(test, testError);\n \n return testError;\n}\n\nexport function failTestAssertionError(\n test: Test,\n assertion: FailedAssertion\n): AssemblyScriptTestError {\n (test.meta as AssemblyScriptTestTaskMeta).assertionsFailed.push(assertion);\n\n const testError: AssemblyScriptTestError = {\n name: TEST_ERROR_NAMES.AssertionError,\n message: assertion.message\n };\n \n if (assertion?.valuesProvided) {\n testError.expected = assertion.expected !== undefined ? String(assertion.expected) : undefined;\n testError.actual = assertion.actual !== undefined ? String(assertion.actual) : undefined;\n }\n\n failTest(test, testError);\n \n return testError;\n}\n\nexport function failTestWithTimeoutError (test: Test, startTime: number, duration: number): void {\n const timeoutErr = createTestTimeoutError(test);\n\n if (test.result) {\n test.result.state = 'fail';\n test.result.startTime = startTime;\n \n // accumulate duration for any retries that may be done\n test.result.duration = (test.result.duration ?? 0) + duration;\n\n if (test.result.errors) {\n test.result.errors.push(timeoutErr)\n } else {\n test.result.errors = [timeoutErr];\n }\n } else {\n test.result = {\n state: 'fail',\n startTime,\n duration,\n errors: [timeoutErr],\n retryCount: 0,\n };\n }\n}\n\nexport function setSuitePrepareResult(suite: Suite): void {\n if (suite.mode === 'skip') {\n suite.result = {\n state: 'skip',\n duration: 0,\n };\n } else {\n suite.result = {\n state: 'run',\n startTime: Date.now(),\n };\n }\n}\n\nexport function updateSuiteFinishedResult(suite: Suite, logPrefix: string): void {\n if (suite.mode === 'skip') {\n suite.result = {\n state: 'skip',\n duration: 0,\n };\n } else {\n // update suite final result based on sub-task results\n const hasFailures = suite.tasks.some(({ result }) => result?.state === 'fail' );\n \n if (suite.result) {\n suite.result.duration = positiveSum(suite.tasks, t => t.result?.duration);\n suite.result.state = hasFailures ? 'fail' : 'pass';\n \n debug(`${logPrefix} - Set suite result: \"${suite.result.state}\" (hasFailures: ${hasFailures})`);\n }\n }\n}\n\nexport function finalizeSuiteResult(suite: Suite): void {\n (suite.meta as AssemblyScriptSuiteTaskMeta).resultFinal = true;\n}\n\nexport function resetTestForRetry(test: Test, startTime: number): void {\n if (test.result) {\n test.result!.state = 'run';\n test.result!.startTime = startTime;\n }\n\n const meta = test.meta as AssemblyScriptTestTaskMeta;\n\n // clear any custom metadata associated with the immediate last run\n meta.assertionsPassedCount = 0;\n meta.assertionsFailed = [];\n delete meta.lastError;\n delete meta.lastErrorValuesProvided;\n delete meta.lastErrorRawCallStack;\n delete meta.lastErrorCallStackRef;\n delete meta.lastTimeoutTerminationTime;\n delete meta.coverageData;\n}\n\n\n","import type { SerializedConfig } from 'vitest';\nimport type { File, Suite, Task, TaskBase } from '@vitest/runner/types';\nimport {\n calculateSuiteHash,\n createFileTask,\n someTasksAreOnly\n} from '@vitest/runner/utils';\nimport { processError } from '@vitest/utils/error';\n\nimport { ASSEMBLYSCRIPT_POOL_NAME } from '../types/constants.js';\nimport { DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS } from '../types/typed-constants.js';\nimport type {\n AssemblyScriptSuiteTaskMeta,\n AssemblyScriptTestError,\n AssemblyScriptTestOptions,\n} from '../types/types.js';\nimport { finalizeSuiteResult } from './vitest-tasks.js';\n\nexport function createInitialFileTask(\n testFile: string,\n projectName: string,\n projectRoot: string,\n configTestTimeout: number,\n configRetry: number,\n): File {\n const file: File = createFileTask(\n testFile,\n projectRoot,\n projectName,\n ASSEMBLYSCRIPT_POOL_NAME\n );\n\n file.mode = 'queued';\n file.environmentLoad = 0; // AS pool has no environment setup\n file.setupDuration = 0; // AS pool has no setup files\n\n const defaultTestOptions: AssemblyScriptTestOptions = {\n ...DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS,\n timeout: configTestTimeout,\n retry: configRetry,\n };\n\n const meta: AssemblyScriptSuiteTaskMeta = {\n idxInParentTasks: -1, // file task has no parent, should never be used anyway\n defaultTestOptions,\n suitePreparedSent: false,\n resultFinal: false,\n }\n file.meta = meta;\n\n return file;\n}\n\nexport function createFailedFileTask(\n testFile: string,\n projectName: string,\n config: SerializedConfig,\n error: AssemblyScriptTestError,\n): File {\n const file: File = createFileTask(\n testFile,\n config.root,\n projectName,\n ASSEMBLYSCRIPT_POOL_NAME\n );\n file.mode = 'run';\n file.result = {\n state: 'fail',\n errors: [error]\n };\n file.environmentLoad = 0;\n file.setupDuration = 0;\n file.collectDuration = 0;\n\n return file;\n}\n\nexport function prepareFileTaskForCollection(\n file: File,\n testNamePattern?: RegExp,\n allowOnly?: boolean,\n): void {\n calculateSuiteHash(file);\n\n // Interpret task modes does the following:\n // 1. If only mode enabled on any test, flip all non-only test.mode to skip\n // 2. Apply test name pattern filtering (from -t flag) to skip if needed\n // 3. If all test modes are skip, set file task mode to skip\n const hasOnly = someTasksAreOnly(file);\n interpretTaskModes(\n file,\n testNamePattern, // user regexp\n undefined, // testLocations\n undefined,\n undefined,\n hasOnly, // onlyMode - true if only is used anywhere\n false, // parentIsOnly - always false for the file task\n allowOnly\n );\n\n // update from queued (onQueued report) to run (onCollected report)\n if (file.mode === 'queued') {\n file.mode = 'run';\n }\n}\n\nexport function failFile(\n file: File,\n testError: AssemblyScriptTestError,\n runStartPerf: number,\n): AssemblyScriptTestError {\n file.mode = 'run';\n if (file.result) {\n file.result.state = 'fail';\n file.result.errors = file.result.errors ? file.result.errors.concat(testError) : [testError];\n } else {\n file.result = {\n state: 'fail',\n errors: [testError]\n };\n }\n file.environmentLoad = file.environmentLoad ?? 0;\n file.setupDuration = performance.now() - runStartPerf;\n file.collectDuration = file.collectDuration ?? 0;\n\n // we can always finalize on failing the file, no other work to do\n finalizeSuiteResult(file);\n\n return testError;\n}\n\nexport function getFullTaskHierarchy(file: File): string {\n function spacesForLevel(level: number): string {\n return new Array(level + 1).fill(' ').join('');\n }\n\n function taskStr(task: Task, level: number): string {\n if (task.type === 'test') {\n return `${spacesForLevel(level)}ID: ${task.id} Mode: \"${task.mode}\" Test: \"${task.name}\"`;\n } else {\n const suiteStr = `${spacesForLevel(level)}ID: ${task.id} Mode: \"${task.mode}\" Suite: \"${task.name}\"\\n`;\n return suiteStr + task.tasks.map(t => taskStr(t, level + 1)).join('\\n');\n }\n };\n\n return taskStr(file, 0);\n}\n\n\n// ============================================================================\n// interpretTaskModes function borrowed from Vitest\n// ============================================================================\n\n/**\n * Function interface changes from vitest 4.0.x -> 4.1.x, so now were' just handling this\n * functionality ourselves to prevent version compat conflicts.\n * \n * @see https://github.com/vitest-dev/vitest/blob/v4.1.0/packages/runner/src/utils/collect.ts#L10\n * \n * Vitest is released under the MIT license, included in this project's root.\n * Copyright (c) 2021-Present Vitest Team\n */\n\nfunction interpretTaskModes(\n file: Suite,\n namePattern?: string | RegExp,\n testLocations?: number[] | undefined,\n testIds?: string[] | undefined,\n testTagsFilter?: ((testTags: string[]) => boolean) | undefined,\n onlyMode?: boolean,\n parentIsOnly?: boolean,\n allowOnly?: boolean,\n): void {\n const matchedLocations: number[] = [];\n\n const traverseSuite = (suite: Suite, parentIsOnly?: boolean, parentMatchedWithLocation?: boolean) => {\n const suiteIsOnly = parentIsOnly || suite.mode === 'only';\n\n // Check if any tasks in this suite have `.only` - if so, only those should run\n const hasSomeTasksOnly = onlyMode && suite.tasks.some(\n t => t.mode === 'only' || (t.type === 'suite' && someTasksAreOnly(t)),\n );\n\n suite.tasks.forEach((t) => {\n // Check if either the parent suite or the task itself are marked as included\n // If there are tasks with `.only` in this suite, only include those (not all tasks from describe.only)\n const includeTask = hasSomeTasksOnly\n ? (t.mode === 'only' || (t.type === 'suite' && someTasksAreOnly(t)))\n : (suiteIsOnly || t.mode === 'only');\n if (onlyMode) {\n if (t.type === 'suite' && (includeTask || someTasksAreOnly(t))) {\n // Don't skip this suite\n if (t.mode === 'only') {\n checkAllowOnly(t, allowOnly);\n t.mode = 'run';\n }\n }\n else if (t.mode === 'run' && !includeTask) {\n t.mode = 'skip';\n }\n else if (t.mode === 'only') {\n checkAllowOnly(t, allowOnly);\n t.mode = 'run';\n }\n }\n\n let hasLocationMatch = parentMatchedWithLocation\n // Match test location against provided locations, only run if present\n // in `testLocations`. Note: if `includeTaskLocation` is not enabled,\n // all test will be skipped.\n if (testLocations !== undefined && testLocations.length !== 0) {\n if (t.location && testLocations?.includes(t.location.line)) {\n t.mode = 'run';\n matchedLocations.push(t.location.line);\n hasLocationMatch = true;\n }\n else if (parentMatchedWithLocation) {\n t.mode = 'run';\n }\n else if (t.type === 'test') {\n t.mode = 'skip';\n }\n }\n\n if (t.type === 'test') {\n if (namePattern && !getTaskFullName(t).match(namePattern)) {\n t.mode = 'skip';\n }\n if (testIds && !testIds.includes(t.id)) {\n t.mode = 'skip';\n }\n if (testTagsFilter && !testTagsFilter(t.tags || [])) {\n t.mode = 'skip';\n }\n }\n else if (t.type === 'suite') {\n if (t.mode === 'skip') {\n skipAllTasks(t);\n }\n else if (t.mode === 'todo') {\n todoAllTasks(t);\n }\n else {\n traverseSuite(t, includeTask, hasLocationMatch);\n }\n }\n })\n\n // if all subtasks are skipped, mark as skip\n if (suite.mode === 'run' || suite.mode === 'queued') {\n if (suite.tasks.length && suite.tasks.every(i => i.mode !== 'run' && i.mode !== 'queued')) {\n suite.mode = 'skip';\n }\n }\n }\n\n traverseSuite(file, parentIsOnly, false);\n\n const nonMatching = testLocations?.filter(loc => !matchedLocations.includes(loc))\n if (nonMatching && nonMatching.length !== 0) {\n const message = nonMatching.length === 1\n ? `line ${nonMatching[0]}`\n : `lines ${nonMatching.join(', ')}`;\n\n if (file.result === undefined) {\n file.result = {\n state: 'fail',\n errors: [],\n };\n }\n if (file.result.errors === undefined) {\n file.result.errors = [];\n }\n\n file.result.errors.push(\n processError(new Error(`No test found in ${file.name} in ${message}`)),\n );\n }\n}\n\nfunction getTaskFullName(task: TaskBase): string {\n return `${task.suite ? `${getTaskFullName(task.suite)} ` : ''}${task.name}`;\n}\n\nfunction skipAllTasks(suite: Suite) {\n suite.tasks.forEach((t) => {\n if (t.mode === 'run' || t.mode === 'queued') {\n t.mode = 'skip';\n if (t.type === 'suite') {\n skipAllTasks(t);\n }\n }\n });\n}\n\nfunction todoAllTasks(suite: Suite) {\n suite.tasks.forEach((t) => {\n if (t.mode === 'run' || t.mode === 'queued') {\n t.mode = 'todo';\n if (t.type === 'suite') {\n todoAllTasks(t);\n }\n }\n });\n}\n\nfunction checkAllowOnly(task: TaskBase, allowOnly?: boolean) {\n if (allowOnly) {\n return;\n }\n const error = processError(\n new Error(\n '[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error',\n ),\n );\n task.result = {\n state: 'fail',\n errors: [error],\n };\n}\n"],"mappings":";;;;;;;AAwJA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AChJD,MAAM,qCAAsH;CAC1H,OAAO;CACP,aAAa;CACb,sBAAsB;CACtB,0BAA0B;CAC1B,aAAa;CACb,cAAc,sBAAsB,GAAG;CACvC,oBAAoB,EAAE;CACvB;AAED,SAAS,sBAAsB,SAA0C;AACvE,QAAO;EACL,MAAM,iBAAiB;EACvB;EACD;;AAIH,SAAgB,mBAAmB,iBAA0D;CAC3F,MAAM,cAAyC,mBAAmB;AAGlE,MAAK,MAAM,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