From 7eb8ab389c61a3ec410c20464ff4973f8ba2ee67 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 6 Sep 2026 07:56:26 +0000 Subject: [PATCH 1/3] test: detect ASAN from the runtime in the vendored Node test harness process.config.variables.asan is always 0 in Bun, so common.isASan never fired and Node tests that skip under ASAN ran on the ASAN lane. test-crypto-dh-leak.js measures RSS growth, and the ASAN quarantine holds the freed BIGNUMs, so the growth sits at the 20 MB limit and flakes. --- test/js/node/test/common/index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/js/node/test/common/index.js b/test/js/node/test/common/index.js index a4ab5ba15f73..46df6c592c2c 100644 --- a/test/js/node/test/common/index.js +++ b/test/js/node/test/common/index.js @@ -308,7 +308,19 @@ const isFreeBSD = process.platform === 'freebsd'; const isOpenBSD = process.platform === 'openbsd'; const isLinux = process.platform === 'linux'; const isMacOS = process.platform === 'darwin'; -const isASan = process.config.variables.asan === 1; +// Bun: process.config.variables.asan is always 0 (node-gyp would otherwise +// build addons with -fsanitize=address), so ask the runtime directly. The +// binding is expose-internals-gated; fall back to the CI binary name. +const isASan = process.config.variables.asan === 1 || bunIsASan(); +function bunIsASan() { + try { + const { isASANEnabled } = require('bun:internal-for-testing'); + if (typeof isASANEnabled === 'function') return isASANEnabled(); + } catch { + // gated in release builds without BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING=1 + } + return path.basename(process.execPath).includes('bun-asan'); +} const isRiscv64 = process.arch === 'riscv64'; const isDebug = process.features.debug; function isPi() { From a391a914c669363979e1ca059864721ee07d7c41 Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 6 Sep 2026 08:12:33 +0000 Subject: [PATCH 2/3] test: probe ASAN lazily in the vendored Node test harness Loading bun:internal-for-testing evaluates about a dozen internal modules. Do it only when a test reads common.isASan. --- test/js/node/test/common/index.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/test/js/node/test/common/index.js b/test/js/node/test/common/index.js index 46df6c592c2c..eb7d284d9562 100644 --- a/test/js/node/test/common/index.js +++ b/test/js/node/test/common/index.js @@ -309,17 +309,20 @@ const isOpenBSD = process.platform === 'openbsd'; const isLinux = process.platform === 'linux'; const isMacOS = process.platform === 'darwin'; // Bun: process.config.variables.asan is always 0 (node-gyp would otherwise -// build addons with -fsanitize=address), so ask the runtime directly. The -// binding is expose-internals-gated; fall back to the CI binary name. -const isASan = process.config.variables.asan === 1 || bunIsASan(); -function bunIsASan() { +// build addons with -fsanitize=address), so ask the runtime directly. Lazy, +// because loading bun:internal-for-testing pulls in many internal modules. +// The binding is expose-internals-gated; fall back to the CI binary name. +let isASan; +function getIsASan() { + if (isASan !== undefined) return isASan; + if (process.config.variables.asan === 1) return (isASan = true); try { const { isASANEnabled } = require('bun:internal-for-testing'); - if (typeof isASANEnabled === 'function') return isASANEnabled(); + if (typeof isASANEnabled === 'function') return (isASan = isASANEnabled()); } catch { // gated in release builds without BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING=1 } - return path.basename(process.execPath).includes('bun-asan'); + return (isASan = path.basename(process.execPath).includes('bun-asan')); } const isRiscv64 = process.arch === 'riscv64'; const isDebug = process.features.debug; @@ -1235,7 +1238,9 @@ const common = { hasMultiLocalhost, invalidArgTypeHelper, isAlive, - isASan, + get isASan() { + return getIsASan(); + }, isDebug, isDumbTerminal, isFreeBSD, From 7ae983308b879cf4544ffb9db237c8b7d1a1ba6f Mon Sep 17 00:00:00 2001 From: robobun <117481402+robobun@users.noreply.github.com> Date: Sun, 6 Sep 2026 08:51:13 +0000 Subject: [PATCH 3/3] ci: retrigger