File tree Expand file tree Collapse file tree
test/js-native-api/test_exception Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,14 +9,24 @@ if (process.argv[2] === 'child') {
99 } catch ( anException ) {
1010 anException . binding . createExternal ( ) ;
1111 }
12- const interval = setInterval ( ( ) => {
13- clearInterval ( interval ) ;
14- } , 100 ) ;
12+
13+ // Collect garbage 10 times. At least one of those should throw the exception
14+ // and cause the whole process to bail with it, its text printed to stderr and
15+ // asserted by the parent process to match expectations.
16+ let gcCount = 10 ;
17+ ( function gcLoop ( ) {
18+ global . gc ( ) ;
19+ if ( -- gcCount > 0 ) {
20+ setImmediate ( ( ) => gcLoop ( ) ) ;
21+ }
22+ } ) ( ) ;
1523 return ;
1624}
1725
1826const assert = require ( 'assert' ) ;
1927const { spawnSync } = require ( 'child_process' ) ;
20- const child = spawnSync ( process . execPath , [ __filename , 'child' ] ) ;
28+ const child = spawnSync ( process . execPath , [
29+ '--expose-gc' , __filename , 'child'
30+ ] ) ;
2131assert . strictEqual ( child . signal , null ) ;
2232assert . match ( child . stderr . toString ( ) , / E r r o r d u r i n g F i n a l i z e / m) ;
You can’t perform that action at this time.
0 commit comments