From 948bba396cb4f73f2962d04e53465247b3b1f356 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 8 Sep 2024 07:16:32 +0800 Subject: [PATCH] build: do not build with code cache for core coverage collection Disable code cache for built-ins when are building Node.js to collect test coverage of built-ins, as code caching makes the V8 coverage collection less precises (specifically, all the functions deserialized from the code cache will not have block-level coverage data). Data from local testing: Before: ---------|----------|---------|--------- % Stmts | % Branch | % Funcs | % Lines ---------|----------|---------|--------- 95.58 | 94.43 | 95.19 | 95.58 ---------|----------|---------|--------- After: ---------|----------|---------|--------- % Stmts | % Branch | % Funcs | % Lines ---------|----------|---------|--------- 95.93 | 94.77 | 96.03 | 95.93 ---------|----------|---------|--------- PR-URL: https://github.com/nodejs/node/pull/54633 Reviewed-By: Chengzhong Wu Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Daeyeon Jeong --- configure.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 31e0aa65cb7018..52c3d40442bfd7 100755 --- a/configure.py +++ b/configure.py @@ -1436,7 +1436,9 @@ def configure_node(o): o['variables']['node_use_node_snapshot'] = b( not cross_compiling and not options.shared) - if options.without_node_code_cache or options.without_node_snapshot or options.node_builtin_modules_path: + # Do not use code cache when Node.js is built for collecting coverage of itself, this allows more + # precise coverage for the JS built-ins. + if options.without_node_code_cache or options.without_node_snapshot or options.node_builtin_modules_path or options.coverage: o['variables']['node_use_node_code_cache'] = 'false' else: # TODO(refack): fix this when implementing embedded code-cache when cross-compiling.