1'use strict';
2
3// Tests --heap-prof without --heap-prof-interval. Here we just verify that
4// we manage to generate a profile.
5
6const common = require('../common');
7
8const fixtures = require('../common/fixtures');
9common.skipIfInspectorDisabled();
10
11const assert = require('assert');
12const { spawnSync } = require('child_process');
13
14const tmpdir = require('../common/tmpdir');
15
16const {
17  getHeapProfiles,
18  env
19} = require('../common/prof');
20
21{
22  tmpdir.refresh();
23  const output = spawnSync(process.execPath, [
24    '--heap-prof',
25    fixtures.path('workload', 'allocation.js'),
26  ], {
27    cwd: tmpdir.path,
28    env
29  });
30  if (output.status !== 0) {
31    console.log(output.stderr.toString());
32    console.log(output);
33  }
34  assert.strictEqual(output.status, 0);
35  const profiles = getHeapProfiles(tmpdir.path);
36  assert.strictEqual(profiles.length, 1);
37}
38