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