From 720da563a5e31e23d8e7a543b52bf8177be2488f Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 5 Jul 2026 22:18:18 +1000 Subject: [PATCH] refactor: Correct under-reported code coverage for Options/parsers buildConfigDefinitions imported parsers from ../src/Options/parsers at module scope. Loading it in a spec instruments the real src file a second time (top level only), colliding with the sourcemap-remapped lib coverage from parsers.spec.js and clobbering it down to ~2.5%. Move the require into parseDefaultValue, its only consumer, so the module reports its true 100%. --- resources/buildConfigDefinitions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/buildConfigDefinitions.js b/resources/buildConfigDefinitions.js index 1a3cbb4b55..0581a290b5 100644 --- a/resources/buildConfigDefinitions.js +++ b/resources/buildConfigDefinitions.js @@ -9,7 +9,6 @@ * To rebuild the definitions file, run * `$ node resources/buildConfigDefinitions.js` */ -const parsers = require('../src/Options/parsers'); /** The types of nested options. */ const nestedOptionTypes = [ @@ -190,6 +189,8 @@ function mapperFor(elt, t) { } function parseDefaultValue(elt, value, t) { + /* istanbul ignore next: lazy require (not module scope) so specs don't double-instrument parsers.js; only reached by `npm run definitions` */ + const parsers = require('../src/Options/parsers'); let literalValue; if (t.isStringTypeAnnotation(elt)) { if (value == '""' || value == "''") {