vitest 0.10.2 → 0.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { promises } from 'fs';
2
- import { c as createBirpc } from './chunk-vite-node-utils.c160b239.js';
2
+ import { c as createBirpc } from './chunk-vite-node-utils.6b0ec89a.js';
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.90075174.js';
13
- import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.c50fec92.js';
12
+ import { A as API_PATH } from './chunk-constants.54c46a47.js';
13
+ import { r as interpretSourcePos, b as parseStacktrace } from './chunk-utils-timers.27e0c6e9.js';
14
14
  import 'module';
15
15
  import 'vm';
16
- import './chunk-utils-global.9b434e81.js';
16
+ import './chunk-utils-global.eb31f3da.js';
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 { k as resolve } from './chunk-utils-global.9b434e81.js';
2
+ import { k as resolve } from './chunk-utils-global.eb31f3da.js';
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, k as resolve } from './chunk-utils-global.9b434e81.js';
4
+ import { t as toArray, k as resolve } from './chunk-utils-global.eb31f3da.js';
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}/**"];
@@ -1,22 +1,22 @@
1
- import { g as globalApis } from './chunk-constants.90075174.js';
2
- import { i as index } from './vendor-entry.17835032.js';
1
+ import { g as globalApis } from './chunk-constants.54c46a47.js';
2
+ import { i as index } from './vendor-entry.9551d577.js';
3
3
  import 'url';
4
- import './chunk-utils-global.9b434e81.js';
4
+ import './chunk-utils-global.eb31f3da.js';
5
5
  import 'tty';
6
6
  import 'local-pkg';
7
7
  import 'path';
8
8
  import 'fs';
9
9
  import 'console';
10
10
  import 'stream';
11
- import './chunk-runtime-chain.6292a3de.js';
11
+ import './chunk-runtime-chain.d0bd6df6.js';
12
12
  import 'chai';
13
13
  import './vendor-_commonjsHelpers.addc3445.js';
14
- import './chunk-runtime-rpc.8e14ae4f.js';
15
- import './chunk-utils-timers.c50fec92.js';
14
+ import './chunk-runtime-rpc.710f6f7f.js';
15
+ import './chunk-utils-timers.27e0c6e9.js';
16
16
  import './chunk-integrations-spy.f036df6f.js';
17
17
  import 'tinyspy';
18
18
  import 'util';
19
- import './chunk-defaults.fd5b939d.js';
19
+ import './chunk-defaults.c143550b.js';
20
20
  import 'module';
21
21
  import 'crypto';
22
22
 
@@ -1,9 +1,9 @@
1
1
  import chai$1, { expect as expect$1, util } from 'chai';
2
2
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
3
- import { r as rpc } from './chunk-runtime-rpc.8e14ae4f.js';
4
- import { i as isObject, a as index, g as getCallLastIndex, s as slash, b as getWorkerState, c as getNames, d as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.9b434e81.js';
3
+ import { r as rpc } from './chunk-runtime-rpc.710f6f7f.js';
4
+ import { i as isObject, a as index, g as getCallLastIndex, s as slash, b as getWorkerState, c as getNames, d as assertTypes, p as picocolors, n as noop, t as toArray, r as resetModules } from './chunk-utils-global.eb31f3da.js';
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, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.c50fec92.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, c as setTimeout, d as clearTimeout } from './chunk-utils-timers.27e0c6e9.js';
7
7
  import { i as isMockFunction, s as spyOn, f as fn, a as spies } from './chunk-integrations-spy.f036df6f.js';
8
8
  import require$$0, { format } from 'util';
9
9
 
@@ -534,14 +534,18 @@ ${snapshots.join("\n\n")}
534
534
  }
535
535
  function prepareExpected(expected) {
536
536
  function findStartIndent() {
537
- var _a;
538
- const match = /^( +)}\s+$/m.exec(expected || "");
539
- return ((_a = match == null ? void 0 : match[1]) == null ? void 0 : _a.length) || 0;
537
+ var _a, _b;
538
+ const matchObject = /^( +)}\s+$/m.exec(expected || "");
539
+ const objectIndent = (_a = matchObject == null ? void 0 : matchObject[1]) == null ? void 0 : _a.length;
540
+ if (objectIndent)
541
+ return objectIndent;
542
+ const matchText = /^\n( +)"/.exec(expected || "");
543
+ return ((_b = matchText == null ? void 0 : matchText[1]) == null ? void 0 : _b.length) || 0;
540
544
  }
541
- const startIdent = findStartIndent();
545
+ const startIndent = findStartIndent();
542
546
  let expectedTrimmed = expected == null ? void 0 : expected.trim();
543
- if (startIdent) {
544
- expectedTrimmed = expectedTrimmed == null ? void 0 : expectedTrimmed.replace(new RegExp(`^${" ".repeat(startIdent)}`, "gm"), "").replace(/ +}$/, "}");
547
+ if (startIndent) {
548
+ expectedTrimmed = expectedTrimmed == null ? void 0 : expectedTrimmed.replace(new RegExp(`^${" ".repeat(startIndent)}`, "gm"), "").replace(/ +}$/, "}");
545
549
  }
546
550
  return expectedTrimmed;
547
551
  }
@@ -898,7 +902,17 @@ class SnapshotClient {
898
902
  clearTest() {
899
903
  this.test = void 0;
900
904
  }
901
- assert(received, test = this.test, message, isInline = false, properties, inlineSnapshot, error) {
905
+ assert(options) {
906
+ const {
907
+ test = this.test,
908
+ message,
909
+ isInline = false,
910
+ properties,
911
+ inlineSnapshot,
912
+ error,
913
+ errorMessage
914
+ } = options;
915
+ let { received } = options;
902
916
  if (!test)
903
917
  throw new Error("Snapshot cannot be used outside of test");
904
918
  if (typeof properties === "object") {
@@ -911,7 +925,7 @@ class SnapshotClient {
911
925
  else
912
926
  received = deepMergeSnapshot(received, properties);
913
927
  } catch (err) {
914
- err.message = "Snapshot mismatched";
928
+ err.message = errorMessage || "Snapshot mismatched";
915
929
  throw err;
916
930
  }
917
931
  }
@@ -931,7 +945,7 @@ class SnapshotClient {
931
945
  try {
932
946
  expect$1(actual.trim()).equals(expected ? expected.trim() : "");
933
947
  } catch (error2) {
934
- error2.message = `Snapshot \`${key || "unknown"}\` mismatched`;
948
+ error2.message = errorMessage || `Snapshot \`${key || "unknown"}\` mismatched`;
935
949
  throw error2;
936
950
  }
937
951
  }
@@ -973,7 +987,15 @@ const SnapshotPlugin = (chai, utils) => {
973
987
  message = properties;
974
988
  properties = void 0;
975
989
  }
976
- getSnapshotClient().assert(expected, test, message, false, properties);
990
+ const errorMessage = utils.flag(this, "message");
991
+ getSnapshotClient().assert({
992
+ received: expected,
993
+ test,
994
+ message,
995
+ isInline: false,
996
+ properties,
997
+ errorMessage
998
+ });
977
999
  });
978
1000
  }
979
1001
  utils.addMethod(chai.Assertion.prototype, "toMatchInlineSnapshot", function __VITEST_INLINE_SNAPSHOT__(properties, inlineSnapshot, message) {
@@ -987,18 +1009,43 @@ const SnapshotPlugin = (chai, utils) => {
987
1009
  }
988
1010
  if (inlineSnapshot)
989
1011
  inlineSnapshot = stripSnapshotIndentation(inlineSnapshot);
990
- getSnapshotClient().assert(expected, test, message, true, properties, inlineSnapshot, error);
1012
+ const errorMessage = utils.flag(this, "message");
1013
+ getSnapshotClient().assert({
1014
+ received: expected,
1015
+ test,
1016
+ message,
1017
+ isInline: true,
1018
+ properties,
1019
+ inlineSnapshot,
1020
+ error,
1021
+ errorMessage
1022
+ });
991
1023
  });
992
1024
  utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingSnapshot", function(message) {
993
1025
  const expected = utils.flag(this, "object");
994
1026
  const test = utils.flag(this, "vitest-test");
995
- getSnapshotClient().assert(getErrorString(expected), test, message);
1027
+ const errorMessage = utils.flag(this, "message");
1028
+ getSnapshotClient().assert({
1029
+ received: getErrorString(expected),
1030
+ test,
1031
+ message,
1032
+ errorMessage
1033
+ });
996
1034
  });
997
1035
  utils.addMethod(chai.Assertion.prototype, "toThrowErrorMatchingInlineSnapshot", function __VITEST_INLINE_SNAPSHOT__(inlineSnapshot, message) {
998
1036
  const expected = utils.flag(this, "object");
999
1037
  const error = utils.flag(this, "error");
1000
1038
  const test = utils.flag(this, "vitest-test");
1001
- getSnapshotClient().assert(getErrorString(expected), test, message, true, void 0, inlineSnapshot, error);
1039
+ const errorMessage = utils.flag(this, "message");
1040
+ getSnapshotClient().assert({
1041
+ received: getErrorString(expected),
1042
+ test,
1043
+ message,
1044
+ inlineSnapshot,
1045
+ isInline: true,
1046
+ error,
1047
+ errorMessage
1048
+ });
1002
1049
  });
1003
1050
  };
1004
1051
 
@@ -1,8 +1,8 @@
1
- import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.c160b239.js';
1
+ import { n as normalizeRequestId, i as isNodeBuiltin, t as toFilePath, V as ViteNodeRunner } from './chunk-vite-node-utils.6b0ec89a.js';
2
2
  import { normalizePath } from 'vite';
3
- import { b as getWorkerState, B as isWindows, C as mergeSlashes, h as dirname, f as basename, k as resolve, D as getType, E as getAllProperties, s as slash } from './chunk-utils-global.9b434e81.js';
3
+ import { b as getWorkerState, D as isWindows, E as mergeSlashes, h as dirname, f as basename, k as resolve, F as getType, G as getAllProperties, s as slash } from './chunk-utils-global.eb31f3da.js';
4
4
  import { existsSync, readdirSync } from 'fs';
5
- import { d as distDir } from './chunk-constants.90075174.js';
5
+ import { d as distDir } from './chunk-constants.54c46a47.js';
6
6
 
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -1,4 +1,4 @@
1
- import { b as getWorkerState } from './chunk-utils-global.9b434e81.js';
1
+ import { b as getWorkerState } from './chunk-utils-global.eb31f3da.js';
2
2
 
3
3
  const rpc = () => {
4
4
  return getWorkerState().rpc;
@@ -335,6 +335,9 @@ function assertTypes(value, name, types) {
335
335
  if (!pass)
336
336
  throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`);
337
337
  }
338
+ function stdout() {
339
+ return console._stdout || process.stdout;
340
+ }
338
341
 
339
342
  function getTests(suite) {
340
343
  return toArray(suite).flatMap((s) => s.type === "test" ? [s] : s.tasks.flatMap((c) => c.type === "test" ? [c] : getTests(c)));
@@ -454,4 +457,4 @@ function getCallLastIndex(code) {
454
457
  return null;
455
458
  }
456
459
 
457
- export { extname as A, isWindows as B, mergeSlashes as C, getType as D, getAllProperties as E, clone as F, partitionSuiteChildren as G, hasTests as H, index as a, getWorkerState as b, getNames as c, assertTypes as d, notNullish as e, basename as f, getCallLastIndex as g, dirname as h, isObject as i, join as j, resolve as k, isAbsolute as l, relative as m, noop as n, getTests as o, picocolors as p, getFullName as q, resetModules as r, slash as s, toArray as t, hasFailed as u, hasFailedSnapshot as v, getSuites as w, deepMerge as x, toNamespacedPath as y, ensurePackageInstalled as z };
460
+ export { ensurePackageInstalled as A, stdout as B, extname as C, isWindows as D, mergeSlashes as E, getType as F, getAllProperties as G, clone as H, partitionSuiteChildren as I, hasTests as J, index as a, getWorkerState as b, getNames as c, assertTypes as d, notNullish as e, basename as f, getCallLastIndex as g, dirname as h, isObject as i, join as j, resolve as k, isAbsolute as l, relative as m, noop as n, getTests as o, picocolors as p, getFullName as q, resetModules as r, slash as s, toArray as t, hasFailed as u, hasFailedSnapshot as v, getSuites as w, normalize as x, deepMerge as y, toNamespacedPath as z };
@@ -1,4 +1,4 @@
1
- import { s as slash, e as notNullish, p as picocolors } from './chunk-utils-global.9b434e81.js';
1
+ import { s as slash, e as notNullish, p as picocolors } from './chunk-utils-global.eb31f3da.js';
2
2
 
3
3
  const setTimeout$1 = globalThis.setTimeout;
4
4
  const setInterval = globalThis.setInterval;
@@ -7407,7 +7407,7 @@ function stringify(object, maxDepth = 10, options) {
7407
7407
  const printReceived = (object) => RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
7408
7408
  const printExpected = (value) => EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
7409
7409
  function diff(a, b, options) {
7410
- return unifiedDiff(stringify(a), stringify(b));
7410
+ return unifiedDiff(stringify(b), stringify(a));
7411
7411
  }
7412
7412
 
7413
7413
  var matcherUtils = /*#__PURE__*/Object.freeze({
@@ -5,25 +5,25 @@ import process$1 from 'process';
5
5
  import { s as signalExit, m as mergeStream, g as getStream, c as crossSpawn, o as onetime$1 } from './vendor-index.40be925a.js';
6
6
  import url, { fileURLToPath, pathToFileURL } from 'url';
7
7
  import require$$0, { constants as constants$5, cpus, hostname } from 'os';
8
- import { j as join, f as basename, h as dirname, k as resolve, p as picocolors, s as slash$2, l as isAbsolute, m as relative, o as getTests, q as getFullName, u as hasFailed, v as hasFailedSnapshot, w as getSuites, t as toArray, n as noop$1, x as deepMerge, y as toNamespacedPath, g as getCallLastIndex, e as notNullish, z as ensurePackageInstalled } from './chunk-utils-global.9b434e81.js';
8
+ import { j as join, f as basename, h as dirname, k as resolve, p as picocolors, s as slash$2, l as isAbsolute, m as relative, o as getTests, q as getFullName, u as hasFailed, v as hasFailedSnapshot, w as getSuites, t as toArray, x as normalize, n as noop$1, y as deepMerge, z as toNamespacedPath, g as getCallLastIndex, e as notNullish, A as ensurePackageInstalled, B as stdout } from './chunk-utils-global.eb31f3da.js';
9
9
  import { createServer, mergeConfig } from 'vite';
10
10
  import fs$8, { promises, existsSync, readFileSync } from 'fs';
11
- import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.90075174.js';
11
+ import { d as distDir, a as defaultPort, c as configFiles } from './chunk-constants.54c46a47.js';
12
12
  import readline from 'readline';
13
13
  import require$$0$1 from 'util';
14
14
  import require$$0$2 from 'stream';
15
15
  import require$$2 from 'events';
16
16
  import { c as commonjsGlobal } from './vendor-_commonjsHelpers.addc3445.js';
17
- 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.c160b239.js';
18
- import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.fd5b939d.js';
17
+ 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.6b0ec89a.js';
18
+ import { c as configDefaults, r as resolveC8Options, a as cleanCoverage, b as reportCoverage } from './chunk-defaults.c143550b.js';
19
19
  import { MessageChannel } from 'worker_threads';
20
20
  import { Tinypool } from 'tinypool';
21
21
  import { performance } from 'perf_hooks';
22
- import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.c50fec92.js';
22
+ import { e as stripAnsi, h as stringWidth, i as ansiStyles, j as sliceAnsi, k as setInterval, o as clearInterval, q as cliTruncate, c as setTimeout$1, b as parseStacktrace, r as interpretSourcePos, s as stringify$5, u as unifiedDiff, a as posToNumber, l as lineSplitRE, d as clearTimeout$1 } from './chunk-utils-timers.27e0c6e9.js';
23
23
  import MagicString from './chunk-magic-string.d5e0e473.js';
24
24
  import { p as prompts } from './vendor-index.405e58ef.js';
25
25
 
26
- var version = "0.10.2";
26
+ var version = "0.10.5";
27
27
 
28
28
  function stripFinalNewline(input) {
29
29
  const LF = typeof input === 'string' ? '\n' : '\n'.charCodeAt();
@@ -8487,7 +8487,7 @@ class BaseReporter {
8487
8487
  if (errors.length) {
8488
8488
  process.exitCode = 1;
8489
8489
  const errorMessage = picocolors.exports.red(picocolors.exports.bold(`
8490
- Vitest catched ${errors.length} unhandled error${errors.length > 1 ? "s" : ""} during the test run. This might cause false positive tests.
8490
+ Vitest caught ${errors.length} unhandled error${errors.length > 1 ? "s" : ""} during the test run. This might cause false positive tests.
8491
8491
  Please, resolve all the errors to make sure your tests are not affected.`));
8492
8492
  this.ctx.log(picocolors.exports.red(divider(picocolors.exports.bold(picocolors.exports.inverse(" Unhandled Errors ")))));
8493
8493
  this.ctx.log(errorMessage);
@@ -10099,7 +10099,7 @@ const esmErrors = [
10099
10099
  function handleImportOutsideModuleError(stack, ctx) {
10100
10100
  if (!esmErrors.some((e) => stack.includes(e)))
10101
10101
  return;
10102
- const path = stack.split("\n")[0].trim();
10102
+ const path = normalize(stack.split("\n")[0].trim());
10103
10103
  let name = path.split("/node_modules/").pop() || "";
10104
10104
  if (name == null ? void 0 : name.startsWith("@"))
10105
10105
  name = name.split("/").slice(0, 2).join("/");
@@ -10435,7 +10435,10 @@ class Vitest {
10435
10435
  await this.rerunFiles(this.state.getFailedFilepaths(), "rerun failed");
10436
10436
  }
10437
10437
  async updateSnapshot(files) {
10438
- files = files || this.state.getFailedFilepaths();
10438
+ files = files || [
10439
+ ...this.state.getFailedFilepaths(),
10440
+ ...this.snapshot.summary.uncheckedKeysByFile.map((s) => s.filePath)
10441
+ ];
10439
10442
  this.configOverride = {
10440
10443
  snapshotOptions: {
10441
10444
  updateSnapshot: "all"
@@ -10935,7 +10938,7 @@ async function VitestPlugin(options = {}, ctx = new Vitest()) {
10935
10938
  await ctx.setServer(options, server);
10936
10939
  haveStarted = true;
10937
10940
  if (options.api && options.watch)
10938
- (await import('./chunk-api-setup.b55307fb.js')).setup(ctx);
10941
+ (await import('./chunk-api-setup.2c4e9375.js')).setup(ctx);
10939
10942
  if (!options.watch)
10940
10943
  await server.watcher.close();
10941
10944
  }
@@ -10974,7 +10977,7 @@ const keys = [
10974
10977
  ["q", "quit"]
10975
10978
  ];
10976
10979
  function printShortcutsHelp() {
10977
- process.stdout.write(`
10980
+ stdout().write(`
10978
10981
  ${picocolors.exports.bold(" Watch Usage")}
10979
10982
  ${keys.map((i) => picocolors.exports.dim(" press ") + picocolors.exports.reset(picocolors.exports.bold(i[0])) + picocolors.exports.dim(` to ${i[1]}`)).join("\n")}
10980
10983
  `);
@@ -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 { l as isAbsolute$2, k as resolve, j as join$2, A as extname$2, h as dirname$2 } from './chunk-utils-global.9b434e81.js';
4
+ import { l as isAbsolute$2, k as resolve, j as join$2, C as extname$2, h as dirname$2 } from './chunk-utils-global.eb31f3da.js';
5
5
  import path from 'path';
6
6
  import fs, { realpathSync, statSync, Stats, promises, existsSync } from 'fs';
7
7
  import assert from 'assert';
@@ -8976,7 +8976,7 @@ ${getStack()}`), 2e3);
8976
8976
  const requestStubs = this.options.requestStubs || DEFAULT_REQUEST_STUBS;
8977
8977
  if (id in requestStubs)
8978
8978
  return requestStubs[id];
8979
- const { code: transformed, externalize } = await this.options.fetchModule(id);
8979
+ let { code: transformed, externalize } = await this.options.fetchModule(id);
8980
8980
  if (externalize) {
8981
8981
  const mod = await this.interopedImport(externalize);
8982
8982
  this.moduleCache.set(fsPath, { exports: mod });
@@ -9010,6 +9010,8 @@ ${getStack()}`), 2e3);
9010
9010
  __filename,
9011
9011
  __dirname: dirname$2(__filename)
9012
9012
  });
9013
+ if (transformed[0] === "#")
9014
+ transformed = transformed.replace(/^\#\!.*/, (s) => " ".repeat(s.length));
9013
9015
  const fn = vm.runInThisContext(`'use strict';async (${Object.keys(context).join(",")})=>{{${transformed}
9014
9016
  }}`, {
9015
9017
  filename: fsPath,
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
- import { p as picocolors } from './chunk-utils-global.9b434e81.js';
3
- import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.4255f25f.js';
2
+ import { p as picocolors } from './chunk-utils-global.eb31f3da.js';
3
+ import { v as version, s as startVitest, d as divider } from './chunk-vite-node-externalize.965e6527.js';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
@@ -16,16 +16,16 @@ import 'util';
16
16
  import 'url';
17
17
  import 'os';
18
18
  import 'vite';
19
- import './chunk-constants.90075174.js';
19
+ import './chunk-constants.54c46a47.js';
20
20
  import 'readline';
21
- import './chunk-vite-node-utils.c160b239.js';
21
+ import './chunk-vite-node-utils.6b0ec89a.js';
22
22
  import 'module';
23
23
  import 'vm';
24
- import './chunk-defaults.fd5b939d.js';
24
+ import './chunk-defaults.c143550b.js';
25
25
  import 'worker_threads';
26
26
  import 'tinypool';
27
27
  import 'perf_hooks';
28
- import './chunk-utils-timers.c50fec92.js';
28
+ import './chunk-utils-timers.27e0c6e9.js';
29
29
  import './chunk-magic-string.d5e0e473.js';
30
30
  import './vendor-index.405e58ef.js';
31
31
 
package/dist/entry.js CHANGED
@@ -1,20 +1,20 @@
1
- export { r as run } from './vendor-entry.17835032.js';
1
+ export { r as run } from './vendor-entry.9551d577.js';
2
2
  import 'fs';
3
- import './chunk-utils-global.9b434e81.js';
3
+ import './chunk-utils-global.eb31f3da.js';
4
4
  import 'tty';
5
5
  import 'local-pkg';
6
6
  import 'path';
7
7
  import 'console';
8
8
  import 'stream';
9
- import './chunk-runtime-chain.6292a3de.js';
9
+ import './chunk-runtime-chain.d0bd6df6.js';
10
10
  import 'chai';
11
11
  import './vendor-_commonjsHelpers.addc3445.js';
12
- import './chunk-runtime-rpc.8e14ae4f.js';
13
- import './chunk-utils-timers.c50fec92.js';
12
+ import './chunk-runtime-rpc.710f6f7f.js';
13
+ import './chunk-utils-timers.27e0c6e9.js';
14
14
  import './chunk-integrations-spy.f036df6f.js';
15
15
  import 'tinyspy';
16
16
  import 'util';
17
- import './chunk-defaults.fd5b939d.js';
17
+ import './chunk-defaults.c143550b.js';
18
18
  import 'module';
19
19
  import 'url';
20
20
  import 'crypto';
package/dist/index.js CHANGED
@@ -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.6292a3de.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.d0bd6df6.js';
2
2
  export { assert, default as chai, should } from 'chai';
3
3
  import './vendor-_commonjsHelpers.addc3445.js';
4
- import './chunk-runtime-rpc.8e14ae4f.js';
5
- import './chunk-utils-global.9b434e81.js';
4
+ import './chunk-runtime-rpc.710f6f7f.js';
5
+ import './chunk-utils-global.eb31f3da.js';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
8
  import 'path';
9
9
  import 'fs';
10
- import './chunk-utils-timers.c50fec92.js';
10
+ import './chunk-utils-timers.27e0c6e9.js';
11
11
  import './chunk-integrations-spy.f036df6f.js';
12
12
  import 'tinyspy';
13
13
  import 'util';
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.4255f25f.js';
2
- export { V as VitestRunner } from './chunk-runtime-mocker.ca5ecf98.js';
1
+ export { V as VitestPlugin, c as createVitest, s as startVitest } from './chunk-vite-node-externalize.965e6527.js';
2
+ export { V as VitestRunner } from './chunk-runtime-mocker.0871693a.js';
3
3
  import 'buffer';
4
4
  import 'path';
5
5
  import 'child_process';
@@ -13,19 +13,19 @@ import 'stream';
13
13
  import 'util';
14
14
  import 'url';
15
15
  import 'os';
16
- import './chunk-utils-global.9b434e81.js';
16
+ import './chunk-utils-global.eb31f3da.js';
17
17
  import 'tty';
18
18
  import 'local-pkg';
19
19
  import 'vite';
20
- import './chunk-constants.90075174.js';
20
+ import './chunk-constants.54c46a47.js';
21
21
  import 'readline';
22
- import './chunk-vite-node-utils.c160b239.js';
22
+ import './chunk-vite-node-utils.6b0ec89a.js';
23
23
  import 'module';
24
24
  import 'vm';
25
- import './chunk-defaults.fd5b939d.js';
25
+ import './chunk-defaults.c143550b.js';
26
26
  import 'worker_threads';
27
27
  import 'tinypool';
28
28
  import 'perf_hooks';
29
- import './chunk-utils-timers.c50fec92.js';
29
+ import './chunk-utils-timers.27e0c6e9.js';
30
30
  import './chunk-magic-string.d5e0e473.js';
31
31
  import './vendor-index.405e58ef.js';
@@ -1,13 +1,13 @@
1
1
  import { promises } from 'fs';
2
- import { b as getWorkerState, t as toArray, F as clone, D as getType, m as relative, G as partitionSuiteChildren, H as hasTests, u as hasFailed, q as getFullName, r as resetModules } from './chunk-utils-global.9b434e81.js';
2
+ import { b as getWorkerState, t as toArray, H as clone, F as getType, m as relative, B as stdout, I as partitionSuiteChildren, J as hasTests, u as hasFailed, q as getFullName, r as resetModules } from './chunk-utils-global.eb31f3da.js';
3
3
  import { Console } from 'console';
4
4
  import { Writable } from 'stream';
5
5
  import { importModule } from 'local-pkg';
6
- 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.6292a3de.js';
6
+ 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.d0bd6df6.js';
7
7
  import chai, { assert, should, util } from 'chai';
8
- import { r as rpc } from './chunk-runtime-rpc.8e14ae4f.js';
9
- import { d as clearTimeout, c as setTimeout, s as stringify } from './chunk-utils-timers.c50fec92.js';
10
- import { t as takeCoverage } from './chunk-defaults.fd5b939d.js';
8
+ import { r as rpc } from './chunk-runtime-rpc.710f6f7f.js';
9
+ import { d as clearTimeout, c as setTimeout, s as stringify } from './chunk-utils-timers.27e0c6e9.js';
10
+ import { t as takeCoverage } from './chunk-defaults.c143550b.js';
11
11
  import { createHash } from 'crypto';
12
12
  import { format } from 'util';
13
13
 
@@ -374,8 +374,8 @@ var jsdom = {
374
374
  var happy = {
375
375
  name: "happy-dom",
376
376
  async setup(global) {
377
- const { Window } = await importModule("happy-dom");
378
- const win = new Window();
377
+ const { Window, GlobalWindow } = await importModule("happy-dom");
378
+ const win = new (GlobalWindow || Window)();
379
379
  const keys = getWindowKeys(global, win);
380
380
  const overrideObject = /* @__PURE__ */ new Map();
381
381
  for (const key of keys) {
@@ -419,7 +419,7 @@ async function setupGlobalEnv(config) {
419
419
  globalSetup = true;
420
420
  setupConsoleLogSpy();
421
421
  if (config.globals)
422
- (await import('./chunk-integrations-globals.16d9702f.js')).registerApiGlobally();
422
+ (await import('./chunk-integrations-globals.d3383e75.js')).registerApiGlobally();
423
423
  }
424
424
  function setupDefines(defines) {
425
425
  for (const key in defines)
@@ -672,7 +672,7 @@ async function collectTests(paths, config) {
672
672
  state: "fail",
673
673
  error: processError(e)
674
674
  };
675
- process.stdout.write("\0");
675
+ stdout().write("\0");
676
676
  }
677
677
  calculateHash(file);
678
678
  const hasOnlyTasks = someTasksAreOnly(file);
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
- import { k as resolve, b as getWorkerState } from './chunk-utils-global.9b434e81.js';
2
- import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.c160b239.js';
3
- import { d as distDir } from './chunk-constants.90075174.js';
4
- import { e as executeInViteNode } from './chunk-runtime-mocker.ca5ecf98.js';
5
- import { r as rpc } from './chunk-runtime-rpc.8e14ae4f.js';
1
+ import { k as resolve, b as getWorkerState, B as stdout } from './chunk-utils-global.eb31f3da.js';
2
+ import { c as createBirpc, M as ModuleCacheMap } from './chunk-vite-node-utils.6b0ec89a.js';
3
+ import { d as distDir } from './chunk-constants.54c46a47.js';
4
+ import { e as executeInViteNode } from './chunk-runtime-mocker.0871693a.js';
5
+ import { r as rpc } from './chunk-runtime-rpc.710f6f7f.js';
6
6
  import 'tty';
7
7
  import 'local-pkg';
8
8
  import 'path';
@@ -54,7 +54,7 @@ async function startViteNode(ctx) {
54
54
  function init(ctx) {
55
55
  if (typeof __vitest_worker__ !== "undefined" && ctx.config.threads && ctx.config.isolate)
56
56
  throw new Error(`worker for ${ctx.files.join(",")} already initialized by ${getWorkerState().ctx.files.join(",")}. This is probably an internal bug of Vitest.`);
57
- process.stdout.write("\0");
57
+ stdout().write("\0");
58
58
  const { config, port, id } = ctx;
59
59
  process.env.VITEST_WORKER_ID = String(id);
60
60
  globalThis.__vitest_worker__ = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vitest",
3
3
  "type": "module",
4
- "version": "0.10.2",
4
+ "version": "0.10.5",
5
5
  "description": "A blazing fast unit test framework powered by Vite",
6
6
  "keywords": [
7
7
  "vite",
@@ -81,7 +81,7 @@
81
81
  "local-pkg": "^0.4.1",
82
82
  "tinypool": "^0.1.3",
83
83
  "tinyspy": "^0.3.2",
84
- "vite": "^2.9.5"
84
+ "vite": "^2.9.7"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@antfu/install-pkg": "^0.1.0",
@@ -93,7 +93,7 @@
93
93
  "@types/node": "^17.0.31",
94
94
  "@types/prompts": "^2.4.0",
95
95
  "@types/sinonjs__fake-timers": "^8.1.2",
96
- "@vitest/ui": "0.10.2",
96
+ "@vitest/ui": "0.10.5",
97
97
  "birpc": "^0.2.2",
98
98
  "c8": "^7.11.2",
99
99
  "cac": "^6.7.12",
@@ -104,7 +104,7 @@
104
104
  "fast-glob": "^3.2.11",
105
105
  "find-up": "^6.3.0",
106
106
  "flatted": "^3.2.5",
107
- "happy-dom": "^2.55.0",
107
+ "happy-dom": "^3.1.1",
108
108
  "jsdom": "^19.0.0",
109
109
  "log-update": "^5.0.1",
110
110
  "magic-string": "^0.26.1",
@@ -120,7 +120,7 @@
120
120
  "source-map-js": "^1.0.2",
121
121
  "strip-ansi": "^7.0.1",
122
122
  "typescript": "^4.6.4",
123
- "vite-node": "0.10.2",
123
+ "vite-node": "0.10.5",
124
124
  "ws": "^8.6.0"
125
125
  },
126
126
  "engines": {