Give more details on unit test output
This adds an output handler for Busted which reuses the built-in "utfTerminal" handler, and augments it by showing the name of each suite/test as it is run.
This commit is contained in:
28
spec/detailUtfTerm.lua
Normal file
28
spec/detailUtfTerm.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
#! /usr/bin/env lua
|
||||
--
|
||||
-- detailUtfTerm.lua
|
||||
-- Copyright (C) 2016 Adrian Perez <aperez@igalia.com>
|
||||
--
|
||||
-- Distributed under terms of the MIT license.
|
||||
--
|
||||
|
||||
local colors = require 'term.colors'
|
||||
|
||||
return function(options)
|
||||
local busted = require 'busted'
|
||||
local handler = require 'busted.outputHandlers.utfTerminal' (options)
|
||||
|
||||
handler.fileStart = function(element)
|
||||
io.write("\n" .. colors.cyan(handler.getFullName(element)) .. ':')
|
||||
end
|
||||
|
||||
handler.testStart = function(element, parent, status, debug)
|
||||
io.write('\n ' .. handler.getFullName(element) .. '\r ')
|
||||
io.flush()
|
||||
end
|
||||
|
||||
busted.subscribe({ 'file', 'start' }, handler.fileStart)
|
||||
busted.subscribe({ 'test', 'start' }, handler.testStart)
|
||||
|
||||
return handler
|
||||
end
|
||||
Reference in New Issue
Block a user