Skip to content

Segmentation fault - Test fails when using Vitest, but passes when using Jest #5730

@Newbie012

Description

@Newbie012

Describe the bug

When testing a module from libpg-query, the test passes but at the end of the execution I get "Segmentation fault" with an exit code 139:

 RUN  v1.[6](https://github.com/Newbie012/test-libpg-query-seg-fault/actions/runs/9092913524/job/24990698769#step:6:6).0 /home/runner/work/test-libpg-query-seg-fault/test-libpg-query-seg-fault
 ✓ vitest.test.ts  (1 test) 1ms
 Test Files  1 passed (1)
      Tests  1 passed (1)
   Start at  09:03:23
   Duration  249ms (transform 31ms, setup 0ms, collect 22ms, tests 1ms, environment 0ms, prepare [7](https://github.com/Newbie012/test-libpg-query-seg-fault/actions/runs/9092913524/job/24990698769#step:6:8)0ms)
Segmentation fault (core dumped)
 ELIFECYCLE  Command failed with exit code 139.
Error: Process completed with exit code 139.

When running the same file (but with @jest/globals), I get:

PASS ./jest.test.ts
  ✓ should not throw segfault (4 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.506 s
Ran all test suites matching /jest/i.

Additional Info

Reproduction

  1. git clone [email protected]:Newbie012/test-libpg-query-seg-fault.git
  2. pnpm install
  3. pnpm test:vitest (see error)

System Info

System:
    OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD EPYC 7763 64-Core Processor
    Memory: 14.62 GB / 15.61 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.12.2 - /opt/hostedtoolcache/node/20.12.2/x64/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.5.0 - /opt/hostedtoolcache/node/20.12.2/x64/bin/npm
    pnpm: 8.15.8 - ~/setup-pnpm/node_modules/.bin/pnpm
  Browsers:
    Chrome: 124.0.6367.60
    Chromium: 124.0.6367.0

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions