File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const common = require ( '../common' ) ;
3+
4+ // Refs: https://github.com/nodejs/node/issues/39555
5+
6+ // After this issue is fixed, this can perhaps be integrated into
7+ // test/sequential/test-debugger-heap-profiler.js as it shares almost all
8+ // the same code.
9+
10+ common . skipIfInspectorDisabled ( ) ;
11+
12+ if ( ! common . isMainThread ) {
13+ common . skip ( 'process.chdir() is not available in workers' ) ;
14+ }
15+
16+ const fixtures = require ( '../common/fixtures' ) ;
17+ const startCLI = require ( '../common/debugger' ) ;
18+ const tmpdir = require ( '../common/tmpdir' ) ;
19+
20+ tmpdir . refresh ( ) ;
21+ process . chdir ( tmpdir . path ) ;
22+
23+ const { readFileSync } = require ( 'fs' ) ;
24+
25+ const filename = 'node.heapsnapshot' ;
26+
27+ // Check that two simultaneous snapshots don't step all over each other.
28+ {
29+ const cli = startCLI ( [ fixtures . path ( 'debugger/empty.js' ) ] ) ;
30+
31+ function onFatal ( error ) {
32+ cli . quit ( ) ;
33+ throw error ;
34+ }
35+
36+ return cli . waitForInitialBreak ( )
37+ . then ( ( ) => cli . waitForPrompt ( ) )
38+ . then ( ( ) => cli . command ( 'takeHeapSnapshot(); takeHeapSnapshot()' ) )
39+ . then ( ( ) => cli . command ( ) )
40+ . then ( ( ) => JSON . parse ( readFileSync ( filename , 'utf8' ) ) )
41+ . then ( ( ) => cli . quit ( ) )
42+ . then ( null , onFatal ) ;
43+ }
You can’t perform that action at this time.
0 commit comments