File tree 2 files changed +12
-15
lines changed
test/integration-tests/testexplorer
2 files changed +12
-15
lines changed Original file line number Diff line number Diff line change 15
15
import * as assert from "assert" ;
16
16
import * as vscode from "vscode" ;
17
17
import { beforeEach , afterEach } from "mocha" ;
18
- import { testAssetUri } from "../../fixtures" ;
19
18
import { TestExplorer } from "../../../src/TestExplorer/TestExplorer" ;
20
19
import {
21
20
assertContains ,
@@ -39,7 +38,11 @@ import {
39
38
reduceTestItemChildren ,
40
39
} from "../../../src/TestExplorer/TestUtils" ;
41
40
import { runnableTag } from "../../../src/TestExplorer/TestDiscovery" ;
42
- import { activateExtensionForSuite , updateSettings } from "../utilities/testutilities" ;
41
+ import {
42
+ activateExtensionForSuite ,
43
+ folderInRootWorkspace ,
44
+ updateSettings ,
45
+ } from "../utilities/testutilities" ;
43
46
import { Commands } from "../../../src/commands" ;
44
47
import { SwiftToolchain } from "../../../src/toolchain/toolchain" ;
45
48
@@ -54,10 +57,7 @@ suite("Test Explorer Suite", function () {
54
57
activateExtensionForSuite ( {
55
58
async setup ( ctx ) {
56
59
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 ) ;
61
61
62
62
if ( ! targetFolder ) {
63
63
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(
164
164
) ;
165
165
}
166
166
167
- function syncPromise ( callback : ( ) => void ) : Promise < void > {
167
+ export function syncPromise ( callback : ( ) => void ) : Promise < void > {
168
168
return new Promise ( resolve => {
169
169
callback ( ) ;
170
170
resolve ( ) ;
@@ -188,14 +188,11 @@ export function eventPromise<T>(event: vscode.Event<T>): Promise<T> {
188
188
export async function waitForTestExplorerReady (
189
189
testExplorer : TestExplorer
190
190
) : 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 ;
199
196
}
200
197
201
198
/**
You can’t perform that action at this time.
0 commit comments