vitest 0.8.5 → 0.9.2

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.
@@ -1,9 +1,8 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.a6890356.js';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.7f0053fb.js';
2
2
  import { normalizePath } from 'vite';
3
- import { z as isWindows, A as mergeSlashes, h as dirname, f as basename, u as resolve } from './chunk-utils-base.aff0a195.js';
3
+ import { g as getWorkerState, B as isWindows, C as mergeSlashes, k as dirname, h as basename, w as resolve, s as slash } from './chunk-utils-global.10dcdfa6.js';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { d as distDir } from './chunk-constants.76cf224a.js';
6
- import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
5
+ import { d as distDir } from './chunk-constants.e59013dc.js';
7
6
 
8
7
  var __defProp = Object.defineProperty;
9
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -31,7 +30,9 @@ function getAllProperties(obj) {
31
30
  if (curr === Object.prototype || curr === Function.prototype || curr === RegExp.prototype)
32
31
  break;
33
32
  const props = Object.getOwnPropertyNames(curr);
33
+ const symbs = Object.getOwnPropertySymbols(curr);
34
34
  props.forEach((prop) => allProps.add(prop));
35
+ symbs.forEach((symb) => allProps.add(symb));
35
36
  } while (curr = Object.getPrototypeOf(curr));
36
37
  return Array.from(allProps);
37
38
  }
@@ -185,7 +186,7 @@ const _VitestMocker = class {
185
186
  async ensureSpy() {
186
187
  if (_VitestMocker.spyModule)
187
188
  return;
188
- _VitestMocker.spyModule = await this.request(resolve(distDir, "spy.js"));
189
+ _VitestMocker.spyModule = await this.request(`/@fs/${slash(resolve(distDir, "spy.js"))}`);
189
190
  }
190
191
  async requestWithMock(dep) {
191
192
  var _a;
@@ -0,0 +1,7 @@
1
+ import { g as getWorkerState } from './chunk-utils-global.10dcdfa6.js';
2
+
3
+ const rpc = () => {
4
+ return getWorkerState().rpc;
5
+ };
6
+
7
+ export { rpc as r };
@@ -248,6 +248,10 @@ const index = {
248
248
  ..._path
249
249
  };
250
250
 
251
+ function getWorkerState() {
252
+ return globalThis.__vitest_worker__;
253
+ }
254
+
251
255
  function notNullish(v) {
252
256
  return v != null;
253
257
  }
@@ -349,6 +353,19 @@ function partitionSuiteChildren(suite) {
349
353
  tasksGroups.push(tasksGroup);
350
354
  return tasksGroups;
351
355
  }
356
+ function resetModules() {
357
+ const modules = getWorkerState().moduleCache;
358
+ const vitestPaths = [
359
+ /\/vitest\/dist\//,
360
+ /vitest-virtual-\w+\/dist/,
361
+ /@vitest\/dist/
362
+ ];
363
+ modules.forEach((_, path) => {
364
+ if (vitestPaths.some((re) => re.test(path)))
365
+ return;
366
+ modules.delete(path);
367
+ });
368
+ }
352
369
  function getFullName(task) {
353
370
  return getNames(task).join(c.dim(" > "));
354
371
  }
@@ -405,4 +422,4 @@ function getCallLastIndex(code) {
405
422
  return null;
406
423
  }
407
424
 
408
- export { mergeSlashes as A, partitionSuiteChildren as B, hasTests as C, index as a, getNames as b, c, assertTypes as d, notNullish as e, basename as f, getCallLastIndex as g, dirname as h, isObject as i, join as j, isAbsolute as k, getFullName as l, hasFailed as m, noop as n, hasFailedSnapshot as o, getSuites as p, getTests as q, relative as r, slash as s, toArray as t, resolve as u, deepMerge as v, toNamespacedPath as w, ensurePackageInstalled as x, extname as y, isWindows as z };
425
+ export { extname as A, isWindows as B, mergeSlashes as C, partitionSuiteChildren as D, hasTests as E, index as a, getCallLastIndex as b, getNames as c, assertTypes as d, c as e, notNullish as f, getWorkerState as g, basename as h, isObject as i, join as j, dirname as k, isAbsolute as l, relative as m, noop as n, getTests as o, getFullName as p, hasFailed as q, resetModules as r, slash as s, toArray as t, hasFailedSnapshot as u, getSuites as v, resolve as w, deepMerge as x, toNamespacedPath as y, ensurePackageInstalled as z };