@@ -27,9 +27,7 @@ test.after(() => {
2727 }
2828} )
2929
30- const condTest = process . platform !== 'win32' ? test : test . skip
31-
32- condTest ( 'should be able to require in worker thread' , async ( t ) => {
30+ test ( 'should be able to require in worker thread' , async ( t ) => {
3331 await Promise . all (
3432 Array . from ( { length : concurrency } ) . map ( ( ) => {
3533 const w = new Worker ( join ( __dirname , 'worker.js' ) , {
@@ -54,7 +52,7 @@ condTest('should be able to require in worker thread', async (t) => {
5452 )
5553} )
5654
57- condTest ( 'custom GC works on worker_threads' , async ( t ) => {
55+ test ( 'custom GC works on worker_threads' , async ( t ) => {
5856 await Promise . all (
5957 Array . from ( { length : concurrency } ) . map ( ( ) =>
6058 Promise . all ( [
@@ -98,30 +96,27 @@ condTest('custom GC works on worker_threads', async (t) => {
9896 )
9997} )
10098
101- condTest (
102- 'should be able to new Class in worker thread concurrently' ,
103- async ( t ) => {
104- await Promise . all (
105- Array . from ( { length : concurrency } ) . map ( ( ) => {
106- const w = new Worker ( join ( __dirname , 'worker.js' ) , {
107- env : process . env ,
99+ test ( 'should be able to new Class in worker thread concurrently' , async ( t ) => {
100+ await Promise . all (
101+ Array . from ( { length : concurrency } ) . map ( ( ) => {
102+ const w = new Worker ( join ( __dirname , 'worker.js' ) , {
103+ env : process . env ,
104+ } )
105+ return new Promise < void > ( ( resolve , reject ) => {
106+ w . postMessage ( { type : 'constructor' } )
107+ w . on ( 'message' , ( msg ) => {
108+ t . is ( msg , 'Ellie' )
109+ resolve ( )
108110 } )
109- return new Promise < void > ( ( resolve , reject ) => {
110- w . postMessage ( { type : 'constructor' } )
111- w . on ( 'message' , ( msg ) => {
112- t . is ( msg , 'Ellie' )
113- resolve ( )
114- } )
115- w . on ( 'error' , ( err ) => {
116- reject ( err )
117- } )
111+ w . on ( 'error' , ( err ) => {
112+ reject ( err )
118113 } )
119- . then ( ( ) => setTimeout ( 100 ) )
120- . then ( ( ) => w . terminate ( ) )
121- . then ( ( ) => {
122- t . pass ( )
123- } )
124- } ) ,
125- )
126- } ,
127- )
114+ } )
115+ . then ( ( ) => setTimeout ( 100 ) )
116+ . then ( ( ) => w . terminate ( ) )
117+ . then ( ( ) => {
118+ t . pass ( )
119+ } )
120+ } ) ,
121+ )
122+ } )
0 commit comments