11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_cicommon.skipIfInspectorDisabled(); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ci// Test that example code in doc/api/inspector.md continues to work with the V8 71cb0ef41Sopenharmony_ci// experimental API. 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst assert = require('assert'); 101cb0ef41Sopenharmony_ciconst inspector = require('inspector'); 111cb0ef41Sopenharmony_ciconst session = new inspector.Session(); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cisession.connect(); 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciconst chunks = []; 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cisession.on('HeapProfiler.addHeapSnapshotChunk', (m) => { 181cb0ef41Sopenharmony_ci chunks.push(m.params.chunk); 191cb0ef41Sopenharmony_ci}); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_cisession.post('HeapProfiler.takeHeapSnapshot', null, common.mustSucceed((r) => { 221cb0ef41Sopenharmony_ci assert.deepStrictEqual(r, {}); 231cb0ef41Sopenharmony_ci session.disconnect(); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci const profile = JSON.parse(chunks.join('')); 261cb0ef41Sopenharmony_ci assert(profile.snapshot.meta); 271cb0ef41Sopenharmony_ci assert(profile.snapshot.node_count > 0); 281cb0ef41Sopenharmony_ci assert(profile.snapshot.edge_count > 0); 291cb0ef41Sopenharmony_ci})); 30