Skip to content

Commit aa1cfd8

Browse files
author
Archkon
committed
test: isolate debugger CPU profile output
Run the debugger CLI in the per-test temporary directory so concurrent runs do not overwrite or remove the same node.cpuprofile file. Signed-off-by: Archkon <180910180+Archkon@users.noreply.github.com>
1 parent c31b790 commit aa1cfd8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

test/parallel/test-debugger-profile-command.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ common.skipIfInspectorDisabled();
55

66
const fixtures = require('../common/fixtures');
77
const startCLI = require('../common/debugger');
8+
const tmpdir = require('../common/tmpdir');
89

910
const assert = require('assert');
1011
const fs = require('fs');
11-
const path = require('path');
1212

13-
const cli = startCLI([fixtures.path('debugger/empty.js')]);
13+
tmpdir.refresh();
1414

15-
const rootDir = path.resolve(__dirname, '..', '..');
15+
const cli = startCLI(
16+
[fixtures.path('debugger/empty.js')],
17+
[],
18+
{ cwd: tmpdir.path },
19+
);
1620

1721
(async () => {
1822
await cli.waitForInitialBreak();
@@ -25,7 +29,7 @@ const rootDir = path.resolve(__dirname, '..', '..');
2529
await cli.command('profiles[0].save()');
2630
assert.match(cli.output, /Saved profile to .*node\.cpuprofile/);
2731

28-
const cpuprofile = path.resolve(rootDir, 'node.cpuprofile');
32+
const cpuprofile = tmpdir.resolve('node.cpuprofile');
2933
const data = JSON.parse(fs.readFileSync(cpuprofile, 'utf8'));
3034
assert.strictEqual(Array.isArray(data.nodes), true);
3135

0 commit comments

Comments
 (0)