Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test-process-cwd-deleted.js
  • Loading branch information
Ankush1oo8 authored Feb 26, 2025
commit c7ed580eabdcc9d4e6815a6d801f61d5a2157824
13 changes: 8 additions & 5 deletions test/parallel/test-process-cwd-deleted.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ const proc = fork(__filename, ['child'], {
silent: true,
});

let stderrData = '';

proc.stderr.on('data', (chunk) => {
stderrData += chunk.toString(); // Collect stderr output
});

proc.on('spawn', common.mustCall(() => rmSync(tmpDir, { recursive: true })));

proc.on('exit', common.mustCall((code) => {
assert.strictEqual(code, 1);
proc.stderr.toArray().then(common.mustCall((chunks) => {
const buf = Buffer.concat(chunks);
assert.match(buf.toString(), /Current working directory does not exist/);
}));
assert.strictEqual(code, 1); // Ensure process exits with error
assert.match(stderrData, /Current working directory does not exist/);
}));