@@ -22,20 +22,31 @@ test('headless with every service: the lines in order; SIGINT quits with exit 0'
2222 await session . waitForOutput ( / \[ w e b \s * \] w e b l i s t e n i n g o n 2 1 0 8 2 / ) ;
2323 await session . waitForOutput ( / \[ w o r k e r \s * \] w o r k e r l i s t e n i n g o n \d + / ) ;
2424
25- const order = positions ( session . stdout , [
26- / \[ s t a c k c t l \] \[ I N F O \] m o d e d e v e l o p m e n t \( d e f a u l t \) / ,
27- / \[ a p i \s * \] s t a r t e d / ,
28- / \[ w e b \s * \] w a i t i n g f o r a p i \. \. \. / ,
29- / \[ a p i \s * \] a p i l i s t e n i n g o n 2 1 0 8 1 / ,
30- / \[ w e b \s * \] a p i r e a d y , s t a r t i n g \. \. \. / ,
31- / \[ w e b \s * \] s t a r t e d / ,
32- / \[ w e b \s * \] w e b l i s t e n i n g o n 2 1 0 8 2 / ,
33- ] ) ;
34- expect (
35- order . every ( ( at ) => at >= 0 ) ,
36- session . stdout ,
37- ) . toBe ( true ) ;
38- expect ( order ) . toEqual ( [ ...order ] . sort ( ( a , b ) => a - b ) ) ;
25+ // Two chains, each in order. Between them nothing is: web says it waits as soon as it is launched,
26+ // while api is started once the session's first `.env` read is done, which can come either side.
27+ const chains = [
28+ [
29+ / \[ s t a c k c t l \] \[ I N F O \] m o d e d e v e l o p m e n t \( d e f a u l t \) / ,
30+ / \[ a p i \s * \] s t a r t e d / ,
31+ / \[ a p i \s * \] a p i l i s t e n i n g o n 2 1 0 8 1 / ,
32+ ] ,
33+ [
34+ / \[ s t a c k c t l \] \[ I N F O \] m o d e d e v e l o p m e n t \( d e f a u l t \) / ,
35+ / \[ w e b \s * \] w a i t i n g f o r a p i \. \. \. / ,
36+ / \[ a p i \s * \] a p i l i s t e n i n g o n 2 1 0 8 1 / ,
37+ / \[ w e b \s * \] a p i r e a d y , s t a r t i n g \. \. \. / ,
38+ / \[ w e b \s * \] s t a r t e d / ,
39+ / \[ w e b \s * \] w e b l i s t e n i n g o n 2 1 0 8 2 / ,
40+ ] ,
41+ ] ;
42+ for ( const chain of chains ) {
43+ const order = positions ( session . stdout , chain ) ;
44+ expect (
45+ order . every ( ( at ) => at >= 0 ) ,
46+ session . stdout ,
47+ ) . toBe ( true ) ;
48+ expect ( order ) . toEqual ( [ ...order ] . sort ( ( a , b ) => a - b ) ) ;
49+ }
3950 expect ( session . stdout ) . toMatch ( / \[ w o r k e r \s * \] s t a r t e d / ) ;
4051
4152 session . child . kill ( 'SIGINT' ) ;
0 commit comments