Skip to content

Commit 2a920e1

Browse files
authored
chore(deps): update typescript to v3 (#27)
1 parent 7d9b33d commit 2a920e1

File tree

5 files changed

+158
-1012
lines changed

5 files changed

+158
-1012
lines changed

lib/extend.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import {getDocument, getQueriesForElement} from '.'
21
import {ElementHandle} from '../node_modules/@types/puppeteer'
2+
3+
import {getDocument, getQueriesForElement} from '.'
34
import {IScopedQueryUtils} from './typedefs'
45

56
// tslint:disable-next-line

lib/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {readFileSync} from 'fs'
22
import * as path from 'path'
33
import {ElementHandle, EvaluateFn, JSHandle, Page} from 'puppeteer'
44
import waitForExpect from 'wait-for-expect'
5+
56
import {IQueryUtils, IScopedQueryUtils} from './typedefs'
67

78
const domLibraryAsString = readFileSync(
@@ -32,7 +33,7 @@ type ContextFn = (...args: any[]) => ElementHandle
3233

3334
async function createElementHandleArray(handle: JSHandle): Promise<ElementHandle[]> {
3435
const lengthHandle = await handle.getProperty('length')
35-
const length = await lengthHandle.jsonValue()
36+
const length = await lengthHandle.jsonValue() as number
3637

3738
const elements: ElementHandle[] = []
3839
for (let i = 0; i < length; i++) {

package.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,20 @@
3434
"config": {
3535
"tslint": {
3636
"rules": {
37-
"no-unsafe-any": false
37+
"increment-decrement": false,
38+
"no-unsafe-any": false,
39+
"ban-ts-ignore": {
40+
"severity": "warning"
41+
},
42+
"function-constructor": {
43+
"severity": "warning"
44+
},
45+
"strict-comparisons": {
46+
"severity": "warning"
47+
},
48+
"match-default-export-name": {
49+
"severity": "warning"
50+
}
3851
}
3952
},
4053
"exportAliases": {
@@ -56,9 +69,9 @@
5669
"rollup-plugin-commonjs": "^10.1.0",
5770
"rollup-plugin-node-resolve": "^5.2.0",
5871
"rollup-plugin-replace": "^2.2.0",
59-
"ts-jest": "^22.4.6",
60-
"tslint": "^5.10.0",
61-
"typescript": "^2.9.2"
72+
"ts-jest": "^25.2.1",
73+
"tslint": "^6.0.0",
74+
"typescript": "^3.8.3"
6275
},
6376
"peerDependencies": {
6477
"puppeteer": "^1.5.0 || ^2.0.0"

test/extend.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('lib/extend.ts', () => {
5353
const scope = await document.$('#scoped')
5454

5555
try {
56-
await scope.getByTitle('missing')
56+
await scope!.getByTitle('missing')
5757
fail()
5858
} catch (err) {
5959
err.message = err.message.replace(/(\s*at .*(\n|$))+/gm, '\n <stack>:X:X')
@@ -82,18 +82,18 @@ describe('lib/extend.ts', () => {
8282

8383
it('should scope results to element', async () => {
8484
const scope = await document.$('#scoped')
85-
const element = await scope.queryByText(/Hello/)
85+
const element = await scope!.queryByText(/Hello/)
8686
/* istanbul ignore next */
8787
expect(await page.evaluate(el => el.textContent, element)).toEqual('Hello h3')
8888
})
8989

9090
it('should get text content', async () => {
9191
const $h3 = await document.$('#scoped h3')
92-
expect(await $h3.getNodeText()).toEqual('Hello h3')
92+
expect(await $h3!.getNodeText()).toEqual('Hello h3')
9393
})
9494

9595
it('should work with destructuring', async () => {
96-
const {queryByText} = (await document.$('#scoped')).getQueriesForElement()
96+
const {queryByText} = (await document.$('#scoped'))!.getQueriesForElement()
9797
expect(await queryByText('Hello h1')).toBeFalsy()
9898
expect(await queryByText('Hello h3')).toBeTruthy()
9999
})

0 commit comments

Comments
 (0)