diff options
author | 2023-08-28 20:08:08 -0700 | |
---|---|---|
committer | 2023-08-28 20:08:08 -0700 | |
commit | d1c2d6b25ceaeb58513d8687ba7945447adb6618 (patch) | |
tree | 19292e163ea1bb3caaa58b25c8bc1478c16ab50a /test/js/node | |
parent | a2aad40171292914bef924f12172ae00049fcef4 (diff) | |
download | bun-d1c2d6b25ceaeb58513d8687ba7945447adb6618.tar.gz bun-d1c2d6b25ceaeb58513d8687ba7945447adb6618.tar.zst bun-d1c2d6b25ceaeb58513d8687ba7945447adb6618.zip |
use `options.fd` if provided for `fs.Read/WriteStream` (#4378)
* use `options.fd` over path
* tests
* fix `@clack/prompts`
* == null
Diffstat (limited to 'test/js/node')
-rw-r--r-- | test/js/node/fs/fs.test.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts index fac7c2b57..5cca5fce9 100644 --- a/test/js/node/fs/fs.test.ts +++ b/test/js/node/fs/fs.test.ts @@ -1288,6 +1288,17 @@ describe("fs.WriteStream", () => { done(); }); }); + + it("should use fd if provided", () => { + const path = join(tmpdir(), "/not-used.txt"); + // @ts-ignore-next-line + const ws = new WriteStream_(path, { + fd: 2, + }); + // @ts-ignore-next-line + expect(ws.fd).toBe(2); + expect(existsSync(path)).toBe(false); + }); }); describe("fs.ReadStream", () => { @@ -1389,6 +1400,17 @@ describe("fs.ReadStream", () => { done(); }); }); + + it("should use fd if provided", () => { + const path = join(tmpdir(), "not-used.txt"); + // @ts-ignore-next-line + const ws = new ReadStream_(path, { + fd: 0, + }); + // @ts-ignore-next-line + expect(ws.fd).toBe(0); + expect(existsSync(path)).toBe(false); + }); }); describe("createWriteStream", () => { |