@vitest/expect 4.1.5 → 5.0.0-beta.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 (2) hide show
  1. package/dist/index.js +3 -4
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { printDiffOrStringify, diff } from '@vitest/utils/diff';
2
- import { stringify } from '@vitest/utils/display';
2
+ import { stringify, inspect } from '@vitest/utils/display';
3
3
  import { getType, isObject, noop, assertTypes, ordinal } from '@vitest/utils/helpers';
4
4
  import c from 'tinyrainbow';
5
5
  import { isMockFunction } from '@vitest/spy';
@@ -1407,7 +1407,7 @@ const JestChaiExpect = (chai, utils) => {
1407
1407
  };
1408
1408
  const { value, exists } = getValue();
1409
1409
  const pass = exists && (args.length === 1 || equals(expected, value, customTesters));
1410
- const valueString = args.length === 1 ? "" : ` with value ${utils.objDisplay(expected)}`;
1410
+ const valueString = args.length === 1 ? "" : ` with value ${inspect(expected, { truncate: 40 })}`;
1411
1411
  return this.assert(pass, `expected #{this} to have property "${propertyName}"${valueString}`, `expected #{this} to not have property "${propertyName}"${valueString}`, expected, exists ? value : undefined);
1412
1412
  });
1413
1413
  def("toBeCloseTo", function(received, precision = 2) {
@@ -1548,8 +1548,7 @@ const JestChaiExpect = (chai, utils) => {
1548
1548
  });
1549
1549
  def(["toThrow", "toThrowError"], function(expected) {
1550
1550
  if (typeof expected === "string" || typeof expected === "undefined" || expected instanceof RegExp) {
1551
- // Fixes the issue related to `chai` <https://github.com/vitest-dev/vitest/issues/6618>
1552
- return this.throws(expected === "" ? /^$/ : expected);
1551
+ return this.throws(expected);
1553
1552
  }
1554
1553
  const obj = this._obj;
1555
1554
  const promise = utils.flag(this, "promise");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/expect",
3
3
  "type": "module",
4
- "version": "4.1.5",
4
+ "version": "5.0.0-beta.1",
5
5
  "description": "Jest's expect matchers as a Chai plugin",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -39,11 +39,11 @@
39
39
  "@types/chai": "^5.2.2",
40
40
  "chai": "^6.2.2",
41
41
  "tinyrainbow": "^3.1.0",
42
- "@vitest/spy": "4.1.5",
43
- "@vitest/utils": "4.1.5"
42
+ "@vitest/spy": "5.0.0-beta.1",
43
+ "@vitest/utils": "5.0.0-beta.1"
44
44
  },
45
45
  "devDependencies": {
46
- "@vitest/runner": "4.1.5"
46
+ "@vitest/runner": "5.0.0-beta.1"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "premove dist && rollup -c",