Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.69 KB

README.md

File metadata and controls

44 lines (31 loc) · 1.69 KB

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.