mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

This makes sure that the tests are run on actual heap snapshots and prints out missing paths when it cannot be found, which makes failures easier to debug, and removes the unnecessary requirement for BaseObjects to be root - which would make the heap snapshot containment view rather noisy and is not conceptually correct, since they are actually held by the BaseObjectList held by the realms. PR-URL: https://github.com/nodejs/node/pull/57417 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
29 lines
991 B
JavaScript
29 lines
991 B
JavaScript
'use strict';
|
|
// This tests heap snapshot integration of inspector.
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const { validateByRetainingPath, validateByRetainingPathFromNodes } = require('../common/heap');
|
|
const inspector = require('inspector');
|
|
|
|
// Starts with no JSBindingsConnection.
|
|
{
|
|
const nodes = validateByRetainingPath('Node / JSBindingsConnection', []);
|
|
assert.strictEqual(nodes.length, 0);
|
|
}
|
|
|
|
// JSBindingsConnection should be added once inspector session is created.
|
|
{
|
|
const session = new inspector.Session();
|
|
session.connect();
|
|
|
|
const nodes = validateByRetainingPath('Node / JSBindingsConnection', []);
|
|
validateByRetainingPathFromNodes(nodes, 'Node / JSBindingsConnection', [
|
|
{ node_name: 'Node / InspectorSession', edge_name: 'session' },
|
|
]);
|
|
validateByRetainingPathFromNodes(nodes, 'Node / JSBindingsConnection', [
|
|
{ node_name: 'Connection', edge_name: 'native_to_javascript' },
|
|
]);
|
|
}
|