File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 6363 "ts:mocha" : " cd test-types/mocha && tsc --project ./tsconfig.json" ,
6464 "ts:jasmine" : " cd test-types/jasmine && tsc --project ./tsconfig.json" ,
6565 "ts:jasmine-async" : " cd test-types/jasmine-async && tsc --project ./tsconfig.json" ,
66+ "checks:all" : " npm run build && npm run compile && npm run tsc:root-types && npm run test && npm run ts" ,
6667 "watch" : " npm run compile -- --watch" ,
6768 "prepare" : " husky install"
6869 },
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ describe('type assertions', () => {
77
88 const element : WebdriverIO . Element = { } as unknown as WebdriverIO . Element
99 const elementArray : WebdriverIO . ElementArray = [ ] as unknown as WebdriverIO . ElementArray
10+ const elements : WebdriverIO . Element [ ] = [ ] as unknown as WebdriverIO . Element [ ]
1011
1112 const networkMock : WebdriverIO . Mock = { } as unknown as WebdriverIO . Mock
1213
@@ -323,6 +324,26 @@ describe('type assertions', () => {
323324 expectVoid = expect ( chainableArray ) . toBeElementsArrayOfSize ( { lte : 10 } )
324325 } )
325326
327+ it ( 'should work correctly when actual is element array' , async ( ) => {
328+ expectPromiseVoid = expect ( elementArray ) . toBeElementsArrayOfSize ( 5 )
329+ expectPromiseVoid = expect ( elementArray ) . toBeElementsArrayOfSize ( { lte : 10 } )
330+
331+ // @ts -expect-error
332+ expectVoid = expect ( elementArray ) . toBeElementsArrayOfSize ( 5 )
333+ // @ts -expect-error
334+ expectVoid = expect ( elementArray ) . toBeElementsArrayOfSize ( { lte : 10 } )
335+ } )
336+
337+ it ( 'should work correctly when actual is element[]' , async ( ) => {
338+ expectPromiseVoid = expect ( elements ) . toBeElementsArrayOfSize ( 5 )
339+ expectPromiseVoid = expect ( elements ) . toBeElementsArrayOfSize ( { lte : 10 } )
340+
341+ // @ts -expect-error
342+ expectVoid = expect ( elements ) . toBeElementsArrayOfSize ( 5 )
343+ // @ts -expect-error
344+ expectVoid = expect ( elements ) . toBeElementsArrayOfSize ( { lte : 10 } )
345+ } )
346+
326347 it ( 'should not work when actual is not chainableArray' , async ( ) => {
327348 // @ts -expect-error
328349 await expect ( chainableElement ) . toBeElementsArrayOfSize ( 5 )
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ type WdioOnlyMaybePromiseLike = ElementPromise | ElementArrayPromise | Chainable
5454 */
5555type ElementOrArrayLike = ElementLike | ElementArrayLike
5656type ElementLike = WebdriverIO . Element | ChainablePromiseElement
57- type ElementArrayLike = WebdriverIO . ElementArray | ChainablePromiseArray
57+ type ElementArrayLike = WebdriverIO . ElementArray | ChainablePromiseArray | WebdriverIO . Element [ ]
5858type MockPromise = Promise < WebdriverIO . Mock >
5959
6060/**
You can’t perform that action at this time.
0 commit comments