13
13
//===----------------------------------------------------------------------===//
14
14
15
15
import * as vscode from "vscode" ;
16
- import * as fs from "fs" ;
16
+ import * as fs from "fs/promises " ;
17
17
import * as path from "path" ;
18
18
import { expect } from "chai" ;
19
19
import { waitForNoRunningTasks } from "../../utilities" ;
@@ -29,6 +29,7 @@ import {
29
29
folderInRootWorkspace ,
30
30
updateSettings ,
31
31
} from "../utilities/testutilities" ;
32
+ import { pathExists } from "../../../src/utilities/filesystem" ;
32
33
33
34
suite ( "Build Commands" , function ( ) {
34
35
let folderContext : FolderContext ;
@@ -60,8 +61,8 @@ suite("Build Commands", function () {
60
61
61
62
teardown ( async ( ) => {
62
63
// Remove the build directory after each test case
63
- if ( fs . existsSync ( buildPath ) ) {
64
- fs . rmSync ( buildPath , { recursive : true , force : true } ) ;
64
+ if ( await pathExists ( buildPath ) ) {
65
+ await fs . rm ( buildPath , { recursive : true , force : true } ) ;
65
66
}
66
67
} ) ;
67
68
@@ -79,12 +80,12 @@ suite("Build Commands", function () {
79
80
let result = await vscode . commands . executeCommand ( Commands . RUN ) ;
80
81
expect ( result ) . to . be . true ;
81
82
82
- const beforeItemCount = fs . readdirSync ( buildPath ) . length ;
83
+ const beforeItemCount = ( await fs . readdir ( buildPath ) ) . length ;
83
84
84
85
result = await vscode . commands . executeCommand ( Commands . CLEAN_BUILD ) ;
85
86
expect ( result ) . to . be . true ;
86
87
87
- const afterItemCount = fs . readdirSync ( buildPath ) . length ;
88
+ const afterItemCount = ( await fs . readdir ( buildPath ) ) . length ;
88
89
// This test will run in order after the Swift: Run Build test,
89
90
// where .build folder is going to be filled with built artifacts.
90
91
// After executing the clean command the build directory is guranteed to have less entry.
0 commit comments