vitest 0.26.0 → 0.26.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.
Files changed (41) hide show
  1. package/browser.d.ts +1 -0
  2. package/dist/browser.d.ts +5 -5
  3. package/dist/browser.js +16 -14
  4. package/dist/{chunk-api-setup.08f3b356.js → chunk-api-setup.46ee0021.js} +7 -5
  5. package/dist/{chunk-env-node.67948209.js → chunk-env-node.b3664da2.js} +1 -1
  6. package/dist/{chunk-install-pkg.579a5a27.js → chunk-install-pkg.31846bc1.js} +20 -20
  7. package/dist/chunk-integrations-globals.5af12e76.js +27 -0
  8. package/dist/{chunk-node-git.5a1b1656.js → chunk-node-git.43b341db.js} +10 -6
  9. package/dist/{chunk-runtime-chain.e655f6cc.js → chunk-runtime-chain.198631fd.js} +8 -7
  10. package/dist/{chunk-runtime-error.dfbbf9be.js → chunk-runtime-error.12631a44.js} +6 -4
  11. package/dist/{chunk-runtime-mocker.35fabb8b.js → chunk-runtime-mocker.03096876.js} +11 -4
  12. package/dist/{chunk-runtime-rpc.7959fc79.js → chunk-runtime-rpc.503623e9.js} +2 -2
  13. package/dist/{chunk-runtime-setup.4c1b529e.js → chunk-runtime-setup.f79addc3.js} +17 -16
  14. package/dist/{chunk-snapshot-manager.7d978f79.js → chunk-snapshot-manager.8c94a052.js} +74 -47
  15. package/dist/{chunk-typecheck-constants.3f865d14.js → chunk-typecheck-constants.e478eb98.js} +3 -3
  16. package/dist/{chunk-utils-env.03f840f2.js → chunk-utils-env.4afc6329.js} +8 -8
  17. package/dist/{chunk-utils-import.ca62c9d7.js → chunk-utils-import.dc87c88c.js} +41 -40
  18. package/dist/{chunk-utils-source-map.5bbb50cd.js → chunk-utils-source-map.95b8b3f0.js} +2 -2
  19. package/dist/{chunk-utils-timers.793fd179.js → chunk-utils-timers.54caa12a.js} +31 -15
  20. package/dist/cli-wrapper.js +10 -5
  21. package/dist/cli.js +31 -19
  22. package/dist/config.d.ts +3 -3
  23. package/dist/entry.js +16 -14
  24. package/dist/environments.d.ts +3 -3
  25. package/dist/environments.js +2 -2
  26. package/dist/{index-c3f83a58.d.ts → index-40ebba2b.d.ts} +1 -1
  27. package/dist/index.d.ts +6 -6
  28. package/dist/index.js +12 -10
  29. package/dist/loader.js +10 -6
  30. package/dist/node.d.ts +5 -4
  31. package/dist/node.js +26 -18
  32. package/dist/suite.js +10 -8
  33. package/dist/{types-56bcd6c3.d.ts → types-2a26f28c.d.ts} +28 -6
  34. package/dist/{vendor-index.96e022fd.js → vendor-index.2e96c50b.js} +6 -2
  35. package/dist/{vendor-index.e1d4cf84.js → vendor-index.62932580.js} +16 -16
  36. package/dist/{vendor-index.9c919048.js → vendor-index.808a85a6.js} +0 -0
  37. package/dist/{vendor-index.737c3cff.js → vendor-index.a323f2d0.js} +9 -8
  38. package/dist/worker.js +14 -9
  39. package/environments.d.ts +1 -0
  40. package/package.json +4 -4
  41. package/dist/chunk-integrations-globals.cab94a09.js +0 -25
@@ -1,4 +1,4 @@
1
- import { p as picocolors } from './chunk-utils-env.03f840f2.js';
1
+ import { p as picocolors } from './chunk-utils-env.4afc6329.js';
2
2
 
