vitest 0.12.10 → 0.14.0

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 (36) hide show
  1. package/config.d.ts +1 -1
  2. package/dist/{chunk-api-setup.2405c167.js → chunk-api-setup.7945baf8.mjs} +4 -4
  3. package/dist/{chunk-constants.e8bc5d35.js → chunk-constants.41584d81.mjs} +1 -1
  4. package/dist/{chunk-defaults.a3120857.js → chunk-defaults.a820faeb.mjs} +3 -2
  5. package/dist/{chunk-install-pkg.73b84ae1.js → chunk-install-pkg.6f5930c3.mjs} +2 -2
  6. package/dist/chunk-integrations-globals.f0c5e97f.mjs +26 -0
  7. package/dist/{chunk-integrations-spy.bee66426.js → chunk-integrations-spy.674b628e.mjs} +0 -0
  8. package/dist/{chunk-magic-string.41232190.js → chunk-magic-string.efe26975.mjs} +0 -0
  9. package/dist/{chunk-runtime-chain.d2ed2f76.js → chunk-runtime-chain.6a3c6576.mjs} +8 -8
  10. package/dist/{chunk-runtime-mocker.13651a82.js → chunk-runtime-mocker.7cf95199.mjs} +4 -4
  11. package/dist/{chunk-runtime-rpc.d3d38fc1.js → chunk-runtime-rpc.44043bb4.mjs} +1 -1
  12. package/dist/{chunk-utils-global.eb9e6d32.js → chunk-utils-global.624991bc.mjs} +2 -2
  13. package/dist/{chunk-utils-source-map.6b6c39c8.js → chunk-utils-source-map.4408ba82.mjs} +7 -1
  14. package/dist/{chunk-vite-node-externalize.464ab3dd.js → chunk-vite-node-externalize.aaa06ea4.mjs} +8811 -8790
  15. package/dist/{chunk-vite-node-utils.eec5d968.js → chunk-vite-node-utils.d6687931.mjs} +12 -5
  16. package/dist/{cli.js → cli.mjs} +19 -19
  17. package/dist/config.cjs +2 -1
  18. package/dist/config.d.ts +2 -1
  19. package/dist/{config.js → config.mjs} +2 -1
  20. package/dist/entry.mjs +17 -0
  21. package/dist/index.d.ts +15 -7
  22. package/dist/{index.js → index.mjs} +6 -6
  23. package/dist/node.d.ts +13 -6
  24. package/dist/node.mjs +32 -0
  25. package/dist/{spy.js → spy.mjs} +1 -1
  26. package/dist/{vendor-_commonjsHelpers.addc3445.js → vendor-_commonjsHelpers.4da45ef5.mjs} +0 -0
  27. package/dist/{vendor-entry.3113977a.js → vendor-entry.93b045ee.mjs} +7 -7
  28. package/dist/{vendor-index.405e58ef.js → vendor-index.98e769c1.mjs} +0 -0
  29. package/dist/{vendor-index.40be925a.js → vendor-index.a2a385d8.mjs} +407 -407
  30. package/dist/{worker.js → worker.mjs} +6 -6
  31. package/node.d.ts +1 -1
  32. package/package.json +8 -9
  33. package/vitest.mjs +1 -1
  34. package/dist/chunk-integrations-globals.6e996fa7.js +0 -26
  35. package/dist/entry.js +0 -17
  36. package/dist/node.js +0 -32
package/config.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './dist/config'
1
+ export * from './dist/config.js'
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-utils.eec5d968.js';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.d6687931.mjs';
3
3
  import require$$0$1 from 'stream';
4
4
  import require$$0 from 'zlib';
5
5
  import require$$3 from 'net';
@@ -9,11 +9,11 @@ import require$$2 from 'events';
9
9
  import require$$1 from 'https';
10
10
  import require$$2$1 from 'http';
11
11
  import url from 'url';
12
- import { A as API_PATH } from './chunk-constants.e8bc5d35.js';
13
- import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.6b6c39c8.js';
12
+ import { A as API_PATH } from './chunk-constants.41584d81.mjs';
13
+ import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.4408ba82.mjs';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-utils-global.eb9e6d32.js';
16
+ import './chunk-utils-global.624991bc.mjs';
17
17
  import 'tty';
18
18
  import 'local-pkg';
19
19
  import 'path';
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'url';
2
- import { l as resolve } from './chunk-utils-global.eb9e6d32.js';
2
+ import { l as resolve } from './chunk-utils-global.624991bc.mjs';
3
3
 
4
4
  const distDir = resolve(fileURLToPath(import.meta.url), "../../dist");
5
5
  const defaultPort = 51204;
@@ -1,7 +1,7 @@
1
1
  import { existsSync, promises } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import { pathToFileURL } from 'url';
4
- import { t as toArray, l as resolve } from './chunk-utils-global.eb9e6d32.js';
4
+ import { t as toArray, l as resolve } from './chunk-utils-global.624991bc.mjs';
5
5
 
