test(analyze): stabilize NODE_OPTIONS restoration in respawn specs

Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/1283207f-60bc-47b1-b4ee-3fbc42e23f5d

Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-17 10:41:04 +00:00
committed by GitHub
co-authored by magyargergo
parent e298c8c0cf
commit cd4063acd5
@@ -19,9 +19,10 @@ vi.mock('../../src/core/lbug/lbug-adapter.js', () => ({
}));
describe('analyzeCommand heap respawn', () => {
const initialNodeOptions = process.env.NODE_OPTIONS;
let initialNodeOptions: string | undefined;
beforeEach(() => {
initialNodeOptions = process.env.NODE_OPTIONS;
vi.resetModules();
execFileSyncMock.mockReset();
getHeapStatisticsMock.mockReset();
@@ -71,6 +72,8 @@ describe('analyzeCommand heap respawn', () => {
const { analyzeCommand } = await import('../../src/cli/analyze.js');
await analyzeCommand(undefined, {});
// Signal-only child failures do not carry a numeric status, so the CLI
// falls back to exit code 1.
expect(process.exitCode).toBe(1);
const oomGuidance = cap.records().find((r) => r.msg.includes('Analysis likely ran out of memory.'));
expect(oomGuidance).toBeDefined();