vitest 0.13.0 → 0.14.1

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.554e8dcb.js → chunk-api-setup.7945baf8.mjs} +4 -4
  3. package/dist/{chunk-constants.d60bb984.js → chunk-constants.41584d81.mjs} +1 -1
  4. package/dist/{chunk-defaults.c11f632f.js → chunk-defaults.a820faeb.mjs} +3 -2
  5. package/dist/{chunk-install-pkg.8a034cf6.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.db87de48.js → chunk-runtime-chain.6a3c6576.mjs} +8 -8
  10. package/dist/{chunk-runtime-mocker.8436db18.js → chunk-runtime-mocker.7cf95199.mjs} +4 -4
  11. package/dist/{chunk-runtime-rpc.6e6614a9.js → chunk-runtime-rpc.44043bb4.mjs} +1 -1
  12. package/dist/{chunk-utils-global.b9f8edf8.js → chunk-utils-global.624991bc.mjs} +2 -2
  13. package/dist/{chunk-utils-source-map.ded50c88.js → chunk-utils-source-map.4408ba82.mjs} +7 -1
  14. package/dist/{chunk-vite-node-externalize.0094db73.js → chunk-vite-node-externalize.d492e389.mjs} +63 -32
  15. package/dist/{chunk-vite-node-utils.6856b365.js → chunk-vite-node-utils.d6687931.mjs} +12 -5
  16. package/dist/{cli.js → cli.mjs} +11 -11
  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.6072d652.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.42fcc02c.js → vendor-index.a2a385d8.mjs} +1 -1
  30. package/dist/{worker.js → worker.mjs} +6 -6
  31. package/node.d.ts +1 -1
  32. package/package.json +10 -11
  33. package/vitest.mjs +1 -1
  34. package/dist/chunk-integrations-globals.f7036c09.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.6856b365.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.d60bb984.js';
13
- import { j as interpretSourcePos, b as parseStacktrace } from './chunk-utils-source-map.ded50c88.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.b9f8edf8.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.b9f8edf8.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.b9f8edf8.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.42fcc02c.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.6e6614a9.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.b9f8edf8.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.ded50c88.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.6856b365.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.b9f8edf8.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.d60bb984.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.b9f8edf8.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.8a034cf6.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.b9f8edf8.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
  }
@@ -1,31 +1,31 @@
1
- import { j as join, k as basename, d as dirname, l as resolve, A as AggregateErrorPonyfill, p as picocolors, s as slash$2, m as isAbsolute, o as relative, q as isNode, u as getTests, v as getFullName, x as hasFailed, y as hasFailedSnapshot, z as getSuites, B as safeSetInterval, C as safeClearInterval, e as safeSetTimeout, t as toArray, D as normalize, n as noop$1, f as safeClearTimeout, E as deepMerge, F as toNamespacedPath, g as getCallLastIndex, h as notNullish, G as ensurePackageInstalled, H as stdout } from './chunk-utils-global.b9f8edf8.js';
1
+ import { j as join, k as basename, d as dirname, l as resolve, A as AggregateErrorPonyfill, p as picocolors, s as slash$2, m as isAbsolute, o as relative, q as isNode, u as getTests, v as getFullName, x as hasFailed, y as hasFailedSnapshot, z as getSuites, B as safeSetInterval, C as safeClearInterval, e as safeSetTimeout, t as toArray$1, D as normalize, n as noop$1, f as safeClearTimeout, E as deepMerge, F as toNamespacedPath, g as getCallLastIndex, h as notNullish, G as ensurePackageInstalled, H as stdout } from './chunk-utils-global.624991bc.mjs';
2
2
  import { createServer, mergeConfig } from 'vite';
3
3
  import path$a from 'path';
4
4
  import url, { fileURLToPath, pathToFileURL } from 'url';
5
5
  import process$1 from 'process';
6
6
  import fs$8, { promises, existsSync, readFileSync } from 'fs';
7
- import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.d60bb984.js';
7
+ import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.41584d81.mjs';
8
8
  import readline from 'readline';
9
9
  import require$$0, { cpus, hostname, constants as constants$5 } from 'os';
10
10
  import require$$0$1 from 'util';
11
11
  import require$$0$2 from 'stream';
12
12
  import require$$2 from 'events';
13
- import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
14
- import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.6856b365.js';
13
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
14
+ import { i as isNodeBuiltin, a as isValidNodeImport, s as slash$1, t as toArray, b as toFilePath, w as withInlineSourcemap, c as createBirpc, V as ViteNodeRunner } from './chunk-vite-node-utils.d6687931.mjs';
15
15
  import createDebug from 'debug';
16
- import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.c11f632f.js';
16
+ import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.a820faeb.mjs';
17
17
  import { MessageChannel } from 'worker_threads';
18
18
  import { Tinypool } from 'tinypool';
19
19
  import { performance } from 'perf_hooks';
20
- import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.ded50c88.js';
21
- import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.42fcc02c.js';
20
+ import { c as stripAnsi, d as stringWidth, e as ansiStyles, h as sliceAnsi, i as cliTruncate, b as parseStacktrace, j as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE } from './chunk-utils-source-map.4408ba82.mjs';
21
+ import { o as onetime$1, s as signalExit, m as mergeStream, g as getStream, c as crossSpawn } from './vendor-index.a2a385d8.mjs';
22
22
  import { resolveModule } from 'local-pkg';
23
23
  import { Buffer } from 'buffer';
24
24
  import childProcess from 'child_process';
