Skip to content

Commit 685a62c

Browse files
committed
chore: update reload functionality
- Change reloading to asynchronous parallel execution - Changed UI display to match initialization and display in TestExplorer.
1 parent 6cb13c9 commit 685a62c

1 file changed

Lines changed: 19 additions & 25 deletions

File tree

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

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -218,32 +218,26 @@ export class RepositoryManager extends MetadataRepository implements IRepository
218218
* Refresh WebdriverIO tests
219219
*/
220220
public async refreshTests(): Promise<void> {
221-
return vscode.window.withProgress(
222-
{
223-
location: vscode.ProgressLocation.Notification,
224-
title: 'Reloading WebdriverIO tests...',
225-
cancellable: false,
226-
},
227-
async () => {
228-
try {
229-
if (!this._isInitialized) {
230-
await this.initialize()
231-
}
232-
for (const repo of this._repos) {
233-
// Clear existing tests
234-
repo.clearTests()
235-
// Discover tests again
236-
await repo.discoverAllTests()
237-
}
238-
239-
vscode.window.showInformationMessage('WebdriverIO tests reloaded successfully')
240-
} catch (error) {
241-
const errorMessage = error instanceof Error ? error.message : String(error)
242-
log.error(`Failed to reload tests: ${errorMessage}`)
243-
vscode.window.showErrorMessage(`Failed to reload WebdriverIO tests: ${errorMessage}`)
244-
}
221+
this.controller.items.replace([this._loadingTestItem])
222+
try {
223+
if (!this._isInitialized) {
224+
await this.initialize()
245225
}
246-
)
226+
await Promise.all(
227+
this.repos.map(async (repo) => {
228+
repo.clearTests()
229+
return await repo.discoverAllTests()
230+
})
231+
)
232+
233+
this.registerToTestController()
234+
await this.workerManager.reorganize(this.configManager.getWdioConfigPaths())
235+
} catch (error) {
236+
this.controller.items.replace([])
237+
const errorMessage = error instanceof Error ? error.message : String(error)
238+
log.error(`Failed to reload tests: ${errorMessage}`)
239+
vscode.window.showErrorMessage(`Failed to reload WebdriverIO tests: ${errorMessage}`)
240+
}
247241
}
248242

249243
public async dispose() {

0 commit comments

Comments
 (0)