-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Jest interferes with file reading in Fengari Lua runtime #10368
Comments
TL;DR: I am experiencing probably the same problem with jest. Jest versions: I tried to debug this problem a bit and the problem starts to appear at the return code of Digging a bit deeper the difference between running under Jest and running directly under node is the result of a type check here: https://github.com/fengari-lua/fengari/blob/dfdd62974fe6044f2c947a17be206c83edcd1f1a/src/lzio.js#L53 The context is that the ZIO class (just above in the code) is some buffered reader. If it hits the end of its internal buffer it tries to fill it by calling Sure enough if you google for the problem, you end up at #4422
|
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
🐛 Bug Report
I wrote some tests around node code that uses the Fengari Lua runtime to run Lua code in JS. This works well, except when trying to load files in the Lua runtime. Outside of Jest (running the tests in the node jasmine runner) this code works. But inside jest, non-empty files fail to load (even if they only have whitespace) with Lua not even reporting an error message (like it usually does). My suspicion is that this has something to do with how jest isolates the global environment, maybe even isolating file handles or file buffers? While debugging the issue I noticed some file buffers did not reflect my file's contents. However, I'm not familiar enough with what magic Jest does to figure it out on my own.
I also created an issue with Fengari: fengari-lua/fengari#182
To Reproduce
Steps to reproduce the behavior:
Try loading a lua file through Fengari in a Jest test:
file
./test-load.lua
The result I get back is error code 2, with a null message
Expected behavior
Test passes: The result of the Lua script is returned to the jest test. (As it is with jasmine).
envinfo
jest.config.js:
The text was updated successfully, but these errors were encountered: