Skip to content

A minimal reproduction repo for jest-worker "Do not know how to serialize a BigInt" issue

Notifications You must be signed in to change notification settings

klesun-productions/jest-bigint-worker-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Created for jestjs/jest#11617

Steps to reproduce the issue:

git clone [email protected]:klesun-productions/jest-bigint-worker-issue.git # clone this repo
cd jest-bigint-worker-issue
npm ci # install jest dependency
npm test # run the test that reproduces the issue

Expected behaviour: you should have seen assertion error informing you that expect(1n).toEqual(2n); expectation failed

Actual behaviour: you get following output due to an internal jest-worker error:

 PASS  tests/some-other.test.js
  ✓ should succeed (2 ms)

 FAIL  tests/bigint.test.js
  ● Test suite failed to run

    TypeError: Do not know how to serialize a BigInt
        at stringify (<anonymous>)

      at messageParent (node_modules/jest-worker/build/workers/messageParent.js:42:19)

Test Suites: 1 failed, 1 passed, 2 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.777 s

With no details of what the actual error that jest-worker tried to report was.

The code in messageParent.js that was supposed to report the assertion error fails itself on invocation of:

parentProcess.send([_types().PARENT_MESSAGE_CUSTOM, message]);

I assume that's because message includes failureDetails.matcherResult holding the compared bigint values that can't be passed to process.send(), as unlike worker_threads it does not support non-json values out of the box.

About

A minimal reproduction repo for jest-worker "Do not know how to serialize a BigInt" issue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published