File tree 1 file changed +6
-5
lines changed
packages/vitest/src/node/pools
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ import type { RawSourceMap } from 'vite-node'
2
2
import type { RuntimeRPC } from '../../types/rpc'
3
3
import type { TestProject } from '../project'
4
4
import type { ResolveSnapshotPathHandlerContext } from '../types/config'
5
- import { mkdir , writeFile } from 'node:fs/promises'
5
+ import { mkdirSync } from 'node:fs'
6
+ import { writeFile } from 'node:fs/promises'
6
7
import { join } from 'pathe'
7
8
import { hash } from '../hash'
8
9
@@ -54,14 +55,14 @@ export function createMethodsRPC(project: TestProject, options: MethodsOptions =
54
55
const dir = join ( project . tmpDir , transformMode )
55
56
const name = hash ( 'sha1' , id , 'hex' )
56
57
const tmp = join ( dir , name )
58
+ if ( ! created . has ( dir ) ) {
59
+ mkdirSync ( dir , { recursive : true } )
60
+ created . add ( dir )
61
+ }
57
62
if ( promises . has ( tmp ) ) {
58
63
await promises . get ( tmp )
59
64
return { id : tmp }
60
65
}
61
- if ( ! created . has ( dir ) ) {
62
- await mkdir ( dir , { recursive : true } )
63
- created . add ( dir )
64
- }
65
66
promises . set (
66
67
tmp ,
67
68
writeFile ( tmp , code , 'utf-8' ) . finally ( ( ) => promises . delete ( tmp ) ) ,
You can’t perform that action at this time.
0 commit comments