We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bun-debug test test\js\node\fs\fs.test.ts
bun test v1.0.25-canary.50 (e8e84a37) ✓ copyFileSync > should work for files < 128 KB [10.64ms] ✓ copyFileSync > should work for files > 128 KB [26.73ms] ✓ copyFileSync > constants are right [3.24ms] ✓ copyFileSync > FICLONE option does not error ever [4.95ms] ✓ copyFileSync > COPYFILE_EXCL works [5.91ms] ✓ mkdirSync > should create a directory [2.57ms] ✓ mkdirSync > throws for invalid options [3.08ms] ✓ promises.readFile > & fs.promises.writefile encodes & decodes [81.64ms] ✓ readSync > works on large files [32970.70ms] ✓ readSync > works with bigint on read [5.19ms] ✓ readSync > works with a position set to 0 [1.13ms] ✓ readSync > works without position set [1.08ms] ✓ writeSync > works with bigint [3.85ms] ✓ writeSync > works with a position set to 0 [1.18ms] 950 | expect(count).toBe(4); 951 | } 952 | closeSync(fd); 953 | }); 954 | it("works without position set", () => { 955 | const fd = openSync(import.meta.dir + "/writeFileSync.txt", "w+"); ^ EPERM: Operation not permitted errno: -1 syscall: "open" path: "D:\a\bun\bun\test\js\node\fs/writeFileSync.txt" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:955:16 ✗ writeSync > works without position set [2.14ms] ✓ readFileSync > works [7.91ms] ✓ readFileSync > works with a file url [4.26ms] ✓ readFileSync > works with a file path which contains spaces [9.84ms] 989 | 990 | it("works with a file URL which contains spaces", async () => { 991 | gc(); 992 | const outpath = join(tmpdir(), "read file sync with space characters " + Math.random().toString(32) + " .txt"); 993 | await Bun.write(outpath, Bun.file(Bun.fileURLToPath(new URL("./readFileSync.txt", import.meta.url)))); 994 | const text = readFileSync(new URL(outpath, import.meta.url), "utf8"); ^ TypeError: URL must be a non-empty "file:" path code: "ERR_INVALID_ARG_TYPE" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:994:18 ✗ readFileSync > works with a file URL which contains spaces [5.07ms] 996 | expect(text).toBe("File read successfully"); 997 | }); 998 | 999 | it("works with special files in the filesystem", () => { 1000 | { 1001 | const text = readFileSync("/dev/null", "utf8"); ^ ENOENT: No such file or directory errno: -2 syscall: "open" path: "/dev/null" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1001:20 ✗ readFileSync > works with special files in the filesystem [1.91ms] ✓ readFileSync > returning Buffer works [24.93ms] ✓ readFile > works [5.69ms] ✓ readFile > returning Buffer works [33.49ms] ✓ writeFileSync > works [1.97ms] ✓ writeFileSync > write file with mode, issue #3740 [1.44ms] ✓ writeFileSync > returning Buffer works [35.66ms] ✓ writeFileSync > returning ArrayBuffer works [3.40ms] 1102 | 1103 | describe("lstat", () => { 1104 | it("file metadata is correct", () => { 1105 | const fileStats = lstatSync(new URL("./fs-stream.js", import.meta.url).toString().slice("file://".length - 1)); 1106 | expect(fileStats.isSymbolicLink()).toBe(false); 1107 | expect(fileStats.isFile()).toBe(true); ^ error: expect(received).toBe(expected) Expected: true Received: false at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1107:5 ✗ lstat > file metadata is correct [8.68ms] 1114 | 1115 | it("folder metadata is correct", () => { 1116 | const fileStats = lstatSync(new URL("../../../../test", import.meta.url).toString().slice("file://".length - 1)); 1117 | expect(fileStats.isSymbolicLink()).toBe(false); 1118 | expect(fileStats.isFile()).toBe(false); 1119 | expect(fileStats.isDirectory()).toBe(true); ^ error: expect(received).toBe(expected) Expected: true Received: false at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1119:5 ✗ lstat > folder metadata is correct [3.71ms] 1123 | triggerDOMJIT(fileStats, fileStats.isSymbolicLink, false); 1124 | }); 1125 | 1126 | it("symlink metadata is correct", () => { 1127 | const linkStats = lstatSync(new URL("./fs-stream.link.js", import.meta.url).toString().slice("file://".length - 1)); 1128 | expect(linkStats.isSymbolicLink()).toBe(true); ^ error: expect(received).toBe(expected) Expected: true Received: false at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1128:5 ✗ lstat > symlink metadata is correct [3.06ms] 1189 | 1190 | describe("stat", () => { 1191 | it("file metadata is correct", () => { 1192 | const fileStats = statSync(new URL("./fs-stream.js", import.meta.url).toString().slice("file://".length - 1)); 1193 | expect(fileStats.isSymbolicLink()).toBe(false); 1194 | expect(fileStats.isFile()).toBe(true); ^ error: expect(received).toBe(expected) Expected: true Received: false at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1194:5 ✗ stat > file metadata is correct [4.08ms] 1201 | 1202 | it("folder metadata is correct", () => { 1203 | const fileStats = statSync(new URL("../../../../test", import.meta.url).toString().slice("file://".length - 1)); 1204 | expect(fileStats.isSymbolicLink()).toBe(false); 1205 | expect(fileStats.isFile()).toBe(false); 1206 | expect(fileStats.isDirectory()).toBe(true); ^ error: expect(received).toBe(expected) Expected: true Received: false at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1206:5 ✗ stat > folder metadata is correct [4.25ms] ✓ stat > stat returns ENOENT [3.27ms] ✓ exist > should return false with invalid path [0.12ms] ✓ exist > should return false with empty string [0.06ms] ✓ fs.exists > should throw TypeError with invalid argument [1.05ms] ✓ fs.exists > should return false with invalid path [3.52ms] ✓ fs.exists > should return true with existed path [2.76ms] ✓ rm > removes a file [516.36ms] ✓ rm > removes a dir [2.83ms] ✓ rm > removes a dir recursively [2.07ms] ✓ rmdir > does not remove a file [3.96ms] ✓ rmdir > removes a dir [3.57ms] ✓ rmdir > removes a dir x 512 [281.58ms] ✓ rmdir > does not remove a dir with a file in it [8.51ms] ✓ rmdir > removes a dir recursively [4.05ms] ✓ rmdirSync > does not remove a file [4.54ms] ✓ rmdirSync > removes a dir [1.32ms] ✓ rmdirSync > removes a dir recursively [2.31ms] » createReadStream > works (1 chunk) » createReadStream > works (22 chunk) » createReadStream > works (highWaterMark 1, 512 chunk) » createReadStream > works (512 chunk) » createReadStream > works with larger highWaterMark (1024 chunk) » createReadStream > works with very large file » createReadStream > should emit open » createReadStream > should call close callback » fs.WriteStream > should be exported » fs.WriteStream > should be constructable » fs.WriteStream > should be able to write to a file » fs.WriteStream > should work if re-exported by name » fs.WriteStream > should work if re-exported by name, called without new » fs.WriteStream > should work if re-exported, as export * from ... » fs.WriteStream > should work if re-exported, as export * from..., called without new » fs.WriteStream > should be able to write to a file with re-exported WriteStream » fs.WriteStream > should use fd if provided » fs.ReadStream > should be exported » fs.ReadStream > should be constructable » fs.ReadStream > should be able to read from a file » fs.ReadStream > should work if re-exported by name » fs.ReadStream > should work if re-exported by name, called without new » fs.ReadStream > should work if re-exported as export * from ... » fs.ReadStream > should work if re-exported as export * from ..., called without new » fs.ReadStream > should be able to read from a file, with re-exported ReadStream » fs.ReadStream > should use fd if provided » createWriteStream > simple write stream finishes » createWriteStream > writing null throws ERR_STREAM_NULL_VALUES » createWriteStream > writing null throws ERR_STREAM_NULL_VALUES (objectMode: true) » createWriteStream > writing false throws ERR_INVALID_ARG_TYPE » createWriteStream > writing false throws ERR_INVALID_ARG_TYPE (objectMode: true) » createWriteStream > writing in append mode should not truncate the file » createWriteStream > should emit open and call close callback » createWriteStream > should call close callback » createWriteStream > should call callbacks in the correct order 2001 | expect(bun).toEqual(node as string[]); 2002 | }, 100000); 2003 | 2004 | for (let withFileTypes of [false, true] as const) { 2005 | const doIt = async () => { 2006 | const maxFD = openSync("/dev/null", "r"); ^ ENOENT: No such file or directory errno: -2 syscall: "open" path: "/dev/null" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:2006:21 at doIt (D:\a\bun\bun\test\js\node\fs\fs.test.ts:2005:18) ✗ fs/promises > withFileTypes > readdir(path, {recursive: true} should work x 100 [2.21ms] 2029 | closeSync(newMaxFD); 2030 | expect(maxFD).toBe(newMaxFD); // assert we do not leak file descriptors 2031 | }; 2032 | 2033 | const fail = async () => { 2034 | const maxFD = openSync("/dev/null", "r"); ^ ENOENT: No such file or directory errno: -2 syscall: "open" path: "/dev/null" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:2034:21 at fail (D:\a\bun\bun\test\js\node\fs\fs.test.ts:2033:18) ✗ fs/promises > withFileTypes > readdir(path, {recursive: true} should fail x 100 [2.04ms] ✓ fs/promises > rmdir > removes a file [4.68ms] ✓ fs/promises > rmdir > removes a dir [4.13ms] ✓ fs/promises > rmdir > removes a dir recursively [5.22ms] ✓ fs/promises > should not segfault on exception [2.03ms] ✓ fs/promises > readFile [2.79ms] ✓ fs/promises > writeFile [2.58ms] ✓ fs/promises > readdir() [2.82ms] 1969 | it("readdir(path, {recursive: true}) produces the same result as Node.js", async () => { 1970 | const full = resolve(import.meta.dir, "../"); 1971 | const [bun, subprocess] = await Promise.all([ 1972 | (async function () { 1973 | console.time("readdir(path, {recursive: true})"); 1974 | const files = await promises.readdir(full, { recursive: true }); ^ TODOError: fs.promises.readdir is not implemented on Windows yet at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1974:29 at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1972:26 at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1977:16 at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1969:78 ✗ fs/promises > readdir(path, {recursive: true}) produces the same result as Node.js [5.06ms] 2001 | expect(bun).toEqual(node as string[]); 2002 | }, 100000); 2003 | 2004 | for (let withFileTypes of [false, true] as const) { 2005 | const doIt = async () => { 2006 | const maxFD = openSync("/dev/null", "r"); ^ ENOENT: No such file or directory errno: -2 syscall: "open" path: "/dev/null" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:2006:21 at doIt (D:\a\bun\bun\test\js\node\fs\fs.test.ts:2005:18) ✗ fs/promises > readdir(path, {recursive: true} should work x 100 [4.95ms] 2029 | closeSync(newMaxFD); 2030 | expect(maxFD).toBe(newMaxFD); // assert we do not leak file descriptors 2031 | }; 2032 | 2033 | const fail = async () => { 2034 | const maxFD = openSync("/dev/null", "r"); ^ ENOENT: No such file or directory errno: -2 syscall: "open" path: "/dev/null" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:2034:21 at fail (D:\a\bun\bun\test\js\node\fs\fs.test.ts:2033:18) ✗ fs/promises > readdir(path, {recursive: true} should fail x 100 [3.22ms] ✓ fs/promises > readdir() no args doesnt segfault [4.55ms] ENOENT: No such file or directory errno: -2 syscall: "open" path: "." ✗ fs/promises > opendir should have a path property, issue#4995 [3.11ms] ✓ utimesSync > works [8.00ms] ✓ utimesSync > accepts a Number(value).toString() [2.46ms] Stats { atime: 1970-01-01T00:00:00.000Z, atimeMs: 0, birthtime: 2024-01-24T15:54:20.896Z, birthtimeMs: 1706111660896.161, blksize: 4096, blocks: 0, ctime: 2024-01-24T15:54:20.896Z, ctimeMs: 1706111660896.161, dev: 2629467712, gid: 0, ino: 562949954322966, isBlockDevice: [Function: isBlockDevice], isCharacterDevice: [Function: isCharacterDevice], isDirectory: [Function: isDirectory], isFIFO: [Function: isFIFO], isFile: [Function: isFile], isSocket: [Function: isSocket], isSymbolicLink: [Function: isSymbolicLink], mode: 33206, mtime: 1970-01-01T00:00:00.333Z, mtimeMs: 333, nlink: 1, rdev: 0, size: 4, uid: 0, } 2345 | fs.utimesSync(tmp, newAccessTime, newModifiedTime); 2346 | 2347 | const newStats = fs.statSync(tmp); 2348 | console.log(newStats); 2349 | 2350 | expect(newStats.mtime).toEqual(newModifiedTime); ^ error: expect(received).toEqual(expected) + 1970-01-01T00:00:00.333Z - 2045-04-30T19:32:12.333Z - Expected - 1 + Received + 1 at D:\a\bun\bun\test\js\node\fs\fs.test.ts:2350:5 ✗ utimesSync > works after 2038 [6.13ms] ✓ fs.write > should work with (fd, buffer, offset, length, position, callback) [5.47ms] ✓ fs.write > should work with (fd, buffer, offset, length, callback) [7.09ms] ✓ fs.write > should work with (fd, string, position, encoding, callback) [5.86ms] ✓ fs.write > should work with (fd, string, position, callback) [6.97ms] ✓ fs.write > should work with util.promisify [7.32ms] ✓ fs.read > should work with (fd, callback) [5.09ms] ✓ fs.read > should work with (fd, options, callback) [4.18ms] ✓ fs.read > should work with (fd, buffer, offset, length, position, callback) [4.23ms] ✓ fs.read > should work with offset [4.13ms] ✓ fs.read > should work with position [3.81ms] ✓ fs.read > should work with both position and offset [4.23ms] ✓ fs.read > should work with util.promisify [4.98ms] ✓ Dirent.name setter [2.88ms] ✓ writeFileSync in append should not truncate the file [3.02ms] » await readdir #3931 ✓ writeFileSync NOT in append SHOULD truncate the file [16.85ms] ✓ readdirSync on import.meta.dir [7.08ms] ✓ promises.readdir on a large folder [137.14ms] ✓ promises.readFile [64.49ms] ✓ promises.readFile - UTF16 file path [154.40ms] ✓ promises.readFile - atomized file path [148.93ms] ✓ promises.readFile with buffer as file path [30.06ms] ✓ promises.readdir on a large folder withFileTypes [88.60ms] 658 | } 659 | rmSync(huge, { force: true, recursive: true }); 660 | }); 661 | 662 | it("statSync throwIfNoEntry", () => { 663 | expect(statSync("/tmp/404/not-found/ok", { throwIfNoEntry: false })).toBeUndefined(); ^ ENOENT: No such file or directory errno: -2 syscall: "stat" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:663:10 ✗ statSync throwIfNoEntry [1.84ms] ✓ statSync throwIfNoEntry: true [10.85ms] ✓ stat == statSync [3.27ms] ✓ mkdtempSync, readdirSync, rmdirSync and unlinkSync with non-ascii [11.85ms] ✓ mkdtempSync() empty name [10.40ms] 725 | 726 | it("mkdtempSync() non-exist dir #2568", () => { 727 | try { 728 | expect(mkdtempSync("/tmp/hello/world")).toBeFalsy(); 729 | } catch (err: any) { 730 | expect(err?.errno).toBe(process.platform === "win32" ? -4058 : -2); ^ error: expect(received).toBe(expected) Expected: -4058 Received: -2 at D:\a\bun\bun\test\js\node\fs\fs.test.ts:730:5 ✗ mkdtempSync() non-exist dir #2568 [3.67ms] 732 | }); 733 | 734 | it("mkdtemp() non-exist dir #2568", done => { 735 | mkdtemp("/tmp/hello/world", (err, folder) => { 736 | try { 737 | expect(err?.errno).toBe(process.platform === "win32" ? -4058 : -2); ^ error: expect(received).toBe(expected) Expected: -4058 Received: -2 at D:\a\bun\bun\test\js\node\fs\fs.test.ts:737:7 ✗ mkdtemp() non-exist dir #2568 [5.52ms] ✓ readdirSync on import.meta.dir with trailing slash [2.90ms] ✓ readdirSync works on empty directories [1.25ms] ✓ readdirSync works on directories with under 32 files [2.94ms] 774 | it("readdirSync throws when given a file path", () => { 775 | try { 776 | readdirSync(import.meta.path); 777 | throw new Error("should not get here"); 778 | } catch (exception: any) { 779 | expect(exception.name).toBe("ENOTDIR"); ^ error: expect(received).toBe(expected) Expected: "ENOTDIR" Received: "ENOENT" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:779:5 ✗ readdirSync throws when given a file path [3.59ms] 783 | it("readdirSync throws when given a path that doesn't exist", () => { 784 | try { 785 | readdirSync(import.meta.path + "/does-not-exist/really"); 786 | throw new Error("should not get here"); 787 | } catch (exception: any) { 788 | expect(exception.name).toBe("ENOTDIR"); ^ error: expect(received).toBe(expected) Expected: "ENOTDIR" Received: "ENOENT" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:788:5 ✗ readdirSync throws when given a path that doesn't exist [3.85ms] 792 | it("readdirSync throws when given a file path with trailing slash", () => { 793 | try { 794 | readdirSync(import.meta.path + "/"); 795 | throw new Error("should not get here"); 796 | } catch (exception: any) { 797 | expect(exception.name).toBe("ENOTDIR"); ^ error: expect(received).toBe(expected) Expected: "ENOTDIR" Received: "ENOENT" at D:\a\bun\bun\test\js\node\fs\fs.test.ts:797:5 ✗ readdirSync throws when given a file path with trailing slash [4.56ms] ✓ writevSync [1.69ms] ✓ pwritevSync [3.38ms] ✓ readvSync [1.74ms] ✓ preadv [1.45ms] ✓ symlink [2.11ms] ✓ readlink [1.98ms] 1172 | tasks[i] = promises.realpath(current).then( 1173 | () => { 1174 | throw new Error("should not get here"); 1175 | }, 1176 | e => { 1177 | expect(e?.path).toBe(current); ^ error: expect(received).toBe(expected) Expected: "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\0.hkabnt682k4-fs-realpath.txt0" Received: undefined at D:\a\bun\bun\test\js\node\fs\fs.test.ts:1177:9 ✗ realpath async [7.36ms] ✓ stat on a large file [36370.58ms] ✓ fs.constants [3.97ms] ✓ fs.promises.constants [3.33ms] ✓ fs.Dirent [0.19ms] ✓ fs.Stats [0.07ms] ✓ repro 1516: can use undefined/null to specify default flag [2.36ms] ✓ existsSync with invalid path doesn't throw [1.52ms] uh-oh: reached unreachable code bun will crash now 😭😭😭 ----- bun meta ----- Bun v1.0.25-canary.50 (e8e84a37) Windows x64 TestCommand: bunfig Elapsed: 71589ms | User: 72828ms | Sys: 2468ms RSS: 1.22GB | Peak: 1.22GB | Commit: 1.31GB | Faults: 318485 ----- bun meta ----- Search GitHub issues https://bun.sh/issues or join in #windows channel in https://bun.sh/discord thread 6236 panic: reached unreachable code ???:?:?: 0x7ff6a5050852 in ??? (bun.exe) ???:?:?: 0x7ff6a50c9925 in ??? (bun.exe) ???:?:?: 0x7ff6a5cad0af in ??? (bun.exe) ???:?:?: 0x7ff6a5cb5a91 in ??? (bun.exe) ???:?:?: 0x7ff6a5c1451c in ??? (bun.exe) ???:?:?: 0x7ff6a5c13f0a in ??? (bun.exe) ???:?:?: 0x7ff6a5c1064d in ??? (bun.exe) ???:?:?: 0x7ff6a5c12045 in ??? (bun.exe) ???:?:?: 0x7ff6a5c10477 in ??? (bun.exe) ???:?:?: 0x7ff6a5c30d0c in ??? (bun.exe) ???:?:?: 0x7ff6a5cb2427 in ??? (bun.exe) ???:?:?: 0x7ff6a5c13f91 in ??? (bun.exe) ???:?:?: 0x7ff6a5c0cde7 in ??? (bun.exe) ???:?:?: 0x7ff6a6805244 in ??? (bun.exe) ???:?:?: 0x7ff6a68df7cb in ??? (bun.exe) ???:?:?: 0x1c3206c2759 in ??? (???) ???:?:?: 0x3d6a5430b7 in ??? (???) ???:?:?: 0x1c36366174f in ??? (???) ???:?:?: 0x1c36354763f in ??? (???) ???:?:?: 0xfffdffffffffffff in ??? (???) ???:?:?: 0xfffe000000000001 in ??? (???) ???:?:?: 0x1c3206c1652 in ??? (???) ???:?:?: 0x6 in ??? (???) ???:?:?: 0x1c361be421f in ??? (???) ???:?:?: 0x3d6a542d6f in ??? (???) ???:?:?: 0x1c3206fbffe in ??? (???) ???:?:?: 0x1c3206fbdff in ??? (???) ???:?:?: 0x0 in ??? (???) ???:?:?: 0x3d6a5430b7 in ??? (???) ???:?:?: 0xfffdffffffffffff in ??? (???) ???:?:?: 0x3d6a542d6f in ??? (???) ???:?:?: 0x7ff6a74e9055 in ??? (bun.exe) ???:?:?: 0x1c36337c99f in ??? (???) ???:?:?: 0x1c361b0455f in ??? (???) ???:?:?: 0x0 in ??? (???) ???:?:?: 0x1c361cc018f in ??? (???) ???:?:?: 0x1c361b0455f in ??? (???) ???:?:?: 0x1c361be421f in ??? (???) ???:?:?: 0x1c36366174f in ??? (???) ???:?:?: 0x1c36354763f in ??? (???) ???:?:?: 0xfffdffffffffffff in ??? (???) ???:?:?: 0xfffe000000000001 in ??? (???) ???:?:?: 0x3d6a542dff in ??? (???) ???:?:?: 0x7ff6a74e9055 in ??? (bun.exe) ???:?:?: 0x1c36337c99f in ??? (???) ???:?:?: 0x1c361b0455f in ??? (???) ???:?:?: 0x600000000 in ??? (???) ???:?:?: 0x1c361cc018f in ??? (???)
The text was updated successfully, but these errors were encountered:
Related fs issues:
fs
"."
" "
fs.readdir
Stats.ino
\
path.toNamespacedPath
\\.\
\\.\UNC\
fs.readFile
reached unreachable code
Also:
path
Error
BTW:
path.resolve
path.resolve("\\\\ComputerName\\SharedFolder") === "\\\\ComputerName\\SharedFolder\\"
Sorry, something went wrong.
Still no plan to use \\?\ prefix internally for all fs operations to fix #8246 and #8836 issues?
\\?\
gvilums
No branches or pull requests
The text was updated successfully, but these errors were encountered: