Skip to content

Commit

Permalink
test: fix test-debugger-heap-profiler for workers
Browse files Browse the repository at this point in the history
Fix `sequential/test-debugger-heap-profiler` so that it can be run
in a worker thread. `process.chdir()` is not allowd in worker threads
but passing a current working directory into a spawned child process
is allowed.
  • Loading branch information
richardlau committed Aug 6, 2021
1 parent b00d1ae commit c481617
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/sequential/test-debugger-heap-profiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ const common = require('../common');

common.skipIfInspectorDisabled();

if (!common.isMainThread) {
common.skip('process.chdir() is not available in workers');
}

const fixtures = require('../common/fixtures');
const startCLI = require('../common/debugger');
const tmpdir = require('../common/tmpdir');
const path = require('path');

tmpdir.refresh();
process.chdir(tmpdir.path);

const { readFileSync } = require('fs');

const filename = 'node.heapsnapshot';
const filename = path.join(tmpdir.path, 'node.heapsnapshot');

// Heap profiler take snapshot.
{
const cli = startCLI([fixtures.path('debugger/empty.js')]);
const opts = { cwd: tmpdir.path };
const cli = startCLI([fixtures.path('debugger/empty.js')], [], opts);

function onFatal(error) {
cli.quit();
Expand Down

0 comments on commit c481617

Please sign in to comment.