Search code examples
npmjestjsgitlab-cigitlab-ci-runnerts-jest

Gitlab - jest test - Segmentation fault (core dumped)


In the GitLab Runner,
After all the npm modules are installed,
Jest is ran for all the unit tests that are in Typescript.

The Jest Command is:

jest ./API/* --verbose --coverage --detectOpenHandles --bail --ci

This is the error:

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

Thats the end of the script, So the tests pass, but then it fails afterwards because of the Segmentation fault (core dumped)

Just before the test start, the memory is this:

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

How would I fix this?


Solution

  • In Jest, if you use --detectOpenHandles it will try to look up open handles that gitlab doesn't allow you to.

    When you are running Jest. Just make sure you don't use this flag and they should work!