vitest-pool-assemblyscript 0.9.1 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/assembly/compare.ts +11 -12
  2. package/assembly/describe.ts +4 -4
  3. package/assembly/expect.ts +44 -26
  4. package/assembly/test.ts +9 -9
  5. package/assembly/utils.ts +218 -62
  6. package/dist/{addon-interface-CYFXMbK7.mjs → addon-interface-BaUmn7uC.mjs} +12 -12
  7. package/dist/addon-interface-BaUmn7uC.mjs.map +1 -0
  8. package/dist/{ast-visitor-CWEOd3UH.mjs → ast-visitor-w1HMbuJR.mjs} +2 -2
  9. package/dist/{ast-visitor-CWEOd3UH.mjs.map → ast-visitor-w1HMbuJR.mjs.map} +1 -1
  10. package/dist/compile-runner-BGHM_85g.mjs +82 -0
  11. package/dist/compile-runner-BGHM_85g.mjs.map +1 -0
  12. package/dist/compiler/transforms/deep-equals.d.mts.map +1 -1
  13. package/dist/compiler/transforms/deep-equals.mjs +61 -22
  14. package/dist/compiler/transforms/deep-equals.mjs.map +1 -1
  15. package/dist/compiler/transforms/strip-inline.mjs +2 -2
  16. package/dist/{compiler-Dqs-qd3I.mjs → compiler-CXR5UJId.mjs} +55 -27
  17. package/dist/compiler-CXR5UJId.mjs.map +1 -0
  18. package/dist/config/index-v3.d.mts +1 -1
  19. package/dist/config/index-v3.d.mts.map +1 -1
  20. package/dist/config/index-v3.mjs.map +1 -1
  21. package/dist/config/index.d.mts +2 -2
  22. package/dist/config/index.mjs +5 -7
  23. package/dist/{constants-DbxJ3hzg.mjs → constants-Bq5KNxXJ.mjs} +4 -2
  24. package/dist/constants-Bq5KNxXJ.mjs.map +1 -0
  25. package/dist/{coverage-merge-CBXkpM1O.mjs → coverage-merge-0WqdC-dq.mjs} +1 -1
  26. package/dist/{coverage-merge-CBXkpM1O.mjs.map → coverage-merge-0WqdC-dq.mjs.map} +1 -1
  27. package/dist/coverage-provider/index.mjs +36 -36
  28. package/dist/coverage-provider/index.mjs.map +1 -1
  29. package/dist/{feature-check-Bje3ntpV.mjs → feature-check-BJpc4LoO.mjs} +4 -4
  30. package/dist/{feature-check-Bje3ntpV.mjs.map → feature-check-BJpc4LoO.mjs.map} +1 -1
  31. package/dist/index-internal.d.mts +3 -3
  32. package/dist/index-internal.d.mts.map +1 -1
  33. package/dist/index-internal.mjs +5 -4
  34. package/dist/index-v3.d.mts.map +1 -1
  35. package/dist/index-v3.mjs +19 -33
  36. package/dist/index-v3.mjs.map +1 -1
  37. package/dist/index.d.mts +1 -1
  38. package/dist/index.mjs +5 -7
  39. package/dist/{load-user-imports-Bx5ZlhSm.mjs → load-user-imports-Bcx9NOt9.mjs} +119 -232
  40. package/dist/load-user-imports-Bcx9NOt9.mjs.map +1 -0
  41. package/dist/pool-errors-Bn6YaguR.mjs +630 -0
  42. package/dist/pool-errors-Bn6YaguR.mjs.map +1 -0
  43. package/dist/{pool-runner-init-CNpRdA5u.d.mts → pool-runner-init-CCvnKt5o.d.mts} +2 -2
  44. package/dist/pool-runner-init-CCvnKt5o.d.mts.map +1 -0
  45. package/dist/{pool-runner-init-BqkwQ2tk.mjs → pool-runner-init-DjRCbiX-.mjs} +15 -30
  46. package/dist/pool-runner-init-DjRCbiX-.mjs.map +1 -0
  47. package/dist/pool-thread/compile-worker-thread.d.mts +1 -1
  48. package/dist/pool-thread/compile-worker-thread.d.mts.map +1 -1
  49. package/dist/pool-thread/compile-worker-thread.mjs +29 -19
  50. package/dist/pool-thread/compile-worker-thread.mjs.map +1 -1
  51. package/dist/pool-thread/test-worker-thread.d.mts +1 -1
  52. package/dist/pool-thread/test-worker-thread.d.mts.map +1 -1
  53. package/dist/pool-thread/test-worker-thread.mjs +25 -18
  54. package/dist/pool-thread/test-worker-thread.mjs.map +1 -1
  55. package/dist/pool-thread/v3-tinypool-thread.d.mts +1 -1
  56. package/dist/pool-thread/v3-tinypool-thread.d.mts.map +1 -1
  57. package/dist/pool-thread/v3-tinypool-thread.mjs +43 -33
  58. package/dist/pool-thread/v3-tinypool-thread.mjs.map +1 -1
  59. package/dist/test-runner-BeP8ClnE.mjs +147 -0
  60. package/dist/test-runner-BeP8ClnE.mjs.map +1 -0
  61. package/dist/{types-DHVk5iAx.d.mts → types-CoroKYxB.d.mts} +39 -16
  62. package/dist/types-CoroKYxB.d.mts.map +1 -0
  63. package/dist/vitest-file-tasks-vvZzigcF.mjs +473 -0
  64. package/dist/vitest-file-tasks-vvZzigcF.mjs.map +1 -0
  65. package/dist/wasm-memory-C8Nkl2Sz.mjs +134 -0
  66. package/dist/wasm-memory-C8Nkl2Sz.mjs.map +1 -0
  67. package/dist/{worker-rpc-channel-CZZIxtv5.mjs → worker-rpc-channel-CvCrc8aa.mjs} +1 -1
  68. package/dist/{worker-rpc-channel-CZZIxtv5.mjs.map → worker-rpc-channel-CvCrc8aa.mjs.map} +1 -1
  69. package/package.json +1 -1
  70. package/prebuilds/darwin-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  71. package/prebuilds/darwin-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  72. package/prebuilds/linux-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  73. package/prebuilds/linux-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  74. package/prebuilds/linux-x64/vitest-pool-assemblyscript.musl.node +0 -0
  75. package/prebuilds/win32-arm64/vitest-pool-assemblyscript.glibc.node +0 -0
  76. package/prebuilds/win32-x64/vitest-pool-assemblyscript.glibc.node +0 -0
  77. package/src/instrumentation/native/addon.cpp +71 -32
  78. package/dist/addon-interface-CYFXMbK7.mjs.map +0 -1
  79. package/dist/compile-runner-BNFHRGZO.mjs +0 -85
  80. package/dist/compile-runner-BNFHRGZO.mjs.map +0 -1
  81. package/dist/compiler-Dqs-qd3I.mjs.map +0 -1
  82. package/dist/constants-DbxJ3hzg.mjs.map +0 -1
  83. package/dist/debug-DtRAL4rM.mjs +0 -232
  84. package/dist/debug-DtRAL4rM.mjs.map +0 -1
  85. package/dist/load-user-imports-Bx5ZlhSm.mjs.map +0 -1
  86. package/dist/path-utils-t9OzjXYF.mjs +0 -24
  87. package/dist/path-utils-t9OzjXYF.mjs.map +0 -1
  88. package/dist/pool-runner-init-BqkwQ2tk.mjs.map +0 -1
  89. package/dist/pool-runner-init-CNpRdA5u.d.mts.map +0 -1
  90. package/dist/resolve-config-s9gSJSMc.mjs +0 -85
  91. package/dist/resolve-config-s9gSJSMc.mjs.map +0 -1
  92. package/dist/test-runner-BGqc9uCK.mjs +0 -138
  93. package/dist/test-runner-BGqc9uCK.mjs.map +0 -1
  94. package/dist/types-DHVk5iAx.d.mts.map +0 -1
  95. package/dist/vitest-file-tasks-D8sOClGX.mjs +0 -149
  96. package/dist/vitest-file-tasks-D8sOClGX.mjs.map +0 -1
  97. package/dist/vitest-tasks-BZ24sghI.mjs +0 -321
  98. package/dist/vitest-tasks-BZ24sghI.mjs.map +0 -1
  99. package/dist/wasm-names-BFtzQCH4.mjs +0 -124
  100. package/dist/wasm-names-BFtzQCH4.mjs.map +0 -1
