Skip to content

Commit 6474bef

Browse files
committed
test: use single heap snapshot for multiple validations
1 parent 2e22db1 commit 6474bef

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

test/pummel/test-heapdump-secure-context.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ if (!common.hasCrypto) common.skip('missing crypto');
77

88
const fixtures = require('../common/fixtures');
99
const assert = require('assert');
10-
const { validateByRetainingPath } = require('../common/heap');
10+
const {
11+
createJSHeapSnapshot,
12+
validateByRetainingPathFromNodes,
13+
} = require('../common/heap');
1114
const tls = require('tls');
1215

1316
{
14-
const nodes = validateByRetainingPath('Node / SecureContext', []);
15-
assert.strictEqual(nodes.length, 0);
17+
const nodes = createJSHeapSnapshot();
18+
const matches = nodes.filter(
19+
(n) => n.name === 'Node / SecureContext' && n.type !== 'string');
20+
assert.strictEqual(matches.length, 0);
1621
}
1722

1823
// eslint-disable-next-line no-unused-vars
@@ -21,7 +26,12 @@ const ctx = tls.createSecureContext({
2126
key: fixtures.readKey('agent1-key.pem'),
2227
});
2328

24-
validateByRetainingPath('Node / SecureContext', [
25-
{ edge_name: 'ctx', node_name: 'Node / ctx' },
26-
{ edge_name: 'cert', node_name: 'Node / cert' },
27-
]);
29+
{
30+
const nodes = createJSHeapSnapshot();
31+
validateByRetainingPathFromNodes(nodes, 'Node / SecureContext', [
32+
{ edge_name: 'ctx', node_name: 'Node / ctx' },
33+
]);
34+
validateByRetainingPathFromNodes(nodes, 'Node / SecureContext', [
35+
{ edge_name: 'cert', node_name: 'Node / cert' },
36+
]);
37+
}

0 commit comments

Comments
 (0)