File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,14 @@ import {
11
11
WEVAL_TEST_ENABLED ,
12
12
DEBUG_TEST_ENABLED ,
13
13
maybeLogging ,
14
+ buildDefaultTestOpts ,
14
15
} from './util.js' ;
15
16
16
17
suite ( 'Bindings' , async ( ) => {
17
18
const bindingsCases = await readdir ( new URL ( './cases' , import . meta. url ) ) ;
18
19
19
20
for ( const name of bindingsCases ) {
20
- test ( name , async ( ) => {
21
+ test ( name , buildDefaultTestOpts ( ) , async ( ) => {
21
22
const source = await readFile (
22
23
new URL ( `./cases/${ name } /source.js` , import . meta. url ) ,
23
24
'utf8' ,
Original file line number Diff line number Diff line change @@ -12,14 +12,15 @@ import {
12
12
WEVAL_TEST_ENABLED ,
13
13
DEBUG_TEST_ENABLED ,
14
14
maybeLogging ,
15
+ buildDefaultTestOpts ,
15
16
} from './util.js' ;
16
17
17
18
suite ( 'Builtins' , async ( ) => {
18
19
const builtins = await readdir ( new URL ( './builtins' , import . meta. url ) ) ;
19
20
20
21
for ( const filename of builtins ) {
21
22
const name = filename . slice ( 0 , - 3 ) ;
22
- test ( name , async ( ) => {
23
+ test ( name , buildDefaultTestOpts ( ) , async ( ) => {
23
24
const {
24
25
source,
25
26
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);
7
7
export const DEBUG_TEST_ENABLED = isEnabledEnvVar ( env . DEBUG_TEST ) ;
8
8
9
9
function 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
+ ) ;
11
13
}
12
14
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
+ }
13
24
14
25
// Utility function for getting a random port
15
26
export async function getRandomPort ( ) {
Original file line number Diff line number Diff line change @@ -13,13 +13,11 @@ import {
13
13
DEBUG_TRACING_ENABLED ,
14
14
WEVAL_TEST_ENABLED ,
15
15
DEBUG_TEST_ENABLED ,
16
+ buildDefaultTestOpts ,
16
17
} from './util.js' ;
17
18
18
- // Enable retries for individual tests if weval is under test
19
- const TEST_OPTS = WEVAL_TEST_ENABLED ? { retry : 3 } : undefined ;
20
-
21
19
suite ( 'WASI' , ( ) => {
22
- test ( 'basic app (old API)' , TEST_OPTS , async ( ) => {
20
+ test ( 'basic app (old API)' , buildDefaultTestOpts ( ) , async ( ) => {
23
21
const { instance } = await setupComponent ( {
24
22
componentize : {
25
23
src : `
@@ -61,7 +59,7 @@ suite('WASI', () => {
61
59
assert . strictEqual ( result . split ( ',' ) . length , 3 ) ;
62
60
} ) ;
63
61
64
- test ( 'basic app (OriginalSourceFile API)' , TEST_OPTS , async ( ) => {
62
+ test ( 'basic app (OriginalSourceFile API)' , buildDefaultTestOpts ( ) , async ( ) => {
65
63
const { instance } = await setupComponent ( {
66
64
componentize : {
67
65
opts : {
You can’t perform that action at this time.
0 commit comments