Gitlab - 玩笑测试 - 分段错误(核心转储)

Gitlab - jest test - Segmentation fault (core dumped)

在 GitLab Runner 中,
安装完所有 npm 模块后,
对于 Typescript 中的所有单元测试,Jest 是 运行。

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 不允许您查找的打开句柄。

当你运行开玩笑的时候。只要确保你不使用这个标志,它们应该可以工作!