lunarmodules / busted

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

A typo in .busted makes the file silently ignored #597

Closed mkpankov closed 5 years ago

mkpankov commented 5 years ago

It makes it hard to understand why options from .busted are ignored.

Tieske commented 5 years ago

what typos? can you provide a minimal example?

mkpankov commented 5 years ago

Basically any typo:

➜  test_suites git:(lua-tests) ✗ cat .busted
return {
  _all = {
    coverage = tru
  }
}
➜  test_suites git:(lua-tests) ✗ busted .
●
1 success / 0 failures / 0 errors / 0 pending : 0.003184 seconds
➜  test_suites git:(lua-tests) ✗ ls luacov.stats.out
ls: cannot access 'luacov.stats.out': No such file or directory

My main concern is absence of error/warning from busted when .busted is invalid syntactically.

Tieske commented 5 years ago

thing is in this case; it is syntactically correct. In this case you're accessing a global named tru. Since it's undefined, the result is nil, and hence it is falsy, and no coverage report is ran.

mkpankov commented 5 years ago

Well, real syntax error isn't reported too:

return {
  _all = {
    coverage = false
  }
Tieske commented 5 years ago

fix in #600