vitest 0.0.121 → 0.0.125

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,11 +1,11 @@
1
- import { g as globalApis } from './constants-22bbd600.js';
2
- import { i as index } from './index-32bc2073.js';
1
+ import { g as globalApis } from './constants-8b3a9b31.js';
2
+ import { i as index } from './index-7f52a6d6.js';
3
3
  import 'url';
4
- import './index-090545ef.js';
4
+ import './index-9fdde2e8.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
- import './vi-db2bc738.js';
8
+ import './vi-56df0b20.js';
9
9
  import './_commonjsHelpers-c9e3b764.js';
10
10
  import './jest-mock-038a01b3.js';
11
11
  import 'chai';
@@ -1,16 +1,16 @@
1
- import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1 } from './index-090545ef.js';
1
+ import fs$8, { promises, existsSync } from 'fs';
2
+ import { c, s as slash$1, a as isAbsolute, r as relative, d as dirname, b as basename, g as getFullName, h as hasFailed, f as getSuites, j as getTests, t as toArray, k as resolve, l as deepMerge, m as toFilePath, n as noop$1, e as ensurePackageInstalled } from './index-9fdde2e8.js';
2
3
  import { createServer, mergeConfig } from 'vite';
3
4
  import path$a from 'path';
4
5
  import process$1 from 'process';
5
- import fs$8, { promises, existsSync } from 'fs';
6
6
  import require$$0 from 'os';
7
7
  import require$$0$1 from 'util';
8
8
  import require$$0$2 from 'stream';
9
9
  import require$$2 from 'events';
10
- import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-22bbd600.js';
10
+ import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-8b3a9b31.js';
11
11
  import MagicString from './magic-string.es-94000aea.js';
12
12
  import { performance } from 'perf_hooks';
13
- import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-a295cb37.js';
13
+ import { F as F_POINTER, a as F_DOWN, s as stripAnsi, b as F_LONG_DASH, c as F_DOWN_RIGHT, d as F_DOT, e as F_CHECK, f as F_CROSS, g as F_RIGHT, p as printError, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as cliTruncate } from './diff-3adb959a.js';
14
14
  import { o as onetime, s as signalExit } from './index-648e7ab2.js';
15
15
  import { createRequire } from 'module';
16
16
  import { pathToFileURL } from 'url';
@@ -6840,7 +6840,7 @@ const MocksPlugin = () => {
6840
6840
  if (m) {
6841
6841
  return {
6842
6842
  code: m.toString(),
6843
- map: m.generateMap()
6843
+ map: m.generateMap({ hires: true })
6844
6844
  };
6845
6845
  }
6846
6846
  }
@@ -7058,9 +7058,9 @@ ${c.bold(c.inverse(c.green(" PASS ")))}${c.green(" Waiting for file changes...")
7058
7058
  await this.printTaskErrors(failedTests, errorDivider);
7059
7059
  }
7060
7060
  const executionTime = this.end - this.start;
