lunarmodules / busted

Elegant Lua unit testing.
https://lunarmodules.github.io/busted/
MIT License
1.39k stars 184 forks source link

module 'system' not found error when running `busted -c` #650

Closed dbalatero closed 3 years ago

dbalatero commented 3 years ago

When running busted -c I get a failure to find the system module:

╰ busted -c
/usr/local/opt/lua/bin/lua5.3: /usr/local/share/lua/5.3/busted/core.lua:6: module 'system' not found:No LuaRocks module found for system
        no field package.preload['system']
        no file '/usr/local/share/lua/5.3/system.lua'
        no file '/usr/local/share/lua/5.3/system/init.lua'
        no file '/usr/local/lib/lua/5.3/system.lua'
        no file '/usr/local/lib/lua/5.3/system/init.lua'
        no file './system.lua'
        no file './system/init.lua'
        no file '/Users/dbalatero/.luarocks/share/lua/5.3/system.lua'
        no file '/Users/dbalatero/.luarocks/share/lua/5.3/system/init.lua'
        no file '/usr/local/lib/lua/5.3/system.so'
        no file '/usr/local/lib/lua/5.3/loadall.so'
        no file './system.so'
        no file '/Users/dbalatero/.luarocks/lib/lua/5.3/system.so'
stack traceback:
        [C]: in function 'require'
        /usr/local/share/lua/5.3/busted/core.lua:6: in main chunk
        [C]: in function 'require'
        /usr/local/share/lua/5.3/busted/runner.lua:18: in function 'busted.runner'
        /usr/local/lib/luarocks/rocks-5.3/busted/2.0.0-1/bin/busted:3: in main chunk
        [C]: in ?

In core.lua, this is referenced:

  busted.gettime = system.gettime
  busted.monotime = system.monotime
  busted.sleep = system.sleep

What is the system module and how do I install it?

Sidenote: Is Lua packaging just super gross compared to other ecosystems, or am I doing something wrong? I feel like every package I install, I have to play dependency whack-a-mole.

dbalatero commented 3 years ago

Also I cannot find any documentation on Google relevant to monotime, gettime, or sleep that would point me at a module called system.

dbalatero commented 3 years ago

Ok I found it - luarocks install luasystem - but why didn't luarocks do the right thing with these dependencies?

https://github.com/Olivine-Labs/busted/blob/master/busted-scm-2.rockspec#L20-L31

DorianGray commented 3 years ago

how did you install busted?

dbalatero commented 3 years ago

I think I just did luarocks install busted?

I did fix everything ultimately by manually installing everything in the rockspec file with luarocks install <pkg>

alerque commented 3 years ago

I think I just did luarocks install busted?

It doesn't sound like it. That should have installed the dependency tree too. The Lua package ecosystem has more rough edges than some, but it isn't quite that dumb. It sounds like something probably errored out in the install and you didn't notice ... or perhaps you ran the install with --no-deps?

Also, depending on your project and system usage of course you might look into whether your system/distro has packages. It can be useful to have busted around as a system binary to easily run on projects without having to install dev dependencies every time.

dbalatero commented 3 years ago

The Lua package ecosystem has more rough edges than some, but it isn't quite that dumb.

Yeah this was definitely my surprised thought as well.

I got my dependencies from this script originally which just runs luarocks install pkg, although it's been a while since I ran it. https://github.com/dbalatero/VimMode.spoon/blob/4dad48dd22c79beb20ee2cc08f1e2af9f1cc5b52/bin/dev-setup#L1-L43

Maybe I'll try a clean install of luarocks and see if I hit the same problem, but I think we can close this.