forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest-heapdump-env.js
More file actions
24 lines (19 loc) · 849 Bytes
/
test-heapdump-env.js
File metadata and controls
24 lines (19 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Flags: --expose-internals
'use strict';
// This tests that Environment is tracked in heap snapshots.
require('../common');
const { validateSnapshotNodes } = require('../common/heap');
// This is just using ContextifyScript as an example here, it can be replaced
// with any BaseObject that we can easily instantiate here and register in
// cleanup hooks.
// These can all be changed to reflect the status of how these objects
// are captured in the snapshot.
const context = require('vm').createScript('const foo = 123');
validateSnapshotNodes('Node / Environment', [{
children: [
{ node_name: 'Node / cleanup_hooks', edge_name: 'cleanup_hooks' },
{ node_name: 'process', edge_name: 'process_object' },
{ node_name: 'Node / IsolateData', edge_name: 'isolate_data' },
]
}]);
console.log(context); // Make sure it's not GC'ed