mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
## Summary
- Fix path normalization for "." on Windows where `normalizeStringBuf`
was incorrectly stripping it to an empty string
- This caused `existsSync('.')`, `statSync('.')`, and other fs
operations to fail on Windows
## Test plan
- Added regression test `test/regression/issue/26631.test.ts` that tests
`existsSync`, `exists`, `statSync`, and `stat` for both `.` and `..`
paths
- All tests pass locally with `bun bd test
test/regression/issue/26631.test.ts`
- Verified code compiles on all platforms with `bun run zig:check-all`
Fixes #26631
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { expect, test } from "bun:test";
|
|
import { existsSync, statSync } from "node:fs";
|
|
import { exists, stat } from "node:fs/promises";
|
|
|
|
// https://github.com/oven-sh/bun/issues/26631
|
|
// Path resolution fails for current directory '.' on Windows
|
|
|
|
test("existsSync('.') should return true", () => {
|
|
expect(existsSync(".")).toBe(true);
|
|
});
|
|
|
|
test("exists('.') should return true", async () => {
|
|
expect(await exists(".")).toBe(true);
|
|
});
|
|
|
|
test("statSync('.') should return directory stats", () => {
|
|
const stats = statSync(".");
|
|
expect(stats.isDirectory()).toBe(true);
|
|
});
|
|
|
|
test("stat('.') should return directory stats", async () => {
|
|
const stats = await stat(".");
|
|
expect(stats.isDirectory()).toBe(true);
|
|
});
|
|
|
|
test("existsSync('..') should return true", () => {
|
|
expect(existsSync("..")).toBe(true);
|
|
});
|
|
|
|
test("exists('..') should return true", async () => {
|
|
expect(await exists("..")).toBe(true);
|
|
});
|
|
|
|
test("statSync('..') should return directory stats", () => {
|
|
const stats = statSync("..");
|
|
expect(stats.isDirectory()).toBe(true);
|
|
});
|
|
|
|
test("stat('..') should return directory stats", async () => {
|
|
const stats = await stat("..");
|
|
expect(stats.isDirectory()).toBe(true);
|
|
});
|