11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ciconst common = require('../common');
31cb0ef41Sopenharmony_ciconst {
41cb0ef41Sopenharmony_ci  assertSummaryShape,
51cb0ef41Sopenharmony_ci  assertSingleDetailedShape,
61cb0ef41Sopenharmony_ci  expectExperimentalWarning
71cb0ef41Sopenharmony_ci} = require('../common/measure-memory');
81cb0ef41Sopenharmony_ciconst assert = require('assert');
91cb0ef41Sopenharmony_ciconst vm = require('vm');
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ciexpectExperimentalWarning();
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ci// Test eager memory measurement
141cb0ef41Sopenharmony_ci{
151cb0ef41Sopenharmony_ci  vm.measureMemory({ execution: 'eager' })
161cb0ef41Sopenharmony_ci    .then(common.mustCall(assertSummaryShape));
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci  if (!common.isWindows) {
191cb0ef41Sopenharmony_ci    vm.measureMemory({ mode: 'detailed', execution: 'eager' })
201cb0ef41Sopenharmony_ci      .then(common.mustCall(assertSingleDetailedShape));
211cb0ef41Sopenharmony_ci  }
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci  vm.measureMemory({ mode: 'summary', execution: 'eager' })
241cb0ef41Sopenharmony_ci    .then(common.mustCall(assertSummaryShape));
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ci  assert.throws(() => vm.measureMemory(null), {
271cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_TYPE'
281cb0ef41Sopenharmony_ci  });
291cb0ef41Sopenharmony_ci  assert.throws(() => vm.measureMemory('summary'), {
301cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_TYPE'
311cb0ef41Sopenharmony_ci  });
321cb0ef41Sopenharmony_ci  assert.throws(() => vm.measureMemory({ mode: 'random' }), {
331cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_VALUE'
341cb0ef41Sopenharmony_ci  });
351cb0ef41Sopenharmony_ci  assert.throws(() => vm.measureMemory({ execution: 'random' }), {
361cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_VALUE'
371cb0ef41Sopenharmony_ci  });
381cb0ef41Sopenharmony_ci}
39