fix(ci): raise Node.js heap limit for RIT type-check & test step#35973
fix(ci): raise Node.js heap limit for RIT type-check & test step#35973Copilot wants to merge 3 commits intocopilot/enforce-consistent-type-importsfrom
Conversation
…or RIT tests Co-authored-by: Hotell <1223799+Hotell@users.noreply.github.com>
|
@copilot this won't work because RIT actually remaps commands in template or rit.config.js to use explicit we would need to exapnd the rit configuration options with |
Agent-Logs-Url: https://github.com/microsoft/fluentui/sessions/038eaff4-ca57-4f02-8d5d-e25fb6f48798 Co-authored-by: Hotell <1223799+Hotell@users.noreply.github.com>
Done — removed |
The
react-major-versions-integrationCI job OOMs when Jest runs thereact-chartssuite via RIT — the D3 + VegaDeclarativeChart render load exhausts the default ~2 GB V8 heap on a single worker.Changes
.github/workflows/pr.yml: AddedNODE_OPTIONS: --max-old-space-size=4096as anenvvariable on the "React Versions Integration Tests (17,18) - Type-check & Test" step. This is inherited by all Node.js subprocesses (including Jest workers) spawned in that step, raising the V8 heap limit to 4 GB without requiring per-package config changes.The
rit.config.jsapproach was not used because RIT remaps commands to add its ownnode ../node_modules/.bin/prefix, making a custom command-based heap override ineffective.Original prompt
Problem
The
react-major-versions-integrationCI job is OOMing (JavaScript heap out of memory) when running Jest tests for thereact-chartspackage via the React Integration Tester (RIT) tool with React 17 and 18.The crash happens because the
react-chartstest suite is large and memory-intensive (D3 + React renders, VegaDeclarativeChart tests), and the default Node.js V8 heap limit (~2 GB) is hit by a single Jest worker process.The RIT template test command
jest --passWithNoTests -uhas no heap limit set, and modifying the shared templates to fix 1-2 packages is not desired.Solution
Add a
rit.config.jstopackages/charts/react-charts/library/that overrides the test command for both React 17 and 18 to raise the Node.js heap limit to 4096 MB usingnode --max-old-space-size=4096.This follows the existing per-project RIT override pattern used in the repo (e.g.
packages/react-components/react-provider/library/rit.config.js).File to create
Create
packages/charts/react-charts/library/rit.config.jswith the following content:No other files need to be changed.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: Now let me fetch the key files referenced in the errors:
Assistant: Looking at the logs and source files, there are two distinct failure categories:
Failure 1:
rejects excessively deep JSON specstest (line 1345)Root cause: The test at
VegaDeclarativeChart.test.tsx:1345callsexpect(...).toThrow('Maximum JSON depth exceeded'), but the error is being thrown inside React's render cycle — not caught synchronously by theexpectwrapper. React catches it internally and logs it as an unhandled exception (console.error), sotoThrow()never sees it.This happens because
validateJsonDepthis called inside the component body (line 398 ofVegaDeclarativeChart.tsx), which means React's error boundary / rendering pipeline intercepts it before Jest's.toThrow()can.Fix: Wrap
render(...)with@testing-library/react's recommended pattern for expecting render-time throws — use a try/catch or suppress the React error boundary noise. The most reliable fix is to wrap the render call so the error propagates correctly:Alternatively, move the validation before the component renders — e.g., validate in the parent or call
validateJsonDepthdirectly in the test to verify the utility itself: