aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-09 19:26:02 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-09-09 19:26:02 -0700
commitc600196b1a566b575d32bbdc4229f78c7dc3eb81 (patch)
treee700116cb61d93df970c6b77f6cb1080334cfe86 /test
parent3d8edcb77b7579090ebf370f12ce6107f3b3fb04 (diff)
downloadbun-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.js12
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 = [