25
- import MagicString from './chunk-magic-string.41232190.js';
26
- import { p as prompts } from './vendor-index.405e58ef.js';
25
+ import MagicString from './chunk-magic-string.efe26975.mjs';
26
+ import { p as prompts } from './vendor-index.98e769c1.mjs';
27
27
 
28
- var version = "0.13.0";
28
+ var version = "0.14.1";
29
29
 
30
30
  /*
31
31
  How it works:
@@ -188,7 +188,7 @@ async function pLocate(
188
188
  {
189
189
  concurrency = Number.POSITIVE_INFINITY,
190
190
  preserveOrder = true,
191
- } = {},
191
+ },
192
192
  ) {
193
193
  const limit = pLimit(concurrency);
194
194
 
@@ -255,7 +255,7 @@ const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath)
255
255
 
256
256
  const findUpStop = Symbol('findUpStop');
257
257
 
258
- async function findUpMultiple(name, options = {}) {
258
+ async function findUpMultiple(name, options) {
259
259
  let directory = path$a.resolve(toPath(options.cwd) || '');
260
260
  const {root} = path$a.parse(directory);
261
261
  const stopAt = path$a.resolve(directory, options.stopAt || root);
@@ -299,7 +299,7 @@ async function findUpMultiple(name, options = {}) {
299
299
  return matches;
300
300
  }
301
301
 
302
- async function findUp(name, options = {}) {
302
+ async function findUp(name, options) {
303
303
  const matches = await findUpMultiple(name, {...options, limit: 1});
304
304
  return matches[0];
305
305
  }
@@ -1189,7 +1189,7 @@ const invalidStep = (step, options) => {
1189
1189
  return [];
1190
1190
  };
1191
1191
 
1192
- const fillNumbers = (start, end, step = 1, options = {}) => {
1192
+ const fillNumbers = (start, end, step = 1, options) => {
1193
1193
  let a = Number(start);
1194
1194
  let b = Number(end);
1195
1195
 
@@ -1241,7 +1241,7 @@ const fillNumbers = (start, end, step = 1, options = {}) => {
1241
1241
  return range;
1242
1242
  };
1243
1243
 
1244
- const fillLetters = (start, end, step = 1, options = {}) => {
1244
+ const fillLetters = (start, end, step = 1, options) => {
1245
1245
  if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) {
1246
1246
  return invalidRange(start, end, options);
1247
1247
  }
@@ -6930,8 +6930,10 @@ async function _shouldExternalize(id, options) {
6930
6930
  return false;
6931
6931
  }
6932
6932
  function matchExternalizePattern(id, patterns) {
6933
- if (!patterns)
6933
+ if (patterns == null)
6934
6934
  return false;
6935
+ if (patterns === true)
6936
+ return true;
6935
6937
  for (const ex of patterns) {
6936
6938
  if (typeof ex === "string") {
6937
6939
  if (id.includes(`/node_modules/${ex}/`))
@@ -6980,6 +6982,17 @@ class ViteNodeServer {
6980
6982
  this.fetchPromiseMap = /* @__PURE__ */ new Map();
6981
6983
  this.transformPromiseMap = /* @__PURE__ */ new Map();
6982
6984
  this.fetchCache = /* @__PURE__ */ new Map();
6985
+ var _a, _b;
6986
+ const ssrOptions = server.config.ssr;
6987
+ if (ssrOptions) {
6988
+ options.deps ?? (options.deps = {});
6989
+ if (ssrOptions.noExternal === true) {
6990
+ (_a = options.deps).inline ?? (_a.inline = true);
6991
+ } else if (options.deps.inline !== true) {
6992
+ (_b = options.deps).inline ?? (_b.inline = []);
6993
+ options.deps.inline.push(...toArray(ssrOptions.noExternal));
6994
+ }
6995
+ }
6983
6996
  }
6984
6997
  shouldExternalize(id) {
6985
6998
  return shouldExternalize(id, this.options.deps);
@@ -7134,7 +7147,7 @@ var __spreadValues$5 = (a, b) => {
7134
7147
  }
7135
7148
  return a;
7136
7149
  };
