fix(eslint-plugin-fiori-tools): fix heap OOM on macos Node 20 arm64#4570
fix(eslint-plugin-fiori-tools): fix heap OOM on macos Node 20 arm64#4570
Conversation
|
There was a problem hiding this comment.
The PR is a clean, well-motivated fix — removing the c8 process-level wrapper in favour of Jest's built-in coverageProvider: 'v8' is the correct solution for the per-process OOM described. The only suggestion is to add a brief comment in jest.config.js making the implicit collectCoverage: true inheritance explicit, to guard against future regressions.
PR Bot Information
Version: 1.20.11 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
|



Root cause
The previous fix (#4566) added
--merge-asyncto c8, targeting coverage merge time. The full stack trace reveals the OOM is one layer deeper — in Node's nativeV8CoverageConnection::WriteProfileat process exit:c8 runs as a single orchestrator process that accumulates V8 profiler data for all 71 test files before serialising it. With
--experimental-vm-modules, each test file re-instruments every source module, producing ~269 MB of raw coverage data.JSON.stringifyof this object requires a contiguous string buffer that exhausts the ~2 GB heap on macos arm64 Node 20.--merge-asynconly affects how c8 handles already-written JSON files — the OOM fires before that step.Fix
Replace the c8 process-level wrapper with Jest's built-in
coverageProvider: 'v8'. Jest's own V8 provider collects coverage per worker process (one test file each) viacollect-v8-coverage, keeping per-process memory bounded. The main Jest process aggregates small per-worker reports — the large serialisation never happens in a single process.Also removes the unused
c8devDependency and adds--maxWorkers=50%(scales to available CPUs rather than hardcoding 2).--experimental-vm-modulesis still required — ESLint 9 uses dynamicimport()internally and fails without it.Changes
jest.config.js: removecollectCoverage: false, addcoverageProvider: 'v8'package.json: drop c8 wrapper, keepNODE_OPTIONS='--experimental-vm-modules', add--maxWorkers=50%Test plan
macos-latestNode 20.x without OOMCloses #4545