Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Commit 4351dd9

Browse files
committed
fixed a few bugs related to error reporting. Removed async and made tests pending until I can come up with a clean way of re-implementing it. Current implementation of async did not play nice with output handlers
1 parent 3082045 commit 4351dd9

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

bin/busted

+5-4
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ cli:add_flag('--suppress-pending', 'suppress `pending` test output')
4747
cli:add_flag('--defer-print', 'defer print to when test suite is complete')
4848

4949
-- Parse the cli arguments
50-
local cliArgs, error = cli:parse()
51-
if error then
50+
local cliArgs, hasError = cli:parse()
51+
if hasError then
5252
os.exit(1)
5353
end
5454

@@ -181,14 +181,16 @@ testFileLoader(rootFile, pattern)
181181
local failures = 0
182182
local errors = 0
183183

184-
busted.subscribe({ 'error' }, function()
184+
busted.subscribe({ 'error' }, function(...)
185185
errors = errors + 1
186+
return nil, true
186187
end)
187188

188189
busted.subscribe({ 'test', 'end' }, function(element, parent, status)
189190
if status == 'failure' then
190191
failures = failures + 1
191192
end
193+
return nil, true
192194
end)
193195

194196
busted.publish({ 'suite', 'start' })
@@ -199,5 +201,4 @@ local exit = 0
199201
if failures > 0 or errors > 0 then
200202
exit = 1
201203
end
202-
203204
os.exit(exit)

busted/init.lua

-13
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,6 @@ return function(busted)
9898
busted.publish({ 'test', 'end' }, pending, busted.context.parent(pending), 'pending', trace)
9999
end
100100

101-
local async = function()
102-
local parent = busted.context.get()
103-
if not parent.env then parent.env = {} end
104-
105-
parent.env.done = require 'busted.done'.new(function()
106-
busted.publish({ 'test', 'end' }, it, parent, 'success')
107-
if finally then busted.safe('finally', finally, it) end
108-
dexecAll('after_each', parent, true)
109-
end)
110-
end
111-
112101
busted.register('file', file)
113102

114103
busted.register('describe', describe)
@@ -117,8 +106,6 @@ return function(busted)
117106
busted.register('it', it)
118107
busted.register('pending', pending)
119108

120-
busted.context.get().env.async = async
121-
122109
busted.register('setup')
123110
busted.register('teardown')
124111
busted.register('before_each')

spec/async_spec.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe('testing the done callback with tokens', function()
1+
pending('testing the done callback with tokens', function()
22

33
it('Tests done call back ordered', function()
44
async()
@@ -49,7 +49,7 @@ describe('testing the done callback with tokens', function()
4949
end)
5050
end)
5151

52-
describe('testing done callbacks being provided for async tests', function()
52+
pending('testing done callbacks being provided for async tests', function()
5353
setup(function()
5454
async()
5555
assert.is_table(done)

0 commit comments

Comments
 (0)