1// Flags: --expose-internals 2'use strict'; 3 4// This tests that Environment is tracked in heap snapshots. 5 6require('../common'); 7const { validateSnapshotNodes } = require('../common/heap'); 8 9// This is just using ContextifyScript as an example here, it can be replaced 10// with any BaseObject that we can easily instantiate here and register in 11// cleanup hooks. 12// These can all be changed to reflect the status of how these objects 13// are captured in the snapshot. 14const context = require('vm').createScript('const foo = 123'); 15 16validateSnapshotNodes('Node / Environment', [{ 17 children: [ 18 { node_name: 'Node / cleanup_hooks', edge_name: 'cleanup_hooks' }, 19 { node_name: 'process', edge_name: 'process_object' }, 20 { node_name: 'Node / IsolateData', edge_name: 'isolate_data' }, 21 ] 22}]); 23 24console.log(context); // Make sure it's not GC'ed 25