Skip to content

Commit 46fac0e

Browse files
committed
fix: guard benchmark main() behind require.main === module
Prevents the full 131-test benchmark suite from auto-executing when the script is require()'d for syntax or import validation. Exports main() for programmatic use.
1 parent c3bcec2 commit 46fac0e

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

skills/analysis/home-security-benchmark/scripts/run-benchmark.cjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,9 +1806,14 @@ async function main() {
18061806
process.exit(failed > 0 ? 1 : 0);
18071807
}
18081808

1809-
main().catch(err => {
1810-
log(`Fatal: ${err.message}`);
1811-
emit({ event: 'error', message: err.message });
1812-
process.exit(1);
1813-
});
1809+
// Only run when executed directly (not when require()'d for syntax/import checks)
1810+
if (require.main === module) {
1811+
main().catch(err => {
1812+
log(`Fatal: ${err.message}`);
1813+
emit({ event: 'error', message: err.message });
1814+
process.exit(1);
1815+
});
1816+
}
1817+
1818+
module.exports = { main };
18141819

0 commit comments

Comments
 (0)