@@ -22,7 +22,7 @@ import type { IRepositoryManager, ITestRepository } from '@vscode-wdio/types/tes
2222
2323const LOADING_TEST_ITEM_ID = '_resolving'
2424
25- export class RepositoryManager extends MetadataRepository implements IRepositoryManager {
25+ export class RepositoryManager implements IRepositoryManager {
2626 private readonly _repos = new Set < ITestRepository > ( )
2727 private _loadingTestItem : vscode . TestItem
2828 private _workspaceTestItems : vscode . TestItem [ ] = [ ]
@@ -33,9 +33,9 @@ export class RepositoryManager extends MetadataRepository implements IRepository
3333 constructor (
3434 public readonly controller : vscode . TestController ,
3535 public readonly configManager : ExtensionConfigManager ,
36- private readonly workerManager : IWorkerManager
36+ private readonly workerManager : IWorkerManager ,
37+ private readonly _metadata = new MetadataRepository ( )
3738 ) {
38- super ( )
3939 this . _loadingTestItem = this . controller . createTestItem ( LOADING_TEST_ITEM_ID , 'Resolving WebdriverIO Tests...' )
4040 this . _loadingTestItem . sortText = '.0' // show at first line
4141 this . _loadingTestItem . busy = true
@@ -64,9 +64,16 @@ export class RepositoryManager extends MetadataRepository implements IRepository
6464 return Array . from ( this . _repos )
6565 }
6666
67+ public getMetadata ( testItem : vscode . TestItem ) {
68+ return this . _metadata . getMetadata ( testItem )
69+ }
70+
71+ public getRepository ( testItem : vscode . TestItem ) : ITestRepository {
72+ return this . _metadata . getRepository ( testItem )
73+ }
74+
6775 public async initialize ( ) {
6876 const workspaces = this . configManager . workspaces
69-
7077 if ( workspaces . length < 1 ) {
7178 log . info ( 'No workspaces is detected.' )
7279 return
@@ -103,7 +110,7 @@ export class RepositoryManager extends MetadataRepository implements IRepository
103110 wdioConfigPath
104111 )
105112
106- const repo = this . getRepository ( configTestItem )
113+ const repo = this . _metadata . getRepository ( configTestItem )
107114 await repo . discoverAllTests ( )
108115 if ( ! this . configManager . isMultiWorkspace ) {
109116 this . controller . items . add ( configTestItem )
@@ -123,7 +130,7 @@ export class RepositoryManager extends MetadataRepository implements IRepository
123130 continue
124131 }
125132 log . debug ( `Remove the TestItem: ${ config . id } ` )
126- const targetRepo = this . getRepository ( config )
133+ const targetRepo = this . _metadata . getRepository ( config )
127134 targetRepo . dispose ( )
128135 this . _repos . delete ( targetRepo )
129136
@@ -161,7 +168,7 @@ export class RepositoryManager extends MetadataRepository implements IRepository
161168 workspaceFolder . name ,
162169 workspaceFolder . uri
163170 )
164- this . setMetadata ( workspaceItem , {
171+ this . _metadata . setMetadata ( workspaceItem , {
165172 uri : workspaceFolder . uri ,
166173 isWorkspace : true ,
167174 isConfigFile : false ,
@@ -198,7 +205,7 @@ export class RepositoryManager extends MetadataRepository implements IRepository
198205
199206 configItem . description = relative ( workspaceTestItem . uri ! . fsPath , dirname ( wdioConfigPath ) )
200207
201- this . setMetadata ( configItem , {
208+ this . _metadata . setMetadata ( configItem , {
202209 uri,
203210 isWorkspace : false ,
204211 isConfigFile : true ,
@@ -225,7 +232,6 @@ export class RepositoryManager extends MetadataRepository implements IRepository
225232 }
226233 await Promise . all (
227234 this . repos . map ( async ( repo ) => {
228- repo . clearTests ( )
229235 return await repo . discoverAllTests ( )
230236 } )
231237 )
@@ -241,11 +247,7 @@ export class RepositoryManager extends MetadataRepository implements IRepository
241247 }
242248
243249 public async dispose ( ) {
244- await Promise . all (
245- Array . from ( this . _repos ) . map ( async ( repo ) => {
246- await repo . dispose ( )
247- } )
248- )
250+ await Promise . all ( this . repos . map ( async ( repo ) => repo . dispose ( ) ) )
249251 this . _repos . clear ( )
250252 this . _workspaceTestItems = [ ]
251253 this . _wdioConfigTestItems = [ ]
0 commit comments