[#25] Tests with no assertions will be marked incomplete
parent
fdf630458a
commit
6fd7ae8953
|
@ -25,6 +25,7 @@
|
||||||
var assert = require( 'assert' ),
|
var assert = require( 'assert' ),
|
||||||
assert_wrapped = {},
|
assert_wrapped = {},
|
||||||
acount = 0,
|
acount = 0,
|
||||||
|
icount = 0,
|
||||||
|
|
||||||
// when set to true, final statistics will be buffered until suite ends
|
// when set to true, final statistics will be buffered until suite ends
|
||||||
suite = false,
|
suite = false,
|
||||||
|
@ -84,7 +85,10 @@ function incAssertCount()
|
||||||
module.exports = function( test_case )
|
module.exports = function( test_case )
|
||||||
{
|
{
|
||||||
var context = prepareCaseContext(),
|
var context = prepareCaseContext(),
|
||||||
setUp = test_case.setUp;
|
setUp = test_case.setUp,
|
||||||
|
|
||||||
|
acount_last = 0
|
||||||
|
;
|
||||||
|
|
||||||
// if we're not running a suite, clear out the failures
|
// if we're not running a suite, clear out the failures
|
||||||
if ( !( suite ) )
|
if ( !( suite ) )
|
||||||
|
@ -108,12 +112,24 @@ module.exports = function( test_case )
|
||||||
setUp.call( context );
|
setUp.call( context );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acount_last = acount;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
test_case[ test ].call( context );
|
test_case[ test ].call( context );
|
||||||
|
|
||||||
scount++;
|
// if there were no assertions, then the test should be marked as
|
||||||
testPrint( '.' );
|
// incomplete
|
||||||
|
if ( acount_last === acount )
|
||||||
|
{
|
||||||
|
testPrint( 'I' );
|
||||||
|
icount++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scount++;
|
||||||
|
testPrint( '.' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch ( e )
|
catch ( e )
|
||||||
{
|
{
|
||||||
|
@ -137,8 +153,7 @@ module.exports = function( test_case )
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
failures = [];
|
failures = [];
|
||||||
scount = 0;
|
scount = acount = icount = 0;
|
||||||
acount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,7 +173,8 @@ function endStats()
|
||||||
testPrint(
|
testPrint(
|
||||||
( ( failures.length ) ? "FAILED" : "OK" ) + " - " +
|
( ( failures.length ) ? "FAILED" : "OK" ) + " - " +
|
||||||
scount + " successful, " + failures.length + " failure(s), " +
|
scount + " successful, " + failures.length + " failure(s), " +
|
||||||
( scount + failures.length ) + " total " +
|
( ( icount > 0 ) ? icount + ' incomplete, ' : '' ) +
|
||||||
|
( scount + icount + failures.length ) + " total " +
|
||||||
'(' + acount + " assertion" + ( ( acount !== 1 ) ? 's' : '' ) + ")\n"
|
'(' + acount + " assertion" + ( ( acount !== 1 ) ? 's' : '' ) + ")\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue