vitest-pool-assemblyscript 0.9.1 → 0.10.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.
- package/assembly/compare.ts +11 -12
- package/assembly/describe.ts +4 -4
- package/assembly/expect.ts +44 -26
- package/assembly/test.ts +9 -9
- package/assembly/utils.ts +218 -62
- package/dist/{addon-interface-CYFXMbK7.mjs → addon-interface-DJB-K27u.mjs} +12 -12
- package/dist/addon-interface-DJB-K27u.mjs.map +1 -0
- package/dist/{ast-visitor-CWEOd3UH.mjs → ast-visitor-w1HMbuJR.mjs} +2 -2
- package/dist/{ast-visitor-CWEOd3UH.mjs.map → ast-visitor-w1HMbuJR.mjs.map} +1 -1
- package/dist/compile-runner-D4SJWhMh.mjs +82 -0
- package/dist/compile-runner-D4SJWhMh.mjs.map +1 -0
- package/dist/compiler/transforms/deep-equals.d.mts.map +1 -1
- package/dist/compiler/transforms/deep-equals.mjs +61 -22
- package/dist/compiler/transforms/deep-equals.mjs.map +1 -1
- package/dist/compiler/transforms/strip-inline.mjs +2 -2
- package/dist/{compiler-Dqs-qd3I.mjs → compiler-DSKhQ5--.mjs} +55 -27
- package/dist/compiler-DSKhQ5--.mjs.map +1 -0
- package/dist/config/index-v3.d.mts +1 -1
- package/dist/config/index-v3.d.mts.map +1 -1
- package/dist/config/index-v3.mjs.map +1 -1
- package/dist/config/index.d.mts +2 -2
- package/dist/config/index.mjs +5 -7
- package/dist/{constants-DbxJ3hzg.mjs → constants-Bq5KNxXJ.mjs} +4 -2
- package/dist/constants-Bq5KNxXJ.mjs.map +1 -0
- package/dist/{coverage-merge-CBXkpM1O.mjs → coverage-merge-0WqdC-dq.mjs} +1 -1
- package/dist/{coverage-merge-CBXkpM1O.mjs.map → coverage-merge-0WqdC-dq.mjs.map} +1 -1
- package/dist/coverage-provider/index.mjs +36 -36
- package/dist/coverage-provider/index.mjs.map +1 -1
- package/dist/{feature-check-Bje3ntpV.mjs → feature-check-DLfJqIrE.mjs} +4 -4
- package/dist/{feature-check-Bje3ntpV.mjs.map → feature-check-DLfJqIrE.mjs.map} +1 -1
- package/dist/index-internal.d.mts +3 -3
- package/dist/index-internal.d.mts.map +1 -1
- package/dist/index-internal.mjs +5 -4
- package/dist/index-v3.d.mts.map +1 -1
- package/dist/index-v3.mjs +19 -33
- package/dist/index-v3.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +5 -7
- package/dist/{load-user-imports-Bx5ZlhSm.mjs → load-user-imports-6Pv-9hRg.mjs} +103 -229
- package/dist/load-user-imports-6Pv-9hRg.mjs.map +1 -0
- package/dist/pool-errors-GWfwrsD7.mjs +631 -0
- package/dist/pool-errors-GWfwrsD7.mjs.map +1 -0
- package/dist/{pool-runner-init-CNpRdA5u.d.mts → pool-runner-init-CCvnKt5o.d.mts} +2 -2
- package/dist/pool-runner-init-CCvnKt5o.d.mts.map +1 -0
- package/dist/{pool-runner-init-BqkwQ2tk.mjs → pool-runner-init-Cta6aVJ6.mjs} +15 -30
- package/dist/pool-runner-init-Cta6aVJ6.mjs.map +1 -0
- package/dist/pool-thread/compile-worker-thread.d.mts +1 -1
- package/dist/pool-thread/compile-worker-thread.d.mts.map +1 -1
- package/dist/pool-thread/compile-worker-thread.mjs +29 -19
- package/dist/pool-thread/compile-worker-thread.mjs.map +1 -1
- package/dist/pool-thread/test-worker-thread.d.mts +1 -1
- package/dist/pool-thread/test-worker-thread.d.mts.map +1 -1
- package/dist/pool-thread/test-worker-thread.mjs +25 -18
- package/dist/pool-thread/test-worker-thread.mjs.map +1 -1
- package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
- package/dist/pool-thread/v3-tinypool-thread.d.mts.map +1 -1
- package/dist/pool-thread/v3-tinypool-thread.mjs +43 -33
- package/dist/pool-thread/v3-tinypool-thread.mjs.map +1 -1
- package/dist/test-runner-M21HMDdH.mjs +147 -0
- package/dist/test-runner-M21HMDdH.mjs.map +1 -0
- package/dist/{types-DHVk5iAx.d.mts → types-CoroKYxB.d.mts} +39 -16
- package/dist/types-CoroKYxB.d.mts.map +1 -0
- package/dist/vitest-file-tasks-Coc4btUw.mjs +473 -0
- package/dist/vitest-file-tasks-Coc4btUw.mjs.map +1 -0
- package/dist/wasm-memory-C8Nkl2Sz.mjs +134 -0
- package/dist/wasm-memory-C8Nkl2Sz.mjs.map +1 -0
- package/dist/{worker-rpc-channel-CZZIxtv5.mjs → worker-rpc-channel-CvCrc8aa.mjs} +1 -1
- package/dist/{worker-rpc-channel-CZZIxtv5.mjs.map → worker-rpc-channel-CvCrc8aa.mjs.map} +1 -1
- package/package.json +1 -1
- package/prebuilds/darwin-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/darwin-x64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/linux-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/linux-x64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/linux-x64/vitest-pool-assemblyscript.musl.node +0 -0
- package/prebuilds/win32-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/prebuilds/win32-x64/vitest-pool-assemblyscript.glibc.node +0 -0
- package/src/instrumentation/native/addon.cpp +71 -32
- package/dist/addon-interface-CYFXMbK7.mjs.map +0 -1
- package/dist/compile-runner-BNFHRGZO.mjs +0 -85
- package/dist/compile-runner-BNFHRGZO.mjs.map +0 -1
- package/dist/compiler-Dqs-qd3I.mjs.map +0 -1
- package/dist/constants-DbxJ3hzg.mjs.map +0 -1
- package/dist/debug-DtRAL4rM.mjs +0 -232
- package/dist/debug-DtRAL4rM.mjs.map +0 -1
- package/dist/load-user-imports-Bx5ZlhSm.mjs.map +0 -1
- package/dist/path-utils-t9OzjXYF.mjs +0 -24
- package/dist/path-utils-t9OzjXYF.mjs.map +0 -1
- package/dist/pool-runner-init-BqkwQ2tk.mjs.map +0 -1
- package/dist/pool-runner-init-CNpRdA5u.d.mts.map +0 -1
- package/dist/resolve-config-s9gSJSMc.mjs +0 -85
- package/dist/resolve-config-s9gSJSMc.mjs.map +0 -1
- package/dist/test-runner-BGqc9uCK.mjs +0 -138
- package/dist/test-runner-BGqc9uCK.mjs.map +0 -1
- package/dist/types-DHVk5iAx.d.mts.map +0 -1
- package/dist/vitest-file-tasks-D8sOClGX.mjs +0 -149
- package/dist/vitest-file-tasks-D8sOClGX.mjs.map +0 -1
- package/dist/vitest-tasks-BZ24sghI.mjs +0 -321
- package/dist/vitest-tasks-BZ24sghI.mjs.map +0 -1
- package/dist/wasm-names-BFtzQCH4.mjs +0 -124
- package/dist/wasm-names-BFtzQCH4.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool-errors-GWfwrsD7.mjs","names":[],"sources":["../src/util/path-utils.ts","../src/util/debug.ts","../src/util/highlight-code.ts","../src/util/test-error-formatting.ts","../src/wasm-executor/source-maps.ts","../src/wasm-executor/wasm-names.ts","../src/wasm-executor/wasm-errors.ts","../src/util/pool-errors.ts"],"sourcesContent":["/**\n * Path Utilities\n *\n * Cross-platform path normalization for consistent path comparisons.\n * All internal paths use forward slashes.\n */\n\n/**\n * Convert path to forward slashes for consistent cross-platform comparison.\n *\n * Source maps always use forward slashes regardless of OS. By normalizing\n * all paths to forward slashes, we ensure consistent matching between:\n * - Source map paths (already forward slashes)\n * - Glob results (OS-native, need conversion on Windows)\n * - Relative paths from Node's path.relative() (OS-native)\n * - Resolved paths from Node's path.resolve() (OS-native)\n */\nexport function toForwardSlash(path: string): string {\n return path.replace(/\\\\/g, '/');\n}\n","/**\n * Debug logging utility\n */\n\ndeclare global {\n var AS_POOL_DEBUG: boolean | undefined;\n}\n\nglobalThis.AS_POOL_DEBUG = false;\n\nconst DEBUG_ENV_ENABLED_VALUE = 'vitest_as_pool' as const;\n\nfunction isEnabled(): boolean {\n return globalThis.AS_POOL_DEBUG === true || process.env.DEBUG === DEBUG_ENV_ENABLED_VALUE;\n}\n\n/**\n * Initialize debug mode for current async context (called by worker at task start)\n * @param {boolean} debugEnabled - Enable verbose debug logging\n */\nexport function setGlobalDebugMode(debugEnabled: boolean): void {\n globalThis.AS_POOL_DEBUG = debugEnabled;\n}\n\nfunction debugLog(...args: any): void {\n // if first arg is a function, execute it and then print the result\n if (args?.length > 0 && typeof args[0] === 'function') {\n const result = args[0]();\n const rest = args.length > 1 ? args.slice(1) : [];\n console.log(Date.now(), String(result), ...rest);\n } else {\n console.log(Date.now(), ...args);\n }\n}\n\n/**\n * Log debug message (only when debug enabled in current global context)\n * or when environment has a given DEBUG variable set.\n */\nexport function debug(...args: any): void {\n if (isEnabled()) {\n debugLog(...args);\n }\n}\n\n/**\n * Log debug message (caller expected to determine if enabled)\n */\nexport function debugOverride(...args: any): void {\n debugLog(...args);\n}\n\n/**\n * Determine if debug mode is enabled for the current global context\n */\nexport function isDebugModeEnabled(): boolean {\n return isEnabled();\n}\n\nexport async function delay(ms: number = 5000): Promise<void> {\n return new Promise<void>((resolve, _reject) => {\n setTimeout(resolve, ms);\n });\n}\n","import { highlight, type TokenColors } from 'tinyhighlight';\nimport c from 'tinyrainbow';\n\n/**\n * Adapted from vitest. The internal function was changed between vitest 3.2.x and 4.0.x,\n * and then removed from public exposure in 4.1.x, so now instead we recreate the same\n * highlighting color rules.\n * \n * @see https://github.com/vitest-dev/vitest/blob/v4.1.0/packages/vitest/src/utils/colors.ts#L18\n * \n * Vitest is released under the MIT license, included in this project's root.\n * Copyright (c) 2021-Present Vitest Team\n */\n\nconst colors: TokenColors = {\n Keyword: c.magenta,\n IdentifierCapitalized: c.yellow,\n Punctuator: c.yellow,\n StringLiteral: c.green,\n NoSubstitutionTemplate: c.green,\n MultiLineComment: c.gray,\n SingleLineComment: c.gray,\n RegularExpressionLiteral: c.cyan,\n NumericLiteral: c.blue,\n TemplateHead: text =>\n c.green(text.slice(0, text.length - 2)) + c.cyan(text.slice(-2)),\n TemplateTail: text => c.cyan(text.slice(0, 1)) + c.green(text.slice(1)),\n TemplateMiddle: text =>\n c.cyan(text.slice(0, 1))\n + c.green(text.slice(1, text.length - 2))\n + c.cyan(text.slice(-2)),\n IdentifierCallable: c.blue,\n PrivateIdentifierCallable: text => `#${c.blue(text.slice(1))}`,\n Invalid: (text: string) => c.white(c.bgRed(c.bold(text)))\n};\n\nexport function highlightCode(source: string): string {\n return highlight(source, { colors });\n}\n","import { stripVTControlCharacters } from 'node:util';\nimport { fileURLToPath } from 'node:url';\nimport { readFile } from 'node:fs/promises';\nimport type { RawSourceMap } from 'source-map';\nimport type { ParsedStack } from '@vitest/utils';\nimport c from 'tinyrainbow';\n\nimport { highlightCode } from './highlight-code.js';\n\nconst FRAME_POINTER = '❯' as const;\nconst CODE_FRAME_INDENT_SPACES = 4 as const;\n\n// same performance guard used in vitest `printError`\nconst MAX_CODE_HIGHLIGHT_LENGTH = 100_000 as const;\n\nexport function getYellowString(str: string): string {\n return c.yellow(str);\n}\n\nexport function toPlaintextStackFrameString(frame: ParsedStack): string {\n return ` at ${frame.method} ${frame.file}:${frame.line}:${frame.column}`;\n}\n\nexport function toVitestLikeStackFrameString(frame: ParsedStack): string {\n return c.cyan(\n ` ${c.dim(FRAME_POINTER)} ${frame.method} ${frame.file}:${c.dim(`${frame.line}:${frame.column}`)}`\n );\n}\n\nexport async function getSourceCodeFrameString(\n sourceMap: RawSourceMap | undefined,\n frame: ParsedStack,\n): Promise<string | undefined> {\n let source: string | undefined;\n\n if (!sourceMap) {\n return undefined;\n }\n\n const fileIndex = sourceMap.sources.indexOf(frame.file);\n if (fileIndex < 0 || !sourceMap.sourcesContent) {\n const framePath = fileURLToPath(frame.file);\n source = await readFile(framePath, 'utf-8');\n } else {\n source = sourceMap.sourcesContent[fileIndex];\n }\n\n if (!source) {\n return undefined;\n }\n\n const highlightedSource = source.length < MAX_CODE_HIGHLIGHT_LENGTH\n ? highlightCode(source)\n : source;\n\n return generateCodeFrame(highlightedSource, CODE_FRAME_INDENT_SPACES, frame);\n}\n\n\n// ============================================================================\n// Source code formatting functions borrowed from Vitest\n// ============================================================================\n\n/**\n * Vitest doesn't expose generateCodeFrame as a util, so we have\n * recreated it here with minimal changes.\n * \n * @see https://github.com/vitest-dev/vitest/blob/v3.2.4/packages/vitest/src/node/printError.ts#L424\n * \n * Vitest is released under the MIT license, included in this project's root.\n * Copyright (c) 2021-Present Vitest Team\n */\n\nconst lineSplitRE: RegExp = /\\r?\\n/;\n\nfunction generateCodeFrame(\n source: string,\n indent = 0,\n loc: { line: number; column: number } | number,\n range = 2,\n): string {\n const start\n = typeof loc === 'object'\n ? positionToOffset(source, loc.line, loc.column)\n : loc\n const end = start\n const lines = source.split(lineSplitRE)\n const nl = /\\r\\n/.test(source) ? 2 : 1\n let count = 0\n let res: string[] = []\n\n const columns = process.stdout?.columns || 80\n\n for (let i = 0; i < lines.length; i++) {\n count += lines[i]!.length + nl\n if (count >= start) {\n for (let j = i - range; j <= i + range || end > count; j++) {\n if (j < 0 || j >= lines.length) {\n continue\n }\n\n const lineLength = lines[j]!.length\n\n // too long, maybe it's a minified file, skip for codeframe\n if (stripVTControlCharacters(lines[j]!).length > 200) {\n return ''\n }\n\n res.push(\n lineNo(j + 1)\n + truncateString(lines[j]!.replace(/\\t/g, ' '), columns - 5 - indent),\n )\n\n if (j === i) {\n // push underline\n const pad = start - (count - lineLength) + (nl - 1)\n const length = Math.max(\n 1,\n end > count ? lineLength - pad : end - start,\n )\n res.push(lineNo() + ' '.repeat(pad) + c.red('^'.repeat(length)))\n }\n else if (j > i) {\n if (end > count) {\n const length = Math.max(1, Math.min(end - count, lineLength))\n res.push(lineNo() + c.red('^'.repeat(length)))\n }\n count += lineLength + 1\n }\n }\n break\n }\n }\n\n if (indent) {\n res = res.map(line => ' '.repeat(indent) + line)\n }\n\n return res.join('\\n')\n}\n\n\nfunction positionToOffset(\n source: string,\n lineNumber: number,\n columnNumber: number,\n): number {\n const lines = source.split(lineSplitRE)\n const nl = /\\r\\n/.test(source) ? 2 : 1\n let start = 0\n\n if (lineNumber > lines.length) {\n return source.length\n }\n\n for (let i = 0; i < lineNumber - 1; i++) {\n start += lines[i]!.length + nl\n }\n\n return start + columnNumber\n}\n\nfunction lineNo(no: number | string = '') {\n return c.gray(`${String(no).padStart(3, ' ')}| `)\n}\n\nfunction truncateString(text: string, maxLength: number): string {\n const plainText = stripVTControlCharacters(text)\n\n if (plainText.length <= maxLength) {\n return text\n }\n\n return `${plainText.slice(0, maxLength - 1)}…`\n}\n","/**\n * Source Map Utilities\n *\n * Maps WASM errors to AssemblyScript source locations using V8 stack traces + source maps.\n *\n * Approach: V8's Error.prepareStackTrace provides WAT (WebAssembly Text) line:column positions,\n * which can be mapped to AS source using the source maps generated by AS compiler.\n */\n\nimport { type RawSourceMap, SourceMapConsumer } from 'source-map';\n\nimport { debug } from '../util/debug.js';\nimport type { WebAssemblyCallSite } from '../types/types.js';\n\nexport function parseSourceMap(sourceMap: string): RawSourceMap {\n // Remove sourceRoot if present to prevent source-map library from prepending it to paths\n // AS compiler sets sourceRoot: \"./output\" which would make paths like \"output/tests/...\"\n // instead of \"tests/...\" - these paths don't exist and won't be found by Vitest\n const sourceMapObj: RawSourceMap = JSON.parse(sourceMap);\n delete sourceMapObj.sourceRoot;\n return sourceMapObj;\n}\n\n/**\n * Extract structured call stack from V8 using Error.prepareStackTrace\n *\n * V8 provides a special API to access structured stack traces with line:column info.\n * This gives us WAT text positions which can be mapped to AS source via source maps.\n *\n * @param capturedError - Error object to extract stack from\n * @returns Array of V8 CallSite objects\n */\nexport function extractCallStack(capturedError: Error): NodeJS.CallSite[] {\n let stackTrace: NodeJS.CallSite[] = [];\n\n const originalPrepareStackTrace = Error.prepareStackTrace;\n Error.prepareStackTrace = (_err: Error, structuredStackTrace: NodeJS.CallSite[]) => {\n stackTrace = structuredStackTrace;\n return ''; // Return empty string to avoid modifying error.stack\n };\n\n // Access error.stack to trigger prepareStackTrace (result unused, just triggers callback)\n capturedError.stack;\n\n // Restore original\n Error.prepareStackTrace = originalPrepareStackTrace;\n\n return stackTrace;\n}\n\n/**\n * Create WebAssembly call site with source mapping\n *\n * Takes a V8 CallSite and maps it to AS source location if possible.\n *\n * @param callSite - V8 CallSite object from Error.prepareStackTrace\n * @param sourceMapJson - Source map consumer initialized with WASM source map\n * @returns Mapped call site or null if not a WASM call site\n */\nexport function createWebAssemblyCallSite(\n callSite: NodeJS.CallSite,\n sourceMapConsumer: SourceMapConsumer,\n loggingPrefix: string,\n allowJS: boolean,\n): WebAssemblyCallSite | null {\n const fileName = callSite.getFileName();\n const watLine = callSite.getLineNumber();\n const watColumn = callSite.getColumnNumber();\n const functionName = callSite.getFunctionName() ?? 'function[unknown]';\n const debugString = `function: \"${functionName}\" | file: ${fileName}:${watLine}:${watColumn}`;\n\n // Only process WASM call sites\n if (!fileName) {\n debug(`${loggingPrefix} - Skipping source-mapping of invalid frame (no file): ${debugString}`);\n return null;\n }\n \n if (!fileName.startsWith('wasm://')) {\n if (allowJS) {\n if (!watLine || !watColumn) {\n debug(`${loggingPrefix} - Failed to pass through invalid JS stack location: ${debugString}`);\n return null;\n }\n\n debug(`${loggingPrefix} - Passing through JS stack location: ${debugString}`);\n return {\n functionName,\n location: {\n filePath: fileName,\n line: watLine,\n column: watColumn\n }\n }; \n } else {\n debug(`${loggingPrefix} - Skipping source-mapping of non-WASM stack location: ${debugString}`);\n return null;\n }\n }\n\n // Try to map WAT location to source location using source map\n if (watLine && watColumn) {\n const original = sourceMapConsumer.originalPositionFor({\n line: watLine,\n column: watColumn\n });\n \n if (!original.source || original.line === null || original.column === null) {\n debug(`${loggingPrefix} - Failed to source-map stack location: ${debugString}`);\n return null;\n }\n\n debug(`${loggingPrefix} - Source-mapped stack location: ${debugString} → ${original.source}:${original.line}:${original.column}`);\n return {\n functionName,\n location: {\n filePath: original.source,\n line: original.line,\n column: original.column\n }\n };\n }\n\n debug(`${loggingPrefix} - Cannot source-map stack-location: ${debugString}`);\n return null;\n}\n","/**\n * Extracts the short name from a WASM function table name identifier.\n */\nexport function getShortFunctionName(fullName: string): string {\n if (!fullName) {\n return '';\n }\n\n // URL decode first (handle potential decoding errors)\n let decoded: string;\n try {\n decoded = decodeURIComponent(fullName);\n \n // handle AS encoding quirk in generics\n // e.g. \"closeTo<bool\\2cbool>\" -> \"closeTo<bool,bool>\"\n decoded = decoded.replace('\\\\2c', ',');\n } catch {\n decoded = fullName;\n }\n\n // Find the last '/' that's not inside angle brackets or parens\n let angleBracketDepth = 0;\n let parenDepth = 0;\n let lastSlashOutsideBrackets = -1;\n\n for (let i = 0; i < decoded.length; i++) {\n const char = decoded[i];\n if (char === '<') {\n angleBracketDepth++;\n } else if (char === '>' && decoded[i - 1] !== '=') {\n angleBracketDepth--;\n } else if (char === '(') {\n parenDepth++;\n } else if (char === ')') {\n parenDepth--;\n } else if (char === '/' && angleBracketDepth === 0 && parenDepth === 0) {\n lastSlashOutsideBrackets = i;\n }\n }\n\n const functionPart = lastSlashOutsideBrackets >= 0\n ? decoded.substring(lastSlashOutsideBrackets + 1)\n : decoded;\n\n // Handle anonymous function case: \"file.as.test~anonymous|1\" → \"anonymous|1\"\n const anonymousMatch = functionPart.match(/^.+~(anonymous\\|\\d+)$/);\n if (anonymousMatch) {\n return anonymousMatch[1]!;\n }\n\n // Process any generics/paths in the function signature\n return shortenTypePart(functionPart);\n}\n\n/**\n * Finds the index of the closing '>' that matches the opening '<' at openIndex.\n */\nfunction findMatchingCloseBracket(str: string, openIndex: number): number {\n let angleBracketDepth = 1;\n\n for (let i = openIndex + 1; i < str.length; i++) {\n const char = str[i];\n if (char === '<') {\n angleBracketDepth++;\n } else if (char === '>' && str[i - 1] !== '=') {\n angleBracketDepth--;\n if (angleBracketDepth === 0) return i;\n }\n }\n return str.length - 1;\n}\n\n/**\n * Finds the index of the closing ')' that matches the opening '(' at openIndex.\n */\nfunction findMatchingCloseParen(str: string, openIndex: number): number {\n let parenDepth = 1;\n let angleBracketDepth = 0;\n\n for (let i = openIndex + 1; i < str.length; i++) {\n const char = str[i];\n if (char === '(') {\n parenDepth++;\n } else if (char === ')') {\n parenDepth--;\n if (parenDepth === 0) return i;\n } else if (char === '<') {\n angleBracketDepth++;\n } else if (char === '>' && str[i - 1] !== '=') {\n angleBracketDepth--;\n }\n }\n return str.length - 1;\n}\n\n/**\n * Splits a string by commas at the top level (not inside <> or ()).\n */\nfunction splitByTopLevelComma(str: string): string[] {\n const parts: string[] = [];\n let current = '';\n let angleBracketDepth = 0;\n let parenDepth = 0;\n\n for (let i = 0; i < str.length; i++) {\n const char = str[i];\n if (char === '<') {\n angleBracketDepth++;\n } else if (char === '>' && str[i - 1] !== '=') {\n angleBracketDepth--;\n } else if (char === '(') {\n parenDepth++;\n } else if (char === ')') {\n parenDepth--;\n } else if (char === ',' && angleBracketDepth === 0 && parenDepth === 0) {\n parts.push(current);\n current = '';\n continue;\n }\n current += char;\n }\n parts.push(current);\n return parts;\n}\n\n/**\n * Processes the content inside generic brackets or function args.\n */\nfunction shortenGenericContent(content: string): string {\n const parts = splitByTopLevelComma(content);\n return parts.map(part => shortenTypePart(part.trim())).join(',');\n}\n\n/**\n * Shortens a function type like (args)=>returnType.\n */\nfunction shortenFunctionType(part: string): string {\n const closeParenIndex = findMatchingCloseParen(part, 0);\n const argsContent = part.substring(1, closeParenIndex);\n const afterParen = part.substring(closeParenIndex + 1);\n\n const shortenedArgs = argsContent ? shortenGenericContent(argsContent) : '';\n\n let returnPart = afterParen;\n if (afterParen.startsWith('=>') && afterParen.length > 2) {\n const returnType = afterParen.substring(2);\n returnPart = '=>' + shortenTypePart(returnType);\n }\n\n return '(' + shortenedArgs + ')' + returnPart;\n}\n\n/**\n * Shortens a type/function part, processing paths and generics recursively.\n */\nfunction shortenTypePart(part: string): string {\n // Function types\n if (part.startsWith('(')) {\n return shortenFunctionType(part);\n }\n\n const openBracket = part.indexOf('<');\n\n if (openBracket === -1) {\n // No generics - extract last path segment if present\n if (!part.includes('/')) {\n return part;\n }\n return part.substring(part.lastIndexOf('/') + 1);\n }\n\n // Has generics - extract name and process content\n const namePart = part.substring(0, openBracket);\n const closeBracket = findMatchingCloseBracket(part, openBracket);\n const genericContent = part.substring(openBracket + 1, closeBracket);\n\n const name = namePart.includes('/')\n ? namePart.substring(namePart.lastIndexOf('/') + 1)\n : namePart;\n\n const shortenedContent = shortenGenericContent(genericContent);\n\n return name + '<' + shortenedContent + '>';\n}\n","/**\n * Error Enhancement and Source Mapping\n *\n * This module handles mapping WASM errors to AssemblyScript source locations\n * using source maps. It enhances error messages and stack traces with accurate\n * file:line:column information for better developer experience.\n */\n\nimport { relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { type ParsedStack } from '@vitest/utils';\nimport { diff, type SerializedDiffOptions } from '@vitest/utils/diff';\nimport type { Test, Suite } from '@vitest/runner/types';\nimport { type RawSourceMap, SourceMapConsumer } from 'source-map';\n\nimport type { AssemblyScriptTestError, WebAssemblyCallSite } from '../types/types.js';\nimport { POOL_INTERNAL_PATHS, TEST_ERROR_NAMES } from '../types/constants.js';\nimport { debug } from '../util/debug.js';\nimport { createWebAssemblyCallSite } from './source-maps.js';\nimport { getShortFunctionName } from './wasm-names.js';\nimport {\n getSourceCodeFrameString,\n toPlaintextStackFrameString,\n toVitestLikeStackFrameString,\n} from '../util/test-error-formatting.js';\nimport { toForwardSlash } from '../util/path-utils.js';\n\nconst POOL_INTERNAL_PATHS_SET = new Set(POOL_INTERNAL_PATHS);\n\nfunction passthroughCallSite(callSite: NodeJS.CallSite): ParsedStack {\n const fileName = callSite.getFileName();\n const watLine = callSite.getLineNumber();\n const watColumn = callSite.getColumnNumber();\n const functionName = callSite.getFunctionName() || 'wasm-function[unknown]';\n\n return {\n method: functionName,\n file: fileName ?? 'unknown-file',\n line: watLine || -1,\n column: watColumn || -1\n };\n}\n\nasync function sourceMapRawCallStack(\n rawCallStack: NodeJS.CallSite[],\n sourceMap: RawSourceMap | undefined,\n loggingPrefix: string,\n allowJS: boolean,\n): Promise<WebAssemblyCallSite[]> {\n const mappedStack: WebAssemblyCallSite[] = [];\n\n if (!rawCallStack || rawCallStack.length === 0) {\n return mappedStack;\n }\n\n if (sourceMap) {\n const sourceMapConsumer = await new SourceMapConsumer(sourceMap);\n \n // map stack call sites from raw WASM locations to source locations \n rawCallStack.forEach(callSite => {\n const mappedCallSite = createWebAssemblyCallSite(callSite, sourceMapConsumer, loggingPrefix, allowJS);\n if (mappedCallSite) {\n mappedStack.push(mappedCallSite);\n }\n });\n \n sourceMapConsumer.destroy();\n }\n\n return mappedStack;\n}\n\n// Parse source-mapped stack array to Vitest TestError reporting format\nfunction parseMappedStack(mappedStack: WebAssemblyCallSite[]): ParsedStack[] {\n return mappedStack\n // filter out frames for internal assertion framework calls\n // (e.g. assert(), assertEqual(), etc) by known location, for more concise/meaningful error stack report\n .filter(frame => !(POOL_INTERNAL_PATHS_SET.has(frame.location.filePath)))\n \n // map to format that vitest reporter can display\n .map(frame => ({\n method: getShortFunctionName(frame.functionName),\n file: frame.location.filePath,\n line: frame.location.line,\n column: frame.location.filePath.startsWith('file')\n ? frame.location.column // unmapped file needs no change \n : frame.location.column + 1, // Convert from raw source-map's 0-indexed to 1-indexed for display\n }));\n}\n\nexport async function processWASMErrorStack(\n rawCallStack: NodeJS.CallSite[],\n sourceMap: RawSourceMap | undefined,\n loggingPrefix: string,\n allowJS: bool,\n): Promise<ParsedStack[]> {\n // map stack call sites from WASM locations to source code locations \n const sourceMappedStack = await sourceMapRawCallStack(rawCallStack, sourceMap, loggingPrefix, allowJS);\n debug(`${loggingPrefix} - Mapped ${rawCallStack.length} call sites to ${sourceMappedStack.length} source locations`);\n\n const parsedStack = parseMappedStack(sourceMappedStack);\n\n if (parsedStack.length === 0) {\n rawCallStack.forEach(callSite => {\n parsedStack.push(passthroughCallSite(callSite));\n });\n }\n\n return parsedStack;\n}\n\n/**\n * Enhance reportable test error on the provided test result with source mapped stack locations\n * and a formatted diff based on the error type\n */\nexport async function enhanceTestError(\n testError: AssemblyScriptTestError,\n task: Test | Suite,\n sourceMap: RawSourceMap | undefined,\n logPrefix: string,\n allowJS: boolean,\n projectRoot: string,\n applyStackToTestErrorCause: boolean,\n rawCallStack?: NodeJS.CallSite[],\n diffOptions?: SerializedDiffOptions\n): Promise<void> {\n let expectedVsActualDiffString: string | undefined;\n const isAssertionFailure = testError.name === TEST_ERROR_NAMES.AssertionError;\n const valuesProvided = testError.expected !== undefined && testError.actual !== undefined;\n\n if (isAssertionFailure && valuesProvided) {\n // remain undefined if there were no expected/actual values provided with the assertion failure\n expectedVsActualDiffString = diff(testError.expected, testError.actual, diffOptions) ?? '';\n }\n\n // if there's no stack to map, set the expected vs actual diff (if any) and return\n if (!rawCallStack || rawCallStack.length === 0) {\n testError.diff = expectedVsActualDiffString;\n\n // stack is used by vitest for error deduplication, so make sure it is set\n testError.stack = `${task.name} - ${testError.message}`;\n\n return;\n }\n\n const testErrorToUpdate: AssemblyScriptTestError = applyStackToTestErrorCause && testError.cause\n ? testError.cause as AssemblyScriptTestError : testError;\n\n // map stack call sites from WASM locations to source locations\n const parsedStack = await processWASMErrorStack(rawCallStack, sourceMap, logPrefix, allowJS);\n \n // build additional strings to add to test error's `diff` field based on parsed stack contents\n let primaryStackFrameString: string | undefined;\n let highlightedSourceCodeFrameString: string | undefined;\n \n if (parsedStack.length > 0) {\n // normalize all paths\n parsedStack.forEach((frame) => {\n\t\t\tif (frame.file.startsWith(\"file://\")) {\n\t\t\t\tframe.file = toForwardSlash(relative(projectRoot, fileURLToPath(frame.file)));\n testErrorToUpdate.stack += toPlaintextStackFrameString(frame) + '\\n';\n\t\t\t}\n\t\t});\n\n const primaryStackFrame = parsedStack[0]!;\n \n // Test error is set to rest of the stack without the first frame.\n // Vitest will report the ParsedStack[] on TestError.stacks below the diff we set.\n testErrorToUpdate.stacks = parsedStack.slice(1);\n\n // stack is used by vitest for error deduplication, so make sure it is set also\n testErrorToUpdate.stack = parsedStack.map(toPlaintextStackFrameString).join('\\n');\n\n try {\n highlightedSourceCodeFrameString = await getSourceCodeFrameString(sourceMap, primaryStackFrame);\n } catch (err) {\n debug(`${logPrefix} - Error reading source for primary stack frame file \"${primaryStackFrame.file}\":`, err);\n }\n\n primaryStackFrameString = toVitestLikeStackFrameString(primaryStackFrame);\n\n debug(`${logPrefix} - Enhanced ${testError.name} error with parsed source stack`);\n } else {\n testErrorToUpdate.stack = `${task.name} - ${testError.message}`;\n }\n\n // Use the diff field as our way to show all output (other than result.error.stacks)\n testErrorToUpdate.diff = [\n expectedVsActualDiffString,\n expectedVsActualDiffString ? '\\n\\n' : '',\n primaryStackFrameString ?? '',\n highlightedSourceCodeFrameString ? '\\n' : '',\n highlightedSourceCodeFrameString ?? ''\n ].join('');\n\n debug(`[${logPrefix} - Enhanced error with diffs`);\n\n return;\n}\n","import type { Suite, Test } from '@vitest/runner/types';\nimport type { SerializedDiffOptions } from '@vitest/utils/diff';\nimport type { RawSourceMap } from 'source-map';\n\nimport type {\n AssemblyScriptPoolError,\n AssemblyScriptTestError,\n PoolErrorName,\n} from '../types/types.js';\nimport {\n AS_POOL_ERROR_FLAG,\n POOL_ERROR_NAMES,\n TEST_ERROR_NAMES\n} from '../types/constants.js';\nimport { getYellowString } from './test-error-formatting.js';\nimport { extractCallStack } from '../wasm-executor/source-maps.js';\nimport { enhanceTestError } from '../wasm-executor/wasm-errors.js';\n\nexport function abortWASMExecutionOnSuccess(): AssemblyScriptPoolError {\n return {\n [AS_POOL_ERROR_FLAG]: true,\n name: POOL_ERROR_NAMES.WASMExecutionAbortSuccess,\n testError: {} as AssemblyScriptTestError,\n originalErrorMayContainJS: false,\n originalErrorRawStack: [],\n applyStackToTestErrorCause: false\n };\n}\n\nexport function abortWASMExecution(\n testError: AssemblyScriptTestError,\n errorForStack?: Error,\n): AssemblyScriptPoolError {\n return {\n [AS_POOL_ERROR_FLAG]: true,\n name: POOL_ERROR_NAMES.WASMExecutionAbortError,\n testError,\n originalErrorMayContainJS: false,\n originalErrorRawStack: errorForStack ? extractCallStack(errorForStack) : [],\n applyStackToTestErrorCause: false\n };\n}\n\nexport function wrapPoolError(\n name: PoolErrorName,\n originalError: any,\n originalErrorMayContainJS: boolean = false,\n): AssemblyScriptPoolError {\n let originalErrorName: string | undefined;\n let originalErrorMessage: string;\n let originalErrorRawStack: NodeJS.CallSite[];\n\n if (originalError && originalError instanceof Error) {\n originalErrorName = originalError.name;\n originalErrorMessage = originalError.message;\n originalErrorRawStack = extractCallStack(originalError);\n } else if (originalError) {\n originalErrorMessage = String(originalError);\n originalErrorRawStack = [];\n } else {\n originalErrorMessage = 'Unknown Error';\n originalErrorRawStack = [];\n }\n\n const namePrefix = originalErrorName ? `${originalErrorName}: ` : '';\n const testError: AssemblyScriptTestError = {\n name,\n message: `${namePrefix}${originalErrorMessage}`\n };\n\n return {\n [AS_POOL_ERROR_FLAG]: true,\n name,\n message: 'Wrapped error',\n originalErrorRawStack,\n originalErrorMayContainJS,\n testError,\n applyStackToTestErrorCause: false\n };\n}\n\nexport function createPoolError(\n name: PoolErrorName,\n message: string,\n originalError?: any,\n originalErrorMayContainJS: boolean = true,\n): AssemblyScriptPoolError {\n if (originalError && originalError[AS_POOL_ERROR_FLAG]) {\n return originalError;\n }\n\n let originalErrorRawStack: NodeJS.CallSite[] = [];\n let applyStackToTestErrorCause: boolean = false;\n const testError: AssemblyScriptTestError = {\n name,\n message\n };\n\n if (originalError && originalError instanceof Error) {\n testError.cause = {\n name: originalError.name,\n message: `${originalError.message}`\n };\n originalErrorRawStack = extractCallStack(originalError);\n applyStackToTestErrorCause = true;\n } else if (originalError) {\n testError.cause = {\n name: POOL_ERROR_NAMES.PoolError,\n message: String(originalError)\n }\n }\n\n return {\n [AS_POOL_ERROR_FLAG]: true,\n name,\n message,\n originalErrorRawStack,\n originalErrorMayContainJS,\n testError,\n applyStackToTestErrorCause\n };\n}\n\nexport function createTestTimeoutError(\n test: Test\n): AssemblyScriptTestError {\n const message = `Test timed out after ${test.timeout}ms`;\n const err: AssemblyScriptTestError = {\n name: POOL_ERROR_NAMES.WASMExecutionTimeoutError,\n message,\n stack: `${test.id}_${message}`,\n diff: getYellowString(` Test Timeout Exceeded (${test.timeout}ms)`)\n };\n return err;\n}\n\nexport function createTestExpectedToFailError(test: Test): AssemblyScriptTestError {\n const message = `Test is expected to fail, but all assertion(s) passed`;\n const err: AssemblyScriptTestError = {\n name: TEST_ERROR_NAMES.AssertionError,\n message,\n stack: `${test.id}_${message}`,\n diff: getYellowString(` Expected to fail, but all assertion(s) passed`)\n };\n return err;\n}\n\nfunction isAbortErrorString(item: any): boolean {\n return item === POOL_ERROR_NAMES.PoolRunAbortedError || item === 'AbortError';\n}\n\nexport function isAbortError(error: any): boolean {\n return isAbortErrorString(error) \n || isAbortErrorString(error?.name)\n || error?.message === 'Terminating worker thread';\n}\n\nexport function getExpectedMessageOrAny(expectedMsgStr?: string): string {\n return expectedMsgStr ? `\"${expectedMsgStr}\"` : '<any>';\n}\n\nexport async function buildEnhancedFileError(\n error: any,\n task: Test | Suite,\n sourceMap: RawSourceMap | undefined,\n logPrefix: string,\n projectRoot: string,\n unexpectedContext: string,\n diffOptions?: SerializedDiffOptions,\n): Promise<AssemblyScriptTestError> {\n let testError: AssemblyScriptTestError;\n let stack: NodeJS.CallSite[];\n let applyStackToTestErrorCause: boolean;\n let allowStackJS: boolean;\n\n if (error && error[AS_POOL_ERROR_FLAG]) {\n const wrapper = error as AssemblyScriptPoolError;\n testError = wrapper.testError;\n stack = wrapper.originalErrorRawStack;\n applyStackToTestErrorCause = wrapper.applyStackToTestErrorCause;\n allowStackJS = wrapper.originalErrorMayContainJS;\n } else if (error instanceof Error) {\n testError = {\n name: POOL_ERROR_NAMES.PoolError,\n message: `${error.name}: ${error.message}`\n };\n stack = extractCallStack(error);\n allowStackJS = true;\n applyStackToTestErrorCause = false;\n } else {\n testError = {\n name: POOL_ERROR_NAMES.PoolError,\n message: `Unexpected error (${unexpectedContext}): ${String(error)}`\n };\n stack = extractCallStack(new Error());\n allowStackJS = true;\n applyStackToTestErrorCause = false;\n }\n\n await enhanceTestError(\n testError,\n task,\n sourceMap,\n logP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;AAIH,SAAgB,8BAA8B,MAAqC;CACjF,MAAM,UAAU;AAOhB,QANqC;EACnC,MAAM,iBAAiB;EACvB;EACA,OAAO,GAAG,KAAK,GAAG,GAAG;EACrB,MAAM,gBAAgB,iDAAiD;EACxE;;AAIH,SAAS,mBAAmB,MAAoB;AAC9C,QAAO,SAAS,iBAAiB,uBAAuB,SAAS;;AAGnE,SAAgB,aAAa,OAAqB;AAChD,QAAO,mBAAmB,MAAM,IAC3B,mBAAmB,OAAO,KAAK,IAC/B,OAAO,YAAY;;AAG1B,SAAgB,wBAAwB,gBAAiC;AACvE,QAAO,iBAAiB,IAAI,eAAe,KAAK;;AAGlD,eAAsB,uBACpB,OACA,MACA,WACA,WACA,aACA,mBACA,aACkC;CAClC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AAEJ,KAAI,SAAS,4BAA2B;EACtC,MAAM,UAAU;AAChB,cAAY,QAAQ;AACpB,UAAQ,QAAQ;AAChB,+BAA6B,QAAQ;AACrC,iBAAe,QAAQ;YACd,iBAAiB,OAAO;AACjC,cAAY;GACV,MAAM,iBAAiB;GACvB,SAAS,GAAG,MAAM,KAAK,IAAI,MAAM;GAClC;AACD,UAAQ,iBAAiB,MAAM;AAC/B,iBAAe;AACf,+BAA6B;QACxB;AACL,cAAY;GACV,MAAM,iBAAiB;GACvB,SAAS,qBAAqB,kBAAkB,KAAK,OAAO,MAAM;GACnE;AACD,UAAQ,iCAAiB,IAAI,OAAO,CAAC;AACrC,iBAAe;AACf,+BAA6B;;AAG/B,OAAM,iBACJ,WACA,MACA,WACA,WACA,cACA,aACA,4BACA,OACA,YACD;AAED,QAAO"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AssemblyScriptPoolOptions } from "./types-
|
|
1
|
+
import { AssemblyScriptPoolOptions } from "./types-CoroKYxB.mjs";
|
|
2
2
|
import { PoolRunnerInitializer } from "vitest/node";
|
|
3
3
|
|
|
4
4
|
//#region src/pool/pool-runner-init.d.ts
|
|
5
5
|
declare function createAssemblyScriptPool(userPoolOptions?: AssemblyScriptPoolOptions): PoolRunnerInitializer;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { createAssemblyScriptPool };
|
|
8
|
-
//# sourceMappingURL=pool-runner-init-
|
|
8
|
+
//# sourceMappingURL=pool-runner-init-CCvnKt5o.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,10 +1,7 @@
|
|
|
1
|
-
import { POOL_ERROR_NAMES } from "./constants-
|
|
2
|
-
import { getCompatConfig, resolvePoolOptions } from "./
|
|
3
|
-
import { createPoolError,
|
|
4
|
-
import {
|
|
5
|
-
import { createInitialFileTask } from "./vitest-file-tasks-D8sOClGX.mjs";
|
|
6
|
-
import { failTestWithTimeoutError, flagTestTerminated } from "./vitest-tasks-BZ24sghI.mjs";
|
|
7
|
-
import { createWorkerRPCChannel } from "./worker-rpc-channel-CZZIxtv5.mjs";
|
|
1
|
+
import { POOL_ERROR_NAMES } from "./constants-Bq5KNxXJ.mjs";
|
|
2
|
+
import { createInitialFileTask, failTestWithTimeoutError, flagTestTerminated, getCompatConfig, resolvePoolOptions } from "./vitest-file-tasks-Coc4btUw.mjs";
|
|
3
|
+
import { createPoolError, debug, isAbortError, setGlobalDebugMode, toForwardSlash } from "./pool-errors-GWfwrsD7.mjs";
|
|
4
|
+
import { createWorkerRPCChannel } from "./worker-rpc-channel-CvCrc8aa.mjs";
|
|
8
5
|
import { availableParallelism } from "node:os";
|
|
9
6
|
import { resolve } from "node:path";
|
|
10
7
|
import { access } from "node:fs/promises";
|
|
@@ -41,20 +38,14 @@ var AssemblyScriptPoolWorker = class {
|
|
|
41
38
|
this.asCoverageOptions = resolvedCoverageOptions;
|
|
42
39
|
this.listenerRegistry = /* @__PURE__ */ new Map();
|
|
43
40
|
setImmediate(async () => {
|
|
44
|
-
const
|
|
45
|
-
const results = await Promise.allSettled([
|
|
46
|
-
access(COMPILE_WORKER_PATH),
|
|
47
|
-
access(TEST_WORKER_PATH),
|
|
48
|
-
this.asPoolOptions.wasmImportsFactory ? access(userImportsFactoryPath) : Promise.resolve()
|
|
49
|
-
]);
|
|
41
|
+
const results = await Promise.allSettled([access(COMPILE_WORKER_PATH), access(TEST_WORKER_PATH)]);
|
|
50
42
|
const failedThreadAccess = [];
|
|
51
43
|
if (results[0].status === "rejected") failedThreadAccess.push(COMPILE_WORKER_PATH);
|
|
52
44
|
if (results[1].status === "rejected") failedThreadAccess.push(TEST_WORKER_PATH);
|
|
53
45
|
if (failedThreadAccess.length) throw new Error(`Cannot access worker thread file(s) at path(s): ${failedThreadAccess}`);
|
|
54
|
-
if (results[2].status === "rejected") throw new Error(`Cannot access user WasmImportsFactory at path: "${userImportsFactoryPath}". Ensure that your module path is relative to the vitest project root (location of shallowest vitest config), and that it has a default export matching () => WebAssembly.Imports`);
|
|
55
46
|
});
|
|
56
47
|
setGlobalDebugMode(this.asPoolOptions.debug);
|
|
57
|
-
debug(`[${this.logModule}] Created AssemblyScriptPoolWorker in ${(performance.now() - start).toFixed(2)} ms | method: "${this.poolOptions.method}" | project: "${this.poolOptions.project.name}"`);
|
|
48
|
+
debug(`[${this.logModule}] Created AssemblyScriptPoolWorker in ${(performance.now() - start).toFixed(2)} ms | method: "${this.poolOptions.method}" | project: "${this.poolOptions.project.name}" | asPoolOptions: ${JSON.stringify(this.asPoolOptions)}`);
|
|
58
49
|
}
|
|
59
50
|
get isCollectTestsMode() {
|
|
60
51
|
return this.poolOptions.method === "collect";
|
|
@@ -108,7 +99,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
108
99
|
debug(`[${this.logModuleWithId}] send: responded "testfileFinished" to vitest | files: "${this.threadSpecs.map((s) => s.file.filepath).join(",")}"`);
|
|
109
100
|
this.threadSpecs = [];
|
|
110
101
|
} catch (error) {
|
|
111
|
-
if (!isAbortError(error)) throw
|
|
102
|
+
if (!isAbortError(error)) throw error;
|
|
112
103
|
} finally {
|
|
113
104
|
this.threadControlPort?.close();
|
|
114
105
|
this.threadAbortController = void 0;
|
|
@@ -148,11 +139,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
148
139
|
idleTimeout: POOL_THREAD_IDLE_TIMEOUT_MS,
|
|
149
140
|
env: this.poolOptions.env,
|
|
150
141
|
execArgv: this.poolOptions.execArgv,
|
|
151
|
-
workerData: {
|
|
152
|
-
asPoolOptions: this.asPoolOptions,
|
|
153
|
-
asCoverageOptions: this.asCoverageOptions,
|
|
154
|
-
projectRoot: this.poolOptions.project.config.root
|
|
155
|
-
}
|
|
142
|
+
workerData: { asCoverageOptions: this.asCoverageOptions }
|
|
156
143
|
});
|
|
157
144
|
const actualRunThreadCount = Math.max(Math.ceil(workers * IDLE_RUN_THREADS_FACTOR), 1);
|
|
158
145
|
debug(`[${this.logModuleWithId}] Creating global run thread pool | ${actualRunThreadCount} threads`);
|
|
@@ -164,11 +151,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
164
151
|
idleTimeout: POOL_THREAD_IDLE_TIMEOUT_MS,
|
|
165
152
|
env: this.poolOptions.env,
|
|
166
153
|
execArgv: this.poolOptions.execArgv,
|
|
167
|
-
workerData: {
|
|
168
|
-
asPoolOptions: this.asPoolOptions,
|
|
169
|
-
asCoverageOptions: this.asCoverageOptions,
|
|
170
|
-
projectRoot: this.poolOptions.project.config.root
|
|
171
|
-
}
|
|
154
|
+
workerData: { asCoverageOptions: this.asCoverageOptions }
|
|
172
155
|
});
|
|
173
156
|
debug(`[${this.logModuleWithId}] Created global thread pools in ${(performance.now() - start).toFixed(2)} ms`);
|
|
174
157
|
GLOBAL_POOL_ABORT_CONTROLLER = new AbortController();
|
|
@@ -224,6 +207,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
224
207
|
port: workerPort,
|
|
225
208
|
file: spec.file,
|
|
226
209
|
config: this.config,
|
|
210
|
+
asPoolOptions: this.asPoolOptions,
|
|
227
211
|
isCollectTestsMode: this.isCollectTestsMode
|
|
228
212
|
}, {
|
|
229
213
|
name: "runCompileAndDiscoverSpec",
|
|
@@ -251,6 +235,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
251
235
|
file: timedOutTest?.file ?? spec.file,
|
|
252
236
|
compilation: spec.compilation,
|
|
253
237
|
config: this.config,
|
|
238
|
+
asPoolOptions: this.asPoolOptions,
|
|
254
239
|
isCollectTestsMode: this.isCollectTestsMode,
|
|
255
240
|
timedOutTest
|
|
256
241
|
}, {
|
|
@@ -341,7 +326,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
341
326
|
if (!this.isWorkerRunning) return;
|
|
342
327
|
if (!this.threadSpecs.length || !this.currentTestRun || !this.currentTestRun.test) {
|
|
343
328
|
const missingStr = +(this.threadSpecs.length ? "" : "threadSpecs") + (this.currentTestRun ? "" : " currentTestRecord") + (this.currentTestRun?.test ? "" : " currentTestRecord.test");
|
|
344
|
-
throw createPoolError(`Cannot timeout/resume worker thread for workerId ${this.currentWorkerId} - missing data: ${missingStr}
|
|
329
|
+
throw createPoolError(POOL_ERROR_NAMES.PoolError, `Cannot timeout/resume worker thread for workerId ${this.currentWorkerId} - missing data: ${missingStr}`);
|
|
345
330
|
}
|
|
346
331
|
const duration = Date.now() - this.currentTestRun.executionStart;
|
|
347
332
|
failTestWithTimeoutError(this.currentTestRun.test, this.currentTestRun.executionStart, duration);
|
|
@@ -352,7 +337,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
352
337
|
this.threadAbortController?.abort();
|
|
353
338
|
await this.threadRunPromise;
|
|
354
339
|
} catch (error) {
|
|
355
|
-
if (!isAbortError(error)) throw
|
|
340
|
+
if (!isAbortError(error)) throw error;
|
|
356
341
|
} finally {
|
|
357
342
|
this.threadControlPort?.close();
|
|
358
343
|
this.threadAbortController = void 0;
|
|
@@ -369,7 +354,7 @@ var AssemblyScriptPoolWorker = class {
|
|
|
369
354
|
debug(`[${this.logModuleWithId}] handleTimeout: file run completed - responded "testfileFinished" to vitest | files: "${this.threadSpecs.map((s) => s.file.filepath).join(",")}"`);
|
|
370
355
|
this.threadSpecs = [];
|
|
371
356
|
} catch (error) {
|
|
372
|
-
if (!isAbortError(error)) throw
|
|
357
|
+
if (!isAbortError(error)) throw error;
|
|
373
358
|
else debug(`[${this.logModuleWithId}] send: caught and ignored timeout awaiting timeout re-run | files: "${this.threadSpecs.map((s) => s.file.filepath).join(",")}"`);
|
|
374
359
|
} finally {
|
|
375
360
|
this.threadControlPort?.close();
|
|
@@ -398,4 +383,4 @@ function createAssemblyScriptPool(userPoolOptions) {
|
|
|
398
383
|
|
|
399
384
|
//#endregion
|
|
400
385
|
export { createAssemblyScriptPool };
|
|
401
|
-
//# sourceMappingURL=pool-runner-init-
|
|
386
|
+
//# sourceMappingURL=pool-runner-init-Cta6aVJ6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool-runner-init-Cta6aVJ6.mjs","names":[],"sources":["../src/pool/pool-worker.ts","../src/pool/pool-runner-init.ts"],"sourcesContent":["import { availableParallelism } from 'node:os';\nimport { resolve } from 'node:path';\nimport { access } from 'node:fs/promises';\nimport type { MessagePort } from 'node:worker_threads';\nimport type { Test } from '@vitest/runner/types';\nimport type { PoolWorker, PoolOptions, WorkerRequest, PoolTask, WorkerResponse } from 'vitest/node';\nimport Tinypool from 'tinypool';\n\nimport type {\n AssemblyScriptPoolWorkerMessage,\n ResolvedAssemblyScriptPoolOptions,\n ResolvedHybridProviderOptions,\n RunCompileAndDiscoverTask,\n RunTestsTask,\n SerializedConfigCompat,\n TestExecutionEnd,\n TestExecutionStart,\n TestRunRecord,\n ThreadSpec,\n WorkerThreadInitData,\n} from '../types/types.js';\nimport { toForwardSlash } from '../util/path-utils.js';\nimport { createInitialFileTask } from '../util/vitest-file-tasks.js';\nimport { failTestWithTimeoutError, flagTestTerminated } from '../util/vitest-tasks.js';\nimport {\n AS_POOL_WORKER_MSG_FLAG,\n ASSEMBLYSCRIPT_POOL_NAME,\n POOL_ERROR_NAMES,\n VITEST_WORKER_RESPONSE_MSG_FLAG\n} from '../types/constants.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createPoolError, isAbortError } from '../util/pool-errors.js';\nimport { createWorkerRPCChannel } from './worker-rpc-channel.js';\nimport { getCompatConfig } from '../util/resolve-config.js';\n\ntype GlobalThreadPools = { compilePool: Tinypool, runPool: Tinypool };\ntype EventCallback = (arg: any) => void;\n\nconst THREAD_RESOLVE_TIMEOUT_MS = 2000 as const;\nconst POOL_THREAD_IDLE_TIMEOUT_MS = 3_600_000 as const;\nconst IDLE_RUN_THREADS_FACTOR = 1 as const;\n// @ts-ignore - see note in getGlobalThreadPools\nconst IDLE_COMPILE_THREADS_FACTOR = 0.25 as const;\n\n// path assumes that we're running from dist/\nconst COMPILE_WORKER_PATH = resolve(import.meta.dirname, 'pool-thread/compile-worker-thread.mjs');\nconst TEST_WORKER_PATH = resolve(import.meta.dirname, 'pool-thread/test-worker-thread.mjs');\n\nvar GLOBAL_POOLS_PROMISE: Promise<GlobalThreadPools> | undefined;\nvar GLOBAL_POOL_ABORT_CONTROLLER: AbortController | undefined;\nvar GLOBAL_RUNNING_POOLWORKER_COUNT: number = 0;\n\nexport class AssemblyScriptPoolWorker implements PoolWorker {\n readonly logModule = 'PoolWorker' as const;\n readonly name: typeof ASSEMBLYSCRIPT_POOL_NAME = ASSEMBLYSCRIPT_POOL_NAME;\n readonly poolOptions: PoolOptions;\n readonly asPoolOptions: ResolvedAssemblyScriptPoolOptions;\n readonly asCoverageOptions: ResolvedHybridProviderOptions;\n\n // for the currently running thread preforming a test run (if any)\n private threadAbortController: AbortController | undefined;\n private threadControlPort: MessagePort | undefined;\n private threadRunPromise: Promise<void> | undefined;\n\n private threadSpecs: ThreadSpec[] = [];\n \n // cached data for possible timeout resume\n private currentTestRun: TestRunRecord | undefined;\n \n // for this particular PoolWorker instance (1 per `maxWorkers`)\n private currentWorkerId: number | undefined;\n private isWorkerRunning: boolean = false;\n private config: SerializedConfigCompat | undefined; // provided with \"start\" message\n\n // registry holding vitest callbacks so we can communicate on behalf of the worker thread\n private listenerRegistry: Map<string, Set<EventCallback>>;\n\n constructor(\n options: PoolOptions,\n resolvedUserPoolOptions: ResolvedAssemblyScriptPoolOptions,\n resolvedCoverageOptions: ResolvedHybridProviderOptions,\n ) {\n const start = performance.now();\n\n this.poolOptions = options;\n this.asPoolOptions = resolvedUserPoolOptions;\n this.asCoverageOptions = resolvedCoverageOptions;\n this.listenerRegistry = new Map<string, Set<EventCallback>>();\n\n setImmediate(async () => {\n const results = await Promise.allSettled([\n access(COMPILE_WORKER_PATH),\n access(TEST_WORKER_PATH)\n ]);\n\n const failedThreadAccess: string[] = [];\n if (results[0].status === 'rejected') failedThreadAccess.push(COMPILE_WORKER_PATH);\n if (results[1].status === 'rejected') failedThreadAccess.push(TEST_WORKER_PATH);\n\n if (failedThreadAccess.length) {\n throw new Error(`Cannot access worker thread file(s) at path(s): ${failedThreadAccess}`);\n }\n });\n \n setGlobalDebugMode(this.asPoolOptions.debug);\n\n debug(`[${this.logModule}] Created AssemblyScriptPoolWorker in ${(performance.now() - start).toFixed(2)} ms`\n + ` | method: \"${this.poolOptions.method}\" | project: \"${this.poolOptions.project.name}\"`\n + ` | asPoolOptions: ${JSON.stringify(this.asPoolOptions)}`\n );\n }\n\n private get isCollectTestsMode(): boolean {\n return this.poolOptions.method === 'collect';\n }\n\n async start(): Promise<void> {\n // do all work in send() message intercept handler so we have access to the config\n }\n\n async stop(): Promise<void> {\n debug(`[${this.logModuleWithId}] stop | running PoolWorker count: ${GLOBAL_RUNNING_POOLWORKER_COUNT}`);\n\n this.listenerRegistry.clear();\n GLOBAL_RUNNING_POOLWORKER_COUNT--;\n this.isWorkerRunning = false;\n\n debug(`[${this.logModuleWithId}] AssemblyScriptPoolWorker STOPPED | running PoolWorker count: ${GLOBAL_RUNNING_POOLWORKER_COUNT}`);\n this.currentWorkerId = undefined;\n }\n\n send(message: WorkerRequest): void {\n switch(message.type) {\n \n // this happens AFTER start() is called (start() is for PoolWorker, \"start\" is for thread)\n case 'start':\n this.currentWorkerId = message.workerId;\n this.config = getCompatConfig(message.context.config);\n debug(`[${this.logModuleWithId}] send: vitest sent \"start\" message | Captured workerId and config`);\n\n setImmediate(async () => {\n const start = performance.now();\n const { compilePool, runPool } = await this.getGlobalThreadPools(this.config?.maxWorkers);\n \n debug(`[${this.logModuleWithId}] start: fetched global thread pools in ${(performance.now() - start).toFixed(2)} ms`\n + ` | compilePool queueSize: ${compilePool.queueSize} | runPool queueSize: ${runPool.queueSize}`\n );\n \n this.isWorkerRunning = true;\n GLOBAL_RUNNING_POOLWORKER_COUNT++;\n debug(`[${this.logModuleWithId}] start | new running PoolWorker count: ${GLOBAL_RUNNING_POOLWORKER_COUNT}`);\n \n this.notifyVitest('started');\n debug(`[${this.logModuleWithId}] send: responded \"started\" to vitest`);\n });\n \n break;\n \n // this happens BEFORE stop() is called (stop() is for PoolWorker, \"stop\" is for thread)\n case 'stop':\n setImmediate(async () => {\n await this.stopThread();\n this.notifyVitest('stopped');\n });\n break;\n \n case 'cancel':\n debug(`[${this.logModuleWithId}] send: got \"cancel\" unexpectedly`, message);\n break;\n \n case 'collect':\n case 'run':\n this.currentWorkerId = message.context.workerId;\n this.threadSpecs = message.context.files.map((fileSpec): ThreadSpec => ({\n file: createInitialFileTask(\n toForwardSlash(fileSpec.filepath),\n this.config!.name ?? '',\n this.config!.root,\n this.config!.testTimeout,\n this.config!.retry\n )\n }));\n\n debug(`[${this.logModuleWithId}] send: vitest sent \"${message.type}\" message`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n\n setImmediate(async () => {\n debug(`[${this.logModuleWithId}] send: dispatched \"${message.type}\" job to worker thread`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n \n this.threadRunPromise = this.orchestrateFileRuns();\n\n try {\n await this.threadRunPromise;\n this.notifyVitest('testfileFinished');\n debug(`[${this.logModuleWithId}] send: responded \"testfileFinished\" to vitest`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n\n this.threadSpecs = [];\n } catch (error) {\n // abort errors are expected, otherwise rethrow\n if (!isAbortError(error)) {\n throw error;\n }\n } finally {\n this.threadControlPort?.close();\n this.threadAbortController = undefined;\n this.threadControlPort = undefined;\n this.threadRunPromise = undefined;\n }\n });\n break;\n }\n }\n\n on(event: string, callback: EventCallback): void {\n this.addEventCallback(event, callback);\n debug(`[${this.logModuleWithId}] ON \"${event}\" - saved listener`);\n }\n\n off(event: string, callback: EventCallback): void {\n if (this.removeEventCallback(event, callback)) {\n debug(`[${this.logModuleWithId}] OFF \"${event}\" - removed callback from registry`);\n } else {\n debug(`[${this.logModuleWithId}] OFF \"${event}\" - callback not found in registry`);\n }\n }\n\n deserialize(data: unknown): unknown {\n return data;\n }\n\n canReuse(_task: PoolTask): boolean {\n return true;\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Thread Pool Management\n // ─────────────────────────────────────────────────────────────────────────────\n\n private async getGlobalThreadPools(workerCount?: number): Promise<GlobalThreadPools> {\n if (GLOBAL_POOLS_PROMISE) {\n return GLOBAL_POOLS_PROMISE;\n }\n\n GLOBAL_POOLS_PROMISE = new Promise<GlobalThreadPools>(async (resolve, _reject) => {\n const workers = workerCount ?? availableParallelism();\n\n // TODO - decide which is better when scaling\n // Empirical observations seem to show that minimum parallelization for compilation\n // tends to *dramatically* improve compilation times because of v8 warmpup on repeated calls to asc.main,\n // so much so that this time savings **almost always** outweighs the benefits of speading over many\n // available threads. The **almost** is the key word here- this needs to be tested on platforms with\n // higher available paralellism (> 8) to see if it holds true.\n const actualCompileThreadCount = workers > 1 ? 2 : 1;\n // const actualCompileThreadCount = Math.max(Math.ceil(workers * IDLE_COMPILE_THREADS_FACTOR), 1);\n\n debug(`[${this.logModuleWithId}] Creating global compile thread pool | ${actualCompileThreadCount} threads`);\n \n const start = performance.now();\n \n const compilePool = new Tinypool({\n filename: COMPILE_WORKER_PATH,\n minThreads: 1,\n maxThreads: actualCompileThreadCount,\n isolateWorkers: false,\n idleTimeout: POOL_THREAD_IDLE_TIMEOUT_MS,\n env: this.poolOptions.env as Record<string, string>,\n execArgv: this.poolOptions.execArgv,\n workerData: {\n asCoverageOptions: this.asCoverageOptions,\n } satisfies WorkerThreadInitData\n });\n\n const actualRunThreadCount = Math.max(Math.ceil(workers * IDLE_RUN_THREADS_FACTOR), 1);\n debug(`[${this.logModuleWithId}] Creating global run thread pool | ${actualRunThreadCount} threads`);\n\n const runPool = new Tinypool({\n filename: TEST_WORKER_PATH,\n minThreads: 1,\n maxThreads: actualRunThreadCount,\n isolateWorkers: false,\n idleTimeout: POOL_THREAD_IDLE_TIMEOUT_MS,\n env: this.poolOptions.env as Record<string, string>,\n execArgv: this.poolOptions.execArgv,\n workerData: {\n asCoverageOptions: this.asCoverageOptions,\n } satisfies WorkerThreadInitData\n });\n\n debug(`[${this.logModuleWithId}] Created global thread pools in ${(performance.now() - start).toFixed(2)} ms`);\n\n GLOBAL_POOL_ABORT_CONTROLLER = new AbortController();\n resolve({ compilePool, runPool });\n });\n \n return GLOBAL_POOLS_PROMISE;\n }\n\n // @ts-ignore\n // pools are never explicitly destroyed.\n // - vitest processes are short-lived\n // - when PoolWorkers are stopped, they cleanup actively-running thread tasks\n // - in practice stop happens after every run, even in watch mode\n // - keeping pools hot is desirable for watch mode re-runs, so we maintain our pools\n private async destroyGlobalPoolsIfNeeded(): Promise<void> {\n if (GLOBAL_RUNNING_POOLWORKER_COUNT === 0 && GLOBAL_POOLS_PROMISE) {\n const destroyStart = performance.now();\n debug(`[${this.logModuleWithId}] Destroying Tinypools...`);\n\n try {\n const { compilePool, runPool } = await GLOBAL_POOLS_PROMISE;\n await Promise.all([ compilePool.destroy(), runPool.destroy() ]);\n } catch {}\n\n GLOBAL_POOLS_PROMISE = undefined;\n GLOBAL_POOL_ABORT_CONTROLLER = undefined;\n\n debug(`[${this.logModuleWithId}] Destroyed tinypools in ${(performance.now() - destroyStart).toFixed(2)} ms`);\n }\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Listener Registry Helpers\n // ─────────────────────────────────────────────────────────────────────────────\n\n private getEventCallbacks(event: string): Set<EventCallback> {\n let callbacks: Set<EventCallback> | undefined = this.listenerRegistry.get(event);\n if (!callbacks) {\n callbacks = new Set<EventCallback>();\n this.listenerRegistry.set(event, callbacks);\n }\n return callbacks;\n }\n\n private addEventCallback(event: string, callback: EventCallback): void {\n this.getEventCallbacks(event).add(callback);\n }\n \n private removeEventCallback(event: string, callback: EventCallback): boolean {\n const callbacks = this.getEventCallbacks(event);\n if (callbacks) {\n return callbacks.delete(callback);\n } else {\n return false;\n }\n }\n\n private notifyVitest(responseType: WorkerResponse['type']): void {\n const messageCallbacks = this.getEventCallbacks('message');\n for (const cb of messageCallbacks) {\n cb({ type: responseType, [VITEST_WORKER_RESPONSE_MSG_FLAG]: true } satisfies WorkerResponse)\n }\n }\n\n // ─────────────────────────────────────────────────────────────────────────────\n // Worker Thread Control/Orchestration\n // ─────────────────────────────────────────────────────────────────────────────\n \n private async dispatchCompile(\n spec: ThreadSpec,\n compilePool: Tinypool,\n ): Promise<void> {\n const { workerPort, poolPort } = createWorkerRPCChannel(this.poolOptions.project, this.isCollectTestsMode);\n this.threadControlPort = poolPort;\n \n const compilePromise: Promise<ThreadSpec> = compilePool.run({\n dispatchStart: Date.now(),\n workerId: this.currentWorkerId!,\n port: workerPort,\n file: spec.file,\n config: this.config!,\n asPoolOptions: this.asPoolOptions,\n isCollectTestsMode: this.isCollectTestsMode,\n } satisfies RunCompileAndDiscoverTask, {\n name: 'runCompileAndDiscoverSpec',\n transferList: [workerPort],\n signal: GLOBAL_POOL_ABORT_CONTROLLER!.signal,\n });\n\n try {\n const { compilation, file } = await compilePromise;\n spec.file = file;\n spec.compilation = compilation;\n } finally {\n this.threadControlPort.close();\n this.threadControlPort = undefined;\n }\n }\n \n private async dispatchRunTests(\n spec: ThreadSpec,\n runPool: Tinypool,\n timedOutTest?: Test,\n ): Promise<void> {\n const { workerPort, poolPort } = createWorkerRPCChannel(this.poolOptions.project, this.isCollectTestsMode);\n \n this.threadAbortController = new AbortController();\n this.threadControlPort = poolPort;\n this.threadControlPort.on('message', this.getWorkerThreadMessageHandler());\n\n const runPromise: Promise<void> = !spec.compilation ? Promise.resolve() : runPool.run({\n dispatchStart: Date.now(),\n workerId: this.currentWorkerId!,\n port: workerPort,\n file: timedOutTest?.file ?? spec.file,\n compilation: spec.compilation,\n config: this.config!,\n asPoolOptions: this.asPoolOptions,\n isCollectTestsMode: this.isCollectTestsMode,\n timedOutTest,\n } satisfies RunTestsTask, {\n name: 'runFileSpec',\n transferList: [workerPort],\n signal: AbortSignal.any([this.threadAbortController.signal, GLOBAL_POOL_ABORT_CONTROLLER!.signal]),\n });\n\n try {\n return await runPromise;\n } finally {\n this.threadControlPort.close();\n this.threadControlPort = undefined;\n }\n }\n\n private async orchestrateFileRuns(timedOutTest?: Test): Promise<void> {\n const modeStr = this.isCollectTestsMode ? 'collectTests' : 'runTests';\n const isResume: boolean = !!timedOutTest;\n const desc = `${modeStr} ${isResume ? '(RESUME)' : '(INITIAL)'}`;\n\n debug(`[${this.logModuleWithId}] orchestrateFileRuns: dispatching ${desc} to worker thread`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n\n const { compilePool, runPool } = await this.getGlobalThreadPools(this.config?.maxWorkers);\n\n // compile\n if (!isResume) {\n await Promise.all(\n this.threadSpecs.map(spec => this.dispatchCompile(spec, compilePool))\n );\n }\n\n // test\n if (!this.isCollectTestsMode) {\n await Promise.all(\n this.threadSpecs.map(spec => this.dispatchRunTests(spec, runPool, timedOutTest))\n );\n }\n\n debug(`[${this.logModuleWithId}] orchestrateFileRuns: ${desc} thread work complete`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n }\n\n private async stopThread(): Promise<void> {\n this.clearTestTimeoutTimer(); // if any\n this.currentTestRun = undefined;\n \n const mod = this.logModuleWithId;\n const start = performance.now();\n\n debug('setting graceful resolve timeout');\n const abortTimeout = setTimeout(() => {\n debug(`[${mod}] stop: timed out waiting on pool worker run resolve ${(performance.now() - start).toFixed(2)} ms | Aborting thread`);\n this.threadAbortController?.abort();\n }, THREAD_RESOLVE_TIMEOUT_MS);\n \n try {\n debug(`[${mod}] stop: awaiting pool worker run resolve: ${!!this.threadRunPromise}`);\n await this.threadRunPromise;\n clearTimeout(abortTimeout);\n debug(`[${this.logModuleWithId}] stop: pool worker run resolved cleanly after ${(performance.now() - start).toFixed(2)} ms`);\n } catch {\n } finally {\n this.threadControlPort?.close();\n debug(`[${this.logModuleWithId}] stop: closed pool port`);\n }\n \n this.threadAbortController = undefined;\n this.threadControlPort = undefined;\n this.threadRunPromise = undefined;\n this.threadSpecs = [];\n }\n\n private getWorkerThreadMessageHandler(): EventCallback {\n return (message: any): void => {\n if (message[AS_POOL_WORKER_MSG_FLAG]) {\n const poolMessage = message as AssemblyScriptPoolWorkerMessage;\n\n switch (poolMessage.type) {\n case 'execution-start':\n this.handleTestExecutionStart(message);\n break;\n case 'execution-end':\n this.handleTestExecutionEnd(message);\n break;\n }\n\n return;\n }\n };\n }\n\n private handleTestExecutionStart(msg: TestExecutionStart): void {\n if (!this.isWorkerRunning) return;\n \n const { executionStart, test } = msg;\n const now = Date.now();\n const transitDuration = now - executionStart;\n const adjustedTimeout = Math.max(test.timeout - transitDuration, 0);\n\n this.currentTestRun = {\n test,\n executionStart,\n timeoutId: setTimeout(() => this.handleTimeout(), adjustedTimeout)\n };\n\n debug(`[${this.logModuleWithId}] START test timeout timer for \"${this.currentTestRun.test.name}\"`);\n }\n\n private handleTestExecutionEnd(_msg: TestExecutionEnd): void {\n this.clearTestTimeoutTimer();\n this.currentTestRun = undefined;\n }\n\n private clearTestTimeoutTimer(): void {\n if (this.currentTestRun) {\n const elapsed = Date.now() - this.currentTestRun.executionStart;\n debug(`[${this.logModuleWithId}] CLEAR test timeout timer (${elapsed.toFixed(2)} ms) for \"${this.currentTestRun?.test.name}\"`);\n clearTimeout(this.currentTestRun.timeoutId);\n }\n }\n\n private async handleTimeout(): Promise<void> {\n if (!this.isWorkerRunning) return;\n\n if (!this.threadSpecs.length || !this.currentTestRun || !this.currentTestRun.test) {\n const missingStr = \n + (this.threadSpecs.length ? '' : 'threadSpecs')\n + (this.currentTestRun ? '' : ' currentTestRecord')\n + (this.currentTestRun?.test ? '' : ' currentTestRecord.test')\n throw createPoolError(\n POOL_ERROR_NAMES.PoolError,\n `Cannot timeout/resume worker thread for workerId ${this.currentWorkerId} - missing data: ${missingStr}`\n );\n }\n\n const duration = Date.now() - this.currentTestRun.executionStart;\n failTestWithTimeoutError(this.currentTestRun.test, this.currentTestRun.executionStart, duration);\n\n // set termination time metadata for measuring resume latency\n flagTestTerminated(this.currentTestRun.test);\n\n debug(`[${this.logModuleWithId}] handleTimeout: TEST TIMEOUT \"${this.currentTestRun.test.name}\" after ${duration.toFixed(2)} ms`\n +` - Terminating worker thread job`\n );\n\n const termStart = performance.now();\n \n try {\n this.threadAbortController?.abort();\n await this.threadRunPromise;\n } catch (error) {\n // abort errors are expected, otherwise rethrow\n if (!isAbortError(error)) {\n throw error;\n }\n } finally {\n this.threadControlPort?.close();\n this.threadAbortController = undefined;\n this.threadControlPort = undefined;\n this.threadRunPromise = undefined;\n }\n\n debug(`[${this.logModuleWithId}] handleTimeout: Worker thread job aborted for timeout in ${(performance.now() - termStart).toFixed(2)} ms`);\n \n if (!this.isWorkerRunning) return;\n\n // supply timed-out test (includes entire file hierarchy & coverage)\n // to resume testing where we leftoff when aborting for timeout\n this.threadRunPromise = this.orchestrateFileRuns(this.currentTestRun.test);\n\n debug(`[${this.logModuleWithId}] handleTimeout: re-dispatched job to worker thread`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n\n try {\n await this.threadRunPromise;\n this.notifyVitest('testfileFinished');\n debug(`[${this.logModuleWithId}] handleTimeout: file run completed - responded \"testfileFinished\" to vitest`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n \n this.threadSpecs = [];\n } catch (error) {\n // abort errors are expected, otherwise rethrow\n if (!isAbortError(error)) {\n throw error;\n } else {\n debug(`[${this.logModuleWithId}] send: caught and ignored timeout awaiting timeout re-run`\n + ` | files: \"${this.threadSpecs.map(s => s.file.filepath).join(',')}\"`\n );\n }\n } finally {\n //@ts-ignore\n this.threadControlPort?.close();\n this.threadControlPort = undefined;\n this.threadAbortController = undefined;\n this.threadRunPromise = undefined;\n }\n }\n\n private get logModuleWithId(): string {\n return `${this.logModule}${this.currentWorkerId === undefined ? '' : ` ${this.currentWorkerId}`}`;\n }\n}\n","import type { PoolOptions, PoolRunnerInitializer } from 'vitest/node';\n\nimport type {\n AssemblyScriptPoolOptions,\n ResolvedHybridProviderOptions\n} from '../types/types.js';\nimport { ASSEMBLYSCRIPT_POOL_NAME } from '../types/constants.js';\nimport { resolvePoolOptions } from '../util/resolve-config.js';\nimport { AssemblyScriptPoolWorker } from './pool-worker.js';\n\nexport function createAssemblyScriptPool(userPoolOptions?: AssemblyScriptPoolOptions): PoolRunnerInitializer {\n const resolvedUserPoolOptions = resolvePoolOptions(userPoolOptions);\n\n return {\n name: ASSEMBLYSCRIPT_POOL_NAME,\n createPoolWorker: (opts: PoolOptions) => {\n const resolvedCoverageOptions = opts.project.config.coverage as unknown as ResolvedHybridProviderOptions;\n return new AssemblyScriptPoolWorker(opts, resolvedUserPoolOptions, resolvedCoverageOptions);\n },\n };\n}\n"],"mappings":";;;;;;;;;;AAsCA,MAAM,4BAA4B;AAClC,MAAM,8BAA8B;AACpC,MAAM,0BAA0B;AAKhC,MAAM,sBAAsB,QAAQ,OAAO,KAAK,SAAS,wCAAwC;AACjG,MAAM,mBAAmB,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,KAAK,gBAAgB,uEACb,KAAK,YAAY,KAAI,MAAK,EAAE,KAAK,SAAS,CAAC,KAAK,IAAI,CAAC,GACtE;YAEK;AAER,QAAK,mBAAmB,OAAO;AAC/B,QAAK,oBAAoB;AACzB,QAAK,wBAAwB;AAC7B,QAAK,mBAAmB;;;CAI5B,IAAY,kBAA0B;AACpC,SAAO,GAAG,KAAK,YAAY,KAAK,oBAAoB,SAAY,KAAK,IAAI,KAAK;;;;;;AC/lBlF,SAAgB,yBAAyB,iBAAoE;CAC3G,MAAM,0BAA0B,mBAAmB,gBAAgB;AAEnE,QAAO;EACL;EACA,mBAAmB,SAAsB;GACvC,MAAM,0BAA0B,KAAK,QAAQ,OAAO;AACpD,UAAO,IAAI,yBAAyB,MAAM,yBAAyB,wBAAwB;;EAE9F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RunCompileAndDiscoverTask, ThreadSpec } from "../types-
|
|
1
|
+
import { RunCompileAndDiscoverTask, ThreadSpec } from "../types-CoroKYxB.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/pool-thread/compile-worker-thread.d.ts
|
|
4
4
|
declare function runCompileAndDiscoverSpec(data: RunCompileAndDiscoverTask): Promise<ThreadSpec>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-worker-thread.d.mts","names":[],"sources":["../../src/pool-thread/compile-worker-thread.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"compile-worker-thread.d.mts","names":[],"sources":["../../src/pool-thread/compile-worker-thread.ts"],"mappings":";;;iBA0BsB,yBAAA,CAA0B,IAAA,EAAM,yBAAA,GAA4B,OAAA,CAAQ,UAAA"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import "../constants-
|
|
2
|
-
import "../
|
|
3
|
-
import { debug, setGlobalDebugMode } from "../
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import "../
|
|
9
|
-
import { runCompileAndDiscover } from "../compile-runner-BNFHRGZO.mjs";
|
|
1
|
+
import "../constants-Bq5KNxXJ.mjs";
|
|
2
|
+
import { failFile } from "../vitest-file-tasks-Coc4btUw.mjs";
|
|
3
|
+
import { buildEnhancedFileError, debug, setGlobalDebugMode } from "../pool-errors-GWfwrsD7.mjs";
|
|
4
|
+
import "../wasm-memory-C8Nkl2Sz.mjs";
|
|
5
|
+
import { createRpcClient, flushRpcUpdates, loadUserWasmImportsFactory, reportFileError, reportFileQueued } from "../load-user-imports-6Pv-9hRg.mjs";
|
|
6
|
+
import { isNodeVersionSupportedForCoverage } from "../feature-check-DLfJqIrE.mjs";
|
|
7
|
+
import "../compiler-DSKhQ5--.mjs";
|
|
8
|
+
import { runCompileAndDiscover } from "../compile-runner-D4SJWhMh.mjs";
|
|
10
9
|
import { threadId, workerData } from "node:worker_threads";
|
|
11
10
|
|
|
12
11
|
//#region src/pool-thread/compile-worker-thread.ts
|
|
@@ -15,22 +14,33 @@ import { threadId, workerData } from "node:worker_threads";
|
|
|
15
14
|
*/
|
|
16
15
|
const logModule = `WorkerThread`;
|
|
17
16
|
const [_unused, initData] = workerData;
|
|
18
|
-
const {
|
|
19
|
-
setGlobalDebugMode(asPoolOptions.debug);
|
|
20
|
-
debug(`[${logModule}] New compile pool thread created`);
|
|
17
|
+
const { asCoverageOptions } = initData;
|
|
21
18
|
const COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();
|
|
22
|
-
const createUserWasmImports = await loadUserWasmImportsFactory(asPoolOptions.wasmImportsFactory, projectRoot, logModule);
|
|
23
19
|
async function runCompileAndDiscoverSpec(data) {
|
|
24
|
-
const { dispatchStart, workerId, file, port, config } = data;
|
|
20
|
+
const { dispatchStart, workerId, file, port, config, asPoolOptions } = data;
|
|
21
|
+
const initPerf = performance.now();
|
|
25
22
|
const dispatchToInit = Date.now() - dispatchStart;
|
|
26
23
|
const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;
|
|
24
|
+
setGlobalDebugMode(asPoolOptions.debug);
|
|
27
25
|
const rpc = createRpcClient(port);
|
|
28
26
|
port.unref();
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
let compilation;
|
|
28
|
+
const diffOptions = typeof config.diff === "object" ? config.diff : void 0;
|
|
29
|
+
try {
|
|
30
|
+
debug(`[${logModuleWithId}] -------- compile and discover starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);
|
|
31
|
+
const createUserWasmImports = await loadUserWasmImportsFactory(asPoolOptions.wasmImportsFactory, config.root, logModuleWithId);
|
|
32
|
+
debug(`[${logModuleWithId}] Awaiting compilation | projectName: "${config.name}" | file: "${file.filepath}"`);
|
|
33
|
+
compilation = await runCompileAndDiscover(file, logModuleWithId, rpc, asPoolOptions, config.root, config.coverage.enabled && COVERAGE_SUPPORTED, asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [], { createUserWasmImports }, diffOptions, config.testNamePattern, config.allowOnly);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
failFile(file, await buildEnhancedFileError(error, file, compilation?.sourceMap, logModuleWithId, config.root, "compile worker thread", diffOptions), initPerf);
|
|
36
|
+
await reportFileQueued(rpc, file, logModule, logModuleWithId);
|
|
37
|
+
await reportFileError(rpc, file, logModule, logModuleWithId);
|
|
38
|
+
debug(`${logModuleWithId} - Reported file error`);
|
|
39
|
+
} finally {
|
|
40
|
+
await flushRpcUpdates(rpc);
|
|
41
|
+
port.close();
|
|
42
|
+
debug(`[${logModuleWithId}] -------- compile and discover completed run --------`);
|
|
43
|
+
}
|
|
34
44
|
return {
|
|
35
45
|
compilation,
|
|
36
46
|
file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/compile-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Compile Worker (vitest v4)\n */\nimport { threadId, workerData } from 'node:worker_threads';\n\nimport type {\n WorkerThreadInitData,\n RunCompileAndDiscoverTask,\n ThreadSpec,\n ThreadImports,\n WasmImportsFactory,\n} from '../types/types.js';\nimport { runCompileAndDiscover } from './runner/compile-runner.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient } from './rpc-reporter.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport {
|
|
1
|
+
{"version":3,"file":"compile-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/compile-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Compile Worker (vitest v4)\n */\nimport { threadId, workerData } from 'node:worker_threads';\n\nimport type {\n WorkerThreadInitData,\n RunCompileAndDiscoverTask,\n ThreadSpec,\n ThreadImports,\n WasmImportsFactory,\n WASMCompilation,\n} from '../types/types.js';\nimport { runCompileAndDiscover } from './runner/compile-runner.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient, flushRpcUpdates, reportFileError, reportFileQueued } from './rpc-reporter.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { failFile } from '../util/vitest-file-tasks.js';\nimport { buildEnhancedFileError } from '../util/pool-errors.js';\n\nconst logModule = `WorkerThread` as const;\nconst [_unused, initData] = workerData;\nconst { asCoverageOptions } = initData as WorkerThreadInitData;\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nexport async function runCompileAndDiscoverSpec(data: RunCompileAndDiscoverTask): Promise<ThreadSpec> {\n const { dispatchStart, workerId, file, port, config, asPoolOptions } = data;\n const initPerf = performance.now();\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;\n\n setGlobalDebugMode(asPoolOptions.debug);\n \n const rpc = createRpcClient(port);\n port.unref();\n\n let compilation: WASMCompilation | undefined;\n const diffOptions = typeof config.diff === 'object' ? config.diff : undefined;\n\n try {\n debug(`[${logModuleWithId}] -------- compile and discover starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n \n const createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n config.root,\n logModuleWithId\n );\n \n debug(`[${logModuleWithId}] Awaiting compilation | projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n\n compilation = await runCompileAndDiscover(\n file,\n logModuleWithId,\n rpc,\n asPoolOptions,\n config.root,\n config.coverage.enabled && COVERAGE_SUPPORTED,\n asCoverageOptions.globbedAssemblyScriptProjectRelativeExcludeOnly ?? [],\n { createUserWasmImports } satisfies ThreadImports,\n diffOptions,\n config.testNamePattern,\n config.allowOnly,\n );\n } catch (error: any) {\n const testError = await buildEnhancedFileError(\n error,\n file,\n compilation?.sourceMap,\n logModuleWithId,\n config.root,\n 'compile worker thread',\n diffOptions\n );\n\n failFile(file, testError, initPerf);\n \n await reportFileQueued(rpc, file, logModule, logModuleWithId);\n await reportFileError(rpc, file, logModule, logModuleWithId);\n \n debug(`${logModuleWithId} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n port.close();\n \n debug(`[${logModuleWithId}] -------- compile and discover completed run --------`);\n }\n\n return { compilation, file };\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,MAAM,YAAY;AAClB,MAAM,CAAC,SAAS,YAAY;AAC5B,MAAM,EAAE,sBAAsB;AAC9B,MAAM,qBAAqB,mCAAmC;AAE9D,eAAsB,0BAA0B,MAAsD;CACpG,MAAM,EAAE,eAAe,UAAU,MAAM,MAAM,QAAQ,kBAAkB;CACvE,MAAM,WAAW,YAAY,KAAK;CAClC,MAAM,iBAAiB,KAAK,KAAK,GAAG;CACpC,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,MAAM,SAAS;AAEhE,oBAAmB,cAAc,MAAM;CAEvC,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAK,OAAO;CAEZ,IAAI;CACJ,MAAM,cAAc,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;AAEpE,KAAI;AACF,QAAM,IAAI,gBAAgB,sEAAsE,eAAe,QAAQ,EAAE,CAAC,IAAI;EAE9H,MAAM,wBAAwD,MAAM,2BAClE,cAAc,oBACd,OAAO,MACP,gBACD;AAED,QAAM,IAAI,gBAAgB,yCAAyC,OAAO,KAAK,aAAa,KAAK,SAAS,GAAG;AAE7G,gBAAc,MAAM,sBAClB,MACA,iBACA,KACA,eACA,OAAO,MACP,OAAO,SAAS,WAAW,oBAC3B,kBAAkB,mDAAmD,EAAE,EACvE,EAAE,uBAAuB,EACzB,aACA,OAAO,iBACP,OAAO,UACR;UACM,OAAY;AAWnB,WAAS,MAVS,MAAM,uBACtB,OACA,MACA,aAAa,WACb,iBACA,OAAO,MACP,yBACA,YACD,EAEyB,SAAS;AAEnC,QAAM,iBAAiB,KAAK,MAAM,WAAW,gBAAgB;AAC7D,QAAM,gBAAgB,KAAK,MAAM,WAAW,gBAAgB;AAE5D,QAAM,GAAG,gBAAgB,wBAAwB;WACzC;AACR,QAAM,gBAAgB,IAAI;AAC1B,OAAK,OAAO;AAEZ,QAAM,IAAI,gBAAgB,wDAAwD;;AAGpF,QAAO;EAAE;EAAa;EAAM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-worker-thread.d.mts","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"test-worker-thread.d.mts","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"mappings":";;;iBAsBsB,WAAA,CAAY,IAAA,EAAM,YAAA,GAAe,OAAA"}
|
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
import "../constants-
|
|
2
|
-
import "../
|
|
3
|
-
import { debug, setGlobalDebugMode } from "../
|
|
4
|
-
import "../
|
|
5
|
-
import { createRpcClient, loadUserWasmImportsFactory } from "../load-user-imports-
|
|
6
|
-
import { isNodeVersionSupportedForCoverage } from "../feature-check-
|
|
7
|
-
import { runSuite } from "../test-runner-
|
|
1
|
+
import "../constants-Bq5KNxXJ.mjs";
|
|
2
|
+
import { failFile } from "../vitest-file-tasks-Coc4btUw.mjs";
|
|
3
|
+
import { buildEnhancedFileError, debug, setGlobalDebugMode } from "../pool-errors-GWfwrsD7.mjs";
|
|
4
|
+
import "../wasm-memory-C8Nkl2Sz.mjs";
|
|
5
|
+
import { createRpcClient, flushRpcUpdates, loadUserWasmImportsFactory, reportFileError } from "../load-user-imports-6Pv-9hRg.mjs";
|
|
6
|
+
import { isNodeVersionSupportedForCoverage } from "../feature-check-DLfJqIrE.mjs";
|
|
7
|
+
import { runSuite } from "../test-runner-M21HMDdH.mjs";
|
|
8
8
|
import { basename } from "node:path";
|
|
9
|
-
import { threadId
|
|
9
|
+
import { threadId } from "node:worker_threads";
|
|
10
10
|
|
|
11
11
|
//#region src/pool-thread/test-worker-thread.ts
|
|
12
12
|
/**
|
|
13
13
|
* Worker entry point - Node Worker (vitest v4)
|
|
14
14
|
*/
|
|
15
15
|
const logModule = `WorkerThread`;
|
|
16
|
-
const [_unused, initData] = workerData;
|
|
17
|
-
const { asPoolOptions, projectRoot } = initData;
|
|
18
|
-
setGlobalDebugMode(asPoolOptions.debug);
|
|
19
|
-
debug(`[${logModule}] New test run pool thread created`);
|
|
20
16
|
const COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();
|
|
21
|
-
const createUserWasmImports = await loadUserWasmImportsFactory(asPoolOptions.wasmImportsFactory, projectRoot, logModule);
|
|
22
17
|
async function runFileSpec(data) {
|
|
23
|
-
const { dispatchStart, workerId, file, port, config, isCollectTestsMode, compilation, timedOutTest } = data;
|
|
18
|
+
const { dispatchStart, workerId, file, port, config, asPoolOptions, isCollectTestsMode, compilation, timedOutTest } = data;
|
|
19
|
+
const initPerf = performance.now();
|
|
24
20
|
const dispatchToInit = Date.now() - dispatchStart;
|
|
25
21
|
const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;
|
|
22
|
+
setGlobalDebugMode(asPoolOptions.debug);
|
|
26
23
|
const rpc = createRpcClient(port);
|
|
27
24
|
port.unref();
|
|
28
25
|
const mode = isCollectTestsMode ? "collectTests" : "runTests";
|
|
26
|
+
const diffOptions = typeof config.diff === "object" ? config.diff : void 0;
|
|
29
27
|
debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);
|
|
30
28
|
debug(`[${logModuleWithId}] projectName: "${config.name}" | file: "${file.filepath}"`);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
try {
|
|
30
|
+
const createUserWasmImports = await loadUserWasmImportsFactory(asPoolOptions.wasmImportsFactory, config.root, logModuleWithId);
|
|
31
|
+
debug(`[${logModuleWithId}] ${mode} | awaiting file run`);
|
|
32
|
+
await runSuite(rpc, port, basename(file.filepath), config.coverage.enabled && COVERAGE_SUPPORTED, compilation, file, logModuleWithId, asPoolOptions, { createUserWasmImports }, "v4", config.root, config.bail, diffOptions, timedOutTest);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
failFile(file, await buildEnhancedFileError(error, file, compilation.sourceMap, logModuleWithId, config.root, "test worker thread", diffOptions), initPerf);
|
|
35
|
+
await reportFileError(rpc, file, logModule, logModuleWithId);
|
|
36
|
+
debug(`${logModuleWithId} - Reported file error`);
|
|
37
|
+
} finally {
|
|
38
|
+
await flushRpcUpdates(rpc);
|
|
39
|
+
port.close();
|
|
40
|
+
debug(`[${logModuleWithId}] -------- ${mode} completed file test run --------`);
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Node Worker (vitest v4)\n */\nimport { basename } from 'node:path';\nimport { threadId
|
|
1
|
+
{"version":3,"file":"test-worker-thread.mjs","names":[],"sources":["../../src/pool-thread/test-worker-thread.ts"],"sourcesContent":["/**\n * Worker entry point - Node Worker (vitest v4)\n */\nimport { basename } from 'node:path';\nimport { threadId } from 'node:worker_threads';\n\nimport type {\n RunTestsTask,\n ThreadImports,\n WasmImportsFactory\n} from '../types/types.js';\nimport { debug, setGlobalDebugMode } from '../util/debug.js';\nimport { createRpcClient, flushRpcUpdates, reportFileError } from './rpc-reporter.js';\nimport { runSuite } from './runner/test-runner.js';\nimport { loadUserWasmImportsFactory } from './load-user-imports.js';\nimport { isNodeVersionSupportedForCoverage } from '../util/feature-check.js';\nimport { failFile } from '../util/vitest-file-tasks.js';\nimport { buildEnhancedFileError } from '../util/pool-errors.js';\n\nconst logModule = `WorkerThread` as const;\nconst COVERAGE_SUPPORTED = isNodeVersionSupportedForCoverage();\n\nexport async function runFileSpec(data: RunTestsTask): Promise<void> {\n const {\n dispatchStart, workerId, file, port, config, asPoolOptions,\n isCollectTestsMode, compilation, timedOutTest\n } = data;\n const initPerf = performance.now();\n const dispatchToInit = Date.now() - dispatchStart;\n const logModuleWithId = `${logModule} ${workerId} (t ${threadId})`;\n \n setGlobalDebugMode(asPoolOptions.debug);\n \n const rpc = createRpcClient(port);\n port.unref();\n\n const mode = isCollectTestsMode ? 'collectTests' : 'runTests';\n const diffOptions = typeof config.diff === 'object' ? config.diff : undefined;\n\n debug(`[${logModuleWithId}] -------- ${mode} starting -------- | dispatchToInit: ${dispatchToInit.toFixed(2)}ms`);\n debug(`[${logModuleWithId}] projectName: \"${config.name}\" | file: \"${file.filepath}\"`);\n\n try {\n const createUserWasmImports: WasmImportsFactory | undefined = await loadUserWasmImportsFactory(\n asPoolOptions.wasmImportsFactory,\n config.root,\n logModuleWithId\n );\n\n debug(`[${logModuleWithId}] ${mode} | awaiting file run`);\n\n await runSuite(\n rpc,\n port,\n basename(file.filepath),\n config.coverage.enabled && COVERAGE_SUPPORTED,\n compilation,\n file,\n logModuleWithId,\n asPoolOptions,\n { createUserWasmImports } satisfies ThreadImports,\n 'v4',\n config.root,\n config.bail,\n diffOptions,\n timedOutTest,\n );\n } catch (error: any) {\n const testError = await buildEnhancedFileError(\n error,\n file,\n compilation.sourceMap,\n logModuleWithId,\n config.root,\n 'test worker thread',\n diffOptions\n );\n \n failFile(file, testError, initPerf);\n\n await reportFileError(rpc, file, logModule, logModuleWithId);\n\n debug(`${logModuleWithId} - Reported file error`);\n } finally {\n await flushRpcUpdates(rpc);\n port.close();\n \n debug(`[${logModuleWithId}] -------- ${mode} completed file test run --------`);\n }\n\n return;\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,MAAM,YAAY;AAClB,MAAM,qBAAqB,mCAAmC;AAE9D,eAAsB,YAAY,MAAmC;CACnE,MAAM,EACJ,eAAe,UAAU,MAAM,MAAM,QAAQ,eAC7C,oBAAoB,aAAa,iBAC/B;CACJ,MAAM,WAAW,YAAY,KAAK;CAClC,MAAM,iBAAiB,KAAK,KAAK,GAAG;CACpC,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,MAAM,SAAS;AAEhE,oBAAmB,cAAc,MAAM;CAEvC,MAAM,MAAM,gBAAgB,KAAK;AACjC,MAAK,OAAO;CAEZ,MAAM,OAAO,qBAAqB,iBAAiB;CACnD,MAAM,cAAc,OAAO,OAAO,SAAS,WAAW,OAAO,OAAO;AAEpE,OAAM,IAAI,gBAAgB,aAAa,KAAK,uCAAuC,eAAe,QAAQ,EAAE,CAAC,IAAI;AACjH,OAAM,IAAI,gBAAgB,kBAAkB,OAAO,KAAK,aAAa,KAAK,SAAS,GAAG;AAEtF,KAAI;EACF,MAAM,wBAAwD,MAAM,2BAClE,cAAc,oBACd,OAAO,MACP,gBACD;AAED,QAAM,IAAI,gBAAgB,IAAI,KAAK,sBAAsB;AAEzD,QAAM,SACJ,KACA,MACA,SAAS,KAAK,SAAS,EACvB,OAAO,SAAS,WAAW,oBAC3B,aACA,MACA,iBACA,eACA,EAAE,uBAAuB,EACzB,MACA,OAAO,MACP,OAAO,MACP,aACA,aACD;UACM,OAAY;AAWnB,WAAS,MAVS,MAAM,uBACtB,OACA,MACA,YAAY,WACZ,iBACA,OAAO,MACP,sBACA,YACD,EAEyB,SAAS;AAEnC,QAAM,gBAAgB,KAAK,MAAM,WAAW,gBAAgB;AAE5D,QAAM,GAAG,gBAAgB,wBAAwB;WACzC;AACR,QAAM,gBAAgB,IAAI;AAC1B,OAAK,OAAO;AAEZ,QAAM,IAAI,gBAAgB,aAAa,KAAK,mCAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v3-tinypool-thread.d.mts","names":[],"sources":["../../src/pool-thread/v3-tinypool-thread.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"v3-tinypool-thread.d.mts","names":[],"sources":["../../src/pool-thread/v3-tinypool-thread.ts"],"mappings":";;;iBA8BsB,WAAA,CAAY,QAAA,EAAU,sBAAA,GAAyB,OAAA"}
|