This is a compliment to the done() function, except it fails the test case.
This is useful for situations where you want to fail a test case if a callback is called.
For example, if you were going to test http.Fetch:
{
name = "http.Fetch doesn't fail",
async = true,
timeout = 3,
func = function()
http.Fetch( "url", function( body ) expect( #body ).to.equal( 1024 ) end, fail )
end
}
Without the fail function, you would need to intentionally throw an error or fail an expectation inside the failure callback (and wait for the timeout to actually finish the test).
(This also fixes an issue where test groups would stop running if the per-group timeout was hit)
This is a compliment to the
done()
function, except it fails the test case.This is useful for situations where you want to fail a test case if a callback is called. For example, if you were going to test
http.Fetch
:Without the
fail
function, you would need to intentionally throw anerror
or fail an expectation inside the failure callback (and wait for the timeout to actually finish the test).(This also fixes an issue where test groups would stop running if the per-group timeout was hit)