@vitest/expect 2.0.0-beta.1 → 2.0.0-beta.11

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/README.md CHANGED
@@ -6,7 +6,11 @@ Jest's expect matchers as a Chai plugin.
6
6
 
7
7
  ```js
8
8
  import * as chai from 'chai'
9
- import { JestAsymmetricMatchers, JestChaiExpect, JestExtend } from '@vitest/expect'
9
+ import {
10
+ JestAsymmetricMatchers,
11
+ JestChaiExpect,
12
+ JestExtend,
13
+ } from '@vitest/expect'
10
14
 
11
15
  // allows using expect.extend instead of chai.use to extend plugins
12
16
  chai.use(JestExtend)
package/dist/index.d.ts CHANGED
@@ -65,6 +65,7 @@ interface MatcherState {
65
65
  subsetEquality: Tester;
66
66
  };
67
67
  soft?: boolean;
68
+ poll?: boolean;
68
69
  }
69
70
  interface SyncExpectationResult {
70
71
  pass: boolean;
@@ -80,12 +81,7 @@ interface RawMatcherFn<T extends MatcherState = MatcherState> {
80
81
  type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;
81
82
  interface ExpectStatic extends Chai.ExpectStatic, AsymmetricMatchersContaining {
82
83
  <T>(actual: T, message?: string): Assertion<T>;
83
- unreachable: (message?: string) => never;
84
- soft: <T>(actual: T, message?: string) => Assertion<T>;
85
84
  extend: (expects: MatchersObject) => void;
86
- addEqualityTesters: (testers: Array<Tester>) => void;
87
- assertions: (expected: number) => void;
88
- hasAssertions: () => void;
89
85
  anything: () => any;
90
86
  any: (constructor: unknown) => any;
91
87
  getState: () => MatcherState;
@@ -150,12 +146,18 @@ type VitestAssertion<A, T> = {
150
146
  type Promisify<O> = {
151
147
  [K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
152
148
  };
149
+ type PromisifyAssertion<T> = Promisify<Assertion<T>>;
153
150
  interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T> {
154
151
  toBeTypeOf: (expected: 'bigint' | 'boolean' | 'function' | 'number' | 'object' | 'string' | 'symbol' | 'undefined') => void;
155
152
  toHaveBeenCalledOnce: () => void;
156
153
  toSatisfy: <E>(matcher: (value: E) => boolean, message?: string) => void;
157
- resolves: Promisify<Assertion<T>>;
158
- rejects: Promisify<Assertion<T>>;
154
+ toHaveResolved: () => void;
155
+ toHaveResolvedWith: <E>(value: E) => void;
156
+ toHaveResolvedTimes: (times: number) => void;
157
+ toHaveLastResolvedWith: <E>(value: E) => void;
158
+ toHaveNthResolvedWith: <E>(nthCall: number, value: E) => void;
159
+ resolves: PromisifyAssertion<T>;
160
+ rejects: PromisifyAssertion<T>;
159
161
  }
160
162
  declare global {
161
163
  namespace jest {
@@ -255,4 +257,4 @@ declare const JestChaiExpect: ChaiPlugin;
255
257
 
256
258
  declare const JestExtend: ChaiPlugin;
257
259
 
258
- 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, type TesterContext, addCustomEqualityTesters, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getObjectKeys, getObjectSubset, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality };
260
+ 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 };