@@ -2,13 +2,14 @@ import type { HardhatRuntimeEnvironment } from "@ignored/hardhat-vnext-core/type
2
2
import type repl from "node:repl" ;
3
3
4
4
import assert from "node:assert/strict" ;
5
- import fs from "node:fs" ;
5
+ import fsPromises from "node:fs/promises " ;
6
6
import os from "node:os" ;
7
7
import path from "node:path" ;
8
8
import { PassThrough } from "node:stream" ;
9
9
import { afterEach , before , beforeEach , describe , it } from "node:test" ;
10
10
11
11
import { ensureError } from "@ignored/hardhat-vnext-utils/error" ;
12
+ import { exists , remove } from "@ignored/hardhat-vnext-utils/fs" ;
12
13
13
14
import { createHardhatRuntimeEnvironment } from "../../../../src/hre.js" ;
14
15
import consoleAction from "../../../../src/internal/builtin-plugins/console/task-action.js" ;
@@ -137,20 +138,20 @@ describe("console/task-action", function () {
137
138
let cacheDir : string ;
138
139
let history : string ;
139
140
140
- beforeEach ( function ( ) {
141
- cacheDir = fs . mkdtempSync (
141
+ beforeEach ( async function ( ) {
142
+ cacheDir = await fsPromises . mkdtemp (
142
143
path . resolve ( os . tmpdir ( ) , "console-action-test-" ) ,
143
144
) ;
144
145
history = path . resolve ( cacheDir , "console-history.txt" ) ;
145
146
} ) ;
146
147
147
- afterEach ( function ( ) {
148
- fs . rmSync ( cacheDir , { recursive : true , force : true } ) ;
148
+ afterEach ( async function ( ) {
149
+ await remove ( cacheDir ) ;
149
150
} ) ;
150
151
151
152
it ( "should create a history file" , async function ( ) {
152
153
assert . ok (
153
- ! fs . existsSync ( history ) ,
154
+ ! ( await exists ( history ) ) ,
154
155
"History file exists before running the console" ,
155
156
) ;
156
157
const replServer = await consoleAction (
@@ -164,7 +165,7 @@ describe("console/task-action", function () {
164
165
) ;
165
166
assert . equal ( replServer . lastError , undefined ) ;
166
167
assert . ok (
167
- fs . existsSync ( history ) ,
168
+ await exists ( history ) ,
168
169
"History file does not exist after running the console" ,
169
170
) ;
170
171
} ) ;
0 commit comments