diff options
author | 2023-08-02 16:16:22 -0700 | |
---|---|---|
committer | 2023-08-02 16:16:22 -0700 | |
commit | 7656b4b17e91f15b58eeab8f45b78c416ec6a045 (patch) | |
tree | e9dceff8d8db52855f11431f5011949dc0bf8ea5 /test/js | |
parent | 25553e62c1cb8151c901f2e09ccb1a71f6a1e7bd (diff) | |
download | bun-7656b4b17e91f15b58eeab8f45b78c416ec6a045.tar.gz bun-7656b4b17e91f15b58eeab8f45b78c416ec6a045.tar.zst bun-7656b4b17e91f15b58eeab8f45b78c416ec6a045.zip |
Fixes #3931 (#3933)
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'test/js')
-rw-r--r-- | test/js/node/fs/fs.test.ts | 12 | ||||
-rw-r--r-- | test/js/node/fs/repro-3931.js | 4 |
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)); |