@@ -18,51 +18,33 @@ function testWithJSMarshaller({
1818 maxQueueSize,
1919 launchSecondary,
2020} ) {
21- console . log (
22- `[JS {${ cnt ++ } }] Starting thread: ${ threadStarter } , quitAfter: ${ quitAfter } , abort: ${ abort } , maxQueueSize: ${ maxQueueSize } , launchSecondary: ${ launchSecondary } `
23- ) ;
2421 return new Promise ( ( resolve ) => {
2522 const array = [ ] ;
2623 binding [ threadStarter ] (
2724 function testCallback ( value ) {
2825 array . push ( value ) ;
2926 if ( array . length === quitAfter ) {
30- // console.log("[JS] Reached quitAfter, calling StopThread");
3127 setImmediate ( ( ) => {
3228 binding . StopThread ( ( ) => {
33- // console.log("[JS] StopThread callback called, resolving promise");
3429 resolve ( array ) ;
3530 } , ! ! abort ) ;
3631 } ) ;
3732 }
3833 } ,
3934 ! ! abort ,
4035 ! ! launchSecondary ,
41- maxQueueSize
36+ maxQueueSize ,
4237 ) ;
4338 } ) ;
4439}
4540
4641module . exports = ( ) => {
47- // console.log("[JS] Test entry");
48- // return testWithJSMarshaller({
49- // threadStarter: "StartThread",
50- // maxQueueSize: binding.MAX_QUEUE_SIZE,
51- // quitAfter: binding.ARRAY_LENGTH,
52- // }).then((result) => {
53- // console.log("Test completed successfully");
54- // assert.deepStrictEqual(result, expectedArray);
55- // });
5642 return (
5743 new Promise ( function testWithoutJSMarshaller ( resolve ) {
5844 let callCount = 0 ;
5945 binding . StartThreadNoNative (
6046 function testCallback ( ) {
6147 callCount ++ ;
62-
63- // console.log("Callback called with arguments:", arguments);
64- // The default call-into-JS implementation passes no arguments.
65- // assert.strictEqual(arguments.length, 0);
6648 if ( callCount === binding . ARRAY_LENGTH ) {
6749 setImmediate ( ( ) => {
6850 binding . StopThread ( ( ) => {
@@ -73,22 +55,22 @@ module.exports = () => {
7355 } ,
7456 false /* abort */ ,
7557 false /* launchSecondary */ ,
76- binding . MAX_QUEUE_SIZE
58+ binding . MAX_QUEUE_SIZE ,
7759 ) ;
7860 } )
7961 . then ( ( ) =>
8062 testWithJSMarshaller ( {
8163 threadStarter : "StartThread" ,
8264 maxQueueSize : binding . MAX_QUEUE_SIZE ,
8365 quitAfter : binding . ARRAY_LENGTH ,
84- } )
66+ } ) ,
8567 )
8668 . then ( ( ) =>
8769 testWithJSMarshaller ( {
8870 threadStarter : "StartThreadNoJsFunc" ,
8971 maxQueueSize : binding . MAX_QUEUE_SIZE ,
9072 quitAfter : binding . ARRAY_LENGTH ,
91- } )
73+ } ) ,
9274 )
9375 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
9476
@@ -99,7 +81,7 @@ module.exports = () => {
9981 threadStarter : "StartThread" ,
10082 maxQueueSize : 0 ,
10183 quitAfter : binding . ARRAY_LENGTH ,
102- } )
84+ } ) ,
10385 )
10486 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
10587
@@ -110,7 +92,7 @@ module.exports = () => {
11092 threadStarter : "StartThreadNonblocking" ,
11193 maxQueueSize : binding . MAX_QUEUE_SIZE ,
11294 quitAfter : binding . ARRAY_LENGTH ,
113- } )
95+ } ) ,
11496 )
11597 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
11698
@@ -121,7 +103,7 @@ module.exports = () => {
121103 threadStarter : "StartThread" ,
122104 maxQueueSize : binding . MAX_QUEUE_SIZE ,
123105 quitAfter : 1 ,
124- } )
106+ } ) ,
125107 )
126108 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
127109
@@ -132,7 +114,7 @@ module.exports = () => {
132114 threadStarter : "StartThread" ,
133115 maxQueueSize : 0 ,
134116 quitAfter : 1 ,
135- } )
117+ } ) ,
136118 )
137119 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
138120
@@ -143,7 +125,7 @@ module.exports = () => {
143125 threadStarter : "StartThreadNonblocking" ,
144126 maxQueueSize : binding . MAX_QUEUE_SIZE ,
145127 quitAfter : 1 ,
146- } )
128+ } ) ,
147129 )
148130 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
149131
@@ -156,7 +138,7 @@ module.exports = () => {
156138 quitAfter : 1 ,
157139 maxQueueSize : binding . MAX_QUEUE_SIZE ,
158140 launchSecondary : true ,
159- } )
141+ } ) ,
160142 )
161143 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
162144
@@ -169,7 +151,7 @@ module.exports = () => {
169151 quitAfter : 1 ,
170152 maxQueueSize : binding . MAX_QUEUE_SIZE ,
171153 launchSecondary : true ,
172- } )
154+ } ) ,
173155 )
174156 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
175157
@@ -181,7 +163,7 @@ module.exports = () => {
181163 quitAfter : 1 ,
182164 maxQueueSize : binding . MAX_QUEUE_SIZE ,
183165 abort : true ,
184- } )
166+ } ) ,
185167 )
186168 . then ( ( result ) => assert . strictEqual ( result . indexOf ( 0 ) , - 1 ) )
187169
@@ -193,7 +175,7 @@ module.exports = () => {
193175 quitAfter : 1 ,
194176 maxQueueSize : 0 ,
195177 abort : true ,
196- } )
178+ } ) ,
197179 )
198180 . then ( ( result ) => assert . strictEqual ( result . indexOf ( 0 ) , - 1 ) )
199181
@@ -205,7 +187,7 @@ module.exports = () => {
205187 quitAfter : 1 ,
206188 maxQueueSize : binding . MAX_QUEUE_SIZE ,
207189 abort : true ,
208- } )
190+ } ) ,
209191 )
210192 . then ( ( result ) => assert . strictEqual ( result . indexOf ( 0 ) , - 1 ) )
211193
@@ -216,7 +198,7 @@ module.exports = () => {
216198 threadStarter : "StartThreadNonblocking" ,
217199 maxQueueSize : binding . ARRAY_LENGTH >>> 1 ,
218200 quitAfter : binding . ARRAY_LENGTH ,
219- } )
201+ } ) ,
220202 )
221203 . then ( ( result ) => assert . deepStrictEqual ( result , expectedArray ) )
222204 ) ;
0 commit comments