aboutsummaryrefslogtreecommitdiff
path: root/third-party/utfTerminalDetailed.lua
blob: 4d7a7c1d6fcc2c07764dcd2ccd3b8844167499d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- busted output handler that immediately prints file and test names before
-- tests are executed. It simplifies identifying which tests are
-- hanging/crashing
local ansicolors = require 'ansicolors'

return function(options, busted)
  local handler = require 'busted.outputHandlers.utfTerminal'(options, busted)

  handler.fileStart = function(name)
    io.write('\n' .. ansicolors('%{cyan}' .. name) .. ':')
  end

  handler.testStart = function(element, parent, status, debug)
    io.write('\n  ' .. handler.getFullName(element) .. ' ... ')
    io.flush()
  end

  busted.subscribe({ 'file', 'start' }, handler.fileStart)
  busted.subscribe({ 'test', 'start' }, handler.testStart)

  return handler
end