Jest: Maximum call stack size exceeded

Created on 17 Oct 2019  路  4Comments  路  Source: facebook/jest

馃悰 Bug Report

When running acceptance tests, I am sometimes getting a maximum call stack size error.

RangeError: Maximum call stack size exceeded
        at Function.[Symbol.hasInstance] (<anonymous>)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:200:14)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)
      at WriteStream (node_modules/graceful-fs/graceful-fs.js:201:29)

To Reproduce

Sorry, but I cannot reproduce it 100%. It sometimes happens when I create a writable stream:

const fs = require('fs');

describe('xxx', () => {
  it('will sometimes exit on max call stack', () => {
    fs.createWriteStream('test.log', { flags: 'a' })
  })
})

Expected behavior

Does not crash on max. call stack.

Link to repl or repo (highly encouraged)

It seems to sometimes reproduce on this repository:
https://github.com/alesmenzel/churchill

when running the npm run test:acceptance -- file
here is a screenshot from travis-ci running the tests ( https://prnt.sc/pkr5zy )

envinfo

System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Binaries:
    Node: 12.12.0 - ~/.nvm/versions/node/v12.12.0/bin/node
    Yarn: 1.17.3 - ~/.nvm/versions/node/v10.16.0/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v12.12.0/bin/npm
  npmPackages:
    jest: ^24.9.0 => 24.9.0
Bug Report Needs Repro Needs Triage

All 4 comments

Looks like this was resolved in v4.2.3 of graceful-fs: https://github.com/isaacs/node-graceful-fs/issues/174

@SimenB Could a new version be released with this fix? It is breaking my React Native Android app build randomly

Would also like a patch release with this fix as we have some tests crashing out because of this.

+1
If it helps, I tried a second time npm i --save-dev jest and it worked this time,

Was this page helpful?
0 / 5 - 0 ratings