-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Highlights: * Using a random port works (`node inspect --port=0 script.js`) * `takeHeapSnapshot()` creates valid snapshots again PR-URL: #18354 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
- Loading branch information
1 parent
464df6d
commit 442903f
Showing
10 changed files
with
118 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict'; | ||
const { test } = require('tap'); | ||
const { readFileSync, unlinkSync } = require('fs'); | ||
|
||
const startCLI = require('./start-cli'); | ||
const filename = 'node.heapsnapshot'; | ||
|
||
function cleanup() { | ||
try { | ||
unlinkSync(filename); | ||
} catch (_) { | ||
// Ignore. | ||
} | ||
} | ||
|
||
cleanup(); | ||
|
||
test('Heap profiler take snapshot', (t) => { | ||
const cli = startCLI(['examples/empty.js']); | ||
|
||
function onFatal(error) { | ||
cli.quit(); | ||
throw error; | ||
} | ||
|
||
// Check that the snapshot is valid JSON. | ||
return cli.waitForInitialBreak() | ||
.then(() => cli.waitForPrompt()) | ||
.then(() => cli.command('takeHeapSnapshot()')) | ||
.then(() => JSON.parse(readFileSync(filename, 'utf8'))) | ||
.then(() => cleanup()) | ||
.then(() => cli.quit()) | ||
.then(null, onFatal); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters