Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: toEqual() fails jest-worker with "Do not know how to serialize a BigInt" when reporting a failed test #12377

Closed
jstritch opened this issue Feb 12, 2022 · 5 comments

Comments

@jstritch
Copy link

jstritch commented Feb 12, 2022

Version

27.4.7

Steps to reproduce

expect(BigInt(0)).not.toEqual(BigInt(0));

Expected behavior

  1. The expectation should produce the typical expected/received message.

  2. When an individual test fails catastrophically, the failing test should be identified to the user and the entire suite should continue with any remaining tests.

Actual behavior

Summary of all failing tests
FAIL  tests/parsers.test.ts
● 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:34:19)

Test Suites: 1 failed, 46 passed, 47 total
Tests:       285 passed, 285 total
Snapshots:   0 total
Time:        9.718 s, estimated 10 s
Ran all test suites.

Additional context

Possibly related issues:

Environment

System:
    OS: Linux 5.13 Linux Mint 20.3 (Una)
    CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
  Binaries:
    Node: 14.19.0 - /usr/bin/node
    npm: 8.4.1 - /usr/bin/npm
  npmPackages:
    jest: ^27.4.7 => 27.4.7
@SimenB
Copy link
Member

SimenB commented Feb 15, 2022

Duplicate of #11617

@SimenB SimenB marked this as a duplicate of #11617 Feb 15, 2022
@SimenB SimenB closed this as completed Feb 15, 2022
@jstritch
Copy link
Author

Please respond to my second expectation. It would have been easier for me to track down if the test name was included with the other information. Is it possible to add a catch handler inside the loop running the individual tests?

@SimenB
Copy link
Member

SimenB commented Feb 15, 2022

This actually fails outside of the context of a single test (it fails when jest tries to pass the test result from a separate thread/process back to the main process), so we don't know which specific test failure caused this error.

I hope to address this issue in Jest 28 (see #11467 (comment) for latest info)

@jstritch
Copy link
Author

If no object has both the test name and result to format at the same time, is it possible to pass the test name along to include in the error message?

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants