在 GitLab Runner 中,
安装完所有 npm 模块后,
Jest 针对 Typescript 中的所有单元测试运行。
Jest 命令是:
jest ./API/* --verbose --coverage --detectOpenHandles --bail --ci
这是错误:Test Suites: 6 passed, 6 total
Tests: 10 passed, 10 total
Snapshots: 1 passed, 1 total
Time: 22.953 s
Ran all test suites matching ./API/**.
Segmentation fault (core dumped)
Cleaning up file based variables
ERROR: Job failed: exit code 1
这就是脚本的结尾,所以测试通过了,但是之后由于 Segmentation fault (core dumped)
失败了就在测试开始之前,内存是这样的:
MEMORY UPDATE
total used free shared buff/cache available
Mem: 3693 519 338 199 2836 2695
Filesystem Size Used Avail Use% Mounted on
overlay 22G 6.9G 15G 33% /
CPU(s): 1
我将如何解决这个问题?
最佳答案
在 Jest 中,如果您使用 --detectOpenHandles
它将尝试查找 gitlab 不允许您查找的打开句柄。
当您运行 Jest 时。只要确保您不使用此标志,它们就可以工作!
关于npm - Gitlab - 开 Jest 测试 - 段错误(核心转储),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68012814/