@@ -6,7 +6,6 @@ const common = require('../common');
66const assert = require ( 'assert' ) ;
77const fs = require ( 'fs' ) ;
88const { spawnSync } = require ( 'child_process' ) ;
9- const fixtures = require ( '../common/fixtures' ) ;
109const helper = require ( '../common/report' ) ;
1110const tmpdir = require ( '../common/tmpdir' ) ;
1211
@@ -46,49 +45,3 @@ helper.validate(reports[0], [
4645
4746const report = JSON . parse ( fs . readFileSync ( reports [ 0 ] , 'utf8' ) ) ;
4847assert . match ( report . javascriptStack . stack [ 0 ] , / ^ a t s p i n \( \[ e v a l \] : 1 : \d + \) $ / ) ;
49-
50- {
51- // A Worker thread that is blocked in a synchronous native call cannot
52- // provide its part of the report. It is left out, so that the report is
53- // completed before the process is forced to exit.
54- // If the Worker thread was not blocked yet when the deadline expired, which
55- // the fixture signals by creating a file, it is included in the report. Run
56- // the fixture again with a longer timeout in that case.
57- let child ;
58- let report ;
59- for ( let timeout = common . platformTimeout ( 1000 ) ; ; timeout *= 2 ) {
60- // Child processes of a previous attempt may still be running, so use a
61- // different file for each attempt.
62- const marker = tmpdir . resolve ( `blocked-worker.${ timeout } .ready` ) ;
63- child = spawnSync ( process . execPath , [
64- `--process-timeout=${ timeout } ms` ,
65- '--report-on-process-timeout' ,
66- fixtures . path ( 'process-timeout' , 'blocked-worker.js' ) ,
67- marker ,
68- ] , { cwd : tmpdir . path , encoding : 'utf8' } ) ;
69-
70- const reports = helper . findReports ( child . pid , tmpdir . path ) ;
71- assert . strictEqual ( reports . length , 1 , child . stderr ) ;
72- helper . validate ( reports [ 0 ] , [
73- [ 'header.event' , 'Process timed out (--process-timeout)' ] ,
74- [ 'header.trigger' , 'ProcessTimeout' ] ,
75- ] ) ;
76- report = JSON . parse ( fs . readFileSync ( reports [ 0 ] , 'utf8' ) ) ;
77- if ( ( fs . existsSync ( marker ) && report . workers . length === 0 ) ||
78- timeout >= common . platformTimeout ( 16000 ) ) {
79- break ;
80- }
81- }
82-
83- assert . strictEqual ( child . signal , null ) ;
84- assert . strictEqual ( child . status , 124 , child . stderr ) ;
85- assert . match ( child . stderr , / ^ { 4 } W o r k e r \( t h r e a d 1 , n a m e ' b l o c k e d ' \) $ / m) ;
86- // The report is completed before the process is forced to exit, so the
87- // message about that is printed on its own line.
88- assert . match ( child . stderr , new RegExp (
89- '^Writing Node\\.js report to file: report\\.\\S+\\.json\\r?\\n' +
90- 'Node\\.js report completed\\r?\\n' +
91- '\\(node:\\d+\\) The process did not finish exiting within 5000ms after ' +
92- '--process-timeout expired\\. Forcing exit\\.$' , 'm' ) ) ;
93- assert . deepStrictEqual ( report . workers , [ ] ) ;
94- }
0 commit comments