File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,25 @@ async function cleanupAndPrepareReportsDir() {
169
169
await fs . promises . rm ( reportsDir , { recursive : true } ) ;
170
170
} catch { }
171
171
172
- await fs . promises . mkdir ( reportsDir , { recursive : true } ) ;
172
+ try {
173
+ await fs . promises . mkdir ( reportsDir , { recursive : true } ) ;
174
+ } catch ( err ) {
175
+ // If mkdir fails, try to create the entire path structure
176
+ const pathParts = reportsDir . split ( path . sep ) ;
177
+ let currentPath = pathParts [ 0 ] || path . sep ;
178
+
179
+ for ( let i = 1 ; i < pathParts . length ; i ++ ) {
180
+ currentPath = path . join ( currentPath , pathParts [ i ] ) ;
181
+ try {
182
+ await fs . promises . mkdir ( currentPath ) ;
183
+ } catch ( mkdirErr ) {
184
+ // Ignore EEXIST errors, but throw others
185
+ if ( mkdirErr . code !== 'EEXIST' ) {
186
+ throw mkdirErr ;
187
+ }
188
+ }
189
+ }
190
+ }
173
191
}
174
192
175
193
/**
You can’t perform that action at this time.
0 commit comments