0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-22 07:37:56 +01:00
nodejs/test/pummel/test-heapdump-inspector.js
Antoine du Hamel 873e5ce54a
test: add trailing commas in test/pummel
PR-URL: https://github.com/nodejs/node/pull/46610
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2023-02-12 17:36:39 +01:00

45 lines
1.2 KiB
JavaScript

// Flags: --expose-internals
'use strict';
const common = require('../common');
common.skipIfInspectorDisabled();
const { validateSnapshotNodes } = require('../common/heap');
const inspector = require('inspector');
const snapshotNode = {
children: [
{ node_name: 'Node / InspectorSession', edge_name: 'session' },
],
};
// Starts with no JSBindingsConnection (or 1 if coverage enabled).
{
const expected = [];
if (process.env.NODE_V8_COVERAGE) {
expected.push(snapshotNode);
}
validateSnapshotNodes('Node / JSBindingsConnection', expected);
}
// JSBindingsConnection should be added.
{
const session = new inspector.Session();
session.connect();
const expected = [
{
children: [
{ node_name: 'Node / InspectorSession', edge_name: 'session' },
{ node_name: 'Connection', edge_name: 'native_to_javascript' },
(edge) => edge.name === 'callback' &&
(edge.to.type === undefined || // embedded graph
edge.to.type === 'closure'), // snapshot
],
},
];
if (process.env.NODE_V8_COVERAGE) {
expected.push(snapshotNode);
}
validateSnapshotNodes('Node / JSBindingsConnection', expected);
}