7061
- const threadTime = tests.reduce((acc, test) => {
7061
+ const threadTime = files.reduce((acc, test) => {
7062
7062
  var _a;
7063
- return acc + (((_a = test.result) == null ? void 0 : _a.end) ? test.result.end - test.result.start : 0);
7063
+ return acc + (((_a = test.result) == null ? void 0 : _a.duration) || 0) + (test.collectDuration || 0);
7064
7064
  }, 0);
7065
7065
  const padTitle = (str) => c.dim(`${str.padStart(10)} `);
7066
7066
  const time = (time2) => {
@@ -7618,10 +7618,9 @@ function renderTree(tasks, options, level = 0) {
7618
7618
  suffix += c.dim(` (${getTests(task).length})`);
7619
7619
  if (task.mode === "skip" || task.mode === "todo")
7620
7620
  suffix += ` ${c.dim(c.gray("[skipped]"))}`;
7621
- if ((_a = task.result) == null ? void 0 : _a.end) {
7622
- const duration = task.result.end - task.result.start;
7623
- if (duration > DURATION_LONG)
7624
- suffix += c.yellow(` ${Math.round(duration)}${c.dim("ms")}`);
7621
+ if (((_a = task.result) == null ? void 0 : _a.duration) != null) {
7622
+ if (task.result.duration > DURATION_LONG)
7623
+ suffix += c.yellow(` ${Math.round(task.result.duration)}${c.dim("ms")}`);
7625
7624
  }
7626
7625
  let name = task.name;
7627
7626
  if (level === 0)
@@ -7946,7 +7945,7 @@ var __spreadValues = (a, b) => {
7946
7945
  };
7947
7946
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7948
7947
  function resolveConfig(options, viteConfig) {
7949
- var _a, _b;
7948
+ var _a, _b, _c, _d;
7950
7949
  if (options.dom)
7951
7950
  options.environment = "happy-dom";
7952
7951
  const resolved = __spreadProps(__spreadValues({}, deepMerge(options, viteConfig.test)), {
@@ -7955,9 +7954,10 @@ function resolveConfig(options, viteConfig) {
7955
7954
  resolved.coverage = resolveC8Options(resolved.coverage, resolved.root);
7956
7955
  resolved.depsInline = [...((_a = resolved.deps) == null ? void 0 : _a.inline) || []];
7957
7956
  resolved.depsExternal = [...((_b = resolved.deps) == null ? void 0 : _b.external) || []];
7957
+ resolved.fallbackCJS = ((_c = resolved.deps) == null ? void 0 : _c.fallbackCJS) ?? true;
7958
+ resolved.interpretDefault = ((_d = resolved.deps) == null ? void 0 : _d.interpretDefault) ?? true;
7958
7959
  resolved.environment = resolved.environment || "node";
7959
7960
  resolved.threads = resolved.threads ?? true;
7960
- resolved.interpretDefault = resolved.interpretDefault ?? true;
7961
7961
  resolved.clearMocks = resolved.clearMocks ?? false;
7962
7962
  resolved.restoreMocks = resolved.restoreMocks ?? false;
7963
7963
  resolved.mockReset = resolved.mockReset ?? false;
@@ -7980,8 +7980,8 @@ function resolveConfig(options, viteConfig) {
7980
7980
  resolved.setupFiles = Array.from(resolved.setupFiles || []).map((i) => resolve(resolved.root, i));
7981
7981
  if (resolved.api === true)
7982
7982
  resolved.api = defaultPort;
7983
- if (options.findRelatedTests)
7984
- resolved.findRelatedTests = toArray(options.findRelatedTests).map((file) => resolve(resolved.root, file));
7983
+ if (options.related)
7984
+ resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
7985
7985
  return resolved;
7986
7986
  }
7987
7987
 
@@ -8188,7 +8188,7 @@ class Vitest {
8188
8188
  }
8189
8189
  async start(filters) {
8190
8190
  this.report("onInit", this);
8191
- const files = await this.globTestFiles(filters);
8191
+ const files = await this.filterTestsBySource(await this.globTestFiles(filters));
8192
8192
  if (!files.length) {
8193
8193
  if (this.config.passWithNoTests)
8194
8194
  this.log("No test files found\n");
@@ -8202,6 +8202,42 @@ class Vitest {
8202
8202
  if (this.config.coverage.enabled)
8203
8203
  await reportCoverage(this);
8204
8204
  }
8205
+ async getTestDependencies(filepath) {
8206
+ const deps = new Set();
8207
+ const addImports = async (filepath2) => {
8208
+ const transformed = await this.server.transformRequest(filepath2, { ssr: true });
8209
+ if (!transformed)
8210
+ return;
8211
+ const dependencies = [...transformed.deps || [], ...transformed.dynamicDeps || []];
8212
+ for (const dep of dependencies) {
8213
+ const path = await this.server.pluginContainer.resolveId(dep, filepath2, { ssr: true });
8214
+ const fsPath = path && !path.external && path.id.split("?")[0];
8215
+ if (fsPath && !fsPath.includes("node_modules") && !deps.has(fsPath) && existsSync(fsPath)) {
8216
+ deps.add(fsPath);
8217
+ await addImports(fsPath);
8218
+ }
8219
+ }
8220
+ };
8221
+ await addImports(filepath);
8222
+ return deps;
8223
+ }
8224
+ async filterTestsBySource(tests) {
8225
+ const related = this.config.related;
8226
+ if (!related)
8227
+ return tests;
8228
+ if (!related.length)
8229
+ return [];
8230
+ const testDeps = await Promise.all(tests.map(async (filepath) => {
8231
+ const deps = await this.getTestDependencies(filepath);
8232
+ return [filepath, deps];
8233
+ }));
8234
+ const runningTests = [];
8235
+ for (const [filepath, deps] of testDeps) {
8236
+ if (deps.size && related.some((path) => deps.has(path)))
8237
+ runningTests.push(filepath);
8238
+ }
8239
+ return runningTests;
8240
+ }
8205
8241
  async runFiles(files) {
8206
8242
  await this.runningPromise;
8207
8243
  this.runningPromise = (async () => {
@@ -8345,6 +8381,12 @@ async function createVitest(options, viteOverrides = {}) {
8345
8381
  const root = resolve(options.root || process.cwd());
8346
8382
  const configPath = options.config ? resolve(root, options.config) : await findUp(configFiles, { cwd: root });
8347
8383
  let haveStarted = false;
8384
+ async function UIPlugin() {
8385
+ if (!options.open)
8386
+ return;
8387
+ await ensurePackageInstalled("@vitest/ui");
8388
+ return (await import('@vitest/ui')).default();
8389
+ }
8348
8390
  const config = {
8349
8391
  root,
8350
8392
  logLevel: "error",
@@ -8359,29 +8401,26 @@ async function createVitest(options, viteOverrides = {}) {
8359
8401
  await ctx.setServer(options, server2);
8360
8402
  haveStarted = true;
8361
8403
  if (options.api)
8362
- (await import('./setup-c9c7cb5b.js')).setup(ctx);
8404
+ (await import('./setup-b0d2ca33.js')).setup(ctx);
8363
8405
  }
8364
8406
  },
8365
- MocksPlugin()
8407
+ MocksPlugin(),
8408
+ await UIPlugin()
8366
8409
  ],
8367
8410
  server: {
8368
- open: options.open,
8369
- strictPort: true
8411
+ open: options.open ? "/__vitest__/" : void 0,
8412
+ strictPort: true,
8413
+ preTransformRequests: false
8370
8414
  },
8371
8415
  build: {
8372
8416
  sourcemap: true
8373
- },
8374
- optimizeDeps: {
8375
- exclude: [
8376
- "vitest"
8377
- ]
8378
8417
  }
8379
8418
  };
8380
8419
  const server = await createServer(mergeConfig(config, viteOverrides));
8381
8420
  await server.pluginContainer.buildStart({});
8382
8421
  if (options.api === true)
8383
8422
  options.api = defaultPort;
8384
- if (options.open && !options.api)
8423
+ if (options.open && typeof options.api !== "number")
8385
8424
  options.api = defaultPort;
8386
8425
  if (typeof options.api === "number")
8387
8426
  await server.listen(options.api);
@@ -1,4 +1,4 @@
1
- import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-db2bc738.js';
1
+ import { g as getCurrentSuite, w as withTimeout, a as getDefaultHookTimeout, b as getState, s as setState, c as suite, t as test, d as describe, i as it, v as vitest, e as vi } from './vi-56df0b20.js';
2
2
  import chai, { assert, should } from 'chai';
3
3
  import { s as spies, a as spyOn, f as fn } from './jest-mock-038a01b3.js';
4
4
 
@@ -249,13 +249,6 @@ const index = {
249
249
  ..._path
250
250
  };
251
251
 
252
- const isWindows = process.platform === "win32";
253
- function toArray(array) {
254
- array = array || [];
255
- if (Array.isArray(array))
256
- return array;
257
- return [array];
258
- }
259
252
  function notNullish(v) {
260
253
  return v != null;
261
254
  }
@@ -267,32 +260,20 @@ function mergeSlashes(str) {
267
260
  }
268
261
  const noop = () => {
269
262
  };
270
- function partitionSuiteChildren(suite) {
271
- let tasksGroup = [];
272
- const tasksGroups = [];
273
- for (const c2 of suite.tasks) {
274
- if (tasksGroup.length === 0 || c2.computeMode === tasksGroup[0].computeMode) {
275
- tasksGroup.push(c2);
276
- } else {
277
- tasksGroups.push(tasksGroup);
278
- tasksGroup = [c2];
279
- }
280
- }
281
- if (tasksGroup.length > 0)
282
- tasksGroups.push(tasksGroup);
283
- return tasksGroups;
263
+ function toArray(array) {
264
+ array = array || [];
265
+ if (Array.isArray(array))
266
+ return array;
267
+ return [array];
284
268
  }
285
269
  function getTests(suite) {
286
- return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c2) => c2.type === "test" ? [c2] : getTests(c2)));
287
- }
288
- function getTasks(tasks) {
289
- return toArray(tasks).flatMap((s) => s.type === "test" ? [s] : [s, ...getTasks(s.tasks)]);
270
+ return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c) => c.type === "test" ? [c] : getTests(c)));
290
271
  }
291
272
  function getSuites(suite) {
292
273
  return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []);
293
274
  }
294
275
  function hasTests(suite) {
295
- return toArray(suite).some((s) => s.tasks.some((c2) => c2.type === "test" || hasTests(c2)));
276
+ return toArray(suite).some((s) => s.tasks.some((c) => c.type === "test" || hasTests(c)));
296
277
  }
297
278
  function hasFailed(suite) {
298
279
  return toArray(suite).some((s) => {
@@ -310,6 +291,23 @@ function getNames(task) {
310
291
  }
311
292
  return names;
312
293
  }
294
+
295
+ const isWindows = process.platform === "win32";
296
+ function partitionSuiteChildren(suite) {
297
+ let tasksGroup = [];
298
+ const tasksGroups = [];
299
+ for (const c2 of suite.tasks) {
300
+ if (tasksGroup.length === 0 || c2.concurrent === tasksGroup[0].concurrent) {
301
+ tasksGroup.push(c2);
302
+ } else {
303
+ tasksGroups.push(tasksGroup);
304
+ tasksGroup = [c2];
305
+ }
306
+ }
307
+ if (tasksGroup.length > 0)
308
+ tasksGroups.push(tasksGroup);
309
+ return tasksGroups;
310
+ }
313
311
  function getFullName(task) {
314
312
  return getNames(task).join(c.dim(" > "));
315
313
  }
@@ -365,4 +363,4 @@ function toFilePath(id, root) {
365
363
  return isWindows && absolute.startsWith("/") ? fileURLToPath(pathToFileURL(absolute.slice(1)).href) : absolute;
366
364
  }
367
365
 
368
- export { isAbsolute as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getFullName as g, hasFailed as h, isObject as i, getTests as j, resolve as k, deepMerge as l, toFilePath as m, noop as n, notNullish as o, mergeSlashes as p, join as q, relative as r, slash as s, toArray as t, index as u, getNames as v, partitionSuiteChildren as w, hasTests as x, isWindows as y, getTasks as z };
366
+ export { isAbsolute as a, basename as b, c, dirname as d, ensurePackageInstalled as e, getSuites as f, getFullName as g, hasFailed as h, isObject as i, getTests as j, resolve as k, deepMerge as l, toFilePath as m, noop as n, notNullish as o, mergeSlashes as p, join as q, relative as r, slash as s, toArray as t, index as u, getNames as v, partitionSuiteChildren as w, hasTests as x };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import { OptionsReceived, Plugin } from 'pretty-format';
1
2
  import { Formatter } from 'picocolors/types';
2
3
  import { ViteDevServer } from 'vite';
3
4
  import { RawSourceMap } from 'source-map-js';
4
- import { OptionsReceived } from 'pretty-format';
5
5
  import { MessagePort } from 'worker_threads';
6
6
  import { SpyImpl } from 'tinyspy';
7
7
  export { Spy, SpyFn } from 'tinyspy';
@@ -212,6 +212,8 @@ declare class Vitest {
212
212
  constructor();
213
213
  setServer(options: UserConfig, server: ViteDevServer): Promise<void>;
214
214
  start(filters?: string[]): Promise<void>;
215
+ private getTestDependencies;
216
+ filterTestsBySource(tests: string[]): Promise<string[]>;
215
217
  runFiles(files: string[]): Promise<void>;
216
218
  log(...args: any[]): void;
217
219
  error(...args: any[]): void;
@@ -369,6 +371,18 @@ interface ParsedStack {
369
371
  file: string;
370
372
  line: number;
371
373
  column: number;
374
+ sourcePos?: Position;
375
+ }
376
+ interface ErrorWithDiff extends Error {
377
+ name: string;
378
+ nameStr?: string;
379
+ stack?: string;
380
+ stackStr?: string;
381
+ stacks?: ParsedStack[];
382
+ showDiff?: boolean;
383
+ actual?: any;
384
+ expected?: any;
385
+ operator?: string;
372
386
  }
373
387
 
374
388
  declare type ChainableFunction<T extends string, Args extends any[], R = any> = {
@@ -379,21 +393,19 @@ declare type ChainableFunction<T extends string, Args extends any[], R = any> =
379
393
 
380
394
  declare type RunMode = 'run' | 'skip' | 'only' | 'todo';
381
395
  declare type TaskState = RunMode | 'pass' | 'fail';
382
- declare type ComputeMode = 'serial' | 'concurrent';
383
396
  interface TaskBase {
384
397
  id: string;
385
398
  name: string;
386
399
  mode: RunMode;
387
- computeMode: ComputeMode;
400
+ concurrent?: boolean;
388
401
  suite?: Suite;
389
402
  file?: File;
390
403
  result?: TaskResult;
391
404
  }
392
405
  interface TaskResult {
393
406
  state: TaskState;
394
- start: number;
395
- end?: number;
396
- error?: unknown;
407
+ duration?: number;
408
+ error?: ErrorWithDiff;
397
409
  }
398
410
  declare type TaskResultPack = [id: string, result: TaskResult | undefined];
399
411
  interface Suite extends TaskBase {
@@ -402,6 +414,7 @@ interface Suite extends TaskBase {
402
414
  }
403
415
  interface File extends Suite {
404
416
  filepath: string;
417
+ collectDuration?: number;
405
418
  }
406
419
  interface Test extends TaskBase {
407
420
  type: 'test';
@@ -529,6 +542,20 @@ interface InlineConfig {
529
542
  * This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
530
543
  */
531
544
  inline?: (string | RegExp)[];
545
+ /**
546
+ * Interpret CJS module's default as named exports
547
+ *
548
+ * @default true
549
+ */
550
+ interpretDefault?: boolean;
551
+ /**
552
+ * When a dependency is a valid ESM package, try to guess the cjs version based on the path.
553
+ * This will significantly improve the performance in huge repo, but might potentially
554
+ * cause some misalignment if a package have different logic in ESM and CJS mode.
555
+ *
556
+ * @default true
557
+ */
558
+ fallbackCJS?: boolean;
532
559
  };
533
560
  /**
534
561
  * Register apis globally
@@ -582,7 +609,6 @@ interface InlineConfig {
582
609
  * @default available CPUs
583
610
  */
584
611
  minThreads?: number;
585
- interpretDefault?: boolean;
586
612
  /**
587
613
  * Default timeout of a test in milliseconds
588
614
  *
@@ -681,15 +707,17 @@ interface UserConfig extends InlineConfig {
681
707
  /**
682
708
  * Run tests that cover a list of source files
683
709
  */
684
- findRelatedTests?: string[] | string;
710
+ related?: string[] | string;
685
711
  }
686
- interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'findRelatedTests'> {
712
+ interface ResolvedConfig extends Omit<Required<UserConfig>, 'config' | 'filters' | 'coverage' | 'testNamePattern' | 'related'> {
687
713
  config?: string;
688
714
  filters?: string[];
689
715
  testNamePattern?: RegExp;
690
- findRelatedTests?: string[];
716
+ related?: string[];
691
717
  depsInline: (string | RegExp)[];
692
718
  depsExternal: (string | RegExp)[];
719
+ fallbackCJS: boolean;
720
+ interpretDefault: boolean;
693
721
  coverage: ResolvedC8Options;
694
722
  snapshotOptions: SnapshotStateOptions;
695
723
  }
@@ -710,9 +738,9 @@ interface WorkerRPC {
710
738
  snapshotSaved: (snapshot: SnapshotResult) => void;
711
739
  }
712
740
 
713
- declare const suite: ChainableFunction<"concurrent" | "skip" | "only" | "todo", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
741
+ declare const suite: ChainableFunction<"skip" | "only" | "todo" | "concurrent", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
714
742
  declare const test: TestCollector;
715
- declare const describe: ChainableFunction<"concurrent" | "skip" | "only" | "todo", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
743
+ declare const describe: ChainableFunction<"skip" | "only" | "todo" | "concurrent", [name: string, factory?: TestFactory | undefined], SuiteCollector>;
716
744
  declare const it: TestCollector;
717
745
 
718
746
  declare const beforeAll: (fn: SuiteHooks['beforeAll'][0], timeout?: number | undefined) => void;
@@ -882,7 +910,13 @@ declare const vi: VitestUtils;
882
910
  interface WebSocketHandlers {
883
911
  getFiles(): File[];
884
912
  getConfig(): ResolvedConfig;
885
- getSourceCode(id: string): Promise<string>;
913
+ readFile(id: string): Promise<string>;
914
+ writeFile(id: string, content: string): Promise<void>;
915
+ getModuleGraph(id: string): Promise<{
916
+ graph: Record<string, string[]>;
917
+ externalized: string[];
918
+ inlined: string[];
919
+ }>;
886
920
  rerun(files: string[]): Promise<void>;
887
921
  }
888
922
  interface WebSocketEvents extends Pick<Reporter, 'onCollected' | 'onTaskUpdate'> {
@@ -912,56 +946,59 @@ declare global {
912
946
  hasAssertions(): void;
913
947
  anything(): Anything;
914
948
  any(constructor: unknown): Any;
949
+ addSnapshotSerializer(plugin: Plugin): void;
915
950
  not: AsymmetricMatchersContaining;
916
951
  }
917
- interface JestAssertions<T = void> {
918
- toMatchSnapshot(message?: string): T;
919
- toMatchInlineSnapshot(snapshot?: string, message?: string): T;
920
- matchSnapshot(message?: string): T;
921
- toEqual(expected: any): T;
922
- toStrictEqual(expected: any): T;
923
- toBe(expected: any): T;
924
- toMatch(expected: string | RegExp): T;
925
- toMatchObject(expected: any): T;
926
- toContain(item: any): T;
927
- toContainEqual(item: any): T;
928
- toBeTruthy(): T;
929
- toBeFalsy(): T;
930
- toBeGreaterThan(num: number): T;
931
- toBeGreaterThanOrEqual(num: number): T;
932
- toBeLessThan(num: number): T;
933
- toBeLessThanOrEqual(num: number): T;
934
- toBeNaN(): T;
935
- toBeUndefined(): T;
936
- toBeNull(): T;
937
- toBeDefined(): T;
938
- toBeInstanceOf(c: any): T;
939
- toBeCalledTimes(n: number): T;
940
- toHaveLength(l: number): T;
941
- toHaveProperty(p: string, value?: any): T;
942
- toBeCloseTo(number: number, numDigits?: number): T;
943
- toHaveBeenCalledTimes(n: number): T;
944
- toHaveBeenCalledOnce(): T;
945
- toHaveBeenCalled(): T;
946
- toBeCalled(): T;
947
- toHaveBeenCalledWith(...args: any[]): T;
948
- toBeCalledWith(...args: any[]): T;
949
- toHaveBeenNthCalledWith(n: number, ...args: any[]): T;
950
- nthCalledWith(n: number, ...args: any[]): T;
951
- toHaveBeenLastCalledWith(...args: any[]): T;
952
- lastCalledWith(...args: any[]): T;
953
- toThrow(expected?: string | RegExp): T;
954
- toThrowError(expected?: string | RegExp): T;
955
- toReturn(): T;
956
- toHaveReturned(): T;
957
- toReturnTimes(times: number): T;
958
- toHaveReturnedTimes(times: number): T;
959
- toReturnWith(value: any): T;
960
- toHaveReturnedWith(value: any): T;
961
- toHaveLastReturnedWith(value: any): T;
962
- lastReturnedWith(value: any): T;
963
- toHaveNthReturnedWith(nthCall: number, value: any): T;
964
- nthReturnedWith(nthCall: number, value: any): T;
952
+ interface JestAssertions {
953
+ toMatchSnapshot(message?: string): void;
954
+ toMatchInlineSnapshot(snapshot?: string, message?: string): void;
955
+ toThrowErrorMatchingSnapshot(message?: string): void;
956
+ toThrowErrorMatchingInlineSnapshot(snapshot?: string, message?: string): void;
957
+ matchSnapshot(message?: string): void;
958
+ toEqual(expected: any): void;
959
+ toStrictEqual(expected: any): void;
960
+ toBe(expected: any): void;
961
+ toMatch(expected: string | RegExp): void;
962
+ toMatchObject(expected: any): void;
963
+ toContain(item: any): void;
964
+ toContainEqual(item: any): void;
965
+ toBeTruthy(): void;
966
+ toBeFalsy(): void;
967
+ toBeGreaterThan(num: number): void;
968
+ toBeGreaterThanOrEqual(num: number): void;
969
+ toBeLessThan(num: number): void;
970
+ toBeLessThanOrEqual(num: number): void;
971
+ toBeNaN(): void;
972
+ toBeUndefined(): void;
973
+ toBeNull(): void;
974
+ toBeDefined(): void;
975
+ toBeInstanceOf(c: any): void;
976
+ toBeCalledTimes(n: number): void;
977
+ toHaveLength(l: number): void;
978
+ toHaveProperty(p: string, value?: any): void;
979
+ toBeCloseTo(number: number, numDigits?: number): void;
980
+ toHaveBeenCalledTimes(n: number): void;
981
+ toHaveBeenCalledOnce(): void;
982
+ toHaveBeenCalled(): void;
983
+ toBeCalled(): void;
984
+ toHaveBeenCalledWith(...args: any[]): void;
985
+ toBeCalledWith(...args: any[]): void;
986
+ toHaveBeenNthCalledWith(n: number, ...args: any[]): void;
987
+ nthCalledWith(n: number, ...args: any[]): void;
988
+ toHaveBeenLastCalledWith(...args: any[]): void;
989
+ lastCalledWith(...args: any[]): void;
990
+ toThrow(expected?: string | RegExp): void;
991
+ toThrowError(expected?: string | RegExp): void;
992
+ toReturn(): void;
993
+ toHaveReturned(): void;
994
+ toReturnTimes(times: number): void;
995
+ toHaveReturnedTimes(times: number): void;
996
+ toReturnWith(value: any): void;
997
+ toHaveReturnedWith(value: any): void;
998
+ toHaveLastReturnedWith(value: any): void;
999
+ lastReturnedWith(value: any): void;
1000
+ toHaveNthReturnedWith(nthCall: number, value: any): void;
1001
+ nthReturnedWith(nthCall: number, value: any): void;
965
1002
  }
966
1003
  type Promisify<O> = {
967
1004
  [K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
@@ -974,4 +1011,4 @@ declare global {
974
1011
  }
975
1012
  }
976
1013
 
977
- export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, ComputeMode, ConstructorArgumentsOf, DoneCallback, EnhancedSpy, Environment, EnvironmentReturn, File, HookListener, InlineConfig, JestMockCompat, JestMockCompatContext, JestMockCompatFn, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MethodKeysOf, MockWithArgs, MockableFunction, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, Nullable, ParsedStack, Position, PropertyKeysOf, Reporter, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, it, spies, spyOn, suite, test, vi, vitest };
1014
+ export { ArgumentsOf, ArgumentsType, Arrayable, Awaitable, BuiltinEnvironment, ConstructorArgumentsOf, DoneCallback, EnhancedSpy, Environment, EnvironmentReturn, ErrorWithDiff, File, HookListener, InlineConfig, JestMockCompat, JestMockCompatContext, JestMockCompatFn, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MethodKeysOf, MockWithArgs, MockableFunction, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, ModuleCache, Nullable, ParsedStack, Position, PropertyKeysOf, Reporter, ResolvedConfig, RunMode, RuntimeContext, SnapshotData, SnapshotMatchOptions, SnapshotResult, SnapshotStateOptions, SnapshotSummary, SnapshotUpdateState, Suite, SuiteCollector, SuiteHooks, Task, TaskBase, TaskResult, TaskResultPack, TaskState, Test, TestCollector, TestFactory, TestFunction, UncheckedSnapshot, UserConfig, UserConsoleLog, WebSocketEvents, WebSocketHandlers, WorkerContext, WorkerRPC, afterAll, afterEach, beforeAll, beforeEach, describe, expect, fn, it, spies, spyOn, suite, test, vi, vitest };
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-db2bc738.js';
2
- export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-32bc2073.js';
1
+ export { d as describe, i as it, c as suite, t as test, e as vi, v as vitest } from './vi-56df0b20.js';
2
+ export { a as afterAll, d as afterEach, b as beforeAll, c as beforeEach, e as expect } from './index-7f52a6d6.js';
3
3
  export { f as fn, s as spies, a as spyOn } from './jest-mock-038a01b3.js';
4
4
  export { assert, default as chai, should } from 'chai';
5
- import './index-090545ef.js';
5
+ import './index-9fdde2e8.js';
6
6
  import 'url';
7
7
  import 'tty';
8
8
  import 'local-pkg';