vitest 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/entry.js CHANGED
@@ -1,21 +1,20 @@
1
1
  import { promises } from 'fs';
2
- import { t as toArray, r as relative, B as partitionSuiteChildren, C as hasTests, m as hasFailed, l as getFullName } from './chunk-utils-base.8408f73a.js';
2
+ import { t as toArray, r as relative, B as partitionSuiteChildren, C as hasTests, m as hasFailed, l as getFullName } from './chunk-utils-base.aff0a195.js';
3
3
  import { Console } from 'console';
4
4
  import { Writable } from 'stream';
5
5
  import { importModule } from 'local-pkg';
6
- import { r as resetRunOnceCounter, i as index, R as RealDate, s as stringify, c as clearContext, d as defaultSuite, a as setHooks, g as getHooks, b as context, e as getSnapshotClient, f as setState, h as getFn, j as getState, v as vi } from './chunk-runtime-chain.766f27fd.js';
7
- import { r as rpc } from './chunk-runtime-rpc.e8aa1ebe.js';
8
- import { c as clearTimeout, s as setTimeout } from './chunk-utils-timers.7bdeea22.js';
6
+ import { r as resetRunOnceCounter, i as index, R as RealDate, s as stringify, c as clearContext, d as defaultSuite, a as setHooks, g as getHooks, b as context, e as getSnapshotClient, f as setState, h as getFn, j as getState, v as vi } from './chunk-runtime-chain.c86f1eb0.js';
7
+ import { r as rpc } from './chunk-runtime-rpc.5263102e.js';
9
8
  import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
10
- import { performance } from 'perf_hooks';
11
- import { t as takeCoverage } from './chunk-defaults.e5535971.js';
9
+ import { c as clearTimeout, s as setTimeout } from './chunk-utils-timers.5657f2a4.js';
10
+ import { t as takeCoverage } from './chunk-defaults.e85b72aa.js';
12
11
  import { createHash } from 'crypto';
13
12
  import { format } from 'util';
14
13
  import 'path';
15
14
  import 'tty';
16
15
  import 'chai';
17
16
  import './vendor-_commonjsHelpers.34b404ce.js';
18
- import './jest-mock.js';
17
+ import './spy.js';
19
18
  import 'tinyspy';
20
19
  import 'module';
21
20
  import 'url';
@@ -404,69 +403,100 @@ async function setupGlobalEnv(config) {
404
403
  globalSetup = true;
405
404
  setupConsoleLogSpy();
406
405
  if (config.globals)
407
- (await import('./chunk-integrations-globals.ade0c248.js')).registerApiGlobally();
406
+ (await import('./chunk-integrations-globals.3713535d.js')).registerApiGlobally();
408
407
  }
409
408
  function setupDefines(defines) {
410
409
  for (const key in defines)
411
410
  globalThis[key] = defines[key];
412
411
  }
