@@ -19,7 +19,7 @@ import { existsSync } from 'node:fs';
1919import { readFile , rm , writeFile } from 'node:fs/promises' ;
2020import { promisify } from 'node:util' ;
2121
22- import { afterAll , beforeAll , describe , expect , it } from '@jest/globals' ;
22+ import { afterAll , beforeAll , describe , expect , it , jest } from '@jest/globals' ;
2323import axios from 'axios' ;
2424import * as compose from 'docker-compose' ;
2525import { gql , request } from 'graphql-request' ;
@@ -69,6 +69,7 @@ const launchLago = async () => {
6969 cwd : LAGO_PATH ,
7070 log : true ,
7171 env : {
72+ ...process . env ,
7273 LAGO_RSA_PRIVATE_KEY : Buffer . from ( privateKey ) . toString ( 'base64' ) ,
7374 FRONT_PORT : `${ LAGO_FRONT_PORT } ` , // avoiding conflicts, tests do not require a front-end
7475 API_PORT : `${ LAGO_API_PORT } ` ,
@@ -302,7 +303,7 @@ describe('Plugin - Lago', () => {
302303 } ) ,
303304 ) . resolves . not . toThrow ( ) ;
304305 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] created routes` )
305- } ) ;
306+ } , 5 * 1000 ) ;
306307
307308 it ( 'should create consumer' , async ( ) => {
308309 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] creating consumer` )
@@ -322,7 +323,7 @@ describe('Plugin - Lago', () => {
322323 const res = await client . get ( '/hello' , { validateStatus : ( ) => true } ) ;
323324 expect ( res . status ) . toEqual ( 401 ) ;
324325 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] called API without key` )
325- } ) ;
326+ } , 5 * 1000 ) ;
326327
327328 it ( 'call normal API' , async ( ) => {
328329 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] calling normal API` )
@@ -333,7 +334,7 @@ describe('Plugin - Lago', () => {
333334 }
334335 await wait ( 500 ) ;
335336 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] called normal API` )
336- } ) ;
337+ } , 5 * 1000 ) ;
337338
338339 it ( 'check Lago events (normal API)' , async ( ) => {
339340 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] checking Lago events (normal API)` )
@@ -344,7 +345,7 @@ describe('Plugin - Lago', () => {
344345 expect ( data . events ) . toHaveLength ( 3 ) ;
345346 expect ( data . events [ 0 ] . code ) . toEqual ( LAGO_BILLABLE_METRIC_CODE ) ;
346347 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] checked Lago events (normal API)` )
347- } ) ;
348+ } , 5 * 1000 ) ;
348349
349350 let expensiveStartAt : Date ;
350351 it ( 'call expensive API' , async ( ) => {
@@ -357,7 +358,7 @@ describe('Plugin - Lago', () => {
357358 }
358359 await wait ( 500 ) ;
359360 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] called expensive API` )
360- } ) ;
361+ } , 5 * 1000 ) ;
361362
362363 it ( 'check Lago events (expensive API)' , async ( ) => {
363364 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] checking Lago events (expensive API)` )
@@ -370,5 +371,5 @@ describe('Plugin - Lago', () => {
370371 expect ( data . events [ 0 ] . code ) . toEqual ( LAGO_BILLABLE_METRIC_CODE ) ;
371372 expect ( data . events [ 1 ] . properties ) . toEqual ( { tier : 'expensive' } ) ;
372373 console . log ( `[${ new Date ( ) . toLocaleTimeString ( ) } ] checked Lago events (expensive API)` )
373- } ) ;
374+ } , 5 * 1000 ) ;
374375} ) ;
0 commit comments