From cf8cbca94fe3698672c4bc931b2e9b47b04bf296 Mon Sep 17 00:00:00 2001 From: "James P." Date: Sun, 19 May 2024 13:25:04 -0500 Subject: [PATCH] `_open`/`_openSync` correctly handle non-ENOENT errors `_open`/`_openSync` add the original stack trace on the second throw Fixed `configure` overwritting per-backend `disableAsyncCache` --- src/config.ts | 2 +- src/emulation/promises.ts | 37 +++++++++++++++++++++++------------- src/emulation/sync.ts | 39 ++++++++++++++++++++++++-------------- tests/port/channel.test.ts | 6 +++++- 4 files changed, 55 insertions(+), 29 deletions(-) diff --git a/src/config.ts b/src/config.ts index 3c6505b30..653f41ab0 100644 --- a/src/config.ts +++ b/src/config.ts @@ -128,7 +128,7 @@ export async function configure(config: MountConfiguration | Partial { test('configuration', async () => { tmpfs = await resolveMountConfig({ backend: InMemory, name: 'tmp' }); attachFS(port2, tmpfs); - await configure({ backend: Port, port: port1 }); + await configure({ backend: Port, port: port1, disableAsyncCache: true }); }); test('write', async () => { @@ -33,4 +33,8 @@ describe('FS with MessageChannel', () => { test('read', async () => { expect(await fs.promises.readFile('/test', 'utf8')).toBe(content); }); + + test('readFileSync should throw', () => { + expect(() => fs.readFileSync('/test', 'utf8')).toThrow('ENOTSUP'); + }); });