vitest 0.0.83 → 0.0.84

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.
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'events';
2
- import { c } from './error-a65fcd00.js';
3
- import { c as createVitest } from './index-6c8eed3e.js';
2
+ import { c } from './error-c651f5ae.js';
3
+ import { c as createVitest } from './index-ad1b10e4.js';
4
4
  import 'fs';
5
5
  import 'path';
6
6
  import 'tty';
@@ -631,7 +631,7 @@ class CAC extends EventEmitter {
631
631
 
632
632
  const cac = (name = "") => new CAC(name);
633
633
 
634
- var version = "0.0.83";
634
+ var version = "0.0.84";
635
635
 
636
636
  const cli = cac("vitest");
637
637
  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("-o, --open", "open Vitest UI").option("--api", "listen to port and serve API").option("--threads", "enabled threads", { default: true }).option("--silent", "silent").option("--global", "inject apis globally").option("--dom", "mock browser api with happy-dom").option("--environment <env>", "runner environment", {
package/dist/entry.js CHANGED
@@ -7,7 +7,7 @@ import path, { basename } from 'path';
7
7
  import { r as rpc, s as send } from './rpc-7de86f29.js';
8
8
  import { g as getNames, t as toArray, i as interpretOnlyMode, p as partitionSuiteChildren, c as hasTests, h as hasFailed } from './utils-9dcc4050.js';
9
9
  import fs from 'fs';
10
- import { c as c$1, u as unifiedDiff } from './error-a65fcd00.js';
10
+ import { c as c$1, u as unifiedDiff } from './error-c651f5ae.js';
11
11
  import { performance } from 'perf_hooks';
12
12
  import { b as setHooks, c as createSuiteHooks, e as clearContext, f as defaultSuite, h as context, j as getHooks, k as getFn } from './suite-0e21bf9b.js';
13
13
  import { n as nanoid } from './index-9e71c815.js';
@@ -743,7 +743,7 @@ const asymmetricMatcher =
743
743
  : 0x1357a5;
744
744
  const SPACE$2 = ' ';
745
745
 
746
- const serialize$8 = (val, config, indentation, depth, refs, printer) => {
746
+ const serialize$7 = (val, config, indentation, depth, refs, printer) => {
747
747
  const stringedValue = val.toString();
748
748
 
749
749
  if (
@@ -819,13 +819,13 @@ const serialize$8 = (val, config, indentation, depth, refs, printer) => {
819
819
  return val.toAsymmetricMatcher();
820
820
  };
821
821
 
822
- AsymmetricMatcher$2.serialize = serialize$8;
822
+ AsymmetricMatcher$2.serialize = serialize$7;
823
823
 
824
824
  const test$6 = val => val && val.$$typeof === asymmetricMatcher;
825
825
 
826
826
  AsymmetricMatcher$2.test = test$6;
827
827
  const plugin$6 = {
828
- serialize: serialize$8,
828
+ serialize: serialize$7,
829
829
  test: test$6
830
830
  };
831
831
  var _default$7 = plugin$6;
@@ -926,12 +926,12 @@ const test$5 = val =>
926
926
 
927
927
  ConvertAnsi.test = test$5;
928
928
 
929
- const serialize$7 = (val, config, indentation, depth, refs, printer) =>
929
+ const serialize$6 = (val, config, indentation, depth, refs, printer) =>
930
930
  printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
931
931
 
932
- ConvertAnsi.serialize = serialize$7;
932
+ ConvertAnsi.serialize = serialize$6;
933
933
  const plugin$5 = {
934
- serialize: serialize$7,
934
+ serialize: serialize$6,
935
935
  test: test$5
936
936
  };
937
937
  var _default$6 = plugin$5;
@@ -972,7 +972,7 @@ DOMCollection$2.test = test$4;
972
972
  const isNamedNodeMap = collection =>
973
973
  collection.constructor.name === 'NamedNodeMap';
974
974
 
975
- const serialize$6 = (collection, config, indentation, depth, refs, printer) => {
975
+ const serialize$5 = (collection, config, indentation, depth, refs, printer) => {
976
976
  const name = collection.constructor.name;
977
977
 
978
978
  if (++depth > config.maxDepth) {
@@ -1010,9 +1010,9 @@ const serialize$6 = (collection, config, indentation, depth, refs, printer) => {
1010
1010
  );
1011
1011
  };
1012
1012
 
1013
- DOMCollection$2.serialize = serialize$6;
1013
+ DOMCollection$2.serialize = serialize$5;
1014
1014
  const plugin$4 = {
1015
- serialize: serialize$6,
1015
+ serialize: serialize$5,
1016
1016
  test: test$4
1017
1017
  };
1018
1018
  var _default$5 = plugin$4;
@@ -1260,7 +1260,7 @@ function nodeIsFragment(node) {
1260
1260
  return node.nodeType === FRAGMENT_NODE;
1261
1261
  }
1262
1262
 
1263
- const serialize$5 = (node, config, indentation, depth, refs, printer) => {
1263
+ const serialize$4 = (node, config, indentation, depth, refs, printer) => {
1264
1264
  if (nodeIsText(node)) {
1265
1265
  return (0, _markup$2.printText)(node.data, config);
1266
1266
  }
@@ -1310,9 +1310,9 @@ const serialize$5 = (node, config, indentation, depth, refs, printer) => {
1310
1310
  );
1311
1311
  };
1312
1312
 
1313
- DOMElement$2.serialize = serialize$5;
1313
+ DOMElement$2.serialize = serialize$4;
1314
1314
  const plugin$3 = {
1315
- serialize: serialize$5,
1315
+ serialize: serialize$4,
1316
1316
  test: test$3
1317
1317
  };
1318
1318
  var _default$4 = plugin$3;
@@ -1495,7 +1495,7 @@ const printImmutableValues = (
1495
1495
  ) +
1496
1496
  ']';
1497
1497
 
1498
- const serialize$4 = (val, config, indentation, depth, refs, printer) => {
1498
+ const serialize$3 = (val, config, indentation, depth, refs, printer) => {
1499
1499
  if (val[IS_MAP_SENTINEL]) {
1500
1500
  return printImmutableEntries(
1501
1501
  val,
@@ -1552,7 +1552,7 @@ const serialize$4 = (val, config, indentation, depth, refs, printer) => {
1552
1552
  }; // Explicitly comparing sentinel properties to true avoids false positive
1553
1553
  // when mock identity-obj-proxy returns the key as the value for any key.
1554
1554
 
1555
- Immutable$2.serialize = serialize$4;
1555
+ Immutable$2.serialize = serialize$3;
1556
1556
 
1557
1557
  const test$2 = val =>
1558
1558
  val &&
@@ -1560,7 +1560,7 @@ const test$2 = val =>
1560
1560
 
1561
1561
  Immutable$2.test = test$2;
1562
1562
  const plugin$2 = {
1563
- serialize: serialize$4,
1563
+ serialize: serialize$3,
1564
1564
  test: test$2
1565
1565
  };
1566
1566
  var _default$3 = plugin$2;
@@ -1943,7 +1943,7 @@ const getPropKeys$1 = element => {
1943
1943
  .sort();
1944
1944
  };
1945
1945
 
1946
- const serialize$3 = (element, config, indentation, depth, refs, printer) =>
1946
+ const serialize$2 = (element, config, indentation, depth, refs, printer) =>
1947
1947
  ++depth > config.maxDepth
1948
1948
  ? (0, _markup$1.printElementAsLeaf)(getType(element), config)
1949
1949
  : (0, _markup$1.printElement)(
@@ -1969,13 +1969,13 @@ const serialize$3 = (element, config, indentation, depth, refs, printer) =>
1969
1969
  indentation
1970
1970
  );
1971
1971
 
1972
- ReactElement$2.serialize = serialize$3;
1972
+ ReactElement$2.serialize = serialize$2;
1973
1973
 
1974
1974
  const test$1 = val => val != null && ReactIs.isElement(val);
1975
1975
 
1976
1976
  ReactElement$2.test = test$1;
1977
1977
  const plugin$1 = {
1978
- serialize: serialize$3,
1978
+ serialize: serialize$2,
1979
1979
  test: test$1
1980
1980
  };
1981
1981
  var _default$2 = plugin$1;
@@ -2019,7 +2019,7 @@ const getPropKeys = object => {
2019
2019
  : [];
2020
2020
  };
2021
2021
 
2022
- const serialize$2 = (object, config, indentation, depth, refs, printer) =>
2022
+ const serialize$1 = (object, config, indentation, depth, refs, printer) =>
2023
2023
  ++depth > config.maxDepth
2024
2024
  ? (0, _markup.printElementAsLeaf)(object.type, config)
2025
2025
  : (0, _markup.printElement)(
@@ -2049,13 +2049,13 @@ const serialize$2 = (object, config, indentation, depth, refs, printer) =>
2049
2049
  indentation
2050
2050
  );
2051
2051
 
2052
- ReactTestComponent$2.serialize = serialize$2;
2052
+ ReactTestComponent$2.serialize = serialize$1;
2053
2053
 
2054
2054
  const test = val => val && val.$$typeof === testSymbol;
2055
2055
 
2056
2056
  ReactTestComponent$2.test = test;
2057
2057
  const plugin = {
2058
- serialize: serialize$2,
2058
+ serialize: serialize$1,
2059
2059
  test
2060
2060
  };
2061
2061
  var _default$1 = plugin;
@@ -2721,7 +2721,7 @@ ${string}
2721
2721
  const removeExtraLineBreaks = (string) => string.length > 2 && string.startsWith("\n") && string.endsWith("\n") ? string.slice(1, -1) : string;
2722
2722
  const escapeRegex = true;
2723
2723
  const printFunctionName = false;
2724
- function serialize$1(val, indent = 2, formatOverrides = {}) {
2724
+ function serialize(val, indent = 2, formatOverrides = {}) {
2725
2725
  return normalizeNewlines(format_1(val, __spreadValues$1({
2726
2726
  escapeRegex,
2727
2727
  indent,
@@ -2835,7 +2835,7 @@ class SnapshotState {
2835
2835
  key = testNameToKey(testName, count);
2836
2836
  if (!(isInline && this._snapshotData[key] !== void 0))
2837
2837
  this._uncheckedKeys.delete(key);
2838
- const receivedSerialized = addExtraLineBreaks(serialize$1(received, void 0, this._snapshotFormat));
2838
+ const receivedSerialized = addExtraLineBreaks(serialize(received, void 0, this._snapshotFormat));
2839
2839
  const expected = isInline ? inlineSnapshot : this._snapshotData[key];
2840
2840
  const pass = (expected == null ? void 0 : expected.trim()) === (receivedSerialized == null ? void 0 : receivedSerialized.trim());
2841
2841
  const hasSnapshot = expected !== void 0;
@@ -3652,22 +3652,21 @@ async function runSetupFiles(config) {
3652
3652
  }));
3653
3653
  }
3654
3654
 
3655
- function serialize(err) {
3656
- if (typeof err !== "object")
3657
- return err;
3658
- Object.keys(err).forEach((key) => {
3659
- const val = err[key];
3660
- if (typeof val === "function")
3661
- err[key] = `Function<${val.name}>`;
3662
- if (typeof val !== "object")
3663
- return;
3664
- if ("then" in val)
3665
- err[key] = "Promise";
3666
- if (typeof Element !== "undefined" && val instanceof Element)
3667
- err[key] = val.tagName;
3668
- serialize(err[key]);
3655
+ function serializeError(val) {
3656
+ if (!val)
3657
+ return val;
3658
+ if (typeof val === "function")
3659
+ return `Function<${val.name}>`;
3660
+ if (typeof val !== "object")
3661
+ return val;
3662
+ if (val instanceof Promise || "then" in val)
3663
+ return "Promise";
3664
+ if (typeof Element !== "undefined" && val instanceof Element)
3665
+ return val.tagName;
3666
+ Object.keys(val).forEach((key) => {
3667
+ val[key] = serializeError(val[key]);
3669
3668
  });
3670
- return err;
3669
+ return val;
3671
3670
  }
3672
3671
  function processError(err) {
3673
3672
  if (!err)
@@ -3676,7 +3675,7 @@ function processError(err) {
3676
3675
  err.stackStr = String(err.stack);
3677
3676
  if (err.name)
3678
3677
  err.nameStr = String(err.name);
3679
- return serialize(err);
3678
+ return serializeError(err);
3680
3679
  }
3681
3680
 
3682
3681
  async function collectTests(paths, config) {
@@ -1425,6 +1425,8 @@ function parseStack(stack) {
1425
1425
  return stackFrames.filter(notNullish);
1426
1426
  }
1427
1427
  function unifiedDiff(actual, expected) {
1428
+ if (actual === expected)
1429
+ return "";
1428
1430
  const diffLimit = 10;
1429
1431
  const indent = " ";
1430
1432
  let expectedLinesCount = 0;
@@ -5,7 +5,7 @@ import { promises } from 'fs';
5
5
  import { d as defaultInclude, a as defaultExclude, b as defaultPort, c as distDir, e as configFiles } from './constants-adef7ffb.js';
6
6
  import { g as getNames, s as slash, a as getTests, b as getSuites, t as toArray, h as hasFailed } from './utils-9dcc4050.js';
7
7
  import { performance } from 'perf_hooks';
8
- import { s as stringWidth, a as ansiStyles, b as stripAnsi, d as sliceAnsi, c, F as F_POINTER, e as F_DOWN, f as F_LONG_DASH, g as F_DOWN_RIGHT, h as F_DOT, i as F_CHECK, j as F_CROSS, k as cliTruncate, l as F_RIGHT, p as printError } from './error-a65fcd00.js';
8
+ import { s as stringWidth, a as ansiStyles, b as stripAnsi, d as sliceAnsi, c, F as F_POINTER, e as F_DOWN, f as F_LONG_DASH, g as F_DOWN_RIGHT, h as F_DOT, i as F_CHECK, j as F_CROSS, k as cliTruncate, l as F_RIGHT, p as printError } from './error-c651f5ae.js';
9
9
  import require$$0 from 'assert';
10
10
  import require$$2 from 'events';
11
11
  import { MessageChannel } from 'worker_threads';
package/dist/node.js CHANGED
@@ -1,4 +1,4 @@
1
- export { c as createVitest } from './index-6c8eed3e.js';
1
+ export { c as createVitest } from './index-ad1b10e4.js';
2
2
  import 'path';
3
3
  import 'vite';
4
4
  import 'process';
@@ -7,7 +7,7 @@ import './constants-adef7ffb.js';
7
7
  import 'url';
8
8
  import './utils-9dcc4050.js';
9
9
  import 'perf_hooks';
10
- import './error-a65fcd00.js';
10
+ import './error-c651f5ae.js';
11
11
  import 'tty';
12
12
  import 'source-map';
13
13
  import 'assert';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitest",
3
- "version": "0.0.83",
3
+ "version": "0.0.84",
4
4
  "description": "A blazing fast unit test framework powered by Vite",
5
5
  "keywords": [
6
6
  "vite",