aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/js/node/fs/fs.test.ts12
-rw-r--r--test/js/node/fs/repro-3931.js4
2 files changed, 15 insertions, 1 deletions
diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts
index e2de62480..5cb0aea2b 100644
--- a/test/js/node/fs/fs.test.ts
+++ b/test/js/node/fs/fs.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "bun:test";
import { dirname } from "node:path";
-import { gc } from "harness";
+import { bunEnv, bunExe, gc } from "harness";
import fs, {
closeSync,
existsSync,
@@ -42,6 +42,7 @@ import { join } from "node:path";
import { ReadStream as ReadStream_, WriteStream as WriteStream_ } from "./export-from.js";
import { ReadStream as ReadStreamStar_, WriteStream as WriteStreamStar_ } from "./export-star-from.js";
+import { spawnSync } from "bun";
const Buffer = globalThis.Buffer || Uint8Array;
@@ -67,6 +68,15 @@ it("writeFileSync in append should not truncate the file", () => {
expect(readFileSync(path, "utf8")).toBe(str);
});
+it("await readdir #3931", async () => {
+ const { exitCode } = spawnSync({
+ cmd: [bunExe(), join(import.meta.dir, "./repro-3931.js")],
+ env: bunEnv,
+ cwd: import.meta.dir,
+ });
+ expect(exitCode).toBe(0);
+});
+
it("writeFileSync NOT in append SHOULD truncate the file", () => {
const path = join(tmpdir(), "writeFileSync-should-not-append-" + (Date.now() * 10000).toString(16));
diff --git a/test/js/node/fs/repro-3931.js b/test/js/node/fs/repro-3931.js
new file mode 100644
index 000000000..b6651127d
--- /dev/null
+++ b/test/js/node/fs/repro-3931.js
@@ -0,0 +1,4 @@
+import { readdir } from "fs/promises";
+
+const files = await readdir(`/tmp`, {});
+console.log(files.map(a => a));