6
6
  const defaultInclude = ["**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];
7
7
  const defaultExclude = ["**/node_modules/**", "**/dist/**", "**/cypress/**", "**/.{idea,git,cache,output,temp}/**"];
@@ -55,7 +55,8 @@ const config = {
55
55
  testTimeout: 5e3,
56
56
  hookTimeout: 1e4,
57
57
  isolate: true,
58
- watchIgnore: [/\/node_modules\//, /\/dist\//],
58
+ watchExclude: ["**/node_modules/**", "**/dist/**"],
59
+ forceRerunTriggers: [],
59
60
  update: false,
60
61
  reporters: [],
61
62
  silent: false,
@@ -2,9 +2,9 @@ import path$2 from 'path';
2
2
  import fs$2 from 'fs';
3
3
  import require$$0 from 'util';
4
4
  import childProcess$1 from 'child_process';
5
- import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.40be925a.js';
5
+ import { p as pathKey, s as signalExit, m as mergeStream$1, g as getStream$1, c as crossSpawn$1, o as onetime$1 } from './vendor-index.a2a385d8.mjs';
6
6
  import require$$0$1 from 'os';
7
- import './vendor-_commonjsHelpers.addc3445.js';
7
+ import './vendor-_commonjsHelpers.4da45ef5.mjs';
8
8
  import 'assert';
9
9
  import 'events';
10
10
  import 'buffer';
@@ -0,0 +1,26 @@
1
+ import { g as globalApis } from './chunk-constants.41584d81.mjs';
2
+ import { i as index } from './vendor-entry.93b045ee.mjs';
3
+ import 'url';
4
+ import './chunk-utils-global.624991bc.mjs';
5
+ import 'tty';
6
+ import 'local-pkg';
7
+ import 'path';
8
+ import 'fs';
9
+ import './chunk-runtime-chain.6a3c6576.mjs';
10
+ import 'chai';
11
+ import './vendor-_commonjsHelpers.4da45ef5.mjs';
12
+ import './chunk-runtime-rpc.44043bb4.mjs';
13
+ import './chunk-utils-source-map.4408ba82.mjs';
14
+ import './chunk-integrations-spy.674b628e.mjs';
15
+ import 'tinyspy';
16
+ import 'util';
17
+ import './chunk-defaults.a820faeb.mjs';
18
+ import 'module';
19
+
20
+ function registerApiGlobally() {
21
+ globalApis.forEach((api) => {
22
+ globalThis[api] = index[api];
23
+ });
24
+ }
25
+
26
+ export { registerApiGlobally };
@@ -1,10 +1,10 @@
1
1
  import chai$1, { expect as expect$1, AssertionError, util } from 'chai';
2
- import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
3
- import { r as rpc } from './chunk-runtime-rpc.d3d38fc1.js';
4
- import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, e as safeSetTimeout, f as safeClearTimeout, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.eb9e6d32.js';
2
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
3
+ import { r as rpc } from './chunk-runtime-rpc.44043bb4.mjs';
4
+ import { i as isObject, j as join, d as dirname, g as getCallLastIndex, s as slash, a as getWorkerState, b as getNames, c as assertTypes, p as picocolors, e as safeSetTimeout, f as safeClearTimeout, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.624991bc.mjs';
5
5
  import fs, { promises } from 'fs';
6
- import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.6b6c39c8.js';
7
- import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.bee66426.js';
6
+ import { p as plugins_1, f as format_1, g as getOriginalPos, a as posToNumber, n as numberToPos, l as lineSplitRE, b as parseStacktrace, u as unifiedDiff, s as stringify, m as matcherUtils } from './chunk-utils-source-map.4408ba82.mjs';
7
+ import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.674b628e.mjs';
8
8
  import require$$0, { format } from 'util';
9
9
 
10
10
  var __defProp$5 = Object.defineProperty;
@@ -586,7 +586,7 @@ function deepMergeSnapshot(target, source) {
586
586
  }
587
587
 
588
588
  async function saveInlineSnapshots(snapshots) {
589
- const MagicString = (await import('./chunk-magic-string.41232190.js')).default;
589
+ const MagicString = (await import('./chunk-magic-string.efe26975.mjs')).default;
590
590
  const files = new Set(snapshots.map((i) => i.file));
591
591
  await Promise.all(Array.from(files).map(async (file) => {
592
592
  const map = await rpc().getSourceMap(file);
@@ -621,14 +621,14 @@ function prepareSnapString(snap, source, index) {
621
621
  const line = source.split(lineSplitRE)[lineIndex - 1];
622
622
  const indent = line.match(/^\s*/)[0] || "";
623
623
  const indentNext = indent.includes(" ") ? `${indent} ` : `${indent} `;
624
- const lines = snap.trim().replace(/\\/g, "\\\\").replace(/\$/g, "\\$").split(/\n/g);
624
+ const lines = snap.trim().replace(/\\/g, "\\\\").split(/\n/g);
625
625
  const isOneline = lines.length <= 1;
626
626
  const quote = isOneline ? "'" : "`";
627
627
  if (isOneline)
628
628
  return `'${lines.join("\n").replace(/'/g, "\\'")}'`;
629
629
  else
630
630
  return `${quote}
631
- ${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`")}
631
+ ${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`").replace(/\${/g, "\\${")}
632
632
  ${indent}${quote}`;
633
633
  }
634
634
  const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*[\w_$]*(['"`\)])/m;
@@ -1,8 +1,8 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.eec5d968.js';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, b as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.d6687931.mjs';
2
2
  import { normalizePath } from 'vite';
3
- import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, l as resolve, k as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.eb9e6d32.js';
3
+ import { a as getWorkerState, J as isWindows, K as mergeSlashes, d as dirname, l as resolve, k as basename, L as getType, M as getAllProperties, s as slash } from './chunk-utils-global.624991bc.mjs';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { d as distDir } from './chunk-constants.e8bc5d35.js';
5
+ import { d as distDir } from './chunk-constants.41584d81.mjs';
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -171,7 +171,7 @@ const _VitestMocker = class {
171
171
  async ensureSpy() {
172
172
  if (_VitestMocker.spyModule)
173
173
  return;
174
- _VitestMocker.spyModule = await this.request(`/@fs/${slash(resolve(distDir, "spy.js"))}`);
174
+ _VitestMocker.spyModule = await this.request(`/@fs/${slash(resolve(distDir, "spy.mjs"))}`);
175
175
  }
176
176
  async requestWithMock(dep) {
177
177
  var _a;
@@ -1,4 +1,4 @@
1
- import { a as getWorkerState, w as withSafeTimers } from './chunk-utils-global.eb9e6d32.js';
1
+ import { a as getWorkerState, w as withSafeTimers } from './chunk-utils-global.624991bc.mjs';
2
2
 
3
3
  const rpc = () => {
4
4
  const { rpc: rpc2 } = getWorkerState();
@@ -452,14 +452,14 @@ async function ensurePackageInstalled(dependency, promptInstall = !process.env.C
452
452
  `));
453
453
  if (!promptInstall)
454
454
  return false;
455
- const prompts = await import('./vendor-index.405e58ef.js').then(function (n) { return n.i; });
455
+ const prompts = await import('./vendor-index.98e769c1.mjs').then(function (n) { return n.i; });
456
456
  const { install } = await prompts.prompt({
457
457
  type: "confirm",
458
458
  name: "install",
459
459
  message: picocolors.exports.reset(`Do you want to install ${picocolors.exports.green(dependency)}?`)
460
460
  });
461
461
  if (install) {
462
- await (await import('./chunk-install-pkg.73b84ae1.js')).installPackage(dependency, { dev: true });
462
+ await (await import('./chunk-install-pkg.6f5930c3.mjs')).installPackage(dependency, { dev: true });
463
463
  process.stderr.write(picocolors.exports.yellow(`
464
464
  Package ${dependency} installed, re-run the command to start.
465
465
  `));
@@ -1,4 +1,4 @@
1
- import { s as slash, h as notNullish, p as picocolors } from './chunk-utils-global.eb9e6d32.js';
1
+ import { s as slash, h as notNullish, p as picocolors } from './chunk-utils-global.624991bc.mjs';
2
2
 
3
3
  var build = {};
4
4
 
@@ -7278,6 +7278,7 @@ function unifiedDiff(actual, expected, options = {}) {
7278
7278
  const lines = msg.split("\n").slice(5).map(preprocess).filter(Boolean);
7279
7279
  const isCompact = counts["+"] === 1 && counts["-"] === 1 && lines.length === 2;
7280
7280
  let formatted = lines.map((line) => {
7281
+ line = line.replace(/\\"/g, '"');
7281
7282
  if (line[0] === "-") {
7282
7283
  line = formatLine(line.slice(1), outputTruncateLength);
7283
7284
  if (isCompact)
@@ -7301,6 +7302,11 @@ function unifiedDiff(actual, expected, options = {}) {
7301
7302
  `${picocolors.exports.red("+ Received")} ${formatted[1]}`
7302
7303
  ];
7303
7304
  } else {
7305
+ if (formatted[0].includes('"'))
7306
+ formatted[0] = formatted[0].replace('"', "");
7307
+ const last = formatted.length - 1;
7308
+ if (formatted[last].endsWith('"'))
7309
+ formatted[last] = formatted[last].slice(0, formatted[last].length - 1);
7304
7310
  formatted.unshift(picocolors.exports.green(`- Expected - ${counts["-"]}`), picocolors.exports.red(`+ Received + ${counts["+"]}`), "");
7305
7311
  }
7306
7312
  }