99 * the package view, e.g. due to missing base interfaces.
1010 */
1111
12+ import { describe , it , before } from 'node:test' ;
1213import { strict as assert } from 'node:assert' ;
1314import path from 'node:path' ;
1415import { fileURLToPath } from 'node:url' ;
@@ -41,28 +42,25 @@ function validate(ast) {
4142}
4243
4344describe ( `The ${ curatedView . name } view of Web IDL extracts` , function ( ) {
45+ let all ;
4446 before ( async ( ) => {
45- const all = await idl . parseAll ( curatedView . folder ) ;
46-
47- describe ( `The ${ curatedView . name } view of Web IDL extracts` , function ( ) {
48- for ( const [ spec , ast ] of Object . entries ( all ) ) {
49- it ( `contains valid Web IDL for ${ spec } ` , function ( ) {
50- validate ( ast ) ;
51- } ) ;
52- }
53- } ) ;
47+ all = await idl . parseAll ( curatedView . folder ) ;
48+ } ) ;
5449
55- describe ( `The combined Web IDL in the ${ curatedView . name } view` , function ( ) {
56- it ( 'is valid Web IDL' , function ( ) {
57- this . slow ( 1000 ) ;
58- validate ( Object . values ( all ) . flat ( ) ) ;
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 ) ;
5954 } ) ;
55+ }
56+ } ) ;
57+
58+ it ( `The combined Web IDL in the ${ curatedView . name } view` , function ( ) {
59+ it ( 'is valid Web IDL' , function ( ) {
60+ validate ( Object . values ( all ) . flat ( ) ) ;
6061 } ) ;
6162 } ) ;
6263
63- // Dummy test needed for "before" to run and register late tests
64- // (test will fail if before function throws, e.g. because data is invalid)
65- it ( 'contains data that can be parsed with webidl2.js' , ( ) => { } ) ;
6664} ) ;
6765
6866
@@ -72,7 +70,6 @@ describe(`The ${packageView.name} view of Web IDL extracts`, async () => {
7270
7371 describe ( `The combined Web IDL in the ${ packageView . name } view` , function ( ) {
7472 it ( 'is valid Web IDL' , function ( ) {
75- this . slow ( 1000 ) ;
7673 validate ( Object . values ( all ) . flat ( ) ) ;
7774 } ) ;
7875 } ) ;
0 commit comments