vitest 4.0.0-beta.10 → 4.0.0-beta.12

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 (69) hide show
  1. package/LICENSE.md +85 -101
  2. package/dist/browser.d.ts +10 -6
  3. package/dist/browser.js +8 -5
  4. package/dist/chunks/{benchmark.CJUa-Hsa.js → benchmark.DHKMYAts.js} +2 -2
  5. package/dist/chunks/{browser.d.yFAklsD1.d.ts → browser.d.D9YV3JvA.d.ts} +1 -1
  6. package/dist/chunks/{cac.DCxo_nSu.js → cac.r1gel_VZ.js} +18 -11
  7. package/dist/chunks/{cli-api.BJJXh9BV.js → cli-api.CpywZzJV.js} +153 -176
  8. package/dist/chunks/{config.d.B_LthbQq.d.ts → config.d.DGazh2r6.d.ts} +3 -1
  9. package/dist/chunks/{console.7h5kHUIf.js → console.CTJL2nuH.js} +4 -6
  10. package/dist/chunks/{coverage.BCU-r2QL.js → coverage.CiB0fs_7.js} +57 -79
  11. package/dist/chunks/{creator.08Gi-vCA.js → creator.DfXDsUyL.js} +6 -8
  12. package/dist/chunks/{global.d.BK3X7FW1.d.ts → global.d.BcFPD2LN.d.ts} +0 -13
  13. package/dist/chunks/{globals.DG-S3xFe.js → globals.DC4ntO86.js} +8 -6
  14. package/dist/chunks/{index.DIWhzsUh.js → index.Bt-upxGS.js} +6 -12
  15. package/dist/chunks/{index.BIP7prJq.js → index.CHrBLuEH.js} +94 -103
  16. package/dist/chunks/{index.X0nbfr6-.js → index.Dc3xnDvT.js} +48 -289
  17. package/dist/chunks/{index.CMfqw92x.js → index.Dnl38iQ_.js} +2 -2
  18. package/dist/chunks/{index.BjKEiSn0.js → index.uLUz1RDt.js} +3 -3
  19. package/dist/chunks/{inspector.CvQD-Nie.js → inspector.Br76Q2Mb.js} +1 -4
  20. package/dist/chunks/{moduleRunner.d.D9nBoC4p.d.ts → moduleRunner.d.CeYc7nZ0.d.ts} +1 -1
  21. package/dist/chunks/{node.CyipiPvJ.js → node.BwAWWjHZ.js} +3 -4
  22. package/dist/chunks/{plugin.d.BMVSnsGV.d.ts → plugin.d.XreRXLXS.d.ts} +1 -1
  23. package/dist/chunks/{reporters.d.BUWjmRYq.d.ts → reporters.d.CJVTaaWb.d.ts} +54 -13
  24. package/dist/chunks/{resolveSnapshotEnvironment.Bkht6Yor.js → resolveSnapshotEnvironment.BsJpmVZR.js} +7 -8
  25. package/dist/chunks/{rpc.BKr6mtxz.js → rpc.cD77ENhU.js} +13 -14
  26. package/dist/chunks/{setup-common.uiMcU3cv.js → setup-common.BewgbkTd.js} +6 -6
  27. package/dist/chunks/{startModuleRunner.p67gbNo9.js → startModuleRunner.DPBo3mme.js} +65 -56
  28. package/dist/chunks/{test.BiqSKISg.js → test.CTuWuHYH.js} +7 -7
  29. package/dist/chunks/{typechecker.DB-fIMaH.js → typechecker.BfOQ86_a.js} +624 -14
  30. package/dist/chunks/{utils.D2R2NiOH.js → utils.CG9h5ccR.js} +2 -5
  31. package/dist/chunks/{vi.ZPgvtBao.js → vi.B2--mG9U.js} +38 -145
  32. package/dist/{worker.js → chunks/worker.DVTUM2IW.js} +71 -42
  33. package/dist/chunks/{worker.d.BDsXGkwh.d.ts → worker.d.buwuBpBt.d.ts} +2 -77
  34. package/dist/cli.js +7 -5
  35. package/dist/config.d.ts +6 -6
  36. package/dist/coverage.d.ts +5 -5
  37. package/dist/coverage.js +4 -5
  38. package/dist/environments.js +1 -1
  39. package/dist/index.d.ts +8 -8
  40. package/dist/index.js +8 -6
  41. package/dist/module-evaluator.d.ts +3 -3
  42. package/dist/module-evaluator.js +11 -13
  43. package/dist/module-runner.js +5 -5
  44. package/dist/node.d.ts +14 -11
  45. package/dist/node.js +18 -14
  46. package/dist/reporters.d.ts +5 -5
  47. package/dist/reporters.js +7 -5
  48. package/dist/runners.d.ts +1 -1
  49. package/dist/runners.js +9 -7
  50. package/dist/snapshot.js +3 -3
  51. package/dist/suite.js +4 -3
  52. package/dist/{chunks/base.Cjha6usc.js → worker-base.js} +104 -32
  53. package/dist/{chunks/vm.Ca0Y0W5f.js → worker-vm.js} +81 -31
  54. package/dist/workers/runVmTests.js +14 -11
  55. package/package.json +26 -26
  56. package/browser.d.ts +0 -1
  57. package/dist/chunks/moduleTransport.I-bgQy0S.js +0 -19
  58. package/dist/chunks/resolver.Bx6lE0iq.js +0 -119
  59. package/dist/chunks/utils.C2YI6McM.js +0 -52
  60. package/dist/chunks/worker.d.BNcX_2mH.d.ts +0 -8
  61. package/dist/workers/forks.js +0 -67
  62. package/dist/workers/threads.js +0 -55
  63. package/dist/workers/vmForks.js +0 -48
  64. package/dist/workers/vmThreads.js +0 -38
  65. package/dist/workers.d.ts +0 -38
  66. package/dist/workers.js +0 -48
  67. package/execute.d.ts +0 -1
  68. package/utils.d.ts +0 -1
  69. package/workers.d.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  import { r as resolveCoverageProviderModule } from './coverage.D_JHT54q.js';
