• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4const tmpdir = require('../common/tmpdir');
5const assert = require('assert');
6const { spawnSync } = require('child_process');
7const fixtures = require('../common/fixtures');
8const fs = require('fs');
9const env = {
10  ...process.env,
11  TEST_ALLOCATION: 50000,
12  TEST_CHUNK: 1000,
13  TEST_CLEAN_INTERVAL: 500,
14  NODE_DEBUG_NATIVE: 'diagnostics'
15};
16
17{
18  console.log('\nTesting limit = 1');
19  tmpdir.refresh();
20  const child = spawnSync(process.execPath, [
21    '--trace-gc',
22    '--heapsnapshot-near-heap-limit=1',
23    '--max-old-space-size=50',
24    fixtures.path('workload', 'bounded.js'),
25  ], {
26    cwd: tmpdir.path,
27    env,
28  });
29  console.log(child.stdout.toString());
30  console.log(child.stderr.toString());
31  assert.strictEqual(child.signal, null);
32  assert.strictEqual(child.status, 0);
33  const list = fs.readdirSync(tmpdir.path)
34    .filter((file) => file.endsWith('.heapsnapshot'));
35  assert.strictEqual(list.length, 0);
36}
37