@@ -92,6 +92,7 @@ for (const { runnerEnv, ErrorConstructor, message } of [
92
92
cleanupDatabaseClusterDirectory (
93
93
createTestConfig ( { dbLocation } ) ,
94
94
getRecordingLogger ( messages ) ,
95
+ { } ,
95
96
( ) => {
96
97
throw new Error ( rmSyncError ) ;
97
98
} ,
@@ -112,6 +113,33 @@ for (const { runnerEnv, ErrorConstructor, message } of [
112
113
} ) ;
113
114
}
114
115
116
+ test ( "cleanupDatabaseClusterDirectory can disable warning with options" , async ( t ) => {
117
+ await withTmpDir ( async ( tmpDir : string ) => {
118
+ const dbLocation = path . resolve ( tmpDir , "dbs" ) ;
119
+ fs . mkdirSync ( dbLocation , { recursive : true } ) ;
120
+
121
+ const fileToCleanUp = path . resolve ( dbLocation , "something-to-cleanup.txt" ) ;
122
+ fs . writeFileSync ( fileToCleanUp , "" ) ;
123
+
124
+ const messages : LoggedMessage [ ] = [ ] ;
125
+ cleanupDatabaseClusterDirectory (
126
+ createTestConfig ( { dbLocation } ) ,
127
+ getRecordingLogger ( messages ) ,
128
+ { disableExistingDirectoryWarning : true } ,
129
+ ) ;
130
+
131
+ // Should only have the info message, not the warning
132
+ t . is ( messages . length , 1 ) ;
133
+ t . is ( messages [ 0 ] . type , "info" ) ;
134
+ t . is (
135
+ messages [ 0 ] . message ,
136
+ `Cleaned up database cluster directory ${ dbLocation } .` ,
137
+ ) ;
138
+
139
+ t . false ( fs . existsSync ( fileToCleanUp ) ) ;
140
+ } ) ;
141
+ } ) ;
142
+
115
143
type PackInfo = {
116
144
language : KnownLanguage ;
117
145
packinfoContents : string | undefined ;
0 commit comments