@@ -0,0 +1,473 @@
1
+ import { POOL_ERROR_NAMES, TEST_ERROR_NAMES } from "./constants-Bq5KNxXJ.mjs";
2
+ import { createTestExpectedToFailError, createTestTimeoutError, debug } from "./pool-errors-Bn6YaguR.mjs";
3
+ import { availableParallelism } from "node:os";
4
+ import { calculateSuiteHash, createFileTask, someTasksAreOnly } from "@vitest/runner/utils";
5
+ import { processError } from "@vitest/utils/error";
6
+
7
+ //#region src/types/types.ts
8
+ const AS_POOL_FIELDS_WITH_DEFAULTS = [
9
+ "debug",
10
+ "debugNative",
11
+ "debugCoverageExtract",
12
+ "_instrumentPoolInternals",
13
+ "stripInline",
14
+ "maxThreadsV3",
15
+ "extraCompilerFlags"
16
+ ];
17
+
18
+ //#endregion
19
+ //#region src/util/resolve-config.ts
20
+ const DEFAULT_ASSEMBLYSCRIPT_POOL_OTIONS = {
21
+ debug: false,
22
+ debugNative: false,
23
+ debugCoverageExtract: false,
24
+ _instrumentPoolInternals: false,
25
+ stripInline: true,
26
+ maxThreadsV3: availableParallelism() - 1,
27
+ extraCompilerFlags: []
28
+ };
29
+ function createPoolConfigError(message) {
30
+ return {
31
+ name: POOL_ERROR_NAMES.PoolConfigError,
32
+ message
33
+ };
34
+ }
35
+ function resolvePoolOptions(userPoolOptions) {
36
+ const poolOptions = userPoolOptions ?? DEFAULT_ASSEMBLYSCRIPT_POOL_OTIONS;
37
+ for (const configKey of AS_POOL_FIELDS_WITH_DEFAULTS) if (poolOptions[configKey] === void 0) poolOptions[configKey] = DEFAULT_ASSEMBLYSCRIPT_POOL_OTIONS[configKey];
38
+ const resolved = {
39
+ ...poolOptions,
40
+ isResolved: true
41
+ };
42
+ if (resolved.testMemoryPagesInitial !== void 0 && resolved.testMemoryPagesInitial < 1 || resolved.testMemoryPagesMax !== void 0 && resolved.testMemoryPagesMax < 1) throw createPoolConfigError(`AssemblyScript WASM test memory page size options must be positive if defined - testMemoryPagesMin: ${resolved.testMemoryPagesInitial} | testMemoryPagesMax: ${resolved.testMemoryPagesMax}`);
43
+ if (resolved.coverageMemoryPagesInitial !== void 0 && resolved.coverageMemoryPagesInitial < 1 || resolved.coverageMemoryPagesMax !== void 0 && resolved.coverageMemoryPagesMax < 1) throw createPoolConfigError(`AssemblyScript WASM coverage memory page size options must be positive if defined - coverageMemoryPagesMin: ${resolved.coverageMemoryPagesInitial} | coverageMemoryPagesMax: ${resolved.coverageMemoryPagesMax}`);
44
+ return resolved;
45
+ }
46
+ function retryCompat(retry) {
47
+ return typeof retry === "number" ? retry : retry?.count ?? 0;
48
+ }
49
+ function getCompatConfig(config) {
50
+ return {
51
+ ...config,
52
+ retry: retryCompat(config.retry)
53
+ };
54
+ }
55
+ function getProjectConfigs(ctx) {
56
+ const configs = {};
57
+ ctx.projects.filter((p) => p.config.pool.includes("assemblyscript")).forEach((project) => {
58
+ configs[project.name] = { config: getCompatConfig(project.serializedConfig) };
59
+ const maybeOptions = project.config?.poolOptions?.assemblyScript;
60
+ if (maybeOptions) configs[project.name].v3PoolOptions = resolvePoolOptions(maybeOptions);
61
+ });
62
+ return configs;
63
+ }
64
+ function getConfigs(ctx) {
65
+ const coverage = ctx.config.coverage;
66
+ const projects = getProjectConfigs(ctx);
67
+ let fallbackPoolOptions = resolvePoolOptions(ctx.config.poolOptions?.assemblyScript);
68
+ const configs = Object.values(projects);
69
+ if (configs.length > 0) for (const config of configs) {
70
+ if (config.v3PoolOptions?.debug) fallbackPoolOptions.debug = true;
71
+ if (config.v3PoolOptions?.maxThreadsV3 !== void 0 && config.v3PoolOptions.maxThreadsV3 > fallbackPoolOptions.maxThreadsV3) fallbackPoolOptions.maxThreadsV3 = config.v3PoolOptions.maxThreadsV3;
72
+ }
73
+ return {
74
+ coverage,
75
+ projects,
76
+ fallbackPoolOptions
77
+ };
78
+ }
79
+
80
+ //#endregion
81
+ //#region src/types/typed-constants.ts
82
+ const DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS = {
83
+ fails: false,
84
+ skip: false,
85
+ only: false
86
+ };
87
+
88
+ //#endregion
89
+ //#region src/util/vitest-tasks.ts
90
+ function positiveSum(items, getSummableValue) {
91
+ return items.reduce((total, next) => {
92
+ return total + Math.max(getSummableValue(next) || 0, 0);
93
+ }, 0);
94
+ }
95
+ function hasNonFileParentSuite(suite) {
96
+ return !!suite.suite?.id && suite.suite.id !== suite.file.id;
97
+ }
98
+ function getSuiteHierarchyName(suite) {
99
+ let name = suite.name;
100
+ let currentSuite = suite;
101
+ while (hasNonFileParentSuite(currentSuite)) {
102
+ name = `${currentSuite.suite.name} > ${name}`;
103
+ currentSuite = currentSuite.suite;
104
+ }
105
+ return name;
106
+ }
107
+ function isSuiteOwnFile(suite) {
108
+ return suite.file.id === suite.id;
109
+ }
110
+ function getTaskLogLabel(base, task) {
111
+ if (task.type === "suite") return isSuiteOwnFile(task) ? `${base}` : `${base} - "${getSuiteHierarchyName(task)}"`;
112
+ else return `${base} - "${getSuiteHierarchyName(task.suite)} > ${task.name}"`;
113
+ }
114
+ function getTaskLogPrefix(logModule, base, task) {
115
+ return `[${logModule}] ${getTaskLogLabel(base, task)}`;
116
+ }
117
+ function createAfterSuiteRunMeta(coverage, testFiles, projectName = "", vitestVersion = "v4") {
118
+ const base = {
119
+ coverage,
120
+ testFiles,
121
+ projectName
122
+ };
123
+ if (vitestVersion) return {
124
+ ...base,
125
+ transformMode: "ssr"
126
+ };
127
+ else return {
128
+ ...base,
129
+ environment: "node"
130
+ };
131
+ }
132
+ function getInitialTaskMode(options) {
133
+ if (options.skip) return "skip";
134
+ else if (options.only) return "only";
135
+ else return "run";
136
+ }
137
+ function getInitialTestTaskMeta(fnIndex, parentAfterAddingTask) {
138
+ return {
139
+ fnIndex,
140
+ idxInParentTasks: parentAfterAddingTask.tasks.length - 1,
141
+ assertionsPassedCount: 0,
142
+ assertionsFailed: [],
143
+ resultFinal: false
144
+ };
145
+ }
146
+ function getInitialSuiteTaskMeta(parentAfterAddingTask, mergedOptions) {
147
+ return {
148
+ idxInParentTasks: parentAfterAddingTask.tasks.length - 1,
149
+ defaultTestOptions: mergedOptions,
150
+ suitePreparedSent: false,
151
+ resultFinal: false
152
+ };
153
+ }
154
+ function createTaskName(names, separator = " > ") {
155
+ return names.filter((name) => name !== void 0).join(separator);
156
+ }
157
+ function createTestTask(name, fnIndex, file, parent, mergedOptions, vitestVersion = "v4") {
158
+ const test = {
159
+ type: "test",
160
+ name,
161
+ fullName: createTaskName([parent?.fullName ?? file?.fullName, name]),
162
+ fullTestName: createTaskName([parent?.fullTestName, name]),
163
+ id: "",
164
+ file,
165
+ suite: parent,
166
+ context: {},
167
+ annotations: [],
168
+ artifacts: [],
169
+ meta: {},
170
+ mode: getInitialTaskMode(mergedOptions),
171
+ timeout: mergedOptions.timeout,
172
+ retry: mergedOptions.retry,
173
+ fails: mergedOptions.fails
174
+ };
175
+ if (vitestVersion === "v3") {
176
+ delete test.fullName;
177
+ delete test.fullTestName;
178
+ delete test.artifacts;
179
+ }
180
+ parent.tasks.push(test);
181
+ test.meta = getInitialTestTaskMeta(fnIndex, parent);
182
+ return test;
183
+ }
184
+ function createSuiteTask(name, file, parent, mergedOptions, vitestVersion = "v4") {
185
+ const suite = {
186
+ type: "suite",
187
+ name,
188
+ fullName: createTaskName([parent?.fullName ?? file?.fullName, name]),
189
+ fullTestName: createTaskName([parent?.fullTestName, name]),
190
+ id: "",
191
+ file,
192
+ suite: parent,
193
+ meta: {},
194
+ tasks: [],
195
+ mode: getInitialTaskMode(mergedOptions)
196
+ };
197
+ if (vitestVersion === "v3") {
198
+ delete suite.fullName;
199
+ delete suite.fullTestName;
200
+ }
201
+ parent.tasks.push(suite);
202
+ suite.meta = getInitialSuiteTaskMeta(parent, mergedOptions);
203
+ return suite;
204
+ }
205
+ function getRunnableTasks(suite) {
206
+ return suite.tasks.filter((t) => t.mode === "queued" || t.mode === "run");
207
+ }
208
+ function shouldRetryTask(task) {
209
+ const retry = retryCompat(task.retry);
210
+ return task.result?.state === "fail" && task.retry !== void 0 && retry > 0 && (task.result.retryCount === void 0 || task.result.retryCount === 0 || task.result.retryCount < retry);
211
+ }
212
+ /**
213
+ * Invert result if test configured as 'fails'.
214
+ */
215
+ function checkFailsAndInvertResult(test, logPrefix) {
216
+ if (test.fails) {
217
+ if (test.result?.state === "pass") {
218
+ test.result.state = "fail";
219
+ debug(`${logPrefix} - Has 'fails' option set - inverted "pass" to "fail"`);
220
+ const err = createTestExpectedToFailError(test);
221
+ if (test.result.errors) test.result.errors.push(err);
222
+ else test.result.errors = [err];
223
+ } else if (test.result?.state === "fail") {
224
+ test.result.state = "pass";
225
+ test.result.errors = [];
226
+ debug(`${logPrefix} - Has 'fails' option set - inverted "fail" to "pass"`);
227
+ }
228
+ }
229
+ }
230
+ function setTestResultForTestPrepare(test, startTime) {
231
+ test.result = {
232
+ state: "run",
233
+ startTime,
234
+ retryCount: 0
235
+ };
236
+ }
237
+ function updateTestResultAfterRun(test, testTimings) {
238
+ if (test.result?.state === "run") test.result.state = "pass";
239
+ if (test.result && testTimings) test.result.duration = (test.result.duration ?? 0) + (testTimings.execEnd - testTimings.execStart);
240
+ }
241
+ function flagTestTerminated(test) {
242
+ test.meta.lastTimeoutTerminationTime = Date.now();
243
+ }
244
+ function flagTestFinalized(test) {
245
+ test.meta.resultFinal = true;
246
+ }
247
+ function failTest(test, testError) {
248
+ if (test.result) test.result.state = "fail";
249
+ else test.result = { state: "fail" };
250
+ if (test.result.errors) test.result.errors.push(testError);
251
+ else test.result.errors = [testError];
252
+ }
253
+ function failTestRuntimeError(test, errorMessagePrefix, errorMessage) {
254
+ const prefixStr = errorMessagePrefix ? `${errorMessagePrefix}: ` : "";
255
+ const testError = {
256
+ name: TEST_ERROR_NAMES.WASMRuntimeError,
257
+ message: `${prefixStr}${errorMessage}`
258
+ };
259
+ failTest(test, testError);
260
+ return testError;
261
+ }
262
+ function failTestAssertionError(test, assertion) {
263
+ test.meta.assertionsFailed.push(assertion);
264
+ const testError = {
265
+ name: TEST_ERROR_NAMES.AssertionError,
266
+ message: assertion.message
267
+ };
268
+ if (assertion?.valuesProvided) {
269
+ testError.expected = assertion.expected !== void 0 ? String(assertion.expected) : void 0;
270
+ testError.actual = assertion.actual !== void 0 ? String(assertion.actual) : void 0;
271
+ }
272
+ failTest(test, testError);
273
+ return testError;
274
+ }
275
+ function failTestWithTimeoutError(test, startTime, duration) {
276
+ const timeoutErr = createTestTimeoutError(test);
277
+ if (test.result) {
278
+ test.result.state = "fail";
279
+ test.result.startTime = startTime;
280
+ test.result.duration = (test.result.duration ?? 0) + duration;
281
+ if (test.result.errors) test.result.errors.push(timeoutErr);
282
+ else test.result.errors = [timeoutErr];
283
+ } else test.result = {
284
+ state: "fail",
285
+ startTime,
286
+ duration,
287
+ errors: [timeoutErr],
288
+ retryCount: 0
289
+ };
290
+ }
291
+ function setSuitePrepareResult(suite) {
292
+ if (suite.mode === "skip") suite.result = {
293
+ state: "skip",
294
+ duration: 0
295
+ };
296
+ else suite.result = {
297
+ state: "run",
298
+ startTime: Date.now()
299
+ };
300
+ }
301
+ function updateSuiteFinishedResult(suite, logPrefix) {
302
+ if (suite.mode === "skip") suite.result = {
303
+ state: "skip",
304
+ duration: 0
305
+ };
306
+ else {
307
+ const hasFailures = suite.tasks.some(({ result }) => result?.state === "fail");
308
+ if (suite.result) {
309
+ suite.result.duration = positiveSum(suite.tasks, (t) => t.result?.duration);
310
+ suite.result.state = hasFailures ? "fail" : "pass";
311
+ debug(`${logPrefix} - Set suite result: "${suite.result.state}" (hasFailures: ${hasFailures})`);
312
+ }
313
+ }
314
+ }
315
+ function finalizeSuiteResult(suite) {
316
+ suite.meta.resultFinal = true;
317
+ }
318
+ function resetTestForRetry(test, startTime) {
319
+ if (test.result) {
320
+ test.result.state = "run";
321
+ test.result.startTime = startTime;
322
+ }
323
+ const meta = test.meta;
324
+ meta.assertionsPassedCount = 0;
325
+ meta.assertionsFailed = [];
326
+ delete meta.lastError;
327
+ delete meta.lastErrorValuesProvided;
328
+ delete meta.lastErrorRawCallStack;
329
+ delete meta.lastErrorCallStackRef;
330
+ delete meta.lastTimeoutTerminationTime;
331
+ delete meta.coverageData;
332
+ }
333
+
334
+ //#endregion
335
+ //#region src/util/vitest-file-tasks.ts
336
+ function createInitialFileTask(testFile, projectName, projectRoot, configTestTimeout, configRetry) {
337
+ const file = createFileTask(testFile, projectRoot, projectName, "assemblyscript");
338
+ file.mode = "queued";
339
+ file.environmentLoad = 0;
340
+ file.setupDuration = 0;
341
+ file.meta = {
342
+ idxInParentTasks: -1,
343
+ defaultTestOptions: {
344
+ ...DEFAULT_ASSEMBLYSCRIPT_TEST_OPTIONS,
345
+ timeout: configTestTimeout,
346
+ retry: configRetry
347
+ },
348
+ suitePreparedSent: false,
349
+ resultFinal: false
350
+ };
351
+ return file;
352
+ }
353
+ function prepareFileTaskForCollection(file, testNamePattern, allowOnly) {
354
+ calculateSuiteHash(file);
355
+ interpretTaskModes(file, testNamePattern, void 0, void 0, void 0, someTasksAreOnly(file), false, allowOnly);
356
+ if (file.mode === "queued") file.mode = "run";
357
+ }
358
+ function failFile(file, testError, runStartPerf) {
359
+ file.mode = "run";
360
+ if (file.result) {
361
+ file.result.state = "fail";
362
+ file.result.errors = file.result.errors ? file.result.errors.concat(testError) : [testError];
363
+ } else file.result = {
364
+ state: "fail",
365
+ errors: [testError]
366
+ };
367
+ file.environmentLoad = file.environmentLoad ?? 0;
368
+ file.setupDuration = performance.now() - runStartPerf;
369
+ file.collectDuration = file.collectDuration ?? 0;
370
+ finalizeSuiteResult(file);
371
+ return testError;
372
+ }
373
+ function getFullTaskHierarchy(file) {
374
+ function spacesForLevel(level) {
375
+ return new Array(level + 1).fill(" ").join("");
376
+ }
377
+ function taskStr(task, level) {
378
+ if (task.type === "test") return `${spacesForLevel(level)}ID: ${task.id} Mode: "${task.mode}" Test: "${task.name}"`;
379
+ else return `${spacesForLevel(level)}ID: ${task.id} Mode: "${task.mode}" Suite: "${task.name}"\n` + task.tasks.map((t) => taskStr(t, level + 1)).join("\n");
380
+ }
381
+ return taskStr(file, 0);
382
+ }
383
+ /**
384
+ * Function interface changes from vitest 4.0.x -> 4.1.x, so now were' just handling this
385
+ * functionality ourselves to prevent version compat conflicts.
386
+ *
387
+ * @see https://github.com/vitest-dev/vitest/blob/v4.1.0/packages/runner/src/utils/collect.ts#L10
388
+ *
389
+ * Vitest is released under the MIT license, included in this project's root.
390
+ * Copyright (c) 2021-Present Vitest Team
391
+ */
392
+ function interpretTaskModes(file, namePattern, testLocations, testIds, testTagsFilter, onlyMode, parentIsOnly, allowOnly) {
393
+ const matchedLocations = [];
394
+ const traverseSuite = (suite, parentIsOnly, parentMatchedWithLocation) => {
395
+ const suiteIsOnly = parentIsOnly || suite.mode === "only";
396
+ const hasSomeTasksOnly = onlyMode && suite.tasks.some((t) => t.mode === "only" || t.type === "suite" && someTasksAreOnly(t));
397
+ suite.tasks.forEach((t) => {
398
+ const includeTask = hasSomeTasksOnly ? t.mode === "only" || t.type === "suite" && someTasksAreOnly(t) : suiteIsOnly || t.mode === "only";
399
+ if (onlyMode) {
400
+ if (t.type === "suite" && (includeTask || someTasksAreOnly(t))) {
401
+ if (t.mode === "only") {
402
+ checkAllowOnly(t, allowOnly);
403
+ t.mode = "run";
404
+ }
405
+ } else if (t.mode === "run" && !includeTask) t.mode = "skip";
406
+ else if (t.mode === "only") {
407
+ checkAllowOnly(t, allowOnly);
408
+ t.mode = "run";
409
+ }
410
+ }
411
+ let hasLocationMatch = parentMatchedWithLocation;
412
+ if (testLocations !== void 0 && testLocations.length !== 0) {
413
+ if (t.location && testLocations?.includes(t.location.line)) {
414
+ t.mode = "run";
415
+ matchedLocations.push(t.location.line);
416
+ hasLocationMatch = true;
417
+ } else if (parentMatchedWithLocation) t.mode = "run";
418
+ else if (t.type === "test") t.mode = "skip";
419
+ }
420
+ if (t.type === "test") {
421
+ if (namePattern && !getTaskFullName(t).match(namePattern)) t.mode = "skip";
422
+ if (testIds && !testIds.includes(t.id)) t.mode = "skip";
423
+ if (testTagsFilter && !testTagsFilter(t.tags || [])) t.mode = "skip";
424
+ } else if (t.type === "suite") if (t.mode === "skip") skipAllTasks(t);
425
+ else if (t.mode === "todo") todoAllTasks(t);
426
+ else traverseSuite(t, includeTask, hasLocationMatch);
427
+ });
428
+ if (suite.mode === "run" || suite.mode === "queued") {
429
+ if (suite.tasks.length && suite.tasks.every((i) => i.mode !== "run" && i.mode !== "queued")) suite.mode = "skip";
430
+ }
431
+ };
432
+ traverseSuite(file, parentIsOnly, false);
433
+ const nonMatching = testLocations?.filter((loc) => !matchedLocations.includes(loc));
434
+ if (nonMatching && nonMatching.length !== 0) {
435
+ const message = nonMatching.length === 1 ? `line ${nonMatching[0]}` : `lines ${nonMatching.join(", ")}`;
436
+ if (file.result === void 0) file.result = {
437
+ state: "fail",
438
+ errors: []
439
+ };
440
+ if (file.result.errors === void 0) file.result.errors = [];
441
+ file.result.errors.push(processError(/* @__PURE__ */ new Error(`No test found in ${file.name} in ${message}`)));
442
+ }
443
+ }
444
+ function getTaskFullName(task) {
445
+ return `${task.suite ? `${getTaskFullName(task.suite)} ` : ""}${task.name}`;
446
+ }
447
+ function skipAllTasks(suite) {
448
+ suite.tasks.forEach((t) => {
449
+ if (t.mode === "run" || t.mode === "queued") {
450
+ t.mode = "skip";
451
+ if (t.type === "suite") skipAllTasks(t);
452
+ }
453
+ });
454
+ }
455
+ function todoAllTasks(suite) {
456
+ suite.tasks.forEach((t) => {
457
+ if (t.mode === "run" || t.mode === "queued") {
458
+ t.mode = "todo";
459
+ if (t.type === "suite") todoAllTasks(t);
460
+ }
461
+ });
462
+ }
463
+ function checkAllowOnly(task, allowOnly) {
464
+ if (allowOnly) return;
465
+ task.result = {
466
+ state: "fail",
467
+ errors: [processError(/* @__PURE__ */ new Error("[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error"))]
468
+ };
469
+ }
470
+
471
+ //#endregion
472
+ 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
@@ -0,0 +1 @@
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,aAAa,6BACtB,KAAI,YAAY,eAAe,OAC7B,aAAY,aAAa,mCAAmC;CAIhE,MAAM,WAAW;EAAE,G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