3
3
  const {
4
4
  setTimeout: safeSetTimeout,
@@ -3856,15 +3856,20 @@ function formatLine(line, outputTruncateLength) {
3856
3856
  function unifiedDiff(actual, expected, options = {}) {
3857
3857
  if (actual === expected)
3858
3858
  return "";
3859
- const { outputTruncateLength, outputDiffLines, showLegend = true } = options;
3859
+ const { outputTruncateLength, outputDiffLines, outputDiffMaxLines, noColor, showLegend = true } = options;
3860
3860
  const indent = " ";
3861
3861
  const diffLimit = outputDiffLines || 15;
3862
+ const diffMaxLines = outputDiffMaxLines || 50;
3862
3863
  const counts = {
3863
3864
  "+": 0,
3864
3865
  "-": 0
3865
3866
  };
3866
3867
  let previousState = null;
3867
3868
  let previousCount = 0;
3869
+ const str = (str2) => str2;
3870
+ const dim = noColor ? str : picocolors.exports.dim;
3871
+ const green = noColor ? str : picocolors.exports.green;
3872
+ const red = noColor ? str : picocolors.exports.red;
3868
3873
  function preprocess(line) {
3869
3874
  if (!line || line.match(/\\ No newline/))
3870
3875
  return;
@@ -3877,38 +3882,49 @@ function unifiedDiff(actual, expected, options = {}) {
3877
3882
  previousCount++;
3878
3883
  counts[char]++;
3879
3884
  if (previousCount === diffLimit)
3880
- return picocolors.exports.dim(`${char} ...`);
3885
+ return dim(`${char} ...`);
3881
3886
  else if (previousCount > diffLimit)
3882
3887
  return;
3883
3888
  }
3884
3889
  return line;
3885
3890
  }
3886
3891
  const msg = createPatch("string", expected, actual);
3887
- const lines = msg.split("\n").slice(5).map(preprocess).filter(Boolean);
3892
+ let lines = msg.split("\n").slice(5).map(preprocess).filter(Boolean);
3893
+ let moreLines = 0;
3888
3894
  const isCompact = counts["+"] === 1 && counts["-"] === 1 && lines.length === 2;
3895
+ if (lines.length > diffMaxLines) {
3896
+ const firstDiff = lines.findIndex((line) => line[0] === "-" || line[0] === "+");
3897
+ const displayLines = lines.slice(firstDiff - 2, diffMaxLines);
3898
+ const lastDisplayedIndex = firstDiff - 2 + diffMaxLines;
3899
+ if (lastDisplayedIndex < lines.length)
3900
+ moreLines = lines.length - lastDisplayedIndex;
3901
+ lines = displayLines;
3902
+ }
3889
3903
  let formatted = lines.map((line) => {
3890
3904
  line = line.replace(/\\"/g, '"');
3891
3905
  if (line[0] === "-") {
3892
3906
  line = formatLine(line.slice(1), outputTruncateLength);
3893
3907
  if (isCompact)
3894
- return picocolors.exports.green(line);
3895
- return picocolors.exports.green(`- ${formatLine(line, outputTruncateLength)}`);
3908
+ return green(line);
3909
+ return green(`- ${formatLine(line, outputTruncateLength)}`);
3896
3910
  }
3897
3911
  if (line[0] === "+") {
3898
3912
  line = formatLine(line.slice(1), outputTruncateLength);
3899
3913
  if (isCompact)
3900
- return picocolors.exports.red(line);
3901
- return picocolors.exports.red(`+ ${formatLine(line, outputTruncateLength)}`);
3914
+ return red(line);
3915
+ return red(`+ ${formatLine(line, outputTruncateLength)}`);
3902
3916
  }
3903
3917
  if (line.match(/@@/))
3904
3918
  return "--";
3905
3919
  return ` ${line}`;
3906
3920
  });
3921
+ if (moreLines)
3922
+ formatted.push(dim(`... ${moreLines} more lines`));
3907
3923
  if (showLegend) {
3908
3924
  if (isCompact) {
3909
3925
  formatted = [
3910
- `${picocolors.exports.green("- Expected")} ${formatted[0]}`,
3911
- `${picocolors.exports.red("+ Received")} ${formatted[1]}`
3926
+ `${green("- Expected")} ${formatted[0]}`,
3927
+ `${red("+ Received")} ${formatted[1]}`
3912
3928
  ];
3913
3929
  } else {
3914
3930
  if (formatted[0].includes('"'))
@@ -3917,13 +3933,13 @@ function unifiedDiff(actual, expected, options = {}) {
3917
3933
  if (formatted[last].endsWith('"'))
3918
3934
  formatted[last] = formatted[last].slice(0, formatted[last].length - 1);
3919
3935
  formatted.unshift(
3920
- picocolors.exports.green(`- Expected - ${counts["-"]}`),
3921
- picocolors.exports.red(`+ Received + ${counts["+"]}`),
3936
+ green(`- Expected - ${counts["-"]}`),
3937
+ red(`+ Received + ${counts["+"]}`),
3922
3938
  ""
3923
3939
  );
3924
3940
  }
3925
3941
  }
3926
- return formatted.map((i) => indent + i).join("\n");
3942
+ return formatted.map((i) => i ? indent + i : i).join("\n");
3927
3943
  }
3928
3944
 
3929
3945
  const EXPECTED_COLOR = picocolors.exports.green;
@@ -3994,8 +4010,8 @@ function matcherHint(matcherName, received = "received", expected = "expected",
3994
4010
  }
3995
4011
  const SPACE_SYMBOL = "\xB7";
3996
4012
  const replaceTrailingSpaces = (text) => text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length));
3997
- function stringify(object, maxDepth = 10, options) {
3998
- const MAX_LENGTH = 1e4;
4013
+ function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) {
4014
+ const MAX_LENGTH = maxLength ?? 1e4;
3999
4015
  let result;
4000
4016
  try {
4001
4017
  result = format_1(object, {
@@ -1,19 +1,24 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.03f840f2.js';
3
- import { e as execa } from './vendor-index.737c3cff.js';
2
+ import { p as picocolors, E as EXIT_CODE_RESTART } from './chunk-utils-env.4afc6329.js';
3
+ import { e as execa } from './vendor-index.a323f2d0.js';
4
4
  import 'tty';
5
+ import 'node:url';
5
6
  import 'path';
6
- import 'buffer';
7
+ import 'node:buffer';
8
+ import 'node:path';
9
+ import 'node:child_process';
10
+ import 'node:process';
11
+ import './vendor-index.62932580.js';
7
12
  import 'child_process';
8
- import 'process';
9
- import './vendor-index.e1d4cf84.js';
10
13
  import './vendor-_commonjsHelpers.addc3445.js';
11
14
  import 'fs';
12
15
  import 'assert';
13
16
  import 'events';
17
+ import 'buffer';
14
18
  import 'stream';
15
19
  import 'util';
16
20
  import 'os';
21
+ import 'node:os';
17
22
 
18
23
  const ENTRY = new URL("./cli.js", import.meta.url);
19
24
  const NODE_ARGS = [
package/dist/cli.js CHANGED
@@ -1,42 +1,48 @@
1
- import { p as picocolors, n as normalize } from './chunk-utils-env.03f840f2.js';
1
+ import { p as picocolors, n as normalize } from './chunk-utils-env.4afc6329.js';
2
2
  import { EventEmitter } from 'events';
3
- import { v as version, s as startVitest, d as divider } from './chunk-snapshot-manager.7d978f79.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-snapshot-manager.8c94a052.js';
4
4
  import 'tty';
5
- import 'url';
5
+ import 'node:url';
6
6
  import 'path';
7
7
  import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
- import './chunk-env-node.67948209.js';
10
- import 'console';
11
- import './chunk-typecheck-constants.3f865d14.js';
9
+ import './chunk-env-node.b3664da2.js';
10
+ import 'node:console';
11
+ import './chunk-typecheck-constants.e478eb98.js';
12
+ import 'node:path';
12
13
  import 'vite';
13
- import 'process';
14
- import 'fs';
14
+ import 'node:process';
15
+ import 'node:fs';
15
16
  import 'os';
16
17
  import 'util';
17
18
  import 'stream';
19
+ import 'fs';
18
20
  import './vendor-_commonjsHelpers.addc3445.js';
19
21
  import 'vite-node/client';
20
22
  import 'vite-node/server';
21
- import 'fs/promises';
22
- import './vendor-index.737c3cff.js';
23
- import 'buffer';
23
+ import 'node:fs/promises';
24
+ import './vendor-index.a323f2d0.js';
25
+ import 'node:buffer';
26
+ import 'node:child_process';
27
+ import './vendor-index.62932580.js';
24
28
  import 'child_process';
25
- import './vendor-index.e1d4cf84.js';
26
29
  import 'assert';
30
+ import 'buffer';
31
+ import 'node:os';
27
32
  import 'source-map';
28
33
  import 'module';
29
34
  import 'acorn';
30
35
  import 'acorn-walk';
31
- import 'worker_threads';
36
+ import 'node:worker_threads';
32
37
  import 'tinypool';
33
38
  import './vendor-index.783e7f3e.js';
34
39
  import 'perf_hooks';
35
- import './chunk-utils-timers.793fd179.js';
36
- import './chunk-utils-source-map.5bbb50cd.js';
40
+ import './chunk-utils-timers.54caa12a.js';
41
+ import './chunk-utils-source-map.95b8b3f0.js';
37
42
  import 'crypto';
38
43
  import 'vite-node/utils';
39
- import './vendor-index.9c919048.js';
44
+ import './vendor-index.808a85a6.js';
45
+ import 'node:crypto';
40
46
  import './chunk-magic-string.3a794426.js';
41
47
  import 'strip-literal';
42
48
  import 'readline';
@@ -656,7 +662,7 @@ class CAC extends EventEmitter {
656
662
  const cac = (name = "") => new CAC(name);
657
663
 
658
664
  const cli = cac("vitest");
659
- cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputTruncateLength <length>", "diff output length (default: 80)").option("--outputDiffLines <lines>", "number of diff output lines (default: 15)").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "enable coverage report").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--browser", "run tests in browser").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").option("--no-color", "Removes colors from the console output").option("--segfault-retry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").help();
665
+ cli.version(version).option("-r, --root <path>", "root path").option("-c, --config <path>", "path to config file").option("-u, --update", "update snapshot").option("-w, --watch", "watch mode").option("-t, --testNamePattern <pattern>", "run tests with full names matching the specified pattern").option("--dir <path>", "base directory to scan for the test files").option("--ui", "enable UI").option("--open", "open UI automatically (default: !process.env.CI))").option("--api [api]", "serve API, available options: --api.port <port>, --api.host [host] and --api.strictPort").option("--threads", "enabled threads (default: true)").option("--silent", "silent console output from tests").option("--isolate", "isolate environment for each test file (default: true)").option("--reporter <name>", "reporter").option("--outputDiffMaxSize <length>", "object diff output max size (default: 10000)").option("--outputDiffMaxLines <length>", "max lines in diff output window (default: 50)").option("--outputTruncateLength <length>", "diff output line length (default: 80)").option("--outputDiffLines <lines>", "number of lines in single diff (default: 15)").option("--outputFile <filename/-s>", "write test results to a file when the --reporter=json or --reporter=junit option is also specified, use cac's dot notation for individual outputs of multiple reporters").option("--coverage", "enable coverage report").option("--run", "do not watch").option("--mode <name>", "override Vite mode (default: test)").option("--globals", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--browser", "run tests in browser").option("--environment <env>", "runner environment (default: node)").option("--passWithNoTests", "pass when no tests found").option("--logHeapUsage", "show the size of heap for each test").option("--allowOnly", "Allow tests and suites that are marked as only (default: !process.env.CI)").option("--dangerouslyIgnoreUnhandledErrors", "Ignore any unhandled errors that occur").option("--shard <shard>", "Test suite shard to execute in a format of <index>/<count>").option("--changed [since]", "Run tests that are affected by the changed files (default: false)").option("--sequence <options>", "Define in what order to run tests (use --sequence.shuffle to run tests in random order)").option("--no-color", "Removes colors from the console output").option("--segfault-retry <times>", "Return tests on segment fault (default: 0)", { default: 0 }).option("--inspect", "Enable Node.js inspector").option("--inspect-brk", "Enable Node.js inspector with break").help();
660
666
  cli.command("run [...filters]").action(run);
661
667
  cli.command("related [...filters]").action(runRelated);
662
668
  cli.command("watch [...filters]").action(watch);
@@ -686,18 +692,24 @@ async function typecheck(cliFilters = [], options = {}) {
686
692
  console.warn(picocolors.exports.yellow("Testing types with tsc and vue-tsc is an experimental feature.\nBreaking changes might not follow semver, please pin Vitest's version when using it."));
687
693
  await start("typecheck", cliFilters, options);
688
694
  }
689
- function normalizeOptions(argv) {
695
+ function normalizeCliOptions(argv) {
690
696
  if (argv.root)
691
697
  argv.root = normalize(argv.root);
698
+ else
699
+ delete argv.root;
692
700
  if (argv.config)
693
701
  argv.config = normalize(argv.config);
702
+ else
703
+ delete argv.config;
694
704
  if (argv.dir)
695
705
  argv.dir = normalize(argv.dir);
706
+ else
707
+ delete argv.dir;
696
708
  return argv;
697
709
  }
698
710
  async function start(mode, cliFilters, options) {
699
711
  try {
700
- const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeOptions(options));
712
+ const ctx = await startVitest(mode, cliFilters.map(normalize), normalizeCliOptions(options));
701
713
  if (!(ctx == null ? void 0 : ctx.config.watch))
702
714
  await (ctx == null ? void 0 : ctx.exit());
703
715
  return ctx;
package/dist/config.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { UserConfig as UserConfig$2, ConfigEnv } from 'vite';
2
2
  export { ConfigEnv } from 'vite';
3
- import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-56bcd6c3.js';
3
+ import { U as UserConfig$1, ao as ResolvedCoverageOptions, F as FakeTimerInstallOpts } from './types-2a26f28c.js';
4
4
  import 'tinybench';
5
5
  import 'vite-node/client';
6
6
  import 'vite-node/server';
7
7
  import 'vite-node';
8
- import 'fs';
9
- import 'worker_threads';
8
+ import 'node:fs';
9
+ import 'node:worker_threads';
10
10
 
11
11
  declare const defaultInclude: string[];
12
12
  declare const defaultExclude: string[];
package/dist/entry.js CHANGED
@@ -1,26 +1,28 @@
1
- import { promises } from 'fs';
2
- import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.3f865d14.js';
3
- import { v as vi } from './chunk-utils-import.ca62c9d7.js';
4
- import { a as envs } from './chunk-env-node.67948209.js';
5
- import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.4c1b529e.js';
6
- import 'path';
7
- import './chunk-utils-env.03f840f2.js';
1
+ import { promises } from 'node:fs';
2
+ import { g as getWorkerState, a as resetModules } from './chunk-typecheck-constants.e478eb98.js';
3
+ import { v as vi } from './chunk-utils-import.dc87c88c.js';
4
+ import { a as envs } from './chunk-env-node.b3664da2.js';
5
+ import { a as setupGlobalEnv, s as startTests, w as withEnv } from './chunk-runtime-setup.f79addc3.js';
6
+ import 'node:path';
7
+ import './chunk-utils-env.4afc6329.js';
8
8
  import 'tty';
9
- import 'url';
9
+ import 'node:url';
10
+ import 'path';
10
11
  import 'local-pkg';
11
- import './chunk-runtime-chain.e655f6cc.js';
12
+ import './chunk-runtime-chain.198631fd.js';
12
13
  import 'util';
13
14
  import 'chai';
14
15
  import './vendor-_commonjsHelpers.addc3445.js';
15
- import './chunk-runtime-rpc.7959fc79.js';
16
- import './chunk-utils-timers.793fd179.js';
17
- import './chunk-utils-source-map.5bbb50cd.js';
16
+ import './chunk-runtime-rpc.503623e9.js';
17
+ import './chunk-utils-timers.54caa12a.js';
18
+ import './chunk-utils-source-map.95b8b3f0.js';
19
+ import 'fs';
18
20
  import './spy.js';
19
21
  import 'tinyspy';
20
- import 'console';
22
+ import 'node:console';
21
23
  import 'perf_hooks';
22
24
  import './chunk-integrations-coverage.befed097.js';
23
- import './chunk-runtime-error.dfbbf9be.js';
25
+ import './chunk-runtime-error.12631a44.js';
24
26
  import 'vite-node/source-map';
25
27
 
26
28
  function groupBy(collection, iteratee) {
@@ -1,11 +1,11 @@
1
- import { ae as Environment } from './types-56bcd6c3.js';
1
+ import { ae as Environment } from './types-2a26f28c.js';
2
2
  import 'vite';
3
3
  import 'tinybench';
4
4
  import 'vite-node/client';
5
5
  import 'vite-node/server';
6
6
  import 'vite-node';
7
- import 'fs';
8
- import 'worker_threads';
7
+ import 'node:fs';
8
+ import 'node:worker_threads';
9
9
 
10
10
  declare const environments: {
11
11
  node: Environment;
@@ -1,3 +1,3 @@
1
- export { e as builtinEnvironments, p as populateGlobal } from './chunk-env-node.67948209.js';
2
- import 'console';
1
+ export { e as builtinEnvironments, p as populateGlobal } from './chunk-env-node.b3664da2.js';
2
+ import 'node:console';
3
3
  import 'local-pkg';
@@ -1,5 +1,5 @@
1
1
  import { SpyImpl } from 'tinyspy';
2
- import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-56bcd6c3.js';
2
+ import { w as SuiteAPI, v as TestAPI, aw as BenchmarkAPI, y as SuiteHooks, H as HookListener, L as TestContext, p as Suite, x as HookCleanupCallback, O as OnTestFailedHandler, q as Test } from './types-2a26f28c.js';
3
3
 
4
4
  declare type Not<T extends boolean> = T extends true ? false : true;
5
5
  declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-c3f83a58.js';
2
- export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-c3f83a58.js';
3
- import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-56bcd6c3.js';
4
- export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-56bcd6c3.js';
1
+ import { s as spyOn, f as fn, M as MaybeMockedDeep, a as MaybeMocked, b as MaybePartiallyMocked, c as MaybePartiallyMockedDeep, E as EnhancedSpy } from './index-40ebba2b.js';
2
+ export { A as AssertType, E as EnhancedSpy, q as ExpectTypeOf, x as Mock, y as MockContext, w as MockInstance, z as Mocked, B as MockedClass, u as MockedFunction, v as MockedObject, S as SpyInstance, j as afterAll, l as afterEach, r as assertType, h as beforeAll, k as beforeEach, g as bench, n as createExpect, e as describe, m as expect, p as expectTypeOf, i as it, o as onTestFailed, d as suite, t as test } from './index-40ebba2b.js';
3
+ import { D as DoneCallback, F as FakeTimerInstallOpts, R as RuntimeConfig, a as File, T as TaskResultPack, b as ResolvedConfig, M as ModuleGraphData, c as Reporter } from './types-2a26f28c.js';
4
+ export { a1 as AfterSuiteRunMeta, A as ApiConfig, a7 as ArgumentsType, a6 as Arrayable, a4 as Awaitable, ap as BaseCoverageOptions, av as BenchFunction, at as Benchmark, aw as BenchmarkAPI, au as BenchmarkResult, as as BenchmarkUserOptions, B as BuiltinEnvironment, i as CSSModuleScopeStrategy, C as CollectLineNumbers, f as CollectLines, ab as Constructable, h as Context, ar as CoverageC8Options, aq as CoverageIstanbulOptions, an as CoverageOptions, ak as CoverageProvider, al as CoverageProviderModule, am as CoverageReporter, a9 as DeepMerge, D as DoneCallback, ae as Environment, E as EnvironmentOptions, ad as EnvironmentReturn, ai as ErrorWithDiff, a as File, x as HookCleanupCallback, H as HookListener, I as InlineConfig, J as JSDOMOptions, a8 as MergeInsertions, ac as ModuleCache, M as ModuleGraphData, aa as MutableArray, a5 as Nullable, aj as OnServerRestartHandler, O as OnTestFailedHandler, ah as ParsedStack, ag as Position, d as RawErrsMap, c as Reporter, a0 as ResolveIdFunction, b as ResolvedConfig, ao as ResolvedCoverageOptions, g as RootAndTarget, l as RunMode, R as RuntimeConfig, K as RuntimeContext, S as SequenceHooks, P as SnapshotData, X as SnapshotMatchOptions, Y as SnapshotResult, W as SnapshotStateOptions, _ as SnapshotSummary, Q as SnapshotUpdateState, p as Suite, w as SuiteAPI, z as SuiteCollector, G as SuiteFactory, y as SuiteHooks, s as Task, n as TaskBase, o as TaskResult, T as TaskResultPack, m as TaskState, q as Test, v as TestAPI, L as TestContext, t as TestFunction, u as TestOptions, e as TscErrorInfo, r as TypeCheck, k as TypecheckConfig, Z as UncheckedSnapshot, U as UserConfig, af as UserConsoleLog, N as Vitest, V as VitestEnvironment, j as VitestRunMode, $ as WorkerContext, a3 as WorkerGlobalState, a2 as WorkerRPC } from './types-2a26f28c.js';
5
5
  import { TransformResult } from 'vite';
6
6
  import * as chai from 'chai';
7
7
  export { chai };
@@ -11,8 +11,8 @@ import 'tinyspy';
11
11
  import 'vite-node/client';
12
12
  import 'vite-node/server';
13
13
  import 'vite-node';
14
- import 'fs';
15
- import 'worker_threads';
14
+ import 'node:fs';
15
+ import 'node:worker_threads';
16
16
 
17
17
  /**
18
18
  * A simple wrapper for converting callback style to promise
package/dist/index.js CHANGED
@@ -1,21 +1,23 @@
1
- export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.e655f6cc.js';
2
- import { e as dist } from './chunk-utils-import.ca62c9d7.js';
3
- export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-utils-import.ca62c9d7.js';
1
+ export { b as bench, c as createExpect, d as describe, e as expect, i as it, s as suite, t as test } from './chunk-runtime-chain.198631fd.js';
2
+ import { e as dist } from './chunk-utils-import.dc87c88c.js';
3
+ export { a as afterAll, d as afterEach, f as assertType, b as beforeAll, c as beforeEach, k as getRunningMode, h as isFirstRun, l as isWatchMode, o as onTestFailed, g as runOnce, v as vi, j as vitest, w as withCallback } from './chunk-utils-import.dc87c88c.js';
4
4
  import * as chai from 'chai';
5
5
  export { chai };
6
6
  export { assert, should } from 'chai';
7
7
  import 'util';
8
- import './chunk-typecheck-constants.3f865d14.js';
9
- import 'path';
10
- import './chunk-utils-env.03f840f2.js';
8
+ import './chunk-typecheck-constants.e478eb98.js';
9
+ import 'node:path';
10
+ import './chunk-utils-env.4afc6329.js';
11
11
  import 'tty';
12
- import 'url';
12
+ import 'node:url';
13
+ import 'path';
13
14
  import 'local-pkg';
14
15
  import './vendor-_commonjsHelpers.addc3445.js';
15
- import './chunk-runtime-rpc.7959fc79.js';
16
- import './chunk-utils-timers.793fd179.js';
16
+ import './chunk-runtime-rpc.503623e9.js';
17
+ import './chunk-utils-timers.54caa12a.js';
18
+ import 'node:fs';
19
+ import './chunk-utils-source-map.95b8b3f0.js';
17
20
  import 'fs';
18
- import './chunk-utils-source-map.5bbb50cd.js';
19
21
  import './spy.js';
20
22
  import 'tinyspy';
21
23
 
package/dist/loader.js CHANGED
@@ -1,15 +1,19 @@
1
- import { pathToFileURL } from 'url';
2
- import { readFile } from 'fs/promises';
3
- import { i as isNodeBuiltin, h as hasCJSSyntax } from './vendor-index.96e022fd.js';
1
+ import { pathToFileURL } from 'node:url';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { i as isNodeBuiltin, h as hasCJSSyntax } from './vendor-index.2e96c50b.js';
4
4
  import { normalizeModuleId } from 'vite-node/utils';
5
- import { g as getWorkerState } from './chunk-typecheck-constants.3f865d14.js';
5
+ import { g as getWorkerState } from './chunk-typecheck-constants.e478eb98.js';
6
6
  import 'acorn';
7
- import 'module';
7
+ import 'node:module';
8
+ import 'node:fs';
9
+ import 'url';
8
10
  import 'fs';
9
11
  import 'path';
12
+ import 'module';
10
13
  import 'assert';
11
14
  import 'util';
12
- import './chunk-utils-env.03f840f2.js';
15
+ import 'node:path';
16
+ import './chunk-utils-env.4afc6329.js';
13
17
  import 'tty';
14
18
  import 'local-pkg';
15
19
 
package/dist/node.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as MockMap, ay as TestSequencer } from './types-56bcd6c3.js';
2
- export { ay as TestSequencer, aA as TestSequencerConstructor, N as Vitest, az as startVitest } from './types-56bcd6c3.js';
1
+ import { j as VitestRunMode, U as UserConfig, N as Vitest, ax as MockMap, ay as TestSequencer } from './types-2a26f28c.js';
2
+ export { ay as TestSequencer, aA as TestSequencerConstructor, N as Vitest, az as startVitest } from './types-2a26f28c.js';
3
3
  import { UserConfig as UserConfig$1, Plugin } from 'vite';
4
4
  import { ViteNodeRunner } from 'vite-node/client';
5
5
  import { ViteNodeRunnerOptions } from 'vite-node';
6
6
  import 'tinybench';
7
7
  import 'vite-node/server';
8
- import 'fs';
9
- import 'worker_threads';
8
+ import 'node:fs';
9
+ import 'node:worker_threads';
10
10
 
11
11
  declare function createVitest(mode: VitestRunMode, options: UserConfig, viteOverrides?: UserConfig$1): Promise<Vitest>;
12
12
 
@@ -53,6 +53,7 @@ declare class VitestRunner extends ViteNodeRunner {
53
53
  options: ExecuteOptions;
54
54
  mocker: VitestMocker;
55
55
  constructor(options: ExecuteOptions);
56
+ shouldResolveId(id: string, _importee?: string | undefined): boolean;
56
57
  resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>;
57
58
  dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>;
58
59
  prepareContext(context: Record<string, any>): Record<string, any> & {
package/dist/node.js CHANGED
@@ -1,45 +1,53 @@
1
- export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-snapshot-manager.7d978f79.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.35fabb8b.js';
3
- import './chunk-utils-env.03f840f2.js';
1
+ export { B as BaseSequencer, V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-snapshot-manager.8c94a052.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.03096876.js';
3
+ import './chunk-utils-env.4afc6329.js';
4
4
  import 'tty';
5
- import 'url';
5
+ import 'node:url';
6
6
  import 'path';
7
7
  import './chunk-integrations-coverage.befed097.js';
8
8
  import 'local-pkg';
9
- import './chunk-env-node.67948209.js';
10
- import 'console';
11
- import './chunk-typecheck-constants.3f865d14.js';
9
+ import './chunk-env-node.b3664da2.js';
10
+ import 'node:console';
11
+ import './chunk-typecheck-constants.e478eb98.js';
12
+ import 'node:path';
12
13
  import 'vite';
13
- import 'process';
14
- import 'fs';
14
+ import 'node:process';
15
+ import 'node:fs';
15
16
  import 'os';
16
17
  import 'util';
17
18
  import 'stream';
18
19
  import 'events';
20
+ import 'fs';
19
21
  import './vendor-_commonjsHelpers.addc3445.js';
20
22
  import 'vite-node/client';
21
23
  import 'vite-node/server';
22
- import 'fs/promises';
23
- import './vendor-index.737c3cff.js';
24
- import 'buffer';
24
+ import 'node:fs/promises';
25
+ import './vendor-index.a323f2d0.js';
26
+ import 'node:buffer';
27
+ import 'node:child_process';
28
+ import './vendor-index.62932580.js';
25
29
  import 'child_process';
26
- import './vendor-index.e1d4cf84.js';
27
30
  import 'assert';
31
+ import 'buffer';
32
+ import 'node:os';
28
33
  import 'source-map';
29
34
  import 'module';
30
35
  import 'acorn';
31
36
  import 'acorn-walk';
32
- import 'worker_threads';
37
+ import 'node:worker_threads';
33
38
  import 'tinypool';
34
39
  import './vendor-index.783e7f3e.js';
35
40
  import 'perf_hooks';
36
- import './chunk-utils-timers.793fd179.js';
37
- import './chunk-utils-source-map.5bbb50cd.js';
41
+ import './chunk-utils-timers.54caa12a.js';
42
+ import './chunk-utils-source-map.95b8b3f0.js';
38
43
  import 'crypto';
39
44
  import 'vite-node/utils';
40
- import './vendor-index.9c919048.js';
45
+ import './vendor-index.808a85a6.js';
46
+ import 'node:crypto';
41
47
  import './chunk-magic-string.3a794426.js';
42
48
  import 'strip-literal';
43
49
  import 'readline';
44
50
  import './vendor-index.9f20a9be.js';
45
- import './vendor-index.96e022fd.js';
51
+ import './vendor-index.2e96c50b.js';
52
+ import 'node:module';
53
+ import 'url';
package/dist/suite.js CHANGED
@@ -1,16 +1,18 @@
1
1
  import 'util';
2
2
  import 'chai';
3
- import './chunk-typecheck-constants.3f865d14.js';
4
- export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.e655f6cc.js';
5
- import 'path';
6
- import './chunk-utils-env.03f840f2.js';
3
+ import './chunk-typecheck-constants.e478eb98.js';
4
+ export { b as bench, f as clearCollectorContext, q as createSuiteHooks, h as defaultSuite, d as describe, g as getCurrentSuite, i as it, s as suite, t as test } from './chunk-runtime-chain.198631fd.js';
5
+ import 'node:path';
6
+ import './chunk-utils-env.4afc6329.js';
7
7
  import 'tty';
8
- import 'url';
8
+ import 'node:url';
9
+ import 'path';
9
10
  import 'local-pkg';
10
11
  import './vendor-_commonjsHelpers.addc3445.js';
11
- import './chunk-runtime-rpc.7959fc79.js';
12
- import './chunk-utils-timers.793fd179.js';
12
+ import './chunk-runtime-rpc.503623e9.js';
13
+ import './chunk-utils-timers.54caa12a.js';
14
+ import 'node:fs';
15
+ import './chunk-utils-source-map.95b8b3f0.js';
13
16
  import 'fs';
14
- import './chunk-utils-source-map.5bbb50cd.js';
15
17
  import './spy.js';
16
18
  import 'tinyspy';
@@ -3,8 +3,8 @@ import { Task as Task$1, TaskResult as TaskResult$1, Bench, Options } from 'tiny
3
3
  import { ViteNodeRunner } from 'vite-node/client';
4
4
  import { ViteNodeServer } from 'vite-node/server';
5
5
  import { RawSourceMap, ViteNodeResolveId, FetchFunction, ModuleCacheMap } from 'vite-node';
6
- import { Stats } from 'fs';
7
- import { MessagePort } from 'worker_threads';
6
+ import { Stats } from 'node:fs';
7
+ import { MessagePort } from 'node:worker_threads';
8
8
 
9
9
  /**
10
10
  * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
@@ -972,6 +972,7 @@ interface Suite extends TaskBase {
972
972
  tasks: Task[];
973
973
  filepath?: string;
974
974
  benchmark?: Bench;
975
+ projectName?: string;
975
976
  }
976
977
  interface File extends Suite {
977
978
  filepath: string;
@@ -1454,6 +1455,10 @@ interface EnvironmentOptions {
1454
1455
  }
1455
1456
  type VitestRunMode = 'test' | 'benchmark' | 'typecheck';
1456
1457
  interface InlineConfig {
1458
+ /**
1459
+ * Name of the project. Will be used to display in the reporter.
1460
+ */
1461
+ name?: string;
1457
1462
  /**
1458
1463
  * Benchmark options.
1459
1464
  *
@@ -1564,17 +1569,32 @@ interface InlineConfig {
1564
1569
  root?: string;
1565
1570
  /**
1566
1571
  * Custom reporter for output. Can contain one or more built-in report names, reporter instances,
1567
- * and/or paths to custom reporters
1572
+ * and/or paths to custom reporters.
1568
1573
  */
1569
1574
  reporters?: Arrayable<BuiltinReporters | 'html' | Reporter | Omit<string, BuiltinReporters>>;
1570
1575
  /**
1571
- * diff output length
1576
+ * Truncates lines in the output to the given length.
1577
+ * @default stdout.columns || 80
1572
1578
  */
1573
1579
  outputTruncateLength?: number;
1574
1580
  /**
1575
- * number of diff output lines
1581
+ * Maximum number of line to show in a single diff.
1582
+ * @default 15
1576
1583
  */
1577
1584
  outputDiffLines?: number;
1585
+ /**
1586
+ * The maximum number of characters allowed in a single object before doing a diff.
1587
+ * Vitest tries to stringify an object before doing a diff, but if the object is too large,
1588
+ * it will reduce the depth of the object to fit within this limit.
1589
+ * Because of this if object is too big or nested, you might not see the diff.
1590
+ * @default 10000
1591
+ */
1592
+ outputDiffMaxSize?: number;
1593
+ /**
1594
+ * Maximum number of lines in a diff overall.
1595
+ * @default 50
1596
+ */
1597
+ outputDiffMaxLines?: number;
1578
1598
  /**
1579
1599
  * Write test results to a file when the --reporter=json` or `--reporter=junit` option is also specified.
1580
1600
  * Also definable individually per reporter by using an object instead.
@@ -1988,7 +2008,9 @@ declare const INVERTED_COLOR: Formatter;
1988
2008
  declare const BOLD_WEIGHT: Formatter;
1989
2009
  declare const DIM_COLOR: Formatter;
1990
2010
  declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;
1991
- declare function stringify(object: unknown, maxDepth?: number, options?: PrettyFormatOptions): string;
2011
+ declare function stringify(object: unknown, maxDepth?: number, { maxLength, ...options }?: PrettyFormatOptions & {
2012
+ maxLength?: number;
2013
+ }): string;
1992
2014
  declare const printReceived: (object: unknown) => string;
1993
2015
  declare const printExpected: (value: unknown) => string;
1994
2016
  declare function diff(a: any, b: any, options?: DiffOptions): string;