@vitest/utils 3.0.0-beta.1 → 3.0.0-beta.3

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 (2) hide show
  1. package/dist/diff.js +11 -3
  2. package/package.json +2 -2
package/dist/diff.js CHANGED
@@ -1,4 +1,4 @@
1
- import { format, plugins } from '@vitest/pretty-format';
1
+ import { plugins, format } from '@vitest/pretty-format';
2
2
  import c from 'tinyrainbow';
3
3
  import { g as getDefaultExportFromCjs, s as stringify } from './chunk-_commonjsHelpers.js';
4
4
  import { deepClone, getOwnProperties, getType as getType$1 } from './helpers.js';
@@ -1407,7 +1407,7 @@ function getDefaultOptions() {
1407
1407
  includeChangeCounts: false,
1408
1408
  omitAnnotationLines: false,
1409
1409
  patchColor: c.yellow,
1410
- printBasicPrototype: true,
1410
+ printBasicPrototype: false,
1411
1411
  truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
1412
1412
  truncateAnnotation: "... Diff result is truncated",
1413
1413
  truncateAnnotationColor: noColor
@@ -1847,7 +1847,8 @@ const PLUGINS = [
1847
1847
  DOMElement,
1848
1848
  DOMCollection,
1849
1849
  Immutable,
1850
- AsymmetricMatcher
1850
+ AsymmetricMatcher,
1851
+ plugins.Error
1851
1852
  ];
1852
1853
  const FORMAT_OPTIONS = {
1853
1854
  plugins: PLUGINS
@@ -2000,6 +2001,13 @@ ${receivedLine}`;
2000
2001
  return difference;
2001
2002
  }
2002
2003
  function replaceAsymmetricMatcher(actual, expected, actualReplaced = /* @__PURE__ */ new WeakSet(), expectedReplaced = /* @__PURE__ */ new WeakSet()) {
2004
+ if (actual instanceof Error && expected instanceof Error && typeof actual.cause !== "undefined" && typeof expected.cause === "undefined") {
2005
+ delete actual.cause;
2006
+ return {
2007
+ replacedActual: actual,
2008
+ replacedExpected: expected
2009
+ };
2010
+ }
2003
2011
  if (!isReplaceable(actual, expected)) {
2004
2012
  return { replacedActual: actual, replacedExpected: expected };
2005
2013
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/utils",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.1",
4
+ "version": "3.0.0-beta.3",
5
5
  "description": "Shared Vitest utility functions",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "loupe": "^3.1.2",
64
64
  "tinyrainbow": "^1.2.0",
65
- "@vitest/pretty-format": "3.0.0-beta.1"
65
+ "@vitest/pretty-format": "3.0.0-beta.3"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@jridgewell/trace-mapping": "^0.3.25",