@@ -78,20 +78,19 @@ describe("WatchTestCases", () => {
7878 describe ( category . name , ( ) => {
7979 category . tests . forEach ( ( testName ) => {
8080 describe ( testName , ( ) => {
81- const tempDirectory = path . join ( __dirname , "js" , "watch-src" , category . name , testName ) ;
81+ const tempDirectory = path . join ( __dirname , "js" , "watch-src" , category . name , ` ${ testName } - ${ Math . random ( ) . toPrecision ( 21 ) . slice ( 2 ) } ` ) ;
8282 const testDirectory = path . join ( casesPath , category . name , testName ) ;
8383 const runs = fs . readdirSync ( testDirectory ) . sort ( ) . filter ( ( name ) => {
8484 return fs . statSync ( path . join ( testDirectory , name ) ) . isDirectory ( ) ;
85- } ) . map ( ( name ) => {
86- return {
87- name : name ,
88- suite : describe ( name , ( ) => { } )
85+ } ) . map ( ( name ) => ( { name } ) ) ;
86+
87+ let exportedTests = [ ] ;
88+
89+ beforeAll ( ( ) => new Promise ( ( resolve , reject ) => {
90+ const done = ( err ) => {
91+ if ( err ) return reject ( err ) ;
92+ resolve ( ) ;
8993 } ;
90- } ) ;
91- beforeAll ( ( ) => {
92- remove ( tempDirectory ) ;
93- } ) ;
94- it ( "should compile" , function ( done ) {
9594 const outputDirectory = path . join ( __dirname , "js" , "watch" , category . name , testName ) ;
9695
9796 let options = { } ;
@@ -155,10 +154,9 @@ describe("WatchTestCases", () => {
155154 } ) ;
156155 if ( checkArrayExpectation ( path . join ( testDirectory , run . name ) , jsonStats , "error" , "Error" , done ) ) return ;
157156 if ( checkArrayExpectation ( path . join ( testDirectory , run . name ) , jsonStats , "warning" , "Warning" , done ) ) return ;
158- let exportedTests = [ ] ;
159157
160158 function _it ( title , fn ) {
161- exportedTests . push ( fit ( title , fn , 45000 ) ) ;
159+ exportedTests . push ( { title, fn, timeout : 45000 } ) ;
162160 }
163161
164162 const globalContext = {
@@ -193,7 +191,7 @@ describe("WatchTestCases", () => {
193191 return module . exports ;
194192 } else if ( testConfig . modules && module in testConfig . modules ) {
195193 return testConfig . modules [ module ] ;
196- } else return require ( module ) ;
194+ } else return require . requireActual ( module ) ;
197195 }
198196
199197 let testConfig = { } ;
@@ -219,13 +217,16 @@ describe("WatchTestCases", () => {
219217 watching . close ( ) ;
220218 process . nextTick ( done ) ;
221219 }
222- async . waterfall (
223- exportedTests . map ( test => ( callback ) => test . execute ( callback , true ) ) ,
224- done
225- ) ;
226220 } ) ;
227221 } , 300 ) ;
228- } , 45000 ) ;
222+ } ) , 45000 ) ;
223+
224+ it ( testName + " should compile" , ( ) => { } ) ;
225+ exportedTests . forEach ( ( { title, fn, timeout } ) => it ( title , fn , timeout ) ) ;
226+
227+ afterAll ( ( ) => {
228+ remove ( tempDirectory ) ;
229+ } ) ;
229230 } ) ;
230231 } ) ;
231232 } ) ;
0 commit comments