7137
- const workerPath = pathToFileURL(resolve(distDir, "./worker.js")).href;
7150
+ const workerPath = pathToFileURL(resolve(distDir, "./worker.mjs")).href;
7138
7151
  function createPool(ctx) {
7139
7152
  var _a;
7140
7153
  const threadsCount = ctx.config.watch ? Math.max(cpus().length / 2, 1) : Math.max(cpus().length - 1, 1);
@@ -7153,7 +7166,7 @@ function createPool(ctx) {
7153
7166
  options.maxThreads = 1;
7154
7167
  options.minThreads = 1;
7155
7168
  }
7156
- if (ctx.config.coverage)
7169
+ if (ctx.config.coverage.enabled)
7157
7170
  (_a = process.env).NODE_V8_COVERAGE || (_a.NODE_V8_COVERAGE = ctx.config.coverage.tempDirectory);
7158
7171
  options.env = __spreadValues$5(__spreadValues$5({
7159
7172
  TEST: "true",
@@ -8964,8 +8977,15 @@ function resolveConfig(options, viteConfig) {
8964
8977
  resolved.base = viteConfig.base;
8965
8978
  resolved.coverage = resolveC8Options(options.coverage || {}, resolved.root);
8966
8979
  resolved.deps = resolved.deps || {};
8967
- (_b = resolved.deps).inline ?? (_b.inline = []);
8968
- resolved.deps.inline.push(...extraInlineDeps);
8980
+ if (resolved.deps.inline !== true) {
8981
+ const ssrOptions = viteConfig.ssr || {};
8982
+ if (ssrOptions.noExternal === true && resolved.deps.inline == null) {
8983
+ resolved.deps.inline = true;
8984
+ } else {
8985
+ (_b = resolved.deps).inline ?? (_b.inline = []);
8986
+ resolved.deps.inline.push(...extraInlineDeps);
8987
+ }
8988
+ }
8969
8989
  resolved.testNamePattern = resolved.testNamePattern ? resolved.testNamePattern instanceof RegExp ? resolved.testNamePattern : new RegExp(resolved.testNamePattern) : void 0;
8970
8990
  const CI = !!process.env.CI;
8971
8991
  const UPDATE_SNAPSHOT = resolved.update || process.env.UPDATE_SNAPSHOT;
@@ -8980,13 +9000,13 @@ function resolveConfig(options, viteConfig) {
8980
9000
  resolved.maxThreads = parseInt(process.env.VITEST_MAX_THREADS);
8981
9001
  if (process.env.VITEST_MIN_THREADS)
8982
9002
  resolved.minThreads = parseInt(process.env.VITEST_MIN_THREADS);
8983
- resolved.setupFiles = toArray(resolved.setupFiles || []).map((file) => normalize(resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)));
9003
+ resolved.setupFiles = toArray$1(resolved.setupFiles || []).map((file) => normalize(resolveModule(file, { paths: [resolved.root] }) ?? resolve(resolved.root, file)));
8984
9004
  resolved.api = resolveApiConfig(options);
8985
9005
  if (options.related)
8986
- resolved.related = toArray(options.related).map((file) => resolve(resolved.root, file));
9006
+ resolved.related = toArray$1(options.related).map((file) => resolve(resolved.root, file));
8987
9007
  resolved.reporters = Array.from(/* @__PURE__ */ new Set([
8988
- ...toArray(resolved.reporters),
8989
- ...toArray(resolved.reporter)
9008
+ ...toArray$1(resolved.reporters),
9009
+ ...toArray$1(resolved.reporter)
8990
9010
  ])).filter(Boolean);
8991
9011
  if (!resolved.reporters.length)
8992
9012
  resolved.reporters.push("default");
@@ -9001,7 +9021,7 @@ function fileFromParsedStack(stack) {
9001
9021
  return join(stack.file, "../", stack.sourcePos.source);
9002
9022
  return stack.file;
9003
9023
  }
9004
- async function printError(error, ctx, options = {}) {
9024
+ async function printError(error, ctx, options) {
9005
9025
  const { showCodeFrame = true, fullStack = false, type } = options;
9006
9026
  let e = error;
9007
9027
  if (typeof error === "string") {
@@ -9116,7 +9136,7 @@ function printStack(ctx, stack, highlight, errorProperties, onStack) {
9116
9136
  ctx.log(picocolors.exports.red(picocolors.exports.bold("Serialized Error:")), picocolors.exports.gray(propertiesString));
9117
9137
  }
9118
9138
  }
9119
- function generateCodeFrame(source, indent = 0, start = 0, end, range = 2) {
9139
+ function generateCodeFrame(source, indent, start = 0, end, range = 2) {
9120
9140
  var _a;
9121
9141
  start = posToNumber(source, start);
9122
9142
  end = end || start;
@@ -9209,7 +9229,7 @@ function npmRunPath(options = {}) {
9209
9229
  return [...result, path_].join(path$a.delimiter);
9210
9230
  }
9211
9231
 
9212
- function npmRunPathEnv({env = process$1.env, ...options} = {}) {
9232
+ function npmRunPathEnv({env = process$1.env, ...options}) {
9213
9233
  env = {...env};
9214
9234
 
9215
9235
  const path = pathKey({env});
@@ -10368,8 +10388,8 @@ class Vitest {
10368
10388
  this.console.error(picocolors.exports.dim("filter: ") + picocolors.exports.yellow(filters.join(comma)));
10369
10389
  if (this.config.include)
10370
10390
  this.console.error(picocolors.exports.dim("include: ") + picocolors.exports.yellow(this.config.include.join(comma)));
10371
- if (this.config.watchIgnore)
10372
- this.console.error(picocolors.exports.dim("ignore: ") + picocolors.exports.yellow(this.config.watchIgnore.join(comma)));
10391
+ if (this.config.watchExclude)
10392
+ this.console.error(picocolors.exports.dim("watch exclude: ") + picocolors.exports.yellow(this.config.watchExclude.join(comma)));
10373
10393
  if (this.config.passWithNoTests)
10374
10394
  this.log("No test files found, exiting with code 0\n");
10375
10395
  else
@@ -10546,6 +10566,9 @@ class Vitest {
10546
10566
  }
10547
10567
  };
10548
10568
  const watcher = this.server.watcher;
10569
+ if (this.config.forceRerunTriggers.length)
10570
+ watcher.add(this.config.forceRerunTriggers);
10571
+ watcher.unwatch(this.config.watchExclude);
10549
10572
  watcher.on("change", onChange);
10550
10573
  watcher.on("unlink", onUnlink);
10551
10574
  watcher.on("add", onAdd);
@@ -10557,8 +10580,12 @@ class Vitest {
10557
10580
  };
10558
10581
  }
10559
10582
  handleFileChanged(id) {
10560
- if (this.changedTests.has(id) || this.invalidates.has(id) || this.config.watchIgnore.some((i) => id.match(i)))
10583
+ if (this.changedTests.has(id) || this.invalidates.has(id))
10561
10584
  return false;
10585
+ if (micromatch_1.isMatch(id, this.config.forceRerunTriggers)) {
10586
+ this.state.getFilepaths().forEach((file) => this.changedTests.add(file));
10587
+ return true;
10588
+ }
10562
10589
  const mod = this.server.moduleGraph.getModuleById(id);
10563
10590
  if (!mod)
10564
10591
  return false;
@@ -10688,7 +10715,7 @@ async function loadGlobalSetupFiles(ctx) {
10688
10715
  var _a;
10689
10716
  const server = ctx.server;
10690
10717
  const runner = ctx.runner;
10691
- const globalSetupFiles = toArray((_a = server.config.test) == null ? void 0 : _a.globalSetup);
10718
+ const globalSetupFiles = toArray$1((_a = server.config.test) == null ? void 0 : _a.globalSetup);
10692
10719
  return Promise.all(globalSetupFiles.map((file) => loadGlobalSetupFile(file, runner)));
10693
10720
  }
10694
10721
  async function loadGlobalSetupFile(file, runner) {
@@ -10939,7 +10966,11 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
10939
10966
  mainFields: []
10940
10967
  },
10941
10968
  server: __spreadProps(__spreadValues({}, preOptions.api), {
10969
+ watch: {
10970
+ ignored: preOptions.watchExclude
10971
+ },
10942
10972
  open,
10973
+ hmr: false,
10943
10974
  preTransformRequests: false
10944
10975
  }),
10945
10976
  cacheDir: void 0,
@@ -10970,7 +11001,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
10970
11001
  await ctx.setServer(options, server);
10971
11002
  haveStarted = true;
10972
11003
  if (options.api && options.watch)
10973
- (await import('./chunk-api-setup.554e8dcb.js')).setup(ctx);
11004
+ (await import('./chunk-api-setup.7945baf8.mjs')).setup(ctx);
10974
11005
  if (!options.watch)
10975
11006
  await server.watcher.close();
10976
11007
  }
@@ -1,7 +1,7 @@
1
1
  import { builtinModules, createRequire } from 'module';
2
2
  import { pathToFileURL, fileURLToPath as fileURLToPath$2, URL as URL$1 } from 'url';
3
3
  import vm from 'vm';
4
- import { m as isAbsolute$2, l as resolve, j as join$2, I as extname$2, d as dirname$2 } from './chunk-utils-global.b9f8edf8.js';
4
+ import { m as isAbsolute$2, l as resolve, j as join$2, I as extname$2, d as dirname$2 } from './chunk-utils-global.624991bc.mjs';
5
5
  import path from 'path';
6
6
  import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
7
7
  import assert from 'assert';
@@ -2776,7 +2776,7 @@ const compare$b = compare_1$1;
2776
2776
  // - If no C has a prerelease and the LT.semver tuple, return false
2777
2777
  // - Else return true
2778
2778
 
2779
- const subset$1 = (sub, dom, options = {}) => {
2779
+ const subset$1 = (sub, dom, options) => {
2780
2780
  if (sub === dom)
2781
2781
  return true
2782
2782
 
@@ -7290,7 +7290,7 @@ const compare = compare_1;
7290
7290
  // - If no C has a prerelease and the LT.semver tuple, return false
7291
7291
  // - Else return true
7292
7292
 
7293
- const subset = (sub, dom, options = {}) => {
7293
+ const subset = (sub, dom, options) => {
7294
7294
  if (sub === dom)
7295
7295
  return true
7296
7296
 
@@ -7948,7 +7948,7 @@ const defaultFindOptions = {
7948
7948
  return null;
7949
7949
  }
7950
7950
  };
7951
- async function findNearestFile(filename, _options = {}) {
7951
+ async function findNearestFile(filename, _options) {
7952
7952
  const options = { ...defaultFindOptions, ..._options };
7953
7953
  const basePath = resolve(options.startingFrom);
7954
7954
  const leadingSlash = basePath[0] === "/";
@@ -8878,6 +8878,13 @@ async function withInlineSourcemap(result) {
8878
8878
  `;
8879
8879
  return result;
8880
8880
  }
8881
+ function toArray(array) {
8882
+ if (array === null || array === void 0)
8883
+ array = [];
8884
+ if (Array.isArray(array))
8885
+ return array;
8886
+ return [array];
8887
+ }
8881
8888
 
8882
8889
  const debugExecute = createDebug("vite-node:client:execute");
8883
8890
  const debugNative = createDebug("vite-node:client:native");
@@ -9170,4 +9177,4 @@ function nanoid(size = 21) {
9170
9177
  return id;
9171
9178
  }
9172
9179
 
9173
- export { ModuleCacheMap as M, ViteNodeRunner as V, isValidNodeImport as a, createBirpc as c, isNodeBuiltin as i, normalizeRequestId as n, slash as s, toFilePath as t, withInlineSourcemap as w };
9180
+ export { ModuleCacheMap as M, ViteNodeRunner as V, isValidNodeImport as a, toFilePath as b, createBirpc as c, isNodeBuiltin as i, normalizeRequestId as n, slash as s, toArray as t, withInlineSourcemap as w };
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
- import { p as picocolors } from './chunk-utils-global.b9f8edf8.js';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.0094db73.js';
2
+ import { p as picocolors } from './chunk-utils-global.624991bc.mjs';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.d492e389.mjs';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
@@ -8,27 +8,27 @@ import 'vite';
8
8
  import 'url';
9
9
  import 'process';
10
10
  import 'fs';
11
- import './chunk-constants.d60bb984.js';
11
+ import './chunk-constants.41584d81.mjs';
12
12
  import 'readline';
13
13
  import 'os';
14
14
  import 'util';
15
15
  import 'stream';
16
- import './vendor-_commonjsHelpers.addc3445.js';
17
- import './chunk-vite-node-utils.6856b365.js';
16
+ import './vendor-_commonjsHelpers.4da45ef5.mjs';
17
+ import './chunk-vite-node-utils.d6687931.mjs';
18
18
  import 'module';
19
19
  import 'vm';
20
20
  import 'assert';
21
21
  import 'debug';
22
- import './chunk-defaults.c11f632f.js';
22
+ import './chunk-defaults.a820faeb.mjs';
23
23
  import 'worker_threads';
24
24
  import 'tinypool';
25
25
  import 'perf_hooks';
26
- import './chunk-utils-source-map.ded50c88.js';
27
- import './vendor-index.42fcc02c.js';
26
+ import './chunk-utils-source-map.4408ba82.mjs';
27
+ import './vendor-index.a2a385d8.mjs';
28
28
  import 'child_process';
29
29
  import 'buffer';
30
- import './chunk-magic-string.41232190.js';
31
- import './vendor-index.405e58ef.js';
30
+ import './chunk-magic-string.efe26975.mjs';
31
+ import './vendor-index.98e769c1.mjs';
32
32
 
33
33
  function toArr(any) {
34
34
  return any == null ? [] : Array.isArray(any) ? any : [any];
@@ -641,7 +641,7 @@ class CAC extends EventEmitter {
641
641
  }
642
642
  }
643
643
 
644
- const cac = (name = "") => new CAC(name);
644
+ const cac = (name) => new CAC(name);
645
645
 
646
646
  const cli = cac("vitest");
647
647
  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").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 mutliple reporters").option("--coverage", "use c8 for coverage").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("--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("--changed [since]", "Run tests that are affected by the changed files (default: false)").help();
package/dist/config.cjs CHANGED
@@ -54,7 +54,8 @@ const config = {
54
54
  testTimeout: 5e3,
55
55
  hookTimeout: 1e4,
56
56
  isolate: true,
57
- watchIgnore: [/\/node_modules\//, /\/dist\//],
57
+ watchExclude: ["**/node_modules/**", "**/dist/**"],
58
+ forceRerunTriggers: [],
58
59
  update: false,
59
60
  reporters: [],
60
61
  silent: false,
package/dist/config.d.ts CHANGED
@@ -82,7 +82,8 @@ declare const config: {
82
82
  testTimeout: number;
83
83
  hookTimeout: number;
84
84
  isolate: boolean;
85
- watchIgnore: RegExp[];
85
+ watchExclude: string[];
86
+ forceRerunTriggers: never[];
86
87
  update: boolean;
87
88
  reporters: never[];
88
89
  silent: boolean;
@@ -50,7 +50,8 @@ const config = {
50
50
  testTimeout: 5e3,
51
51
  hookTimeout: 1e4,
52
52
  isolate: true,
53
- watchIgnore: [/\/node_modules\//, /\/dist\//],
53
+ watchExclude: ["**/node_modules/**", "**/dist/**"],
54
+ forceRerunTriggers: [],
54
55
  update: false,
55
56
  reporters: [],
56
57
  silent: false,
package/dist/entry.mjs ADDED
@@ -0,0 +1,17 @@
1
+ export { r as run } from './vendor-entry.93b045ee.mjs';
2
+ import 'fs';
3
+ import './chunk-utils-global.624991bc.mjs';
4
+ import 'tty';
5
+ import 'local-pkg';
6
+ import 'path';
7
+ import './chunk-runtime-chain.6a3c6576.mjs';
8
+ import 'chai';
9
+ import './vendor-_commonjsHelpers.4da45ef5.mjs';
10
+ import './chunk-runtime-rpc.44043bb4.mjs';
11
+ import './chunk-utils-source-map.4408ba82.mjs';
12
+ import './chunk-integrations-spy.674b628e.mjs';
13
+ import 'tinyspy';
14
+ import 'util';
15
+ import './chunk-defaults.a820faeb.mjs';
16
+ import 'module';
17
+ import 'url';
package/dist/index.d.ts CHANGED
@@ -192,10 +192,9 @@ declare class ViteNodeRunner {
192
192
  hasNestedDefault(target: any): any;
193
193
  private debugLog;
194
194
  }
195
-
196
195
  interface DepsHandlingOptions {
197
196
  external?: (string | RegExp)[];
198
- inline?: (string | RegExp)[];
197
+ inline?: (string | RegExp)[] | true;
199
198
  /**
200
199
  * Try to guess the CJS version of a package when it's invalid ESM
201
200
  * @default false
@@ -733,7 +732,7 @@ interface Test<ExtraContext = {}> extends TaskBase {
733
732
  }
734
733
  declare type Task = Test | Suite | File;
735
734
  declare type DoneCallback = (error?: any) => void;
736
- declare type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<void>;
735
+ declare type TestFunction<ExtraContext = {}> = (context: TestContext & ExtraContext) => Awaitable<any> | void;
737
736
  declare type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
738
737
  1: [T[0]];
739
738
  2: [T[0], T[1]];
@@ -910,8 +909,10 @@ interface InlineConfig {
910
909
  * Vite will process inlined modules.
911
910
  *
912
911
  * This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
912
+ *
913
+ * If `true`, every dependency will be inlined
913
914
  */
914
- inline?: (string | RegExp)[];
915
+ inline?: (string | RegExp)[] | true;
915
916
  /**
916
917
  * Interpret CJS module's default as named exports
917
918
  *
@@ -1028,11 +1029,17 @@ interface InlineConfig {
1028
1029
  */
1029
1030
  globalSetup?: string | string[];
1030
1031
  /**
1031
- * Pattern of file paths to be ignore from triggering watch rerun
1032
+ * Glob pattern of file paths to be ignore from triggering watch rerun
1033
+ */
1034
+ watchExclude?: string[];
1035
+ /**
1036
+ * Glob patter of file paths that will trigger the whole suite rerun
1032
1037
  *
1033
- * @default [/\/node_modules\//, /\/dist\//]
1038
+ * Useful if you are testing calling CLI commands
1039
+ *
1040
+ * @default []
1034
1041
  */
1035
- watchIgnore?: (string | RegExp)[];
1042
+ forceRerunTriggers?: string[];
1036
1043
  /**
1037
1044
  * Isolate environment for each test file
1038
1045
  *
@@ -1521,6 +1528,7 @@ declare type Classes<T> = {
1521
1528
  [K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
1522
1529
  }[keyof T] & (string | symbol);
1523
1530
  interface SpyInstance<TArgs extends any[] = any[], TReturns = any> {
1531
+ (...args: TArgs): TReturns;
1524
1532
  getMockName(): string;
1525
1533
  mockName(n: string): this;
1526
1534
  mock: SpyContext<TArgs, TReturns>;
@@ -1,13 +1,13 @@
1
- export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.db87de48.js';
1
+ export { c as afterAll, f as afterEach, b as beforeAll, e as beforeEach, g as createExpect, d as describe, h as expect, k as getRunningMode, a as isFirstRun, l as isWatchMode, i as it, r as runOnce, s as suite, t as test, j as vi, v as vitest, w as withCallback } from './chunk-runtime-chain.6a3c6576.mjs';
2
2
  export { assert, default as chai, should } from 'chai';
3
- import './vendor-_commonjsHelpers.addc3445.js';
4
- import './chunk-runtime-rpc.6e6614a9.js';
5
- import './chunk-utils-global.b9f8edf8.js';
3
+ import './vendor-_commonjsHelpers.4da45ef5.mjs';
4
+ import './chunk-runtime-rpc.44043bb4.mjs';
5
+ import './chunk-utils-global.624991bc.mjs';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
8
  import 'path';
9
9
  import 'fs';
10
- import './chunk-utils-source-map.ded50c88.js';
11
- import './chunk-integrations-spy.bee66426.js';
10
+ import './chunk-utils-source-map.4408ba82.mjs';
11
+ import './chunk-integrations-spy.674b628e.mjs';
12
12
  import 'tinyspy';
13
13
  import 'util';
package/dist/node.d.ts CHANGED
@@ -36,10 +36,9 @@ declare class ViteNodeRunner {
36
36
  hasNestedDefault(target: any): any;
37
37
  private debugLog;
38
38
  }
39
-
40
39
  interface DepsHandlingOptions {
41
40
  external?: (string | RegExp)[];
42
- inline?: (string | RegExp)[];
41
+ inline?: (string | RegExp)[] | true;
43
42
  /**
44
43
  * Try to guess the CJS version of a package when it's invalid ESM
45
44
  * @default false
@@ -729,8 +728,10 @@ interface InlineConfig {
729
728
  * Vite will process inlined modules.
730
729
  *
731
730
  * This could be helpful to handle packages that ship `.js` in ESM format (that Node can't handle).
731
+ *
732
+ * If `true`, every dependency will be inlined
732
733
  */
733
- inline?: (string | RegExp)[];
734
+ inline?: (string | RegExp)[] | true;
734
735
  /**
735
736
  * Interpret CJS module's default as named exports
736
737
  *
@@ -847,11 +848,17 @@ interface InlineConfig {
847
848
  */
848
849
  globalSetup?: string | string[];
849
850
  /**
850
- * Pattern of file paths to be ignore from triggering watch rerun
851
+ * Glob pattern of file paths to be ignore from triggering watch rerun
852
+ */
853
+ watchExclude?: string[];
854
+ /**
855
+ * Glob patter of file paths that will trigger the whole suite rerun
856
+ *
857
+ * Useful if you are testing calling CLI commands
851
858
  *
852
- * @default [/\/node_modules\//, /\/dist\//]
859
+ * @default []
853
860
  */
854
- watchIgnore?: (string | RegExp)[];
861
+ forceRerunTriggers?: string[];
855
862
  /**
856
863
  * Isolate environment for each test file
857
864
  *
package/dist/node.mjs ADDED
@@ -0,0 +1,32 @@
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.d492e389.mjs';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.7cf95199.mjs';
3
+ import './chunk-utils-global.624991bc.mjs';
4
+ import 'tty';
5
+ import 'local-pkg';
6
+ import 'path';
7
+ import 'vite';
8
+ import 'url';
9
+ import 'process';
10
+ import 'fs';
11
+ import './chunk-constants.41584d81.mjs';
12
+ import 'readline';
13
+ import 'os';
14
+ import 'util';
15
+ import 'stream';
16
+ import 'events';
17
+ import './vendor-_commonjsHelpers.4da45ef5.mjs';
18
+ import './chunk-vite-node-utils.d6687931.mjs';
19
+ import 'module';
20
+ import 'vm';
21
+ import 'assert';
22
+ import 'debug';
23
+ import './chunk-defaults.a820faeb.mjs';
24
+ import 'worker_threads';
25
+ import 'tinypool';
26
+ import 'perf_hooks';
27
+ import './chunk-utils-source-map.4408ba82.mjs';
28
+ import './vendor-index.a2a385d8.mjs';
29
+ import 'child_process';
30
+ import 'buffer';
31
+ import './chunk-magic-string.efe26975.mjs';
32
+ import './vendor-index.98e769c1.mjs';
@@ -1,2 +1,2 @@
1
- export { f as fn, i as isMockFunction, a as spies, s as spyOn } from './chunk-integrations-spy.bee66426.js';
1
+ export { f as fn, i as isMockFunction, a as spies, s as spyOn } from './chunk-integrations-spy.674b628e.mjs';
2
2
  import 'tinyspy';
@@ -1,12 +1,12 @@
1
1
  import { promises } from 'fs';
2
- import { q as isNode, a as getWorkerState, f as safeClearTimeout, e as safeSetTimeout, t as toArray, N as clone, L as getType, o as relative, O as partitionSuiteChildren, P as hasTests, x as hasFailed, v as getFullName, r as resetModules } from './chunk-utils-global.b9f8edf8.js';
2
+ import { q as isNode, a as getWorkerState, f as safeClearTimeout, e as safeSetTimeout, t as toArray, N as clone, L as getType, o as relative, O as partitionSuiteChildren, P as hasTests, x as hasFailed, v as getFullName, r as resetModules } from './chunk-utils-global.624991bc.mjs';
3
3
  import { importModule } from 'local-pkg';
4
- import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, R as RealDate, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, z as getFn, A as getState } from './chunk-runtime-chain.db87de48.js';
4
+ import { s as suite, t as test, d as describe, i as it, r as runOnce, a as isFirstRun, b as beforeAll, c as afterAll, e as beforeEach, f as afterEach, w as withCallback, g as createExpect, h as expect, v as vitest, j as vi, k as getRunningMode, l as isWatchMode, m as resetRunOnceCounter, R as RealDate, n as clearCollectorContext, o as defaultSuite, p as setHooks, q as getHooks, u as collectorContext, x as getSnapshotClient, y as setState, z as getFn, A as getState } from './chunk-runtime-chain.6a3c6576.mjs';
5
5
  import chai, { assert, should, util } from 'chai';
6
- import { r as rpc } from './chunk-runtime-rpc.6e6614a9.js';
7
- import { t as takeCoverage } from './chunk-defaults.c11f632f.js';
6
+ import { r as rpc } from './chunk-runtime-rpc.44043bb4.mjs';
7
+ import { t as takeCoverage } from './chunk-defaults.a820faeb.mjs';
8
8
  import { format } from 'util';
9
- import { s as stringify } from './chunk-utils-source-map.ded50c88.js';
9
+ import { s as stringify } from './chunk-utils-source-map.4408ba82.mjs';
10
10
 
11
11
  var index = /*#__PURE__*/Object.freeze({
12
12
  __proto__: null,
@@ -284,7 +284,7 @@ function getWindowKeys(global, win) {
284
284
  function isClassLikeName(name) {
285
285
  return name[0] === name[0].toUpperCase();
286
286
  }
287
- function populateGlobal(global, win, options = {}) {
287
+ function populateGlobal(global, win, options) {
288
288
  const { bindFunctions = false } = options;
289
289
  const keys = getWindowKeys(global, win);
290
290
  const originals = new Map(allowRewrite.map(([key]) => [key, global[key]]));
@@ -435,7 +435,7 @@ async function setupGlobalEnv(config) {
435
435
  if (isNode)
436
436
  await setupConsoleLogSpy();
437
437
  if (config.globals)
438
- (await import('./chunk-integrations-globals.f7036c09.js')).registerApiGlobally();
438
+ (await import('./chunk-integrations-globals.f0c5e97f.mjs')).registerApiGlobally();
439
439
  }
440
440
  function setupDefines(defines) {
441
441
  for (const key in defines)
@@ -1,4 +1,4 @@
1
- import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
1
+ import { c as commonjsGlobal } from './vendor-_commonjsHelpers.4da45ef5.mjs';
2
2
  import assert$1 from 'assert';
3
3
  import require$$2 from 'events';
4
4
  import childProcess from 'child_process';
@@ -1,8 +1,8 @@
1
- import { l as resolve, a as getWorkerState } from './chunk-utils-global.b9f8edf8.js';
2
- import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.6856b365.js';
3
- import { d as distDir } from './chunk-constants.d60bb984.js';
4
- import { e as executeInViteNode } from './chunk-runtime-mocker.8436db18.js';
5
- import { r as rpc } from './chunk-runtime-rpc.6e6614a9.js';
1
+ import { l as resolve, a as getWorkerState } from './chunk-utils-global.624991bc.mjs';
2
+ import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.d6687931.mjs';
3
+ import { d as distDir } from './chunk-constants.41584d81.mjs';
4
+ import { e as executeInViteNode } from './chunk-runtime-mocker.7cf95199.mjs';
5
+ import { r as rpc } from './chunk-runtime-rpc.44043bb4.mjs';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
8
  import 'path';
@@ -35,7 +35,7 @@ async function startViteNode(ctx) {
35
35
  const { config } = ctx;
36
36
  const { run: run2 } = (await executeInViteNode({
37
37
  files: [
38
- resolve(distDir, "entry.js")
38
+ resolve(distDir, "entry.mjs")
39
39
  ],
40
40
  fetchModule(id) {
41
41
  return rpc().fetch(id);
package/node.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './dist/node'
1
+ export * from './dist/node.js'
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "type": "module",
4
- "version": "0.13.0",
3
+ "version": "0.14.1",
5
4
  "description": "A blazing fast unit test framework powered by Vite",
6
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
6
  "license": "MIT",
@@ -23,7 +22,7 @@
23
22
  "exports": {
24
23
  ".": {
25
24
  "types": "./dist/index.d.ts",
26
- "import": "./dist/index.js"
25
+ "import": "./dist/index.mjs"
27
26
  },
28
27
  "./*": "./*",
29
28
  "./globals": {
@@ -34,16 +33,16 @@
34
33
  },
35
34
  "./node": {
36
35
  "types": "./dist/node.d.ts",
37
- "import": "./dist/node.js"
36
+ "import": "./dist/node.mjs"
38
37
  },
39
38
  "./config": {
40
39
  "types": "./config.d.ts",
41
- "import": "./dist/config.js",
42
- "require": "./dist/config.cjs"
40
+ "require": "./dist/config.cjs",
41
+ "import": "./dist/config.mjs"
43
42
  }
44
43
  },
45
- "main": "./dist/index.js",
46
- "module": "./dist/index.js",
44
+ "main": "./dist/index.mjs",
45
+ "module": "./dist/index.mjs",
47
46
  "types": "./dist/index.d.ts",
48
47
  "bin": {
49
48
  "vitest": "./vitest.mjs"
@@ -97,7 +96,7 @@
97
96
  "@types/node": "^17.0.35",
98
97
  "@types/prompts": "^2.4.0",
99
98
  "@types/sinonjs__fake-timers": "^8.1.2",
100
- "@vitest/ui": "0.13.0",
99
+ "@vitest/ui": "0.14.1",
101
100
  "birpc": "^0.2.3",
102
101
  "c8": "^7.11.3",
103
102
  "cac": "^6.7.12",
@@ -120,11 +119,11 @@
120
119
  "pkg-types": "^0.3.2",
121
120
  "pretty-format": "^27.5.1",
122
121
  "prompts": "^2.4.2",
123
- "rollup": "^2.74.1",
122
+ "rollup": "^2.75.3",
124
123
  "source-map-js": "^1.0.2",
125
124
  "strip-ansi": "^7.0.1",
126
125
  "typescript": "^4.7.2",
127
- "vite-node": "0.13.0",
126
+ "vite-node": "0.14.1",
128
127
  "ws": "^8.7.0"
129
128
  },
130
129
  "scripts": {
package/vitest.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import './dist/cli.js'
2
+ import './dist/cli.mjs'
@@ -1,26 +0,0 @@
1
- import { g as globalApis } from './chunk-constants.d60bb984.js';
2
- import { i as index } from './vendor-entry.6072d652.js';
3
- import 'url';
4
- import './chunk-utils-global.b9f8edf8.js';
5
- import 'tty';
6
- import 'local-pkg';
7
- import 'path';
8
- import 'fs';
9
- import './chunk-runtime-chain.db87de48.js';
10
- import 'chai';
11
- import './vendor-_commonjsHelpers.addc3445.js';
12
- import './chunk-runtime-rpc.6e6614a9.js';
13
- import './chunk-utils-source-map.ded50c88.js';
14
- import './chunk-integrations-spy.bee66426.js';
15
- import 'tinyspy';
16
- import 'util';
17
- import './chunk-defaults.c11f632f.js';
18
- import 'module';
19
-
20
- function registerApiGlobally() {
21
- globalApis.forEach((api) => {
22
- globalThis[api] = index[api];
23
- });
24
- }
25
-
26
- export { registerApiGlobally };
package/dist/entry.js DELETED
@@ -1,17 +0,0 @@
1
- export { r as run } from './vendor-entry.6072d652.js';
2
- import 'fs';
3
- import './chunk-utils-global.b9f8edf8.js';
4
- import 'tty';
5
- import 'local-pkg';
6
- import 'path';
7
- import './chunk-runtime-chain.db87de48.js';
8
- import 'chai';
9
- import './vendor-_commonjsHelpers.addc3445.js';
10
- import './chunk-runtime-rpc.6e6614a9.js';
11
- import './chunk-utils-source-map.ded50c88.js';
12
- import './chunk-integrations-spy.bee66426.js';
13
- import 'tinyspy';
14
- import 'util';
15
- import './chunk-defaults.c11f632f.js';
16
- import 'module';
17
- import 'url';
package/dist/node.js DELETED
@@ -1,32 +0,0 @@
1
- export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.0094db73.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.8436db18.js';
3
- import './chunk-utils-global.b9f8edf8.js';
4
- import 'tty';
5
- import 'local-pkg';
6
- import 'path';
7
- import 'vite';
8
- import 'url';
9
- import 'process';
10
- import 'fs';
11
- import './chunk-constants.d60bb984.js';
12
- import 'readline';
13
- import 'os';
14
- import 'util';
15
- import 'stream';
16
- import 'events';
17
- import './vendor-_commonjsHelpers.addc3445.js';
18
- import './chunk-vite-node-utils.6856b365.js';
19
- import 'module';
20
- import 'vm';
21
- import 'assert';
22
- import 'debug';
23
- import './chunk-defaults.c11f632f.js';
24
- import 'worker_threads';
25
- import 'tinypool';
26
- import 'perf_hooks';
27
- import './chunk-utils-source-map.ded50c88.js';
28
- import './vendor-index.42fcc02c.js';
29
- import 'child_process';
30
- import 'buffer';
31
- import './chunk-magic-string.41232190.js';
32
- import './vendor-index.405e58ef.js';