2
2
  import { addSerializer } from '@vitest/snapshot';
3
- import { setSafeTimers } from '@vitest/utils';
4
- import { g as getWorkerState } from './utils.D2R2NiOH.js';
3
+ import { setSafeTimers } from '@vitest/utils/timers';
4
+ import { g as getWorkerState } from './utils.CG9h5ccR.js';
5
5
 
6
6
  async function startCoverageInsideWorker(options, loader, runtimeOptions) {
7
7
  const coverageModule = await resolveCoverageProviderModule(options, loader);
@@ -18,7 +18,7 @@ async function stopCoverageInsideWorker(options, loader, runtimeOptions) {
18
18
 
19
19
  let globalSetup = false;
20
20
  async function setupCommonEnv(config) {
21
- if (setupDefines(config), setupEnv(config.env), !globalSetup && (globalSetup = true, setSafeTimers(), config.globals)) (await import('./globals.DG-S3xFe.js')).registerApiGlobally();
21
+ if (setupDefines(config), setupEnv(config.env), !globalSetup && (globalSetup = true, setSafeTimers(), config.globals)) (await import('./globals.DC4ntO86.js')).registerApiGlobally();
22
22
  }
23
23
  function setupDefines(config) {
24
24
  for (const key in config.defines) globalThis[key] = config.defines[key];
@@ -35,14 +35,14 @@ async function loadDiffConfig(config, moduleRunner) {
35
35
  throw new Error(`invalid diff config file ${config.diff}. Must have a default export with config object`);
36
36
  }
37
37
  async function loadSnapshotSerializers(config, moduleRunner) {
38
- const files = config.snapshotSerializers, snapshotSerializers = await Promise.all(files.map(async (file) => {
38
+ const files = config.snapshotSerializers;
39
+ (await Promise.all(files.map(async (file) => {
39
40
  const mo = await moduleRunner.import(file);
40
41
  if (!mo || typeof mo.default !== "object" || mo.default === null) throw new Error(`invalid snapshot serializer file ${file}. Must export a default object`);
41
42
  const config = mo.default;
42
43
  if (typeof config.test !== "function" || typeof config.serialize !== "function" && typeof config.print !== "function") throw new TypeError(`invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`);
43
44
  return config;
44
- }));
45
- snapshotSerializers.forEach((serializer) => addSerializer(serializer));
45
+ }))).forEach((serializer) => addSerializer(serializer));
46
46
  }
47
47
 
48
48
  export { stopCoverageInsideWorker as a, loadSnapshotSerializers as b, setupCommonEnv as c, loadDiffConfig as l, startCoverageInsideWorker as s, takeCoverageInsideWorker as t };
@@ -1,16 +1,15 @@
1
1
  import fs from 'node:fs';
2
- import { builtinModules, isBuiltin } from 'node:module';
3
- import { highlight, isBareImport } from '@vitest/utils';
2
+ import nodeModule, { isBuiltin } from 'node:module';
3
+ import { isBareImport } from '@vitest/utils/helpers';
4
4
  import { pathToFileURL } from 'node:url';
5
5
  import { normalize as normalize$1, join as join$1 } from 'pathe';
6
6
  import { distDir } from '../path.js';
7
- import { processError } from '@vitest/utils/error';
7
+ import { serializeValue } from '@vitest/utils/serialize';
8
8
  import { VitestModuleEvaluator, unwrapId } from '../module-evaluator.js';
9
9
  import { resolve as resolve$1, isAbsolute as isAbsolute$1 } from 'node:path';
10
10
  import vm from 'node:vm';
11
11
  import { MockerRegistry, mockObject, RedirectedModule, AutomockedModule } from '@vitest/mocker';
12
12
  import * as viteModuleRunner from 'vite/module-runner';
13
- import { V as VitestTransport } from './moduleTransport.I-bgQy0S.js';
14
13
 
15
14
  const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
16
15
  function normalizeWindowsPath(input = "") {
@@ -29,8 +28,8 @@ const _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\
29
28
  for (const seg of segments) {
30
29
  if (!seg) continue;
31
30
  if (path.length > 0) {
32
- const pathTrailing = path[path.length - 1] === "/", segLeading = seg[0] === "/", both = pathTrailing && segLeading;
33
- if (both) path += seg.slice(1);
31
+ const pathTrailing = path[path.length - 1] === "/", segLeading = seg[0] === "/";
32
+ if (pathTrailing && segLeading) path += seg.slice(1);
34
33
  else path += pathTrailing || segLeading ? seg : `/${seg}`;
35
34
  } else path += seg;
36
35
  }
@@ -115,17 +114,14 @@ function findMockRedirect(root, mockPath, external) {
115
114
  const baseOriginal = basename(path);
116
115
  function findFile(mockFolder, baseOriginal) {
117
116
  const files = readdirSync(mockFolder);
118
- for (const file of files) {
119
- const baseFile = basename(file, extname(file));
120
- if (baseFile === baseOriginal) {
121
- const path = resolve(mockFolder, file);
122
- // if the same name, return the file
123
- if (statSync(path).isFile()) return path;
124
- {
125
- // find folder/index.{js,ts}
126
- const indexFile = findFile(path, "index");
127
- if (indexFile) return indexFile;
128
- }
117
+ for (const file of files) if (basename(file, extname(file)) === baseOriginal) {
118
+ const path = resolve(mockFolder, file);
119
+ // if the same name, return the file
120
+ if (statSync(path).isFile()) return path;
121
+ {
122
+ // find folder/index.{js,ts}
123
+ const indexFile = findFile(path, "index");
124
+ if (indexFile) return indexFile;
129
125
  }
130
126
  }
131
127
  return null;
@@ -136,7 +132,7 @@ function findMockRedirect(root, mockPath, external) {
136
132
  return existsSync(fullPath) ? fullPath : null;
137
133
  }
138
134
  const builtins = new Set([
139
- ...builtinModules,
135
+ ...nodeModule.builtinModules,
140
136
  "assert/strict",
141
137
  "diagnostics_channel",
142
138
  "dns/promises",
@@ -157,7 +153,7 @@ const builtins = new Set([
157
153
  "node:test/reporters"
158
154
  ]), NODE_BUILTIN_NAMESPACE = "node:";
159
155
  function isNodeBuiltin(id) {
160
- return prefixedBuiltins$1.has(id) ? true : builtins.has(id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(5) : id);
156
+ return nodeModule.isBuiltin ? nodeModule.isBuiltin(id) : prefixedBuiltins$1.has(id) ? true : builtins.has(id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(5) : id);
161
157
  }
162
158
 
163
159
  const spyModulePath = resolve$1(distDir, "spy.js");
@@ -279,16 +275,16 @@ class VitestMocker {
279
275
  if (prop === "then") {
280
276
  if (target instanceof Promise) return target.then.bind(target);
281
277
  } else if (!(prop in target)) {
282
- if (this.filterPublicKeys.includes(prop)) return void 0;
278
+ if (this.filterPublicKeys.includes(prop)) return;
283
279
  throw this.createError(`[vitest] No "${String(prop)}" export is defined on the "${mock.raw}" mock. Did you forget to return it from "vi.mock"?
284
280
  If you need to partially mock a module, you can use "importOriginal" helper inside:
285
- `, highlight(`vi.mock(import("${mock.raw}"), async (importOriginal) => {
281
+ `, `vi.mock(import("${mock.raw}"), async (importOriginal) => {
286
282
  const actual = await importOriginal()
287
283
  return {
288
284
  ...actual,
289
285
  // your mocked methods
290
286
  }
291
- })`));
287
+ })`);
292
288
  }
293
289
  return val;
294
290
  } });
@@ -303,8 +299,7 @@ If you need to partially mock a module, you can use "importOriginal" helper insi
303
299
  return `mock:${dep}`;
304
300
  }
305
301
  getDependencyMock(id) {
306
- const registry = this.getMockerRegistry();
307
- return registry.getById(fixLeadingSlashes(id));
302
+ return this.getMockerRegistry().getById(fixLeadingSlashes(id));
308
303
  }
309
304
  findMockRedirect(mockPath, external) {
310
305
  return findMockRedirect(this.root, mockPath, external);
@@ -319,8 +314,7 @@ If you need to partially mock a module, you can use "importOriginal" helper insi
319
314
  }, object, mockExports);
320
315
  }
321
316
  unmockPath(id) {
322
- const registry = this.getMockerRegistry();
323
- registry.deleteById(id), this.invalidateModuleById(id);
317
+ this.getMockerRegistry().deleteById(id), this.invalidateModuleById(id);
324
318
  }
325
319
  mockPath(originalId, id, url, external, mockType, factory) {
326
320
  const registry = this.getMockerRegistry();
@@ -335,8 +329,8 @@ If you need to partially mock a module, you can use "importOriginal" helper insi
335
329
  this.invalidateModuleById(id);
336
330
  }
337
331
  async importActual(rawId, importer, callstack) {
338
- const { url } = await this.resolveId(rawId, importer), node = await this.moduleRunner.fetchModule(url, importer), result = await this.moduleRunner.cachedRequest(node.url, node, callstack || [importer], void 0, true);
339
- return result;
332
+ const { url } = await this.resolveId(rawId, importer), node = await this.moduleRunner.fetchModule(url, importer);
333
+ return await this.moduleRunner.cachedRequest(node.url, node, callstack || [importer], void 0, true);
340
334
  }
341
335
  async importMock(rawId, importer) {
342
336
  const { id, url, external } = await this.resolveId(rawId, importer);
@@ -421,11 +415,8 @@ const prefixedBuiltins = new Set([
421
415
  // C:\root\id.js -> /id.js
422
416
  // TODO: expose this in vite/module-runner
423
417
  function normalizeModuleId(file) {
424
- if (prefixedBuiltins.has(file)) return file;
425
- // unix style, but Windows path still starts with the drive letter to check the root
426
- const unixFile = slash(file).replace(/^\/@fs\//, isWindows$1 ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
427
418
  // if it's not in the root, keep it as a path, not a URL
428
- return unixFile.replace(/^file:\//, "/");
419
+ return prefixedBuiltins.has(file) ? file : slash(file).replace(/^\/@fs\//, isWindows$1 ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/").replace(/^file:\//, "/");
429
420
  }
430
421
  const windowsSlashRE = /\\/g;
431
422
  function slash(p) {
@@ -437,9 +428,37 @@ function fixLeadingSlashes(id) {
437
428
  return id.startsWith("//") ? id.replace(multipleSlashRe, "/") : id;
438
429
  }
439
430
 
440
- // eslint-disable-next-line ts/ban-ts-comment
441
- // @ts-ignore
442
- const createNodeImportMeta = viteModuleRunner.createNodeImportMeta;
431
+ class VitestTransport {
432
+ constructor(options) {
433
+ this.options = options;
434
+ }
435
+ async invoke(event) {
436
+ if (event.type !== "custom") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support Vite HMR events.`) };
437
+ if (event.event !== "vite:invoke") return { error: /* @__PURE__ */ new Error(`Vitest Module Runner doesn't support ${event.event} event.`) };
438
+ const { name, data } = event.data;
439
+ if (name !== "fetchModule") return { error: /* @__PURE__ */ new Error(`Unknown method: ${name}. Expected "fetchModule".`) };
440
+ try {
441
+ return { result: await this.options.fetchModule(...data) };
442
+ } catch (error) {
443
+ return { error };
444
+ }
445
+ }
446
+ }
447
+
448
+ const createNodeImportMeta = (modulePath) => {
449
+ if (!viteModuleRunner.createDefaultImportMeta) throw new Error(`createNodeImportMeta is not supported in this version of Vite.`);
450
+ const defaultMeta = viteModuleRunner.createDefaultImportMeta(modulePath), href = defaultMeta.url, importMetaResolver = createImportMetaResolver();
451
+ return {
452
+ ...defaultMeta,
453
+ main: false,
454
+ resolve(id, parent) {
455
+ return (importMetaResolver ?? defaultMeta.resolve)(id, parent ?? href);
456
+ }
457
+ };
458
+ };
459
+ function createImportMetaResolver() {
460
+ if (import.meta.resolve) return (specifier, importer) => import.meta.resolve(specifier, importer);
461
+ }
443
462
  // @ts-expect-error overriding private method
444
463
  class VitestModuleRunner extends viteModuleRunner.ModuleRunner {
445
464
  mocker;
@@ -474,11 +493,10 @@ class VitestModuleRunner extends viteModuleRunner.ModuleRunner {
474
493
  }
475
494
  async import(rawId) {
476
495
  const resolved = await this.vitestOptions.transport.resolveId(rawId);
477
- return resolved ? super.import(resolved.url) : super.import(rawId);
496
+ return super.import(resolved ? resolved.url : rawId);
478
497
  }
479
498
  async fetchModule(url, importer) {
480
- const module = await this.cachedModule(url, importer);
481
- return module;
499
+ return await this.cachedModule(url, importer);
482
500
  }
483
501
  _cachedRequest(url, module, callstack = [], metadata) {
484
502
  // @ts-expect-error "cachedRequest" is private
@@ -547,11 +565,11 @@ const dispose = [];
547
565
  function listenForErrors(state) {
548
566
  dispose.forEach((fn) => fn()), dispose.length = 0;
549
567
  function catchError(err, type, event) {
550
- const worker = state(), listeners = process.listeners(event);
568
+ const worker = state();
551
569
  // if there is another listener, assume that it's handled by user code
552
570
  // one is Vitest's own listener
553
- if (listeners.length > 1) return;
554
- const error = processError(err);
571
+ if (process.listeners(event).length > 1) return;
572
+ const error = serializeValue(err);
555
573
  if (typeof error === "object" && error != null) {
556
574
  if (error.VITEST_TEST_NAME = worker.current?.type === "test" ? worker.current.name : void 0, worker.filepath) error.VITEST_TEST_PATH = worker.filepath;
557
575
  error.VITEST_AFTER_ENV_TEARDOWN = worker.environmentTeardownRun;
@@ -597,10 +615,7 @@ function startVitestModuleRunner(options) {
597
615
  if (isWindows) {
598
616
  if (id[1] === ":") {
599
617
  // The drive letter is different for whatever reason, we need to normalize it to CWD
600
- if (id[0] !== cwd[0] && id[0].toUpperCase() === cwd[0].toUpperCase()) {
601
- const isUpperCase = cwd[0].toUpperCase() === cwd[0];
602
- id = (isUpperCase ? id[0].toUpperCase() : id[0].toLowerCase()) + id.slice(1);
603
- }
618
+ if (id[0] !== cwd[0] && id[0].toUpperCase() === cwd[0].toUpperCase()) id = (cwd[0].toUpperCase() === cwd[0] ? id[0].toUpperCase() : id[0].toLowerCase()) + id.slice(1);
604
619
  // always mark absolute windows paths, otherwise Vite will externalize it
605
620
  id = `/@id/${id}`;
606
621
  }
@@ -625,14 +640,10 @@ function startVitestModuleRunner(options) {
625
640
  type: "builtin"
626
641
  };
627
642
  const result = await rpc().fetch(id, importer, environment(), options);
628
- if ("cached" in result) {
629
- const code = readFileSync(result.tmp, "utf-8");
630
- return {
631
- code,
632
- ...result
633
- };
634
- }
635
- return result;
643
+ return "cached" in result ? {
644
+ code: readFileSync(result.tmp, "utf-8"),
645
+ ...result
646
+ } : result;
636
647
  } catch (cause) {
637
648
  // rethrow vite error if it cannot load the module because it's not resolved
638
649
  if (typeof cause === "object" && cause != null && cause.code === "ERR_LOAD_URL" || typeof cause?.message === "string" && cause.message.includes("Failed to load url") || typeof cause?.message === "string" && cause.message.startsWith("Cannot find module '")) {
@@ -652,8 +663,6 @@ function startVitestModuleRunner(options) {
652
663
  vm,
653
664
  createImportMeta: options.createImportMeta
654
665
  });
655
- // await moduleRunner.import('/@vite/env')
656
- // await moduleRunner.mocker.initializeSpyModule()
657
666
  return moduleRunner;
658
667
  }
659
668
  function toBuiltin(id) {
@@ -662,4 +671,4 @@ function toBuiltin(id) {
662
671
  return id;
663
672
  }
664
673
 
665
- export { VitestModuleRunner as V, VITEST_VM_CONTEXT_SYMBOL as a, createNodeImportMeta as c, startVitestModuleRunner as s };
674
+ export { VitestModuleRunner as V, VITEST_VM_CONTEXT_SYMBOL as a, VitestTransport as b, createNodeImportMeta as c, startVitestModuleRunner as s };
@@ -1,13 +1,14 @@
1
1
  import { updateTask } from '@vitest/runner';
2
- import { createDefer, getSafeTimers } from '@vitest/utils';
3
- import { a as getBenchOptions, g as getBenchFn } from './benchmark.CJUa-Hsa.js';
4
- import { g as getWorkerState } from './utils.D2R2NiOH.js';
2
+ import { createDefer } from '@vitest/utils/helpers';
3
+ import { getSafeTimers } from '@vitest/utils/timers';
4
+ import { a as getBenchOptions, g as getBenchFn } from './benchmark.DHKMYAts.js';
5
+ import { g as getWorkerState } from './utils.CG9h5ccR.js';
5
6
  import { setState, GLOBAL_EXPECT, getState } from '@vitest/expect';
6
7
  import { getTests, getNames, getTestName } from '@vitest/runner/utils';
7
8
  import { processError } from '@vitest/utils/error';
8
9
  import { normalize } from 'pathe';
9
- import { a as getSnapshotClient, i as inject, c as createExpect, v as vi } from './vi.ZPgvtBao.js';
10
- import { r as rpc } from './rpc.BKr6mtxz.js';
10
+ import { a as getSnapshotClient, i as inject, c as createExpect, v as vi } from './vi.B2--mG9U.js';
11
+ import { r as rpc } from './rpc.cD77ENhU.js';
11
12
 
12
13
  function createBenchmarkResult(name) {
13
14
  return {
@@ -36,7 +37,7 @@ async function runBenchmarkSuite(suite, runner) {
36
37
  }, updateTask$1("suite-prepare", suite);
37
38
  const addBenchTaskListener = (task, benchmark) => {
38
39
  task.addEventListener("complete", (e) => {
39
- const task = e.task, taskRes = task.result, result = benchmark.result.benchmark;
40
+ const taskRes = e.task.result, result = benchmark.result.benchmark;
40
41
  benchmark.result.state = "pass", Object.assign(result, taskRes);
41
42
  // compute extra stats and free raw samples as early as possible
42
43
  const samples = result.samples;
@@ -93,7 +94,6 @@ class NodeBenchmarkRunner {
93
94
  }
94
95
  }
95
96
 
96
- // import type { VitestExecutor } from '../execute'
97
97
  // worker context is shared between all tests
98
98
  const workerContext = Object.create(null);
99
99
  class VitestTestRunner {