File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ export class FolderContext implements vscode.Disposable {
3737 private testExplorerResolver ?: ( testExplorer : TestExplorer ) => void ;
3838 private packageWatcher : PackageWatcher ;
3939 private testRunManager : TestRunManager ;
40+ public creationStack ?: string ;
4041
4142 /**
4243 * FolderContext constructor
@@ -57,6 +58,10 @@ export class FolderContext implements vscode.Disposable {
5758 this . taskQueue = new TaskQueue ( this ) ;
5859 this . testRunManager = new TestRunManager ( ) ;
5960
61+ // In order to track down why a FolderContext may be created when we don't want one,
62+ // capture the stack so we can log it if we find a duplicate.
63+ this . creationStack = new Error ( ) . stack ;
64+
6065 // Tests often need to wait for the test explorer to be created before they can run.
6166 // This promise resolves when the test explorer is created, allowing them to wait for it before starting.
6267 this . resolvedTestExplorer = new Promise < TestExplorer > ( resolve => {
Original file line number Diff line number Diff line change @@ -467,8 +467,10 @@ export class WorkspaceContext implements vscode.Disposable {
467467 // find context with root folder
468468 const index = this . folders . findIndex ( context => context . folder . fsPath === folder . fsPath ) ;
469469 if ( index !== - 1 ) {
470+ const existingFolder = this . folders [ index ] ;
470471 this . logger . warn ( `Adding package folder ${ folder } twice: ${ Error ( ) . stack } ` ) ;
471- return this . folders [ index ] ;
472+ this . logger . warn ( `Existing folder was created by ${ existingFolder . creationStack } ` ) ;
473+ return existingFolder ;
472474 }
473475 const folderContext = await FolderContext . create ( folder , workspaceFolder , this ) ;
474476 this . folders . push ( folderContext ) ;
You can’t perform that action at this time.
0 commit comments