Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions test/js/node/test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,22 @@ 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. 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');
Comment thread
robobun marked this conversation as resolved.
if (typeof isASANEnabled === 'function') return (isASan = isASANEnabled());
} catch {
// gated in release builds without BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING=1
}
return (isASan = path.basename(process.execPath).includes('bun-asan'));
}
const isRiscv64 = process.arch === 'riscv64';
const isDebug = process.features.debug;
function isPi() {
Expand Down Expand Up @@ -1223,7 +1238,9 @@ const common = {
hasMultiLocalhost,
invalidArgTypeHelper,
isAlive,
isASan,
get isASan() {
return getIsASan();
},
isDebug,
isDumbTerminal,
isFreeBSD,
Expand Down