From 28781682ec4aeae3a497bc603f040dfdfd41c358 Mon Sep 17 00:00:00 2001 From: emozilla Date: Wed, 20 May 2026 14:41:31 -0400 Subject: [PATCH] test(desktop): allow `node-pty` bare-require in packaged entrypoints Pre-existing failure on bb/gui since c858484b4 swapped the node-pty fork for upstream microsoft/node-pty 1.1.0. main.cjs intentionally bare-requires node-pty (it's hoisted by workspace dedup in dev, and staged to resources/native-deps via scripts/stage-native-deps.cjs + extraResources for packaged builds, with a try/catch fallback at line ~38). The allowlist hadn't been updated to match -- same shape as `electron`, which was already allowed. --- apps/desktop/electron/bootstrap-platform.test.cjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/desktop/electron/bootstrap-platform.test.cjs b/apps/desktop/electron/bootstrap-platform.test.cjs index bbd60611a39..a96d6a2b724 100644 --- a/apps/desktop/electron/bootstrap-platform.test.cjs +++ b/apps/desktop/electron/bootstrap-platform.test.cjs @@ -30,7 +30,13 @@ test('bundledRuntimeImportCheck selects platform-specific import checks', () => test('packaged electron entrypoints do not require unpackaged npm modules', () => { const electronDir = __dirname const entrypoints = ['main.cjs', 'preload.cjs', 'bootstrap-platform.cjs'] - const allowedBareRequires = new Set(['electron']) + // - electron: provided by the electron runtime, always resolvable in packaged builds. + // - node-pty: hoisted by workspace dedup AND shipped via extraResources to + // resources/native-deps/node-pty (see scripts/stage-native-deps.cjs). main.cjs + // has a try/catch fallback at line ~38 that resolves the staged copy when the + // bare require fails in the packaged asar, so the bare require itself is by + // design rather than an oversight. + const allowedBareRequires = new Set(['electron', 'node-pty']) const requirePattern = /require\(['"]([^'"]+)['"]\)/g for (const entrypoint of entrypoints) {