Skip to content

Commit

Permalink
Merge pull request #577 from Tieske/luacov-mandatory
Browse files Browse the repository at this point in the history
fix(cli) fail if LuaCov is specified but unavailable
  • Loading branch information
ajacksified authored Jul 20, 2018
2 parents 997514a + 6367736 commit 10f3fff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion busted/modules/luacov.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return function()
local result, luacov = pcall(require, 'luacov.runner')

if not result then
return print('LuaCov not found on the system, try running without --coverage option, or install LuaCov first')
return nil, 'LuaCov not found on the system, try running without --coverage option, or install LuaCov first'
end

-- call it to start
Expand All @@ -16,6 +16,7 @@ return function()
table.insert(luacov.configuration.exclude, 'luassert%.')
table.insert(luacov.configuration.exclude, 'say%.')
table.insert(luacov.configuration.exclude, 'pl%.')
return true
end

return loadLuaCov
Expand Down
6 changes: 5 additions & 1 deletion busted/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ return function(options)

-- If coverage arg is passed in, load LuaCovsupport
if cliArgs.coverage then
luacov()
local ok, err = luacov()
if not ok then
io.stderr:write(appName .. ': error: ' .. err .. '\n')
exit(1, forceExit)
end
end

-- If auto-insulate is disabled, re-register file without insulation
Expand Down

0 comments on commit 10f3fff

Please sign in to comment.