Skip to content

Commit c81a6fc

Browse files
committed
Test ExpectWebdriverIO for custom matcher when using Jest!
1 parent 0609a11 commit c81a6fc

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

test-types/jest/customMatchers/customMatchers.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// TODO dprevost should we review this to have the wdio namespace or maybe the expect namespace?
2-
// Name jest is required to augment the jest.Matchers interface
3-
declare namespace jest {
1+
declare namespace ExpectWebdriverIO {
2+
3+
// TODO dprevost: ensure we still allow custom asymmetric matchers
44
interface AsymmetricMatchers {
55
toBeCustom(): void;
66
}

types/expect-webdriverio.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,15 @@ declare namespace ExpectWebdriverIO {
695695
* Some properties are omitted for the type check to work correctly.
696696
*/
697697
type PartialMatcher<T> = Omit<ExpectLibAsymmetricMatcher<T>, 'sample' | 'inverse' | '$$typeof'>
698+
699+
//TODO dprevost: ensure we do not break custom AsymmetricMatchers from expect library
700+
// declare global {
701+
// namespace ExpectWebdriverIO {
702+
// interface AsymmetricMatchers {
703+
// myCustomMatcher(value: string): ExpectWebdriverIO.PartialMatcher;
704+
// }
705+
// }
706+
// }
698707
}
699708

700709
declare module 'expect-webdriverio' {

0 commit comments

Comments
 (0)