Skip to content

Commit 0609a11

Browse files
committed
Finalize simplification of Jest namespace
1 parent dd57e5d commit 0609a11

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

jest.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/// <reference types="./types/expect-webdriverio.d.ts"/>
22

3+
/**
4+
* Augment the Jest namespace to include the matchers from expect-webdriverio.
5+
* When Jest Library is used, it specifies `expect-webdriverio/jest` for this file in the tsconfig.json's types.
6+
*/
7+
38
declare namespace jest {
49

510
interface Matchers<R, T> extends ExpectWebdriverIO.Matchers<R, T> {

types/expect-webdriverio.d.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,13 @@ interface WdioElementArrayOnlyMatchers<R, ActualT = unknown> {
377377

378378
/**
379379
* Matchers supporting basic snapshot tests as well as DOM snapshot testing.
380-
* Warning: these matchers overload the similar matchers from jest-expect library.
381380
* When the actual is a WebdriverIO.Element, we need to await the `outerHTML` therefore the return type is a Promise.
382-
* TODO dprevost: Review for better typings...
383381
*
384-
* Those need to be also duplicated in jest.d.ts in order for the typing to correctly overload the matchers (we cannot just extend the Matchers interface)
382+
* ⚠️ these matchers overload the similar matchers from jest-expect library.
383+
* Therefore, they also need to be redefined in the jest.d.ts file so correctly overload the matchers from the Jest namespace.
384+
* @see jest.d.ts
385+
*
386+
* TODO dprevost: Review for better typings...
385387
*/
386388
interface WdioJestOverloadedMatchers<R, ActualT> {
387389
/**

0 commit comments

Comments
 (0)