File tree 2 files changed +17
-1
lines changed
packages/vitest/src/types
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ declare global {
44
44
// support augmenting jest.Matchers by other libraries
45
45
namespace jest {
46
46
47
- interface Matchers < _R , _T = { } > { }
47
+ // eslint-disable-next-line unused-imports/no-unused-vars
48
+ interface Matchers < R , T = { } > { }
48
49
}
49
50
50
51
namespace Vi {
Original file line number Diff line number Diff line change @@ -12,7 +12,14 @@ interface CustomMatchers<R = unknown> {
12
12
toBeTestedSync ( ) : R
13
13
toBeTestedPromise ( ) : R
14
14
}
15
+
15
16
declare global {
17
+ namespace jest {
18
+ interface Matchers < R > {
19
+ toBeJestCompatible ( ) : R
20
+ }
21
+ }
22
+
16
23
namespace Vi {
17
24
interface JestAssertion extends CustomMatchers { }
18
25
interface AsymmetricMatchersContaining extends CustomMatchers { }
@@ -182,6 +189,12 @@ describe('jest-expect', () => {
182
189
message : ( ) => 'toBeTestedPromise' ,
183
190
} )
184
191
} ,
192
+ toBeJestCompatible ( ) {
193
+ return {
194
+ pass : true ,
195
+ message : ( ) => '' ,
196
+ }
197
+ } ,
185
198
} )
186
199
187
200
expect ( 5 ) . toBeDividedBy ( 5 )
@@ -195,6 +208,8 @@ describe('jest-expect', () => {
195
208
expect ( ( ) => expect ( null ) . toBeTestedSync ( ) ) . toThrowError ( 'toBeTestedSync' )
196
209
await expect ( async ( ) => await expect ( null ) . toBeTestedAsync ( ) ) . rejects . toThrowError ( 'toBeTestedAsync' )
197
210
await expect ( async ( ) => await expect ( null ) . toBeTestedPromise ( ) ) . rejects . toThrowError ( 'toBeTestedPromise' )
211
+
212
+ expect ( expect ) . toBeJestCompatible ( )
198
213
} )
199
214
200
215
it ( 'object' , ( ) => {
You can’t perform that action at this time.
0 commit comments