File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/test-case-recorder/src Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -90,12 +90,17 @@ export class ScopeTestRecorder {
9090 await fsPromises . mkdir ( langDirectory , { recursive : true } ) ;
9191
9292 for ( const { facet, content } of facetsToAdd ) {
93+ const fileName = `${ facet } .scope` ;
9394 const fullContent = `${ content } ---\n` ;
94- let filePath = path . join ( langDirectory , `${ facet } .scope` ) ;
95+ const subDirectory = path . join ( langDirectory , facet . split ( "." ) [ 0 ] ) ;
96+ const directory = fs . existsSync ( subDirectory )
97+ ? subDirectory
98+ : langDirectory ;
99+ let filePath = path . join ( directory , fileName ) ;
95100 let i = 2 ;
96101
97102 while ( fs . existsSync ( filePath ) ) {
98- filePath = path . join ( langDirectory , `${ facet } ${ i ++ } .scope` ) ;
103+ filePath = path . join ( directory , `${ facet } ${ i ++ } .scope` ) ;
99104 }
100105
101106 await fsPromises . writeFile ( filePath , fullContent , "utf-8" ) ;
You can’t perform that action at this time.
0 commit comments