MCPcopy
hub / github.com/webpack/webpack / checkV8Flags

Function checkV8Flags

test/BenchmarkTestCases.benchmark.mjs:34–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32const REV_LIST_REGEXP = /^([a-f0-9]+)\s*([a-f0-9]+)\s*([a-f0-9]+)?\s*$/;
33
34const checkV8Flags = () => {
35 const requiredFlags = getV8Flags().filter(
36 (flag) => !flag.startsWith("--max-old-space-size")
37 );
38 const actualFlags = process.execArgv;
39 const missingFlags = requiredFlags.filter(
40 (flag) => !actualFlags.includes(flag)
41 );
42 if (missingFlags.length > 0) {
43 // Missing flags invalidate deterministic benchmarking (hash/random seeds,
44 // GC scheduling, JIT). Throw instead of warning so CI and local runs can't
45 // silently produce unstable numbers — use `yarn benchmark` to run with
46 // the correct flags.
47 throw new Error(
48 `Missing required V8 flags for stable benchmarking: ${missingFlags.join(
49 ", "
50 )}\nRun via \`yarn benchmark\` so the flags declared in package.json are applied.`
51 );
52 }
53};
54
55checkV8Flags();
56

Calls

no outgoing calls

Tested by

no test coverage detected