You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular Jest单元测试遇JavaScript堆内存不足错误的解决方法

Angular项目Jest单元测试堆内存不足错误修复方案

在Angular项目中使用Jest执行单元测试时,若出现「Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory」(即JavaScript堆内存不足)错误,可使用以下已验证的命令修复:

node --max-old-space-size=8192 node_modules/jest/bin/jest --detectOpenHandles --coverage --reporters=jest-junit --coverageReporters=cobertura --coverageReporters=html

内容的提问来源于stack exchange,提问作者DaiDH

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 07:41:59