Repository navigation
Conversation
On Windows, mkdir(".", {recursive: true}) was failing with ENOENT
because path normalization was returning an empty string for ".",
which Windows APIs reject.
Two fixes:
1. In resolve_path.zig: Return "." instead of empty string when
normalizing "." path
2. In types.zig: Resolve relative paths to absolute before passing
to Windows kernel APIs
Fixes #21901
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughThis PR fixes mkdir behavior with the recursive option on Windows by ensuring paths are properly resolved to absolute form and normalized to non-empty values. It includes changes to path normalization logic and a regression test for concurrent mkdir operations. Changes
Possibly related PRs
Suggested reviewers
Pre-merge checks✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
src/bun.js/node/types.zig(1 hunks)src/resolver/resolve_path.zig(1 hunks)test/regression/issue/21901.test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
src/**/*.{cpp,zig}
📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
src/**/*.{cpp,zig}: Usebun bdorbun run build:debugto build debug versions for C++ and Zig source files; creates debug build at./build/debug/bun-debug
Run tests usingbun bd test <test-file>with the debug build; never usebun testdirectly as it will not include your changes
Execute files usingbun bd <file> <...args>; never usebun <file>directly as it will not include your changes
Enable debug logs for specific scopes usingBUN_DEBUG_$(SCOPE)=1environment variable
Code generation happens automatically as part of the build process; no manual code generation commands are required
Files:
src/resolver/resolve_path.zigsrc/bun.js/node/types.zig
src/**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
Use
bun.Output.scoped(.${SCOPE}, .hidden)for creating debug logs in Zig codeImplement core functionality in Zig, typically in its own directory in
src/
src/**/*.zig: Zig source code should be organized insrc/*.zigfor core runtime, JavaScript bindings, and package manager
In Zig code, be careful with allocators and use defer for cleanup to manage memory properly
UseBUN_DEBUG_QUIET_LOGS=1to disable debug logging, orBUN_DEBUG_<scopeName>=1to enable specific Output.scoped calls in debug builds
Runbun run zig:check-allto compile the Zig code on all platforms when making platform-specific changes
src/**/*.zig: Private fields in Zig are fully supported using the#prefix:struct { #foo: u32 };
Use decl literals in Zig for declaration initialization:const decl: Decl = .{ .binding = 0, .value = 0 };
Prefer@importat the bottom of the file (auto formatter will move them automatically)
Files:
src/resolver/resolve_path.zigsrc/bun.js/node/types.zig
**/*.zig
📄 CodeRabbit inference engine (.cursor/rules/zig-javascriptcore-classes.mdc)
**/*.zig: Expose generated bindings in Zig structs usingpub const js = JSC.Codegen.JS<ClassName>with trait conversion methods:toJS,fromJS, andfromJSDirect
Use consistent parameter nameglobalObjectinstead ofctxin Zig constructor and method implementations
Usebun.JSError!JSValuereturn type for Zig methods and constructors to enable proper error handling and exception propagation
Implement resource cleanup usingdeinit()method that releases resources, followed byfinalize()called by the GC that invokesdeinit()and frees the pointer
UseJSC.markBinding(@src())in finalize methods for debugging purposes before callingdeinit()
For methods returning cached properties in Zig, declare external C++ functions usingextern fnandcallconv(JSC.conv)calling convention
Implement getter functions with naming patternget<PropertyName>in Zig that acceptthisandglobalObjectparameters and returnJSC.JSValue
Access JavaScript CallFrame arguments usingcallFrame.argument(i), check argument count withcallFrame.argumentCount(), and getthiswithcallFrame.thisValue()
For reference-counted objects, use.deref()in finalize instead ofdestroy()to release references to other JS objects
Files:
src/resolver/resolve_path.zigsrc/bun.js/node/types.zig
src/**/*.{ts,zig,cpp}
📄 CodeRabbit inference engine (CLAUDE.md)
Always use absolute paths in file operations
Files:
src/resolver/resolve_path.zigsrc/bun.js/node/types.zig
src/**/*.{ts,zig}
📄 CodeRabbit inference engine (CLAUDE.md)
Avoid shell commands in code - don't use
findorgrep; use Bun's Glob and built-in tools instead
Files:
src/resolver/resolve_path.zigsrc/bun.js/node/types.zig
test/**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/writing-tests.mdc)
test/**/*.{js,ts,jsx,tsx}: Write tests as JavaScript and TypeScript files using Jest-style APIs (test,describe,expect) and import frombun:test
Usetest.eachand data-driven tests to reduce boilerplate when testing multiple similar cases
Files:
test/regression/issue/21901.test.ts
test/regression/issue/**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
When a test is for a specific numbered GitHub Issue, place it in
test/regression/issue/${issueNumber}.test.tswith a REAL issue number, not a placeholder
Files:
test/regression/issue/21901.test.ts
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.test.{ts,tsx}: For single-file tests, prefer using-eflag overtempDir
For multi-file tests, prefer usingtempDirfromharnessandBun.spawnover other temporary directory creation methods
Always useport: 0for network tests and do not hardcode ports or use custom random port number functions
UsenormalizeBunSnapshotto normalize snapshot output of tests
Never write tests that check for no 'panic' or 'uncaught exception' or similar in the test output - that is NOT a valid test
UsetempDirfromharnessto create temporary directories, do not usetmpdirSyncorfs.mkdtempSync
When spawning processes in tests, check stdout/stderr expectations BEFORE checking exit code to get more useful error messages on test failure
Do not write flaky tests - do not usesetTimeoutin tests, insteadawaitthe condition to be met as you are testing the CONDITION not the TIME PASSING
Verify your test fails withUSE_SYSTEM_BUN=1 bun test <file>and passes withbun bd test <file>- your test is NOT VALID if it passes withUSE_SYSTEM_BUN=1
Files:
test/regression/issue/21901.test.ts
test/**/*.test.{ts,js,jsx,tsx,mjs,cjs}
📄 CodeRabbit inference engine (test/CLAUDE.md)
test/**/*.test.{ts,js,jsx,tsx,mjs,cjs}: Usebun:testwith files that end in*.test.{ts,js,jsx,tsx,mjs,cjs}
Do not write flaky tests. Never wait for time to pass in tests; always wait for the condition to be met instead of using an arbitrary amount of time
Never use hardcoded port numbers in tests. Always useport: 0to get a random port
Prefer concurrent tests over sequential tests usingtest.concurrentordescribe.concurrentwhen multiple tests spawn processes or write files, unless it's very difficult to make them concurrent
When spawning Bun processes in tests, usebunExeandbunEnvfromharnessto ensure the same build of Bun is used and debug logging is silenced
Use-eflag for single-file tests when spawning Bun processes
UsetempDir()from harness to create temporary directories with files for multi-file tests instead of creating files manually
Prefer async/await over callbacks in tests
When callbacks must be used and it's just a single callback, usePromise.withResolversto create a promise that can be resolved or rejected from a callback
Do not set a timeout on tests. Bun already has timeouts
UseBuffer.alloc(count, fill).toString()instead of'A'.repeat(count)to create repetitive strings in tests, as ''.repeat is very slow in debug JavaScriptCore builds
Usedescribeblocks for grouping related tests
Always useawait usingorusingto ensure proper resource cleanup in tests for APIs like Bun.listen, Bun.connect, Bun.spawn, Bun.serve, etc
Always check exit codes and test error scenarios in error tests
Usedescribe.each()for parameterized tests
UsetoMatchSnapshot()for snapshot testing
UsebeforeAll(),afterEach(),beforeEach()for setup/teardown in tests
Track resources (servers, clients) in arrays for cleanup inafterEach()
Files:
test/regression/issue/21901.test.ts
test/regression/issue/**/*.test.ts
📄 CodeRabbit inference engine (test/CLAUDE.md)
Regression tests for specific issues go in
/test/regression/issue/${issueNumber}.test.ts. Do not put tests without issue numbers in the regression directory
Files:
test/regression/issue/21901.test.ts
🧠 Learnings (17)
📚 Learning: 2025-10-08T13:56:00.875Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 23373
File: src/bun.js/api/BunObject.zig:2514-2521
Timestamp: 2025-10-08T13:56:00.875Z
Learning: For Bun codebase: prefer using `bun.path` utilities (e.g., `bun.path.joinAbsStringBuf`, `bun.path.join`) over `std.fs.path` functions for path operations.
Applied to files:
src/bun.js/node/types.zig
📚 Learning: 2025-09-12T18:16:50.754Z
Learnt from: RiskyMH
Repo: oven-sh/bun PR: 22606
File: src/glob/GlobWalker.zig:449-452
Timestamp: 2025-09-12T18:16:50.754Z
Learning: For Bun codebase: prefer using `std.fs.path.sep` over manual platform separator detection, and use `bun.strings.lastIndexOfChar` instead of `std.mem.lastIndexOfScalar` for string operations.
Applied to files:
src/bun.js/node/types.zig
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/**/*.{ts,zig,cpp} : Always use absolute paths in file operations
Applied to files:
src/bun.js/node/types.zig
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/regression/issue/**/*.test.ts : Regression tests for specific issues go in `/test/regression/issue/${issueNumber}.test.ts`. Do not put tests without issue numbers in the regression directory
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to **/*.test.{ts,tsx} : For multi-file tests, prefer using `tempDir` from `harness` and `Bun.spawn` over other temporary directory creation methods
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8.test.ts : Add corresponding test cases to test/v8/v8.test.ts using checkSameOutput() function to compare Node.js and Bun output
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : Use `tempDir()` from harness to create temporary directories with files for multi-file tests instead of creating files manually
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : When spawning Bun processes in tests, use `bunExe` and `bunEnv` from `harness` to ensure the same build of Bun is used and debug logging is silenced
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : Use `-e` flag for single-file tests when spawning Bun processes
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to test/js/bun/**/*.test.{ts,tsx} : For Bun-specific API tests, use the `test/js/bun/` directory (for http, crypto, ffi, shell, etc.)
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-10-26T01:32:04.844Z
Learnt from: Jarred-Sumner
Repo: oven-sh/bun PR: 24082
File: test/cli/test/coverage.test.ts:60-112
Timestamp: 2025-10-26T01:32:04.844Z
Learning: In the Bun repository test files (test/cli/test/*.test.ts), when spawning Bun CLI commands with Bun.spawnSync for testing, prefer using stdio: ["inherit", "inherit", "inherit"] to inherit stdio streams rather than piping them.
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to test/regression/issue/**/*.test.{ts,tsx} : When a test is for a specific numbered GitHub Issue, place it in `test/regression/issue/${issueNumber}.test.ts` with a REAL issue number, not a placeholder
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to **/*.test.{ts,tsx} : Use `tempDir` from `harness` to create temporary directories, do not use `tmpdirSync` or `fs.mkdtempSync`
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:35:50.422Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-11-24T18:35:50.422Z
Learning: Applies to test/cli/**/*.{js,ts,jsx,tsx} : When testing Bun as a CLI, use the `spawn` API from `bun` with the `bunExe()` and `bunEnv` from `harness` to execute Bun commands and validate exit codes, stdout, and stderr
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-10-19T02:44:46.354Z
Learnt from: theshadow27
Repo: oven-sh/bun PR: 23798
File: packages/bun-otel/context-propagation.test.ts:1-1
Timestamp: 2025-10-19T02:44:46.354Z
Learning: In the Bun repository, standalone packages under packages/ (e.g., bun-vscode, bun-inspector-protocol, bun-plugin-yaml, bun-plugin-svelte, bun-debug-adapter-protocol, bun-otel) co-locate their tests with package source code using *.test.ts files. This follows standard npm/monorepo patterns. The test/ directory hierarchy (test/js/bun/, test/cli/, test/js/node/) is reserved for testing Bun's core runtime APIs and built-in functionality, not standalone packages.
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-24T18:37:30.259Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: test/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:37:30.259Z
Learning: Applies to test/**/*.test.{ts,js,jsx,tsx,mjs,cjs} : Always use `await using` or `using` to ensure proper resource cleanup in tests for APIs like Bun.listen, Bun.connect, Bun.spawn, Bun.serve, etc
Applied to files:
test/regression/issue/21901.test.ts
📚 Learning: 2025-11-06T00:58:23.965Z
Learnt from: markovejnovic
Repo: oven-sh/bun PR: 24417
File: test/js/bun/spawn/spawn.test.ts:903-918
Timestamp: 2025-11-06T00:58:23.965Z
Learning: In Bun test files, `await using` with spawn() is appropriate for long-running processes that need guaranteed cleanup on scope exit or when explicitly testing disposal behavior. For short-lived processes that exit naturally (e.g., console.log scripts), the pattern `const proc = spawn(...); await proc.exited;` is standard and more common, as evidenced by 24 instances vs 4 `await using` instances in test/js/bun/spawn/spawn.test.ts.
Applied to files:
test/regression/issue/21901.test.ts
🧬 Code graph analysis (1)
test/regression/issue/21901.test.ts (1)
test/harness.ts (1)
bunExe(102-105)
🔇 Additional comments (2)
test/regression/issue/21901.test.ts (2)
69-109: Good test coverage of the concurrent mkdir scenario.This test block correctly reproduces the original issue scenario where multiple concurrent
mkdir('.')calls withPromise.allSettledwould fail. The test validates that all promises are fulfilled, which is exactly what was broken before the fix.The error handling in the spawned script (lines 85-92) is well done, providing clear failure messages if any promise is rejected.
1-110: Verify test behavior with system vs debug build.According to the coding guidelines and PR description, you should verify:
- The test fails when run with:
USE_SYSTEM_BUN=1 bun test test/regression/issue/21901.test.ts- The test passes when run with:
bun bd test test/regression/issue/21901.test.tsThe PR description mentions this has been verified ("Test passes with debug build, fails with system bun"), but please confirm this is the case before merging.
Based on coding guidelines: "Verify your test fails with
USE_SYSTEM_BUN=1 bun test <file>and passes withbun bd test <file>- your test is NOT VALID if it passes withUSE_SYSTEM_BUN=1"
| // If the normalized path is still relative (like "."), resolve it to an absolute path | ||
| if (!std.fs.path.isAbsoluteWindows(normal)) { | ||
| const cwd_path = std.posix.getcwd(buf) catch @panic("Error getting cwd"); | ||
| const resolved = path_handler.joinAbsStringBuf(cwd_path, b, &.{normal}, .windows); | ||
| return strings.toKernel32Path(@alignCast(std.mem.bytesAsSlice(u16, buf)), resolved); | ||
| } |
There was a problem hiding this comment.
Critical: Replace panic with graceful error handling for getcwd failure.
Using @panic("Error getting cwd") on line 639 will crash the entire Bun process if getcwd() fails. This can occur in legitimate scenarios such as:
- The current directory has been deleted
- Permission issues
- Filesystem errors
While the fix for resolving relative paths is correct, the error handling needs improvement. Consider one of these approaches:
- Return a fallback path: If cwd retrieval fails, return the normalized path as-is (it may fail later in the kernel call, but with a proper error code).
- Propagate the error: Change the function signature to return an error type if feasible.
- Use a default fallback: Fall back to a known safe path like the executable's directory.
Example fix:
- const cwd_path = std.posix.getcwd(buf) catch @panic("Error getting cwd");
+ const cwd_path = std.posix.getcwd(buf) catch {
+ // Fallback: return the normalized path as-is and let Windows APIs handle it
+ return strings.toKernel32Path(@alignCast(std.mem.bytesAsSlice(u16, buf)), normal);
+ };Additionally, check if similar panic calls elsewhere in this function (like line 576, 583, 632) should be addressed consistently.
🤖 Prompt for AI Agents
In src/bun.js/node/types.zig around lines 637 to 642, replace the direct
@panic("Error getting cwd") on getcwd failure with graceful error handling: call
std.posix.getcwd(buf) and if it fails, either (a) return the normalized path
as-is, (b) propagate an error by changing the function signature to return an
error union so callers can handle it, or (c) use a safe fallback path (e.g.,
executable directory); ensure the chosen approach logs or surfaces the original
OS error code/message rather than aborting, and apply the same non-panic pattern
to other @panic calls in this function (lines ~576, 583, 632) for consistent
error handling.
| // If normalization resulted in an empty path, return "." | ||
| // This happens when the input is just "." or consists only of dots/separators that get normalized away | ||
| if (buf_i == buf_start and path_.len > 0) { | ||
| buf[buf_i] = '.'; | ||
| buf_i += 1; | ||
| } | ||
|
|
There was a problem hiding this comment.
🛠️ Refactor suggestion | 🟠 Major
LGTM! Essential fix to prevent empty normalized paths.
This guard correctly addresses the root cause where path normalization could produce an empty string from inputs like "." or paths consisting only of separators and dots. The condition buf_i == buf_start and path_.len > 0 properly detects when normalization produced no output despite having input, and returning "." is the correct POSIX convention for the current directory.
This change works in conjunction with the types.zig modifications to fully resolve the mkdir(".") issue on Windows.
🤖 Prompt for AI Agents
In src/resolver/resolve_path.zig around lines 934 to 940, normalization can
produce an empty output for inputs like "." or strings made only of
dots/separators; add a guard that if buf_i == buf_start and path_.len > 0 then
write a single '.' into buf and increment buf_i so the function returns "."
instead of an empty string, ensuring POSIX current-directory behavior (this
change prevents mkdir(".") issues on Windows).
| test("mkdir('.') should succeed with recursive option on Windows", async () => { | ||
| if (!isWindows) { | ||
| test.skip(); | ||
| return; | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider using test.skipIf for cleaner platform skipping.
The current skip logic is correct, but you can simplify it using test.skipIf:
-test("mkdir('.') should succeed with recursive option on Windows", async () => {
- if (!isWindows) {
- test.skip();
- return;
- }
+test.skipIf(!isWindows)("mkdir('.') should succeed with recursive option on Windows", async () => {This is more idiomatic and doesn't require the early return.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test("mkdir('.') should succeed with recursive option on Windows", async () => { | |
| if (!isWindows) { | |
| test.skip(); | |
| return; | |
| } | |
| test.skipIf(!isWindows)("mkdir('.') should succeed with recursive option on Windows", async () => { |
🤖 Prompt for AI Agents
In test/regression/issue/21901.test.ts around lines 5 to 9, replace the current
manual platform skip (if (!isWindows) { test.skip(); return; }) with the more
idiomatic test.skipIf(!isWindows) at the start of the test so the test is
skipped on non-Windows without an early return; remove the if block and keep the
rest of the test body unchanged.
| // Test mkdirSync with recursive option | ||
| { | ||
| await using proc = Bun.spawn({ | ||
| cmd: [ | ||
| bunExe(), | ||
| "-e", | ||
| ` | ||
| const fs = require('fs'); | ||
| try { | ||
| fs.mkdirSync('.', { recursive: true }); | ||
| console.log('mkdirSync success'); | ||
| } catch (err) { | ||
| console.error('mkdirSync error:', err.message); | ||
| process.exit(1); | ||
| } | ||
| `, | ||
| ], | ||
| env: bunEnv, | ||
| stdout: "pipe", | ||
| stderr: "pipe", | ||
| }); | ||
|
|
||
| const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]); | ||
|
|
||
| expect(stdout.trim()).toBe("mkdirSync success"); | ||
| expect(exitCode).toBe(0); | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider validating or logging stderr for better debugging.
The test captures stderr but never checks or logs it. Consider adding stderr validation or logging it when the test fails:
const [stdout, stderr, exitCode] = await Promise.all([proc.stdout.text(), proc.stderr.text(), proc.exited]);
+expect(stderr.trim()).toBe(""); // or log stderr on failure
expect(stdout.trim()).toBe("mkdirSync success");
expect(exitCode).toBe(0);This would make debugging easier if the test fails unexpectedly.
Apply this suggestion to all three test blocks (lines 11-37, 39-67, and 69-109).
🤖 Prompt for AI Agents
In test/regression/issue/21901.test.ts around lines 11-37 (and similarly apply
to blocks at 39-67 and 69-109), the test captures stderr but never asserts or
surfaces it on failure; update each test block to check stderr and surface its
contents when the test does not pass by asserting stderr is empty or by
appending stderr to the failure message—specifically, read proc.stderr.text() as
already done, and include a conditional that fails the test or logs the stderr
output when exitCode !== 0 or when stdout/unexpected values occur so that test
failures show the captured stderr for easier debugging.
|
Closing this PR because it has been inactive for more than 90 days. |
Summary
mkdir(".", {recursive: true})returning ENOENT on WindowsTest plan
test/regression/issue/21901.test.tsfs.mkdirSync(".", {recursive: true})succeedsfs.promises.mkdir(".", {recursive: true})succeedsPromise.allSettledwith mkdir(".") worksFixes #21901
🤖 Generated with Claude Code