Skip to content

Commit 8775b97

Browse files
committed
chore: update configurations for the typescript
Prepare for the e2e test
1 parent 92f467b commit 8775b97

11 files changed

Lines changed: 45 additions & 46 deletions

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
out
22
dist
33
node_modules
4-
.vscode-test/
4+
.vscode-test
5+
.wdio-vscode-service
56
*.vsix
67
coverage
8+
e2e/logs

tests/api/manager.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ import { dirname, join, normalize } from 'node:path'
22

33
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
44

5-
import { ServerManager } from '../../src/api/manager'
6-
import { WdioExtensionWorker } from '../../src/api/worker'
5+
import { ServerManager } from '../../src/api/manager.js'
6+
import { WdioExtensionWorker } from '../../src/api/worker.js'
77

88
// Mock the worker.js module
99
vi.mock('../../src/api/worker.js', () => {
1010
const WdioExtensionWorker = vi.fn(function (cid, configPath) {
11+
// @ts-ignore
1112
this.cid = cid
13+
// @ts-ignore
1214
this.configPath = configPath
1315
})
1416
WdioExtensionWorker.prototype.start = vi.fn().mockResolvedValue(undefined)

tests/api/worker.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ describe('WdioExtensionWorker', () => {
348348
expect(workerOutSpy).toHaveBeenCalledWith('stderr', 'stderr data')
349349

350350
// Simulate exit event
351-
mockChildProcess.on.mock.calls.find((call) => call[0] === 'exit')[1](0)
351+
mockChildProcess.on.mock.calls.find((call: string[]) => call[0] === 'exit')[1](0)
352352

353353
// Verify worker state was reset
354354
expect((worker as any)._workerProcess).toBe(null)

tests/test/converter.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { join } from 'node:path'
33
import * as chai from 'chai'
44
import * as vscode from 'vscode'
55

6-
import { convertTestData, convertPathToUri, isCucumberFeatureFile } from '../../src/test/converter'
7-
import type { ReadSpecsResult } from '../../src/api/index'
6+
import { convertTestData, convertPathToUri, isCucumberFeatureFile } from '../../src/test/converter.js'
7+
import type { ReadSpecsResult } from '../../src/api/index.js'
88

99
const expect = chai.expect
1010

tests/test/manager.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import * as chai from 'chai'
44
import * as sinon from 'sinon'
55
import * as vscode from 'vscode'
66

7-
import { ServerManager } from '../../src/api/index.ts'
8-
import { ExtensionConfigManager } from '../../src/config/index'
9-
import { EXTENSION_ID, TEST_ID_SEPARATOR } from '../../src/constants'
10-
import { RepositoryManager } from '../../src/test/manager'
11-
import { TestRepository } from '../../src/test/repository.ts'
12-
import type { WorkspaceData } from '../../src/config/types.ts'
13-
import type { WdioConfigTestItem, WorkspaceTestItem } from '../../src/test/types.ts'
7+
import { ServerManager } from '../../src/api/index.js'
8+
import { ExtensionConfigManager } from '../../src/config/index.js'
9+
import { EXTENSION_ID, TEST_ID_SEPARATOR } from '../../src/constants.js'
10+
import { RepositoryManager } from '../../src/test/manager.js'
11+
import { TestRepository } from '../../src/test/repository.js'
12+
import type { WorkspaceData } from '../../src/config/types.js'
13+
import type { WdioConfigTestItem, WorkspaceTestItem } from '../../src/test/types.js'
1414

1515
const expect = chai.expect
1616

@@ -25,7 +25,7 @@ describe('RepositoryManager', () => {
2525

2626
const configManager = new ExtensionConfigManager()
2727
const serverManager = new ServerManager()
28-
let repositoryManager
28+
let repositoryManager: RepositoryManager
2929

3030
const workspacePath = join(process.cwd(), 'fake', 'workspace')
3131
const configPath = join(workspacePath, 'wdio.conf.ts')

tests/worker/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
55
import { WebSocket } from 'ws'
66

77
import { LOG_LEVEL } from '../../src/constants.js'
8-
import { createRpcClient } from '../../src/worker/client'
8+
import { createRpcClient } from '../../src/worker/client.js'
99
import * as handler from '../../src/worker/handler.js'
1010
import * as logger from '../../src/worker/logger.js'
1111

tests/worker/handler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
22

33
import { Launcher } from '../../src/worker/cli.js'
4-
import { createWorker } from '../../src/worker/handler'
4+
import { createWorker } from '../../src/worker/handler.js'
55
import * as parsers from '../../src/worker/parsers/index.js'
66
import * as test from '../../src/worker/test.js'
77

tests/worker/logger.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
22

33
import { LOG_LEVEL } from '../../src/constants.js'
4-
import { getLogger } from '../../src/worker/logger'
4+
import { getLogger } from '../../src/worker/logger.js'
55
import type { ExtensionApi } from '../../src/api/index.js'
66

77
describe('Logger', () => {

tests/worker/test.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import { join } from 'node:path'
44

55
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
66

7-
// Import the module we're testing
8-
import { Launcher } from '../../src/worker/cli.ts'
9-
import { runTest } from '../../src/worker/test'
7+
import { Launcher } from '../../src/worker/cli.js'
8+
import { runTest } from '../../src/worker/test.js'
9+
1010
import type { Dirent } from 'node:fs'
11+
import type { WorkerMetaContext } from '../../src/worker/types.js'
1112

1213
// Mock dependencies
1314
vi.mock('node:fs/promises')
@@ -30,7 +31,7 @@ describe('runTest', () => {
3031

3132
const mockContext = {
3233
log: mockLog,
33-
}
34+
} as unknown as WorkerMetaContext
3435

3536
const mockOptions = {
3637
configPath: '/path/to/wdio.conf.js',

tsconfig.base.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"compilerOptions": {
3+
"module": "NodeNext",
4+
"target": "es2022",
5+
"moduleResolution": "node16",
6+
7+
"lib": ["ES2022"],
8+
"sourceMap": true,
9+
"strict": true /* enable all strict type-checking options */,
10+
"skipLibCheck": true
11+
/* Additional Checks */
12+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
13+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
14+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
15+
},
16+
"exclude": ["coverage", "examples", "node_modules", "**/node_modules/*", "*.js", "*.cjs", "*.mjs"]
17+
}

0 commit comments

Comments
 (0)