lunarmodules / busted

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

No coverage report #539

Closed jaythomas closed 7 years ago

jaythomas commented 7 years ago

Using 2.0.rc12-1, I am trying to generate a coverage report like so: busted --coverage. There are no error messages, no unusual output in the terminal or coverage report file output indicating this is even being called.

My .busted config looks like this:

return {
  default = {
    coverage = true,
    loaders = { 'lua' },
    output = 'utfTerminal',
    pattern = '.spec.lua',
    ROOT = { '.' },
    verbose = true
  }
}

Here is my Dockerfile show that I have the luacov rock installed, which can be accessed from the command line as well:

$ docker run container1 luacov --help                      
LuaCov 0.12.0 - coverage analyzer for Lua scripts
AlexandreRio commented 7 years ago

I never used the --coverage option but it seems that it creates a luacov.stats.out file. Maybe your output is not printed in the standard output but only into a file.

Tieske commented 7 years ago

I think @AlexandreRio is right that it only generates the statistics, but not the reports. For that you would probably have to use the LuaCov tools directly

jaythomas commented 7 years ago

Thanks guys. I went back to this code base from my original comment and tried to replicate the issue I was having, which I remember there being no output file. However, I was not able to replicate the issue as luacov.stats.out is being output as expected. I'm guessing there was some other factor or human error involved.

I would like to point out that at the time I didn't know what and where the output was being generated as I couldn't find any mention in the docs (https://olivinelabs.com/busted/). Perhaps I'll contribute to the docs and add a mention of the output file or a link to luacov's docs where they mention it.

For future reference to anyone else having an issue with coverage, here's my travis config for reference. I'm now having an issue where the stats.out doesn't provide a total coverage for coveralls to report, but that issue may also be something outside of Busted's realm, or at least out of the scope of this issue.

Closing this. Thanks again.