aboutsummaryrefslogtreecommitdiff
path: root/test/js
diff options
context:
space:
mode:
authorGravatar MrPalixir <73360179+coratgerl@users.noreply.github.com> 2023-09-17 03:51:18 +0200
committerGravatar GitHub <noreply@github.com> 2023-09-16 18:51:18 -0700
commit0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea (patch)
tree842c3ff3c6c22a1b7a8be0929f0fd0b88778158b /test/js
parent08426962fa0d4c2f4104d644f0767cb5f93cae65 (diff)
downloadbun-0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea.tar.gz
bun-0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea.tar.zst
bun-0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea.zip
fix: node compatibility with empty path string (#4693)
Co-authored-by: MrPalixir <73360179+MrPalixir@users.noreply.github.com>
Diffstat (limited to 'test/js')
-rw-r--r--test/js/node/fs/fs.test.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts
index 41275edd5..3e030f609 100644
--- a/test/js/node/fs/fs.test.ts
+++ b/test/js/node/fs/fs.test.ts
@@ -953,6 +953,23 @@ describe("stat", () => {
} catch (e: any) {
expect(e.code).toBe("ENOENT");
}
+
+ try {
+ statSync("");
+ throw "statSync should throw";
+ } catch (e: any) {
+ expect(e.code).toBe("ENOENT");
+ }
+ });
+});
+
+describe("exist", () => {
+ it("should return false with invalid path", () => {
+ expect(existsSync("/pathNotExist")).toBe(false);
+ });
+
+ it("should return false with empty string", () => {
+ expect(existsSync("")).toBe(false);
});
});