@vitest/expect 1.0.0-beta.3 → 1.0.0-beta.4

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/index.d.ts CHANGED
@@ -254,6 +254,7 @@ declare function pluralize(word: string, count: number): string;
254
254
  declare const MATCHERS_OBJECT: unique symbol;
255
255
  declare const JEST_MATCHERS_OBJECT: unique symbol;
256
256
  declare const GLOBAL_EXPECT: unique symbol;
257
+ declare const ASYMMETRIC_MATCHERS_OBJECT: unique symbol;
257
258
 
258
259
  declare function getState<State extends MatcherState = MatcherState>(expect: ExpectStatic): State;
259
260
  declare function setState<State extends MatcherState = MatcherState>(state: Partial<State>, expect: ExpectStatic): void;
@@ -262,4 +263,4 @@ declare const JestChaiExpect: ChaiPlugin;
262
263
 
263
264
  declare const JestExtend: ChaiPlugin;
264
265
 
265
- export { Any, Anything, ArrayContaining, type Assertion, AsymmetricMatcher, type AsymmetricMatcherInterface, type AsymmetricMatchersContaining, type AsyncExpectationResult, type ChaiPlugin, type ExpectStatic, type ExpectationResult, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, type JestAssertion, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, type MatcherHintOptions, type MatcherState, type MatchersObject, ObjectContaining, type RawMatcherFn, StringContaining, StringMatching, type SyncExpectationResult, type Tester, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality };
266
+ export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining, type Assertion, AsymmetricMatcher, type AsymmetricMatcherInterface, type AsymmetricMatchersContaining, type AsyncExpectationResult, type ChaiPlugin, type ExpectStatic, type ExpectationResult, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, type JestAssertion, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, type MatcherHintOptions, type MatcherState, type MatchersObject, ObjectContaining, type RawMatcherFn, StringContaining, StringMatching, type SyncExpectationResult, type Tester, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality };
package/dist/index.js CHANGED
@@ -8,10 +8,12 @@ import { util } from 'chai';
8
8
  const MATCHERS_OBJECT = Symbol.for("matchers-object");
9
9
  const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object");
10
10
  const GLOBAL_EXPECT = Symbol.for("expect-global");
11
+ const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for("asymmetric-matchers-object");
11
12
 
12
13
  if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
13
14
  const globalState = /* @__PURE__ */ new WeakMap();
14
15
  const matchers = /* @__PURE__ */ Object.create(null);
16
+ const assymetricMatchers = /* @__PURE__ */ Object.create(null);
15
17
  Object.defineProperty(globalThis, MATCHERS_OBJECT, {
16
18
  get: () => globalState
17
19
  });
@@ -22,6 +24,9 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
22
24
  matchers
23
25
  })
24
26
  });
27
+ Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
28
+ get: () => assymetricMatchers
29
+ });
25
30
  }
26
31
  function getState(expect) {
27
32
  return globalThis[MATCHERS_OBJECT].get(expect);
@@ -1448,10 +1453,11 @@ function JestExtendPlugin(expect, matchers) {
1448
1453
  return `${this.toString()}<${this.sample.map(String).join(", ")}>`;
1449
1454
  }
1450
1455
  }
1456
+ const customMatcher = (...sample) => new CustomMatcher(false, ...sample);
1451
1457
  Object.defineProperty(expect, expectAssertionName, {
1452
1458
  configurable: true,
1453
1459
  enumerable: true,
1454
- value: (...sample) => new CustomMatcher(false, ...sample),
1460
+ value: customMatcher,
1455
1461
  writable: true
1456
1462
  });
1457
1463
  Object.defineProperty(expect.not, expectAssertionName, {
@@ -1460,6 +1466,12 @@ function JestExtendPlugin(expect, matchers) {
1460
1466
  value: (...sample) => new CustomMatcher(true, ...sample),
1461
1467
  writable: true
1462
1468
  });
1469
+ Object.defineProperty(globalThis[ASYMMETRIC_MATCHERS_OBJECT], expectAssertionName, {
1470
+ configurable: true,
1471
+ enumerable: true,
1472
+ value: customMatcher,
1473
+ writable: true
1474
+ });
1463
1475
  });
1464
1476
  };
1465
1477
  }
@@ -1469,4 +1481,4 @@ const JestExtend = (chai, utils) => {
1469
1481
  });
1470
1482
  };
1471
1483
 
1472
- export { Any, Anything, ArrayContaining, AsymmetricMatcher, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, ObjectContaining, StringContaining, StringMatching, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality };
1484
+ export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining, AsymmetricMatcher, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, ObjectContaining, StringContaining, StringMatching, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/expect",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.3",
4
+ "version": "1.0.0-beta.4",
5
5
  "description": "Jest's expect matchers as a Chai plugin",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -31,14 +31,14 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "chai": "^4.3.10",
34
- "@vitest/utils": "1.0.0-beta.3",
35
- "@vitest/spy": "1.0.0-beta.3"
34
+ "@vitest/spy": "1.0.0-beta.4",
35
+ "@vitest/utils": "1.0.0-beta.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/chai": "4.3.6",
39
39
  "picocolors": "^1.0.0",
40
40
  "rollup-plugin-copy": "^3.5.0",
41
- "@vitest/runner": "1.0.0-beta.3"
41
+ "@vitest/runner": "1.0.0-beta.4"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "rimraf dist && rollup -c",