You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jest fails when a second test file requires (directly or indirectly) the ffi module. This happens when jest is executed without the --no-cache flag. It happens with and without the --no-cache flag when running with --runInBand.
To Reproduce
Run jest, jest --runInBand or jest --runInBand --no-cache with the following two test files.
Note: When using jest the first execution will success, subsequent ones will fail.
const ffi = require("ffi");
it("m1", () => {});
const ffi = require("ffi");
it("m2", () => {});
$ jest
PASS ./m1_tests.js
FAIL ./m2_tests.js
● Test suite failed to run
RangeError: Maximum call stack size exceeded
at debug (node_modules/debug/src/debug.js:1:1)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 2.743s
The real world test case provided a bit more context that might be helpful. I am not sure why it did not
show up in the reduced example.
FAIL test\integration\integration_tests.js
● Test suite failed to run
RangeError: Maximum call stack size exceeded
at debug (node_modules/debug/src/debug.js:65:17)
at Object.writePointer [as _writePointer] (node_modules/ref/lib/ref.js:746:3)
at Object.writePointer [as _writePointer] (node_modules/ref/lib/ref.js:747:11)
at Object.writePointer [as _writePointer] (node_modules/ref/lib/ref.js:747:11)
...
at Object.writePointer [as _writePointer] (node_modules/ref/lib/ref.js:747:11)
Test Suites: 2 failed, 2 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 24.99s
Ran all test suites matching "integration".
$ jest --no-cache
PASS ./m1_tests.js
PASS ./m2_tests.js
Test Suites: 2 passed, 2 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 3.332s
Ran all test suites.
Done in 4.41s.
This is a known bug, which we don't have a fix for yet, see: #3552. Any help on the topic appreciated.
Closing as a duplicate (feel free to add your case to linked issue).
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.
🐛 Bug Report
Jest fails when a second test file requires (directly or indirectly) the
ffi
module. This happens when jest is executed without the--no-cache
flag. It happens with and without the--no-cache
flag when running with--runInBand
.To Reproduce
Run
jest
,jest --runInBand
orjest --runInBand --no-cache
with the following two test files.Note: When using
jest
the first execution will success, subsequent ones will fail.The real world test case provided a bit more context that might be helpful. I am not sure why it did not
show up in the reduced example.
Ref: https://ci.appveyor.com/project/havardh/workflow/build/1.0.371#L147
Expected behavior
Passing tests as
jest --no-cache
provides.Link to repo
https://github.com/havardh/jest-require-ffi
Envinfo
The text was updated successfully, but these errors were encountered: