File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/vitest/src/node/pools Expand file tree Collapse file tree 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'
22import type { RuntimeRPC } from '../../types/rpc'
33import type { TestProject } from '../project'
44import 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'
67import { join } from 'pathe'
78import { hash } from '../hash'
89
@@ -54,14 +55,14 @@ export function createMethodsRPC(project: TestProject, options: MethodsOptions =
5455 const dir = join ( project . tmpDir , transformMode )
5556 const name = hash ( 'sha1' , id , 'hex' )
5657 const tmp = join ( dir , name )
58+ if ( ! created . has ( dir ) ) {
59+ mkdirSync ( dir , { recursive : true } )
60+ created . add ( dir )
61+ }
5762 if ( promises . has ( tmp ) ) {
5863 await promises . get ( tmp )
5964 return { id : tmp }
6065 }
61- if ( ! created . has ( dir ) ) {
62- await mkdir ( dir , { recursive : true } )
63- created . add ( dir )
64- }
6566 promises . set (
6667 tmp ,
6768 writeFile ( tmp , code , 'utf-8' ) . finally ( ( ) => promises . delete ( tmp ) ) ,
You can’t perform that action at this time.
0 commit comments