99 * the package view, e.g. due to missing base interfaces. 
1010 */ 
1111
12- import  {  describe ,  it ,   before  }  from  'node:test' ; 
12+ import  {  describe ,  it  }  from  'node:test' ; 
1313import  {  strict  as  assert  }  from  'node:assert' ; 
1414import  path  from  'node:path' ; 
1515import  {  fileURLToPath  }  from  'node:url' ; 
@@ -21,6 +21,7 @@ const curatedView = {
2121  name : 'curated' , 
2222  folder : path . join ( scriptPath ,  '..' ,  '..' ,  'curated' ,  'idl' ) 
2323} ; 
24+ 
2425const  packageView  =  { 
2526  name : '@webref/idl package' , 
2627  folder : path . join ( scriptPath ,  '..' ,  '..' ,  'packages' ,  'idl' ) 
@@ -41,40 +42,39 @@ function validate(ast) {
4142  assert . fail ( message ) ; 
4243} 
4344
44- describe ( `The ${ curatedView . name }   view of Web IDL extracts` ,  function  ( )  { 
45+ describe ( `The ${ curatedView . name }   view of Web IDL extracts` ,  async   function  ( )  { 
4546  let  all ; 
46-   before ( async  ( )  =>  { 
47-     all  =  await  idl . parseAll ( curatedView . folder ) ; 
48-   } ) ; 
49- 
50-   it ( `The ${ curatedView . name }   view of Web IDL extracts` ,  function  ( )  { 
51-     for  ( const  [ spec ,  ast ]  of  Object . entries ( all ) )  { 
52-       it ( `contains valid Web IDL for ${ spec }  ` ,  function  ( )  { 
53-         validate ( ast ) ; 
54-       } ) ; 
55-     } 
56-   } ) ; 
47+   try  { 
48+     all  =  await  idl . parseAll ( { folder : curatedView . folder } ) ; 
49+   }  catch  ( err )  { 
50+     it ( 'contains data that can be parsed with webidl2.js' ,  ( )  =>  { throw  err  ; } ) ; 
51+   } ; 
5752
58-   it ( `The combined Web IDL in the ${ curatedView . name }   view` ,  function  ( )  { 
53+   for  ( const  [ spec ,  ast ]  of  Object . entries ( all ) )  { 
54+     it ( `contains valid Web IDL for ${ spec }  ` ,  function  ( )  { 
55+       validate ( ast ) ; 
56+     } ) ; 
57+   } 
58+   describe ( `The combined Web IDL in the ${ curatedView . name }   view` ,  function  ( )  { 
5959    it ( 'is valid Web IDL' ,  function  ( )  { 
6060      validate ( Object . values ( all ) . flat ( ) ) ; 
6161    } ) ; 
6262  } ) ; 
63- 
6463} ) ; 
6564
66- 
6765describe ( `The ${ packageView . name }   view of Web IDL extracts` ,  async  ( )  =>  { 
68-   before ( async  ( )  =>  { 
69-     const  all  =  await  idl . parseAll ( packageView . folder ) ; 
66+   let  all ; 
67+   try  { 
68+     all  =  await  idl . parseAll ( { folder : packageView . folder } ) ; 
69+   }  catch  ( err )  { 
70+     it ( 'contains data that can be parsed with webidl2.js' ,  ( )  =>  { throw  err ; } ) ; 
71+   } 
7072
71-     describe ( `The combined Web IDL in the ${ packageView . name }   view` ,  function  ( )  { 
72-       it ( 'is valid Web IDL' ,  function  ( )  { 
73-         validate ( Object . values ( all ) . flat ( ) ) ; 
74-       } ) ; 
73+   describe ( `The combined Web IDL in the ${ packageView . name }   view` ,  function  ( )  { 
74+     it ( 'is valid Web IDL' ,  function  ( )  { 
75+       validate ( Object . values ( all ) . flat ( ) ) ; 
7576    } ) ; 
7677  } ) ; 
77- 
78-   it ( 'contains data that can be parsed with webidl2.js' ,  ( )  =>  { } ) ; 
78+   
7979} ) ; 
8080
0 commit comments