413
412
  function setupConsoleLogSpy() {
414
- const stdoutBuffer = [];
415
- const stderrBuffer = [];
416
- let stdoutTime = 0;
417
- let stderrTime = 0;
418
- let timer;
419
- function schedule() {
420
- clearTimeout(timer);
421
- timer = setTimeout(() => {
413
+ const stdoutBuffer = /* @__PURE__ */ new Map();
414
+ const stderrBuffer = /* @__PURE__ */ new Map();
415
+ const timers = /* @__PURE__ */ new Map();
416
+ const unknownTestId = "__vitest__unknown_test__";
417
+ function schedule(taskId) {
418
+ const timer = timers.get(taskId);
419
+ const { stdoutTime, stderrTime } = timer;
420
+ clearTimeout(timer.timer);
421
+ timer.timer = setTimeout(() => {
422
422
  if (stderrTime < stdoutTime) {
423
- sendStderr();
424
- sendStdout();
423
+ sendStderr(taskId);
424
+ sendStdout(taskId);
425
425
  } else {
426
- sendStdout();
427
- sendStderr();
426
+ sendStdout(taskId);
427
+ sendStderr(taskId);
428
428
  }
429
429
  });
430
430
  }
431
- function sendStdout() {
432
- var _a;
433
- if (stdoutBuffer.length) {
431
+ function sendStdout(taskId) {
432
+ const buffer = stdoutBuffer.get(taskId);
433
+ if (buffer) {
434
+ const timer = timers.get(taskId);
434
435
  rpc().onUserConsoleLog({
435
436
  type: "stdout",
436
- content: stdoutBuffer.map((i) => String(i)).join(""),
437
- taskId: (_a = getWorkerState().current) == null ? void 0 : _a.id,
438
- time: stdoutTime || RealDate.now()
437
+ content: buffer.map((i) => String(i)).join(""),
438
+ taskId,
439
+ time: timer.stdoutTime || RealDate.now(),
440
+ size: buffer.length
439
441
  });
442
+ stdoutBuffer.set(taskId, []);
443
+ timer.stdoutTime = 0;
440
444
  }
441
- stdoutBuffer.length = 0;
442
- stdoutTime = 0;
443
445
  }
444
- function sendStderr() {
445
- var _a;
446
- if (stderrBuffer.length) {
446
+ function sendStderr(taskId) {
447
+ const buffer = stderrBuffer.get(taskId);
448
+ if (buffer) {
449
+ const timer = timers.get(taskId);
447
450
  rpc().onUserConsoleLog({
448
451
  type: "stderr",
449
- content: stderrBuffer.map((i) => String(i)).join(""),
450
- taskId: (_a = getWorkerState().current) == null ? void 0 : _a.id,
451
- time: stderrTime || RealDate.now()
452
+ content: buffer.map((i) => String(i)).join(""),
453
+ taskId,
454
+ time: timer.stderrTime || RealDate.now(),
455
+ size: buffer.length
452
456
  });
457
+ stderrBuffer.set(taskId, []);
458
+ timer.stderrTime = 0;
453
459
  }
454
- stderrBuffer.length = 0;
455
- stderrTime = 0;
456
460
  }
457
461
  const stdout = new Writable({
458
462
  write(data, encoding, callback) {
459
- stdoutTime = stdoutTime || RealDate.now();
460
- stdoutBuffer.push(data);
461
- schedule();
463
+ var _a, _b;
464
+ const id = ((_b = (_a = getWorkerState()) == null ? void 0 : _a.current) == null ? void 0 : _b.id) ?? unknownTestId;
465
+ let timer = timers.get(id);
466
+ if (timer) {
467
+ timer.stdoutTime = timer.stdoutTime || RealDate.now();
468
+ } else {
469
+ timer = { stdoutTime: RealDate.now(), stderrTime: RealDate.now(), timer: 0 };
470
+ timers.set(id, timer);
471
+ }
472
+ let buffer = stdoutBuffer.get(id);
473
+ if (!buffer) {
474
+ buffer = [];
475
+ stdoutBuffer.set(id, buffer);
476
+ }
477
+ buffer.push(data);
478
+ schedule(id);
462
479
  callback();
463
480
  }
464
481
  });
465
482
  const stderr = new Writable({
466
483
  write(data, encoding, callback) {
467
- stderrTime = stderrTime || RealDate.now();
468
- stderrBuffer.push(data);
469
- schedule();
484
+ var _a, _b;
485
+ const id = ((_b = (_a = getWorkerState()) == null ? void 0 : _a.current) == null ? void 0 : _b.id) ?? unknownTestId;
486
+ let timer = timers.get(id);
487
+ if (timer) {
488
+ timer.stderrTime = timer.stderrTime || RealDate.now();
489
+ } else {
490
+ timer = { stderrTime: RealDate.now(), stdoutTime: RealDate.now(), timer: 0 };
491
+ timers.set(id, timer);
492
+ }
493
+ let buffer = stderrBuffer.get(id);
494
+ if (!buffer) {
495
+ buffer = [];
496
+ stderrBuffer.set(id, buffer);
497
+ }
498
+ buffer.push(data);
499
+ schedule(id);
470
500
  callback();
471
501
  }
472
502
  });
@@ -549,6 +579,7 @@ Inner error message: ${err == null ? void 0 : err.message}`));
549
579
  }
550
580
  }
551
581
 
582
+ const now$1 = Date.now;
552
583
  function hash(str, length = 10) {
553
584
  return createHash("md5").update(str).digest("hex").slice(0, length);
554
585
  }
@@ -576,9 +607,9 @@ async function collectTests(paths, config) {
576
607
  } else if (c.type === "suite") {
577
608
  file.tasks.push(c);
578
609
  } else {
579
- const start = performance.now();
610
+ const start = now$1();
580
611
  const suite = await c.collect(file);
581
- file.collectDuration = performance.now() - start;
612
+ file.collectDuration = now$1() - start;
582
613
  if (suite.name || suite.tasks.length)
583
614
  file.tasks.push(suite);
584
615
  }
@@ -679,6 +710,7 @@ var __spreadValues = (a, b) => {
679
710
  return a;
680
711
  };
681
712
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
713
+ const now = Date.now;
682
714
  function updateSuiteHookState(suite, name, state) {
683
715
  var _a;
684
716
  if (!suite.result)
@@ -727,14 +759,14 @@ async function runTest(test) {
727
759
  updateTask(test);
728
760
  return;
729
761
  }
730
- const start = performance.now();
762
+ const start = now();
731
763
  test.result = {
732
764
  state: "run",
733
- startTime: Date.now()
765
+ startTime: start
734
766
  };
735
767
  updateTask(test);
736
768
  clearModuleMocks();
737
- getSnapshotClient().setTest(test);
769
+ await getSnapshotClient().setTest(test);
738
770
  const workerState = getWorkerState();
739
771
  workerState.current = test;
740
772
  try {
@@ -775,7 +807,7 @@ async function runTest(test) {
775
807
  }
776
808
  }
777
809
  getSnapshotClient().clearTest();
778
- test.result.duration = performance.now() - start;
810
+ test.result.duration = now() - start;
779
811
  workerState.current = void 0;
780
812
  updateTask(test);
781
813
  }
@@ -795,10 +827,10 @@ async function runSuite(suite) {
795
827
  updateTask(suite);
796
828
  return;
797
829
  }
798
- const start = performance.now();
830
+ const start = now();
799
831
  suite.result = {
800
832
  state: "run",
801
- startTime: Date.now()
833
+ startTime: start
802
834
  };
803
835
  updateTask(suite);
804
836
  if (suite.mode === "skip") {
@@ -822,7 +854,7 @@ async function runSuite(suite) {
822
854
  suite.result.error = processError(e);
823
855
  }
824
856
  }
825
- suite.result.duration = performance.now() - start;
857
+ suite.result.duration = now() - start;
826
858
  if (suite.mode === "run") {
827
859
  if (!hasTests(suite)) {
828
860
  suite.result.state = "fail";
package/dist/index.d.ts CHANGED
@@ -108,7 +108,7 @@ interface MatcherHintOptions {
108
108
  secondArgumentColor?: Formatter;
109
109
  }
110
110
  declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
111
- declare const stringify: (object: unknown, maxDepth?: number) => string;
111
+ declare const stringify: (object: unknown, maxDepth?: number, options?: PrettyFormatOptions | undefined) => string;
112
112
  declare const printReceived: (object: unknown) => string;
113
113
  declare const printExpected: (value: unknown) => string;
114
114
  interface DiffOptions {
@@ -280,11 +280,13 @@ declare class ViteNodeServer {
280
280
  }
281
281
 
282
282
  declare class SnapshotManager {
283
- config: ResolvedConfig;
283
+ options: SnapshotStateOptions;
284
284
  summary: SnapshotSummary;
285
- constructor(config: ResolvedConfig);
285
+ extension: string;
286
+ constructor(options: SnapshotStateOptions);
286
287
  clear(): void;
287
288
  add(result: SnapshotResult): void;
289
+ resolvePath(testPath: string): string;
288
290
  }
289
291
 
290
292
  declare type RunWithFiles = (files: string[], invalidates?: string[]) => Promise<void>;
@@ -506,6 +508,7 @@ interface UserConsoleLog {
506
508
  type: 'stdout' | 'stderr';
507
509
  taskId?: string;
508
510
  time: number;
511
+ size: number;
509
512
  }
510
513
  interface Position {
511
514
  source?: string;
@@ -788,6 +791,7 @@ interface SnapshotStateOptions {
788
791
  updateSnapshot: SnapshotUpdateState;
789
792
  expand?: boolean;
790
793
  snapshotFormat?: OptionsReceived;
794
+ resolveSnapshotPath?: (path: string, extension: string) => string;
791
795
  }
792
796
  interface SnapshotMatchOptions {
793
797
  testName: string;
@@ -1071,6 +1075,10 @@ interface InlineConfig {
1071
1075
  * Format options for snapshot testing.
1072
1076
  */
1073
1077
  snapshotFormat?: PrettyFormatOptions;
1078
+ /**
1079
+ * Resolve custom snapshot path
1080
+ */
1081
+ resolveSnapshotPath?: (path: string, extension: string) => string;
1074
1082
  }
1075
1083
  interface UserConfig extends InlineConfig {
1076
1084
  /**
@@ -1111,7 +1119,7 @@ interface UserConfig extends InlineConfig {
1111
1119
  */
1112
1120
  changed?: boolean | string;
1113
1121
  }
1114
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters'> {
1122
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath'> {
1115
1123
  base?: string;
1116
1124
  config?: string;
1117
1125
  filters?: string[];
@@ -1158,6 +1166,7 @@ interface WorkerRPC {
1158
1166
  onCollected: (files: File[]) => void;
1159
1167
  onTaskUpdate: (pack: TaskResultPack[]) => void;
1160
1168
  snapshotSaved: (snapshot: SnapshotResult) => void;
1169
+ resolveSnapshotPath: (testPath: string) => string;
1161
1170
  }
1162
1171
  interface WorkerGlobalState {
1163
1172
  ctx: WorkerContext;
@@ -1213,11 +1222,12 @@ interface MockResultThrow {
1213
1222
  value: any;
1214
1223
  }
1215
1224
  declare type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
1216
- interface JestMockCompatContext<TArgs, TReturns> {
1225
+ interface SpyContext<TArgs, TReturns> {
1217
1226
  calls: TArgs[];
1218
1227
  instances: TReturns[];
1219
1228
  invocationCallOrder: number[];
1220
1229
  results: MockResult<TReturns>[];
1230
+ lastCall: TArgs | undefined;
1221
1231
  }
1222
1232
  declare type Procedure = (...args: any[]) => any;
1223
1233
  declare type Methods<T> = {
@@ -1232,7 +1242,7 @@ declare type Classes<T> = {
1232
1242
  interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
1233
1243
  getMockName(): string;
1234
1244
  mockName(n: string): this;
1235
- mock: JestMockCompatContext<TArgs, TReturns>;
1245
+ mock: SpyContext<TArgs, TReturns>;
1236
1246
  mockClear(): this;
1237
1247
  mockReset(): this;
1238
1248
  mockRestore(): void;
@@ -1249,6 +1259,7 @@ interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
1249
1259
  }
1250
1260
  interface SpyInstanceFn<TArgs extends any[] = any, TReturns = any> extends SpyInstance<TArgs, TReturns> {
1251
1261
  (...args: TArgs): TReturns;
1262
+ new (...args: TArgs): TReturns;
1252
1263
  }
1253
1264
  declare type MaybeMockedConstructor<T> = T extends new (...args: Array<any>) => infer R ? SpyInstanceFn<ConstructorParameters<T>, R> : T;
1254
1265
  declare type MockedFunction<T extends Procedure> = MockWithArgs<T> & {
@@ -1272,8 +1283,6 @@ interface MockWithArgs<T extends Procedure> extends SpyInstanceFn<Parameters<T>,
1272
1283
  new (...args: T extends new (...args: any) => any ? ConstructorParameters<T> : never): T;
1273
1284
  (...args: Parameters<T>): ReturnType<T>;
1274
1285
  }
1275
- declare const spies: Set<SpyInstance<any[], any>>;
1276
- declare function isMockFunction(fn: any): fn is EnhancedSpy;
1277
1286
  declare function spyOn<T, S extends Properties<Required<T>>>(obj: T, methodName: S, accessType: 'get'): SpyInstance<[], T[S]>;
1278
1287
  declare function spyOn<T, G extends Properties<Required<T>>>(obj: T, methodName: G, accessType: 'set'): SpyInstance<[T[G]], void>;
1279
1288
  declare function spyOn<T, M extends (Methods<Required<T>> | Classes<Required<T>>)>(obj: T, methodName: M): Required<T>[M] extends (...args: infer A) => infer R | (new (...args: infer A) => infer R) ? SpyInstance<A, R> : never;
@@ -1367,7 +1376,7 @@ declare class VitestUtils {
1367
1376
  * using jsdom/happy-dom and want to mock global variables, like
1368
1377
  * `IntersectionObserver`.
1369
1378
  */
1370
- stubGlobal(name: string, value: any): this;
1379
+ stubGlobal(name: string | symbol | number, value: any): this;
1371
1380
  }
1372
1381
  declare const vitest: VitestUtils;
1373
1382
  declare const vi: VitestUtils;
@@ -1498,4 +1507,4 @@ declare global {
1498
1507
  }
1499
1508
  }
1500
1509
 
1501
- export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, JestMockCompatContext, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MergeInsertions, MockWithArgs, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, getRunningMode, isFirstRun, isMockFunction, isWatchMode, it, runOnce, spies, spyOn, suite, test, vi, vitest };
1510
+ export { ApiConfig, ArgumentsType$1 as ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, C8Options, Constructable, CoverageReporter, DeepMerge, DoneCallback, EnhancedSpy, Environment, EnvironmentOptions, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JSDOMOptions, MergeInsertions, ModuleCache, ModuleGraphData, MutableArray, Nullable, ParsedStack, Position, Reporter, ResolveIdFunction, ResolvedC8Options, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, SpyContext, SpyInstance, SpyInstanceFn, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestAPI, TestFunction, TransformResultWithSource, UncheckedSnapshot, UserConfig, UserConsoleLog, Vitest, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerGlobalState, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, getRunningMode, isFirstRun, isWatchMode, it, runOnce, suite, test, vi, vitest };
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- export { q as afterAll, w as afterEach, p as beforeAll, u as beforeEach, l as describe, x as expect, z as getRunningMode, o as isFirstRun, A as isWatchMode, m as it, n as runOnce, k as suite, t as test, v as vi, y as vitest } from './chunk-runtime-chain.766f27fd.js';
2
- export { fn, isMockFunction, spies, spyOn } from './jest-mock.js';
1
+ export { q as afterAll, w as afterEach, p as beforeAll, u as beforeEach, l as describe, x as expect, z as getRunningMode, o as isFirstRun, A as isWatchMode, m as it, n as runOnce, k as suite, t as test, v as vi, y as vitest } from './chunk-runtime-chain.c86f1eb0.js';
3
2
  export { assert, default as chai, should } from 'chai';
4
3
  import 'util';
5
- import './chunk-utils-base.8408f73a.js';
4
+ import './chunk-utils-base.aff0a195.js';
6
5
  import 'path';
7
6
  import 'tty';
8
7
  import 'local-pkg';
9
8
  import './chunk-utils-global.7bcfa03c.js';
10
- import './chunk-utils-timers.7bdeea22.js';
9
+ import './chunk-utils-timers.5657f2a4.js';
11
10
  import './vendor-_commonjsHelpers.34b404ce.js';
12
- import './chunk-runtime-rpc.e8aa1ebe.js';
11
+ import './chunk-runtime-rpc.5263102e.js';
13
12
  import 'fs';
13
+ import './spy.js';
14
14
  import 'tinyspy';
package/dist/node.d.ts CHANGED
@@ -329,6 +329,7 @@ interface UserConsoleLog {
329
329
  type: 'stdout' | 'stderr';
330
330
  taskId?: string;
331
331
  time: number;
332
+ size: number;
332
333
  }
333
334
  interface Position {
334
335
  source?: string;
@@ -551,6 +552,7 @@ interface SnapshotStateOptions {
551
552
  updateSnapshot: SnapshotUpdateState;
552
553
  expand?: boolean;
553
554
  snapshotFormat?: OptionsReceived;
555
+ resolveSnapshotPath?: (path: string, extension: string) => string;
554
556
  }
555
557
  interface SnapshotResult {
556
558
  filepath: string;
@@ -826,6 +828,10 @@ interface InlineConfig {
826
828
  * Format options for snapshot testing.
827
829
  */
828
830
  snapshotFormat?: PrettyFormatOptions;
831
+ /**
832
+ * Resolve custom snapshot path
833
+ */
834
+ resolveSnapshotPath?: (path: string, extension: string) => string;
829
835
  }
830
836
  interface UserConfig extends InlineConfig {
831
837
  /**
@@ -866,7 +872,7 @@ interface UserConfig extends InlineConfig {
866
872
  */
867
873
  changed?: boolean | string;
868
874
  }
869
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters'> {
875
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related' | 'api' | 'reporters' | 'resolveSnapshotPath'> {
870
876
  base?: string;
871
877
  config?: string;
872
878
  filters?: string[];
@@ -882,11 +888,13 @@ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters'
882
888
  declare type MockMap = Map<string, Record<string, string | null | (() => unknown)>>;
883
889
 
884
890
  declare class SnapshotManager {
885
- config: ResolvedConfig;
891
+ options: SnapshotStateOptions;
886
892
  summary: SnapshotSummary;
887
- constructor(config: ResolvedConfig);
893
+ extension: string;
894
+ constructor(options: SnapshotStateOptions);
888
895
  clear(): void;
889
896
  add(result: SnapshotResult): void;
897
+ resolvePath(testPath: string): string;
890
898
  }
891
899
 
892
900
  declare type RunWithFiles = (files: string[], invalidates?: string[]) => Promise<void>;
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.8c747551.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.d320e5e9.js';
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.e472da7d.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.7cc59bee.js';
3
3
  import 'buffer';
4
4
  import 'path';
5
5
  import 'child_process';
@@ -13,17 +13,17 @@ import 'stream';
13
13
  import 'util';
14
14
  import 'url';
15
15
  import 'os';
16
- import './chunk-utils-base.8408f73a.js';
16
+ import './chunk-utils-base.aff0a195.js';
17
17
  import 'tty';
18
18
  import 'local-pkg';
19
19
  import 'vite';
20
- import './chunk-constants.6062c404.js';
21
- import './chunk-vite-node-utils.3c7ce184.js';
20
+ import './chunk-constants.76cf224a.js';
21
+ import './chunk-vite-node-utils.a6890356.js';
22
22
  import 'module';
23
23
  import 'vm';
24
- import './chunk-defaults.e5535971.js';
24
+ import './chunk-defaults.e85b72aa.js';
25
25
  import 'perf_hooks';
26
- import './chunk-utils-timers.7bdeea22.js';
26
+ import './chunk-utils-timers.5657f2a4.js';
27
27
  import 'worker_threads';
28
28
  import 'tinypool';
29
29
  import './chunk-magic-string.d5e0e473.js';
@@ -34,6 +34,9 @@ function enhanceSpy(spy) {
34
34
  const type = callType === "error" ? "throw" : "return";
35
35
  return { type, value };
36
36
  });
37
+ },
38
+ get lastCall() {
39
+ return stub.calls.at(-1);
37
40
  }
38
41
  };
39
42
  let onceImplementations = [];
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
- import { u as resolve } from './chunk-utils-base.8408f73a.js';
2
- import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.3c7ce184.js';
3
- import { d as distDir } from './chunk-constants.6062c404.js';
4
- import { e as executeInViteNode } from './chunk-runtime-mocker.d320e5e9.js';
5
- import { r as rpc } from './chunk-runtime-rpc.e8aa1ebe.js';
1
+ import { u as resolve } from './chunk-utils-base.aff0a195.js';
2
+ import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.a6890356.js';
3
+ import { d as distDir } from './chunk-constants.76cf224a.js';
4
+ import { e as executeInViteNode } from './chunk-runtime-mocker.7cc59bee.js';
5
+ import { r as rpc } from './chunk-runtime-rpc.5263102e.js';
6
6
  import { g as getWorkerState } from './chunk-utils-global.7bcfa03c.js';
7
7
  import 'path';
8
8
  import 'tty';
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.8.4",
3
+ "type": "module",
4
+ "version": "0.8.5",
4
5
  "description": "A blazing fast unit test framework powered by Vite",
5
6
  "keywords": [
6
7
  "vite",
@@ -13,19 +14,15 @@
13
14
  "url": "https://github.com/vitest-dev/vitest/issues"
14
15
  },
15
16
  "license": "MIT",
17
+ "author": "Anthony Fu <anthonyfu117@hotmail.com>",
16
18
  "repository": {
17
19
  "type": "git",
18
20
  "url": "git+https://github.com/vitest-dev/vitest.git"
19
21
  },
20
22
  "funding": "https://github.com/sponsors/antfu",
21
- "author": "Anthony Fu <anthonyfu117@hotmail.com>",
22
- "type": "module",
23
- "files": [
24
- "dist",
25
- "bin",
26
- "*.d.ts",
27
- "*.mjs"
28
- ],
23
+ "main": "./dist/index.js",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
29
26
  "exports": {
30
27
  ".": {
31
28
  "import": "./dist/index.js",
@@ -48,9 +45,12 @@
48
45
  "types": "./config.d.ts"
49
46
  }
50
47
  },
51
- "main": "./dist/index.js",
52
- "module": "./dist/index.js",
53
- "types": "./dist/index.d.ts",
48
+ "files": [
49
+ "dist",
50
+ "bin",
51
+ "*.d.ts",
52
+ "*.mjs"
53
+ ],
54
54
  "bin": {
55
55
  "vitest": "./vitest.mjs"
56
56
  },
@@ -81,7 +81,7 @@
81
81
  "local-pkg": "^0.4.1",
82
82
  "tinypool": "^0.1.2",
83
83
  "tinyspy": "^0.3.0",
84
- "vite": "^2.8.6"
84
+ "vite": "^2.9.1"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@antfu/install-pkg": "^0.1.0",
@@ -93,7 +93,7 @@
93
93
  "@types/node": "^17.0.23",
94
94
  "@types/prompts": "^2.4.0",
95
95
  "@types/sinonjs__fake-timers": "^8.1.2",
96
- "@vitest/ui": "0.8.4",
96
+ "@vitest/ui": "0.8.5",
97
97
  "birpc": "^0.2.2",
98
98
  "c8": "^7.11.0",
99
99
  "cac": "^6.7.12",
@@ -104,7 +104,7 @@
104
104
  "fast-glob": "^3.2.11",
105
105
  "find-up": "^6.3.0",
106
106
  "flatted": "^3.2.5",
107
- "happy-dom": "^2.53.1",
107
+ "happy-dom": "^2.55.0",
108
108
  "jsdom": "^19.0.0",
109
109
  "log-update": "^5.0.0",
110
110
  "magic-string": "^0.26.1",
@@ -120,7 +120,7 @@
120
120
  "source-map-js": "^1.0.2",
121
121
  "strip-ansi": "^7.0.1",
122
122
  "typescript": "^4.6.3",
123
- "vite-node": "0.8.4",
123
+ "vite-node": "0.8.5",
124
124
  "ws": "^8.5.0"
125
125
  },
126
126
  "engines": {