@@ -37,6 +37,7 @@ let args = argv.slice(2);
3737
3838const local = args . includes ( '--local' ) ;
3939const starlingmonkey = args . includes ( '--starlingmonkey' ) ;
40+ const filter = args . filter ( arg => ! arg . startsWith ( '--' ) ) ;
4041
4142async function $ ( ...args ) {
4243 return await retry ( 10 , ( ) => zx ( ...args ) )
@@ -111,11 +112,6 @@ core.endGroup()
111112
112113let { default : tests } = await import ( join ( fixturePath , 'tests.json' ) , { with : { type : 'json' } } ) ;
113114
114- if ( starlingmonkey ) {
115- const { default : testsSkipStarlingMonkey } = await import ( join ( fixturePath , 'tests-skip-starlingmonkey.json' ) , { with : { type : 'json' } } ) ;
116- tests = Object . fromEntries ( Object . entries ( tests ) . filter ( ( [ key ] ) => ! testsSkipStarlingMonkey . includes ( key ) ) ) ;
117- }
118-
119115core . startGroup ( 'Running tests' )
120116function chunks ( arr , size ) {
121117 const output = [ ] ;
@@ -128,6 +124,14 @@ function chunks(arr, size) {
128124let results = [ ] ;
129125for ( const chunk of chunks ( Object . entries ( tests ) , 100 ) ) {
130126 results . push ( ...await Promise . allSettled ( chunk . map ( async ( [ title , test ] ) => {
127+ // basic test filtering
128+ if ( ! title . includes ( filter ) ) {
129+ return {
130+ title,
131+ test,
132+ skipped : true
133+ } ;
134+ }
131135 if ( local ) {
132136 if ( test . environments . includes ( "viceroy" ) ) {
133137 let path = test . downstream_request . pathname ;
@@ -142,6 +146,7 @@ for (const chunk of chunks(Object.entries(tests), 100)) {
142146 await compareDownstreamResponse ( test . downstream_response , response ) ;
143147 return {
144148 title,
149+ test,
145150 skipped : false
146151 } ;
147152 } catch ( error ) {
@@ -150,6 +155,7 @@ for (const chunk of chunks(Object.entries(tests), 100)) {
150155 } else {
151156 return {
152157 title,
158+ test,
153159 skipped : true
154160 }
155161 }
@@ -168,6 +174,7 @@ for (const chunk of chunks(Object.entries(tests), 100)) {
168174 await compareDownstreamResponse ( test . downstream_response , response ) ;
169175 return {
170176 title,
177+ test,
171178 skipped : false
172179 } ;
173180 } catch ( error ) {
@@ -177,6 +184,7 @@ for (const chunk of chunks(Object.entries(tests), 100)) {
177184 } else {
178185 return {
179186 title,
187+ test,
180188 skipped : true
181189 }
182190 }
@@ -191,6 +199,7 @@ let passed = 0;
191199const failed = [ ] ;
192200const green = '\u001b[32m' ;
193201const red = '\u001b[31m' ;
202+ const reset = '\u001b[0m' ;
194203const white = '\u001b[39m' ;
195204const info = '\u2139' ;
196205const tick = '\u2714' ;
@@ -199,16 +208,20 @@ for (const result of results) {
199208 if ( result . status === 'fulfilled' ) {
200209 passed += 1 ;
201210 if ( result . value . skipped ) {
202- if ( local ) {
203- console . log ( white , info , `Skipped as test marked to only run on Fastly Compute: ${ result . value . title } ` , white ) ;
211+ if ( ! result . value . title . includes ( filter ) ) {
212+ console . log ( white , info , `Skipped by test filter: ${ result . value . title } ` , reset ) ;
213+ } else if ( local && ! result . value . test . environments . includes ( "viceroy" ) ) {
214+ console . log ( white , info , `Skipped as test marked to only run on Fastly Compute: ${ result . value . title } ` , reset ) ;
215+ } else if ( ! local && ! result . value . test . environments . includes ( "compute" ) ) {
216+ console . log ( white , info , `Skipped as test marked to only run on local server: ${ result . value . title } ` , reset ) ;
204217 } else {
205- console . log ( white , info , `Skipped as test marked to only run on local server : ${ result . value . title } ` , white ) ;
218+ console . log ( white , info , `Skipped due to no environments set : ${ result . value . title } ` , reset ) ;
206219 }
207220 } else {
208- console . log ( green , tick , result . value . title , white ) ;
221+ console . log ( green , tick , result . value . title , reset ) ;
209222 }
210223 } else {
211- console . log ( red , cross , result . reason , white ) ;
224+ console . log ( red , cross , result . reason , reset ) ;
212225 failed . push ( result . reason )
213226 }
214227}
@@ -219,7 +232,7 @@ if (failed.length) {
219232 core . startGroup ( 'Failed tests' )
220233
221234 for ( const result of failed ) {
222- console . log ( red , cross , result , white ) ;
235+ console . log ( red , cross , result , reset ) ;
223236 }
224237
225238 core . endGroup ( )
0 commit comments