File tree Expand file tree Collapse file tree 2 files changed +12
-15
lines changed
test/integration-tests/testexplorer Expand file tree Collapse file tree 2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change 1515import * as assert from "assert" ;
1616import * as vscode from "vscode" ;
1717import { beforeEach , afterEach } from "mocha" ;
18- import { testAssetUri } from "../../fixtures" ;
1918import { TestExplorer } from "../../../src/TestExplorer/TestExplorer" ;
2019import {
2120 assertContains ,
@@ -39,7 +38,11 @@ import {
3938 reduceTestItemChildren ,
4039} from "../../../src/TestExplorer/TestUtils" ;
4140import { runnableTag } from "../../../src/TestExplorer/TestDiscovery" ;
42- import { activateExtensionForSuite , updateSettings } from "../utilities/testutilities" ;
41+ import {
42+ activateExtensionForSuite ,
43+ folderInRootWorkspace ,
44+ updateSettings ,
45+ } from "../utilities/testutilities" ;
4346import { Commands } from "../../../src/commands" ;
4447import { SwiftToolchain } from "../../../src/toolchain/toolchain" ;
4548
@@ -54,10 +57,7 @@ suite("Test Explorer Suite", function () {
5457 activateExtensionForSuite ( {
5558 async setup ( ctx ) {
5659 workspaceContext = ctx ;
57- const packageFolder = testAssetUri ( "defaultPackage" ) ;
58- const targetFolder = workspaceContext . folders . find (
59- folder => folder . folder . path === packageFolder . path
60- ) ;
60+ const targetFolder = await folderInRootWorkspace ( "defaultPackage" , workspaceContext ) ;
6161
6262 if ( ! targetFolder ) {
6363 throw new Error ( "Unable to find test explorer" ) ;
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ export function assertTestResults(
164164 ) ;
165165}
166166
167- function syncPromise ( callback : ( ) => void ) : Promise < void > {
167+ export function syncPromise ( callback : ( ) => void ) : Promise < void > {
168168 return new Promise ( resolve => {
169169 callback ( ) ;
170170 resolve ( ) ;
@@ -188,14 +188,11 @@ export function eventPromise<T>(event: vscode.Event<T>): Promise<T> {
188188export async function waitForTestExplorerReady (
189189 testExplorer : TestExplorer
190190) : Promise < vscode . TestController > {
191- return (
192- await Promise . all ( [
193- testExplorer . controller . items . size === 0
194- ? eventPromise ( testExplorer . onTestItemsDidChange )
195- : Promise . resolve ( testExplorer . controller ) ,
196- syncPromise ( ( ) => vscode . commands . executeCommand ( "workbench.view.testing.focus" ) ) ,
197- ] )
198- ) [ 0 ] ;
191+ await vscode . commands . executeCommand ( "workbench.view.testing.focus" ) ;
192+ const controller = await ( testExplorer . controller . items . size === 0
193+ ? eventPromise ( testExplorer . onTestItemsDidChange )
194+ : Promise . resolve ( testExplorer . controller ) ) ;
195+ return controller ;
199196}
200197
201198/**
You can’t perform that action at this time.
0 commit comments