jest 工作进程被另一个进程终止

Rad*_*rni 22 linux jestjs

当我构建应用程序时,出现以下错误。

Test suite failed to run

  A jest worker process (pid=2439) was terminated by another process: signal=SIGKILL, exitCode=null. Operating system logs may contain more information on why this occurred.
    at ChildProcessWorker._onExit (node_modules/jest-worker/build/workers/ChildProcessWorker.js:366:23)
Run Code Online (Sandbox Code Playgroud)

您能否建议如何检查 Linux 系统上的操作系统日志以及如何解决此问题?

Bar*_*jen 14

临时解决方法是使用这两个参数运行 jest,--runInBand --no-cache以串行运行所有测试(较慢)并每次都使用干净的缓存(也较慢)。但至少测试运行了。

仅供参考,我习惯NODE_OPTIONS=--experimental-vm-modules将 ESM 模块与ts-jest. 不确定这是否会导致不稳定。

  • `--runInBand` 解决了这个问题,不需要 `--no-cache`,也不需要 `--experimental-vm-modules` 除非你需要使用 ESM (3认同)