11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciif (!process.features.inspector) return;
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_cirequire('../common');
61cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures');
71cb0ef41Sopenharmony_ciconst tmpdir = require('../common/tmpdir');
81cb0ef41Sopenharmony_ciconst assert = require('assert');
91cb0ef41Sopenharmony_ciconst fs = require('fs');
101cb0ef41Sopenharmony_ciconst { spawnSync } = require('child_process');
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_citmpdir.refresh();
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci// v8.takeCoverage() should be a noop if NODE_V8_COVERAGE is not set.
151cb0ef41Sopenharmony_ciconst intervals = 40;
161cb0ef41Sopenharmony_ci{
171cb0ef41Sopenharmony_ci  const output = spawnSync(process.execPath, [
181cb0ef41Sopenharmony_ci    '-r',
191cb0ef41Sopenharmony_ci    fixtures.path('v8-coverage', 'take-coverage'),
201cb0ef41Sopenharmony_ci    fixtures.path('v8-coverage', 'interval'),
211cb0ef41Sopenharmony_ci  ], {
221cb0ef41Sopenharmony_ci    env: {
231cb0ef41Sopenharmony_ci      ...process.env,
241cb0ef41Sopenharmony_ci      NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER',
251cb0ef41Sopenharmony_ci      TEST_INTERVALS: intervals
261cb0ef41Sopenharmony_ci    },
271cb0ef41Sopenharmony_ci  });
281cb0ef41Sopenharmony_ci  console.log(output.stderr.toString());
291cb0ef41Sopenharmony_ci  assert.strictEqual(output.status, 0);
301cb0ef41Sopenharmony_ci  const coverageFiles = fs.readdirSync(tmpdir.path);
311cb0ef41Sopenharmony_ci  assert.strictEqual(coverageFiles.length, 0);
321cb0ef41Sopenharmony_ci}
33