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:
Adrian Perez de Castro
2016-07-10 01:48:37 +03:00
parent 0422c47178
commit 2316b25317
2 changed files with 29 additions and 0 deletions

28
spec/detailUtfTerm.lua Normal file
View 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