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

Lua preloaded code not preloaded #313

Open
slashOwO opened this issue Jul 6, 2024 · 3 comments
Open

Lua preloaded code not preloaded #313

slashOwO opened this issue Jul 6, 2024 · 3 comments

Comments

@slashOwO
Copy link

slashOwO commented Jul 6, 2024

Describe the bug
In Lua, if the test case doesn't include require "setup", the preloaded code will not be preloaded. Even if require "setup" is included, functions like describe or it will not be be accessible.

To Reproduce
Without require "setup"
With require "setup"

Expected behavior
The preloaded code should preloaded correctly.

@hobovsky
Copy link

hobovsky commented Jul 6, 2024

Does anything else than it and describe work when put in preloaded? Preloaded is not meant to hold elements of tests, like test groups or test cases. I am not yet sure if the behavior of preloaded you see is wrong or not, but definitely having it in preloaded does not sound right.

@slashOwO
Copy link
Author

slashOwO commented Jul 7, 2024

Does anything else than it and describe work when put in preloaded?
Anything that isn't from busted works fine. The behavior is like require "solution"

Preloaded is not meant to hold elements of tests
There are katas that hold test elements in the preloaded code. For example, this one.

@hobovsky
Copy link

hobovsky commented Jul 7, 2024

I am not very familiar with LUA and its module loading mechanisms, and I did not manage to figure out how to make busted visible in the preloaded snippet. But that being said, I would say that the test suite you showed as an example is not built correctly and would have to be fixed. It makes a bunch of incorrect assumptions about CW testing in general, about how Busted works, and about LUA setup on Codewars. I would recommend against following the patterns presented in this test suite, and focus on doing things properly: code of tests belongs to tests snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants