@vitest/expect
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -100,4 +100,17 @@ import { MockInstance } from '@vitest/spy'; | ||
} | ||
interface AsymmetricMatchersContaining { | ||
interface CustomMatcher { | ||
/** | ||
* Checks that a value satisfies a custom matcher function. | ||
* | ||
* @param matcher - A function returning a boolean based on the custom condition | ||
* @param message - Optional custom error message on failure | ||
* | ||
* @example | ||
* expect(age).toSatisfy(val => val >= 18, 'Age must be at least 18'); | ||
* expect(age).toEqual(expect.toSatisfy(val => val >= 18, 'Age must be at least 18')); | ||
*/ | ||
toSatisfy: (matcher: (value: any) => boolean, message?: string) => any; | ||
} | ||
interface AsymmetricMatchersContaining extends CustomMatcher { | ||
/** | ||
* Matches if the received string contains the expected substring. | ||
@@ -143,3 +156,3 @@ * | ||
} | ||
interface JestAssertion<T = any> extends jest.Matchers<void, T> { | ||
interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMatcher { | ||
/** | ||
@@ -564,12 +577,2 @@ * Used when you want to check that two objects have the same value. | ||
/** | ||
* Checks that a value satisfies a custom matcher function. | ||
* | ||
* @param matcher - A function returning a boolean based on the custom condition | ||
* @param message - Optional custom error message on failure | ||
* | ||
* @example | ||
* expect(age).toSatisfy(val => val >= 18, 'Age must be at least 18'); | ||
*/ | ||
toSatisfy: <E>(matcher: (value: E) => boolean, message?: string) => void; | ||
/** | ||
* This assertion checks if a `Mock` was called before another `Mock`. | ||
@@ -661,2 +664,4 @@ * @param mock - A mock function created by `vi.spyOn` or `vi.fn` | ||
declare const customMatchers: MatchersObject; | ||
interface AsymmetricMatcherInterface { | ||
@@ -748,2 +753,2 @@ asymmetricMatch: (other: unknown) => boolean; | ||
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 PromisifyAssertion, type RawMatcherFn, StringContaining, StringMatching, type SyncExpectationResult, type Tester, type TesterContext, addCustomEqualityTesters, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getObjectKeys, getObjectSubset, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality }; | ||
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 PromisifyAssertion, type RawMatcherFn, StringContaining, StringMatching, type SyncExpectationResult, type Tester, type TesterContext, addCustomEqualityTesters, arrayBufferEquality, customMatchers, equals, fnNameFor, generateToBeMessage, getObjectKeys, getObjectSubset, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality }; |
{ | ||
"name": "@vitest/expect", | ||
"type": "module", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"description": "Jest's expect matchers as a Chai plugin", | ||
@@ -35,4 +35,4 @@ "license": "MIT", | ||
"tinyrainbow": "^1.2.0", | ||
"@vitest/utils": "3.0.0-beta.1", | ||
"@vitest/spy": "3.0.0-beta.1" | ||
"@vitest/spy": "3.0.0-beta.2", | ||
"@vitest/utils": "3.0.0-beta.2" | ||
}, | ||
@@ -42,3 +42,3 @@ "devDependencies": { | ||
"rollup-plugin-copy": "^3.5.0", | ||
"@vitest/runner": "3.0.0-beta.1" | ||
"@vitest/runner": "3.0.0-beta.2" | ||
}, | ||
@@ -45,0 +45,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
170908
2903
+ Added@vitest/pretty-format@3.0.0-beta.2(transitive)
+ Added@vitest/spy@3.0.0-beta.2(transitive)
+ Added@vitest/utils@3.0.0-beta.2(transitive)
- Removed@vitest/pretty-format@3.0.0-beta.1(transitive)
- Removed@vitest/spy@3.0.0-beta.1(transitive)
- Removed@vitest/utils@3.0.0-beta.1(transitive)
Updated@vitest/spy@3.0.0-beta.2
Updated@vitest/utils@3.0.0-beta.2