Skip to content

Commit 21e67d3

Browse files
committed
test: fix unit test on windows
1 parent ff0660c commit 21e67d3

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

packages/vscode-wdio-server/src/manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class WdioWorkerManager implements IWorkerManager {
5353
return server
5454
}
5555
this.latestId++
56-
return this.startWorker(this.latestId, dirname(configPaths))
56+
return this.startWorker(this.latestId, dirname(normalizedConfigPath))
5757
})
5858
}
5959

packages/vscode-wdio-server/tests/manager.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('ServerManager', () => {
9090
it('should create a new worker if it does not exist', async () => {
9191
// Setup
9292
const configPath = '/path/to/wdio.config.js'
93-
const wdioDirName = dirname(configPath)
93+
const wdioDirName = dirname(normalize(configPath))
9494
const spyFactory = vi.spyOn(workerFactory, 'generate')
9595

9696
// Execute
@@ -113,8 +113,8 @@ describe('ServerManager', () => {
113113

114114
// Assert
115115
expect(spyFactory).toHaveBeenCalledTimes(2)
116-
expect(spyFactory).toHaveBeenCalledWith('#1', '/path/to')
117-
expect(spyFactory).toHaveBeenCalledWith('#2', '/another/path')
116+
expect(spyFactory).toHaveBeenCalledWith('#1', normalize('/path/to'))
117+
expect(spyFactory).toHaveBeenCalledWith('#2', normalize('/another/path'))
118118
})
119119
})
120120

@@ -187,9 +187,9 @@ describe('ServerManager', () => {
187187

188188
// Assert operations were queued and processed in order
189189
expect(operations.length).toBe(3)
190-
expect(operations[0]).toBe('start:/path/1')
191-
expect(operations[1]).toBe('start:/path/2')
192-
expect(operations[2]).toBe('start:/path/3')
190+
expect(operations[0]).toBe(`start:${normalize('/path/1')}`)
191+
expect(operations[1]).toBe(`start:${normalize('/path/2')}`)
192+
expect(operations[2]).toBe(`start:${normalize('/path/3')}`)
193193
})
194194

195195
it('should avoid duplicate operations for the same path', async () => {
@@ -278,7 +278,7 @@ describe('ServerManager', () => {
278278
const stopWorker = (workerManager as any).stopWorker.bind(workerManager)
279279

280280
// Get the worker from the server pool
281-
const worker = (workerManager as any)._workerPool.get('/path/to')
281+
const worker = (workerManager as any)._workerPool.get(normalize('/path/to'))
282282

283283
// Execute
284284
await stopWorker('/path/to', worker)

0 commit comments

Comments
 (0)