Skip to content

Buffers in object cause long to infinite hang #8669

Closed
@DaveStein

Description

@DaveStein

🐛 Bug Report

If I have a test failure with toBeCalledWith, it shows what was actually passed in vs what was expected. It appears that printing this out causes an issue when there is a Buffer.

When using fs.readFileSync to read out a long public PEM file for example, it seems to hang forever. I was able to replicate with an arbitrary string in a buffer of similar length. It seems at about 200 lines it starts to take a long time, and at the real length of 400, it fails for an indefinite period of time.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

The failure should show up with the same speed regardless of datatypes, possibly by truncating values, as console.log does when there is deep nesting.

Link to repl or repo (highly encouraged)

https://repl.it/repls/SuddenFrigidRegression
https://repl.it/repls/DelightfulColorfulScientificcomputing
This does not reproduce on the website, but it does on my local machine. It appears my local machine is on a later version of Node and Jest than the test site.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS 10.14.4
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 8.15.0 - ~/.nvm/versions/node/v8.15.0/bin/node
    Yarn: 1.3.2 - ~/.nvm/versions/node/v8.15.0/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v8.15.0/bin/npm
  npmPackages:
    jest: ^23.3.0 => 23.6.0 

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