diff options
| author | 2022-09-09 19:26:02 -0700 | |
|---|---|---|
| committer | 2022-09-09 19:26:02 -0700 | |
| commit | c600196b1a566b575d32bbdc4229f78c7dc3eb81 (patch) | |
| tree | e700116cb61d93df970c6b77f6cb1080334cfe86 /test | |
| parent | 3d8edcb77b7579090ebf370f12ce6107f3b3fb04 (diff) | |
| download | bun-c600196b1a566b575d32bbdc4229f78c7dc3eb81.tar.gz bun-c600196b1a566b575d32bbdc4229f78c7dc3eb81.tar.zst bun-c600196b1a566b575d32bbdc4229f78c7dc3eb81.zip | |
[node:fs] Fix readFileSync on non-regular files
Fixes https://github.com/oven-sh/bun/issues/1220
Diffstat (limited to 'test')
| -rw-r--r-- | test/bun.js/fs.test.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/bun.js/fs.test.js b/test/bun.js/fs.test.js index 80622f895..304232954 100644 --- a/test/bun.js/fs.test.js +++ b/test/bun.js/fs.test.js @@ -231,6 +231,18 @@ describe("readFileSync", () => { expect(text).toBe("File read successfully"); }); + it("works with special files in the filesystem", () => { + { + const text = readFileSync("/dev/null", "utf8"); + expect(text).toBe(""); + } + + if (process.platform === "linux") { + const text = readFileSync("/proc/filesystems"); + expect(text.length > 0).toBe(true); + } + }); + it("returning Buffer works", () => { const text = readFileSync(import.meta.dir + "/readFileSync.txt"); const encoded = [ |
