@@ -138,6 +138,20 @@ async function getOptions(directory: URL): Promise<unknown> {
138
138
return { }
139
139
}
140
140
141
+ /**
142
+ * Write content to a file.
143
+ *
144
+ * @param url
145
+ * The file URL to write to.
146
+ * @param content
147
+ * The content to write to the file.
148
+ */
149
+ async function outputFile ( url : URL , content : string ) : Promise < undefined > {
150
+ // eslint-disable-next-line no-console
151
+ console . log ( 'Writing' , makePrettyPath ( url ) )
152
+ await writeFile ( url , content )
153
+ }
154
+
141
155
/**
142
156
* Create a test for a single test fixture directory.
143
157
*
@@ -161,8 +175,8 @@ export function createTest<T>(
161
175
write : boolean | undefined ,
162
176
format : boolean | undefined ,
163
177
spec : Test < T >
164
- ) : ( ) => Promise < void > {
165
- return async function run ( ) : Promise < void > {
178
+ ) : ( ) => Promise < undefined > {
179
+ return async function run ( ) : Promise < undefined > {
166
180
let generate : Generate < T >
167
181
let inputUrl : URL
168
182
let expectedUrl : URL
@@ -210,7 +224,7 @@ export function createTest<T>(
210
224
// This is only covered in CI.
211
225
/* c8 ignore start */
212
226
if ( expected == null ) {
213
- return writeFile ( expectedUrl , actual )
227
+ return outputFile ( expectedUrl , actual )
214
228
}
215
229
216
230
/* c8 ignore stop */
@@ -221,9 +235,7 @@ export function createTest<T>(
221
235
// This is only covered outside of CI.
222
236
/* c8 ignore start */
223
237
if ( write && error instanceof AssertionError ) {
224
- // eslint-disable-next-line no-console
225
- console . log ( 'Writing' , makePrettyPath ( expectedUrl ) )
226
- await writeFile ( expectedUrl , actual )
238
+ await outputFile ( expectedUrl , actual )
227
239
}
228
240
229
241
/* c8 ignore stop */
0 commit comments