Skip to content

Commit e12164e

Browse files
richardlautargos
authored andcommitted
test: fix test-debugger-heap-profiler for workers
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>
1 parent b3352cf commit e12164e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

test/sequential/test-debugger-heap-profiler.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,21 @@ const common = require('../common');
33

44
common.skipIfInspectorDisabled();
55

6-
if (!common.isMainThread) {
7-
common.skip('process.chdir() is not available in workers');
8-
}
9-
106
const fixtures = require('../common/fixtures');
117
const startCLI = require('../common/inspector-cli');
128
const tmpdir = require('../common/tmpdir');
9+
const path = require('path');
1310

1411
tmpdir.refresh();
15-
process.chdir(tmpdir.path);
1612

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

19-
const filename = 'node.heapsnapshot';
15+
const filename = path.join(tmpdir.path, 'node.heapsnapshot');
2016

2117
// Heap profiler take snapshot.
2218
{
23-
const cli = startCLI([fixtures.path('debugger/empty.js')]);
19+
const opts = { cwd: tmpdir.path };
20+
const cli = startCLI([fixtures.path('debugger/empty.js')], [], opts);
2421

2522
function onFatal(error) {
2623
cli.quit();

0 commit comments

Comments
 (0)