Skip to content

Commit 4b9bedb

Browse files
Revert "chore(tsc+lint): Enhancing project tsc and linting (#1867)"
This reverts commit 77af39a.
1 parent 6d5373d commit 4b9bedb

11 files changed

+42
-50
lines changed

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default wdioEslint.config([
44
{
55
ignores: [
66
'lib',
7-
'**/*/dist'
7+
'types'
88
]
99
},
1010
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"clean": "run-p clean:*",
4646
"clean:build": "rimraf ./lib",
4747
"clean:tests": "rimraf test-types/**/node_modules && rimraf test-types/**/dist",
48-
"compile": "tsc --build tsconfig.json",
48+
"compile": "tsc --build tsconfig.build.json",
4949
"test": "run-s test:*",
5050
"test:lint": "eslint .",
5151
"test:unit": "vitest --run",

src/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const waitUntil = async (
5353
// wait for condition to be truthy
5454
try {
5555
const start = Date.now()
56+
// eslint-disable-next-line no-constant-condition
5657
while (true) {
5758
if (Date.now() - start > wait) {
5859
throw new Error('timeout')

test/matchers/mock/toBeRequested.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { vi, test, describe, expect } from 'vitest'
2-
// @ts-ignore TODO fix me
32
import type { Matches, Mock } from 'webdriverio'
43

54
import { toBeRequested } from '../../../src/matchers/mock/toBeRequested.js'

test/matchers/mock/toBeRequestedTimes.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { vi, test, describe, expect } from 'vitest'
2-
// @ts-ignore TODO fix me
32
import type { Matches, Mock } from 'webdriverio'
43

54
import { toBeRequestedTimes } from '../../../src/matchers/mock/toBeRequestedTimes.js'

test/util/elementsUtil.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ vi.mock('@wdio/globals')
88
describe('elementsUtil', () => {
99
describe('wrapExpectedWithArray', () => {
1010
test('is not array ', async () => {
11-
const el = (await $('sel')) as unknown as WebdriverIO.Element
11+
const el = await $('sel')
1212
const actual = wrapExpectedWithArray(el, 'Test Actual', 'Test Expected')
1313
expect(actual).toEqual('Test Expected')
1414
})
1515

1616
test('is array ', async () => {
17-
const els = (await $$('sel')) as unknown as WebdriverIO.ElementArray
17+
const els = await $$('sel')
1818
const actual = wrapExpectedWithArray(els, ['Test Actual', 'Test Actual'], 'Test Expected')
1919
expect(actual).toEqual(['Test Expected'])
2020
})

test/util/refetchElements.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('refetchElements', () => {
99
let els: WebdriverIO.ElementArray
1010

1111
beforeEach(async () => {
12-
els = (await $$('parent')) as unknown as WebdriverIO.ElementArray
12+
els = await $$('parent')
1313
// @ts-ignore
1414
els.parent._length = 5
1515
})

tsconfig.build.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"exclude": [
4+
"./test/**/*.ts"
5+
]
6+
}

types/expect-webdriverio.d.ts

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
/* eslint-disable @typescript-eslint/consistent-type-imports*/
2-
type ServiceInstance = import('@wdio/types').Services.ServiceInstance
3-
type Test = import('@wdio/types').Frameworks.Test
4-
type TestResult = import('@wdio/types').Frameworks.TestResult
5-
type PickleStep = import('@wdio/types').Frameworks.PickleStep
6-
type Scenario = import('@wdio/types').Frameworks.Scenario
7-
type SnapshotResult = import('@vitest/snapshot').SnapshotResult
8-
type SnapshotUpdateState = import('@vitest/snapshot').SnapshotUpdateState
1+
type ServiceInstance = import('@wdio/types').Services.ServiceInstance;
2+
type Test = import('@wdio/types').Frameworks.Test;
3+
type TestResult = import('@wdio/types').Frameworks.TestResult;
4+
type PickleStep = import('@wdio/types').Frameworks.PickleStep;
5+
type Scenario = import('@wdio/types').Frameworks.Scenario;
6+
type SnapshotResult = import('@vitest/snapshot').SnapshotResult;
7+
type SnapshotUpdateState = import('@vitest/snapshot').SnapshotUpdateState;
98

109
declare namespace ExpectWebdriverIO {
1110
const expect: ExpectWebdriverIO.Expect
1211
function setOptions(options: DefaultOptions): void
13-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1412
function getConfig(): any
1513

1614
interface SnapshotServiceArgs {
@@ -25,34 +23,32 @@ declare namespace ExpectWebdriverIO {
2523
}
2624

2725
interface SoftFailure {
28-
error: Error
29-
matcherName: string
30-
location?: string
26+
error: Error;
27+
matcherName: string;
28+
location?: string;
3129
}
3230

3331
class SoftAssertService {
34-
static getInstance(): SoftAssertService
35-
setCurrentTest(testId: string, testName?: string, testFile?: string): void
36-
clearCurrentTest(): void
37-
getCurrentTestId(): string | null
38-
addFailure(error: Error, matcherName: string): void
39-
getFailures(testId?: string): SoftFailure[]
40-
clearFailures(testId?: string): void
41-
assertNoFailures(testId?: string): void
32+
static getInstance(): SoftAssertService;
33+
setCurrentTest(testId: string, testName?: string, testFile?: string): void;
34+
clearCurrentTest(): void;
35+
getCurrentTestId(): string | null;
36+
addFailure(error: Error, matcherName: string): void;
37+
getFailures(testId?: string): SoftFailure[];
38+
clearFailures(testId?: string): void;
39+
assertNoFailures(testId?: string): void;
4240
}
4341

4442
interface SoftAssertionServiceOptions {
45-
autoAssertOnTestEnd?: boolean
43+
autoAssertOnTestEnd?: boolean;
4644
}
4745

4846
class SoftAssertionService implements ServiceInstance {
49-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
50-
constructor(serviceOptions?: SoftAssertionServiceOptions, capabilities?: any, config?: any)
51-
beforeTest(test: Test): void
52-
beforeStep(step: PickleStep, scenario: Scenario): void
53-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
54-
afterTest(test: Test, context: any, result: TestResult): void
55-
afterStep(step: PickleStep, scenario: Scenario, result: { passed: boolean, error?: Error }): void
47+
constructor(serviceOptions?: SoftAssertionServiceOptions, capabilities?: any, config?: any);
48+
beforeTest(test: Test): void;
49+
beforeStep(step: PickleStep, scenario: Scenario): void;
50+
afterTest(test: Test, context: any, result: TestResult): void;
51+
afterStep(step: PickleStep, scenario: Scenario, result: { passed: boolean, error?: Error }): void;
5652
}
5753

5854
interface AssertionResult {
@@ -63,9 +59,7 @@ declare namespace ExpectWebdriverIO {
6359
const matchers: Map<
6460
string,
6561
(
66-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6762
actual: any,
68-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6963
...expected: any[]
7064
) => Promise<AssertionResult>
7165
>
@@ -85,7 +79,6 @@ declare namespace ExpectWebdriverIO {
8579
* expect(el).toHaveAttribute('attr', 'value', { ... }) // expectedValue is `['attr', 'value]`
8680
* ```
8781
*/
88-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8982
expectedValue?: any,
9083
/**
9184
* Options that the user has passed in, e.g. `expect(el).toHaveText('foo', { ignoreCase: true })` -> `{ ignoreCase: true }`
@@ -245,10 +238,10 @@ declare namespace ExpectWebdriverIO {
245238
* **Usage**
246239
* ```js
247240
* // Check if an element has the class 'btn'
248-
* await expect(element).toHaveElementClass('btn')
241+
* await expect(element).toHaveElementClass('btn');
249242
*
250243
* // Check if an element has any of the specified classes
251-
* await expect(element).toHaveElementClass(['btn', 'btn-large'])
244+
* await expect(element).toHaveElementClass(['btn', 'btn-large']);
252245
* ```
253246
*/
254247
toHaveElementClass(className: string | RegExp | Array<string | RegExp> | ExpectWebdriverIO.PartialMatcher, options?: ExpectWebdriverIO.StringOptions): R
@@ -258,7 +251,6 @@ declare namespace ExpectWebdriverIO {
258251
*/
259252
toHaveElementProperty(
260253
property: string | RegExp | ExpectWebdriverIO.PartialMatcher,
261-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
262254
value?: any,
263255
options?: ExpectWebdriverIO.StringOptions
264256
): R
@@ -426,7 +418,7 @@ declare namespace ExpectWebdriverIO {
426418
toBeElementsArrayOfSize(
427419
size: number | ExpectWebdriverIO.NumberOptions,
428420
options?: ExpectWebdriverIO.NumberOptions
429-
): R & Promise<WebdriverIO.ElementArray>
421+
): R & Promise<WebdriverIO.ElementArray>;
430422

431423
// ==== network mock ====
432424
/**
@@ -487,10 +479,8 @@ declare namespace ExpectWebdriverIO {
487479
type JsonCompatible = jsonObject | jsonArray
488480

489481
interface PartialMatcher {
490-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
491482
sample?: any
492483
$$typeof: symbol
493-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
494484
asymmetricMatch(...args: any[]): boolean
495485
toString(): string
496486
}
@@ -537,7 +527,6 @@ declare namespace ExpectWebdriverIO {
537527
}
538528

539529
interface AsymmetricMatchers {
540-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
541530
any(expectedObject: any): PartialMatcher
542531
anything(): PartialMatcher
543532
arrayContaining(sample: Array<unknown>): PartialMatcher

types/standalone.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/consistent-type-imports*/
21
/// <reference types="./expect-webdriverio.js"/>
32

43
type ChainablePromiseElement = import('webdriverio').ChainablePromiseElement<WebdriverIO.Element>
@@ -22,7 +21,6 @@ declare namespace ExpectWebdriverIO {
2221
} & AsymmetricMatchers
2322

2423
interface AsymmetricMatchers {
25-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2624
any(expectedObject: any): PartialMatcher
2725
anything(): PartialMatcher
2826
arrayContaining(sample: Array<unknown>): PartialMatcher

0 commit comments

Comments
 (0)