lunarmodules / busted

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

[help needed] fails to execute as a standalone file #726

Closed mb6ockatf closed 1 year ago

mb6ockatf commented 1 year ago

hello. i am trying to run busted with my tests. here's my directory (unrelated files removed):

.
├── config.ld
├── docs
│   ├── index.html
│   └── ldoc.css
├── lfr-1.0-1.rockspec
├── main.lua
├── README.md
├── style
│   └── ldoc.css
└── test.lua

.busted contents are:

return {
    _all = {
    shuffle = true,
    coverage = true
    }
}

whenever i run lua test.lua or ./test.lua, i get this error:

lua: test.lua:41: module 'busted.runner' not found:
        no field package.preload['busted.runner']
        no file '/usr/share/lua/5.4/busted/runner.lua'
        no file '/usr/share/lua/5.4/busted/runner/init.lua'
        no file '/usr/lib/lua/5.4/busted/runner.lua'
        no file '/usr/lib/lua/5.4/busted/runner/init.lua'
        no file './busted/runner.lua'
        no file './busted/runner/init.lua'
        no file '/usr/lib/lua/5.4/busted/runner.so'
        no file '/usr/lib/lua/5.4/loadall.so'
        no file './busted/runner.so'
        no file '/usr/lib/lua/5.4/busted.so'
        no file '/usr/lib/lua/5.4/loadall.so'
        no file './busted.so'
stack traceback:
        [C]: in function 'require'
        test.lua:41: in main chunk
        [C]: in ?

busted . fails to run with this error:

Error → No test files found matching Lua pattern: _spec

i tried installing busted from github, luarocks and archlinux repositories. tried reinstalling penlight, without any success.

please, people, help me. i've been struggling with it all day long

alerque commented 1 year ago

Whatever is in your test.lua file is probably to blame, can you show that?

Also what happens if you run that file with busted test.lua?

mb6ockatf commented 1 year ago

for no reason, now works fine. i'm reeealy surprised - never experienced this thing before. i changed nothing in test.lua. seems to be something to deal with my computer (on other one it has been working nice) thank you, @alerque, for your reply