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 allowed in worker threads
but passing a current working directory into a spawned child process
is allowed.

PR-URL: #39687
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
richardlau authored and nodejs-github-bot committed Aug 9, 2021
1 parent 6145113 commit 602fe4e
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 602fe4e

Please sign in to comment.