@@ -140,7 +140,6 @@ async function retryUntil(
140
140
await Promise . race ( [ retry , timedOut ] ) ;
141
141
}
142
142
143
-
144
143
async function runHttpDiscovery ( modulePath : string ) : Promise < DiscoveryResult > {
145
144
const getPort = promisify ( portfinder . getPort ) as ( ) => Promise < number > ;
146
145
const port = await getPort ( ) ;
@@ -174,7 +173,7 @@ async function runHttpDiscovery(modulePath: string): Promise<DiscoveryResult> {
174
173
175
174
const res = await fetch ( `http://localhost:${ port } /__/functions.yaml` ) ;
176
175
const body = await res . text ( ) ;
177
-
176
+
178
177
if ( res . status === 200 ) {
179
178
const manifest = yaml . load ( body ) as Record < string , unknown > ;
180
179
return { success : true , manifest } ;
@@ -206,7 +205,7 @@ async function runStdioDiscovery(modulePath: string): Promise<DiscoveryResult> {
206
205
207
206
const timeoutId = setTimeout ( ( ) => {
208
207
proc . kill ( 9 ) ;
209
- reject ( new Error ( " Stdio discovery timed out after " + TIMEOUT_M + "ms" ) ) ;
208
+ reject ( new Error ( ` Stdio discovery timed out after ${ TIMEOUT_M } ms` ) ) ;
210
209
} , TIMEOUT_M ) ;
211
210
212
211
proc . on ( "close" , ( ) => {
@@ -220,14 +219,14 @@ async function runStdioDiscovery(modulePath: string): Promise<DiscoveryResult> {
220
219
resolve ( { success : true , manifest } ) ;
221
220
return ;
222
221
}
223
-
222
+
224
223
// Try to parse error
225
224
const errorMatch = stderr . match ( / _ _ F I R E B A S E _ F U N C T I O N S _ M A N I F E S T _ E R R O R _ _ : ( [ \s \S ] + ) / ) ;
226
225
if ( errorMatch ) {
227
226
resolve ( { success : false , error : errorMatch [ 1 ] } ) ;
228
227
return ;
229
228
}
230
-
229
+
231
230
resolve ( { success : false , error : "No manifest or error found" } ) ;
232
231
} ) ;
233
232
@@ -243,7 +242,7 @@ describe("functions.yaml", function () {
243
242
this . timeout ( TIMEOUT_XL ) ;
244
243
245
244
function runDiscoveryTests (
246
- tc : Testcase ,
245
+ tc : Testcase ,
247
246
discoveryFn : ( path : string ) => Promise < DiscoveryResult >
248
247
) {
249
248
it ( "returns expected manifest" , async function ( ) {
@@ -395,8 +394,8 @@ describe("functions.yaml", function () {
395
394
} ) ;
396
395
}
397
396
} ) ;
398
-
399
- describe ( "error handling" , function ( ) {
397
+
398
+ describe ( "error handling" , ( ) => {
400
399
const errorTestcases = [
401
400
{
402
401
name : "broken syntax" ,
@@ -413,7 +412,7 @@ describe("functions.yaml", function () {
413
412
for ( const tc of errorTestcases ) {
414
413
describe ( tc . name , ( ) => {
415
414
for ( const discovery of discoveryMethods ) {
416
- it ( `${ discovery . name } discovery handles error correctly` , async function ( ) {
415
+ it ( `${ discovery . name } discovery handles error correctly` , async ( ) => {
417
416
const result = await discovery . fn ( tc . modulePath ) ;
418
417
expect ( result . success ) . to . be . false ;
419
418
expect ( result . error ) . to . include ( tc . expectedError ) ;
0 commit comments