File tree Expand file tree Collapse file tree 4 files changed +18
-7
lines changed
Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,14 @@ import {
1111 WEVAL_TEST_ENABLED ,
1212 DEBUG_TEST_ENABLED ,
1313 maybeLogging ,
14+ buildDefaultTestOpts ,
1415} from './util.js' ;
1516
1617suite ( 'Bindings' , async ( ) => {
1718 const bindingsCases = await readdir ( new URL ( './cases' , import . meta. url ) ) ;
1819
1920 for ( const name of bindingsCases ) {
20- test ( name , async ( ) => {
21+ test ( name , buildDefaultTestOpts , async ( ) => {
2122 const source = await readFile (
2223 new URL ( `./cases/${ name } /source.js` , import . meta. url ) ,
2324 'utf8' ,
Original file line number Diff line number Diff line change @@ -12,14 +12,15 @@ import {
1212 WEVAL_TEST_ENABLED ,
1313 DEBUG_TEST_ENABLED ,
1414 maybeLogging ,
15+ buildDefaultTestOpts ,
1516} from './util.js' ;
1617
1718suite ( 'Builtins' , async ( ) => {
1819 const builtins = await readdir ( new URL ( './builtins' , import . meta. url ) ) ;
1920
2021 for ( const filename of builtins ) {
2122 const name = filename . slice ( 0 , - 3 ) ;
22- test ( name , async ( ) => {
23+ test ( name , buildDefaultTestOpts ( ) , async ( ) => {
2324 const {
2425 source,
2526 test : runTest ,
Original file line number Diff line number Diff line change @@ -7,9 +7,20 @@ export const WEVAL_TEST_ENABLED = isEnabledEnvVar(env.WEVAL_TEST);
77export const DEBUG_TEST_ENABLED = isEnabledEnvVar ( env . DEBUG_TEST ) ;
88
99function isEnabledEnvVar ( v ) {
10- return typeof v === 'string' && [ '1' , 'yes' , 'true' ] . includes ( v . toLowerCase ( ) ) ;
10+ return (
11+ typeof v === 'string' && [ '1' , 'yes' , 'true' ] . includes ( v . toLowerCase ( ) )
12+ ) ;
1113}
1214
15+ // Enable retries for individual tests if weval is under test
16+ export function buildDefaultTestOpts ( ) {
17+ const opts = { } ;
18+ // if weval is enabled, for more retries
19+ if ( WEVAL_TEST_ENABLED ) {
20+ opts . retry = 3 ;
21+ }
22+ return opts ;
23+ }
1324
1425// Utility function for getting a random port
1526export async function getRandomPort ( ) {
Original file line number Diff line number Diff line change @@ -13,13 +13,11 @@ import {
1313 DEBUG_TRACING_ENABLED ,
1414 WEVAL_TEST_ENABLED ,
1515 DEBUG_TEST_ENABLED ,
16+ buildDefaultTestOpts ,
1617} from './util.js' ;
1718
18- // Enable retries for individual tests if weval is under test
19- const TEST_OPTS = WEVAL_TEST_ENABLED ? { retry : 3 } : undefined ;
20-
2119suite ( 'WASI' , ( ) => {
22- test ( 'basic app (old API)' , TEST_OPTS , async ( ) => {
20+ test ( 'basic app (old API)' , buildDefaultTestOpts ( ) , async ( ) => {
2321 const { instance } = await setupComponent ( {
2422 componentize : {
2523 src : `
You can’t perform that action at this time.
0 commit comments