Skip to content

Commit

Permalink
Merge pull request #27 from DoclerLabs/develop
Browse files Browse the repository at this point in the history
prepare 0.25.0
  • Loading branch information
aliokan authored Jun 27, 2017
2 parents fe1d14c + 3eefda8 commit 72f38e2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
17 changes: 11 additions & 6 deletions src/hex/unittest/notifier/ConsoleNotifier.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ class ConsoleNotifier implements ITestClassResultListener
{
var _tabs : String;
var _errorBubbling : Bool;
var _hideSuccessTest : Bool;

static var _TRACE : Dynamic = haxe.Log.trace;

public function new( errorBubbling : Bool = false )
public function new( errorBubbling : Bool = false, hideSuccessTest : Bool = false )
{
this._errorBubbling = errorBubbling;
this._hideSuccessTest = hideSuccessTest;
}

function _log( message : String ) : Void
Expand Down Expand Up @@ -81,11 +83,14 @@ class ConsoleNotifier implements ITestClassResultListener

public function onSuccess( descriptor : TestClassDescriptor, timeElapsed : Float ) : Void
{
var methodDescriptor = descriptor.currentMethodDescriptor();
var description = methodDescriptor.description;
var time = this.setColor( " " + timeElapsed + "ms", "green+bold" );
var message = "* [" + methodDescriptor.methodName + "] " + ( description.length > 0 ? description : "" ) + time;
this._log( this.setColor( message, "green" ) );
if( !this._hideSuccessTest )
{
var methodDescriptor = descriptor.currentMethodDescriptor();
var description = methodDescriptor.description;
var time = this.setColor( " " + timeElapsed + "ms", "green+bold" );
var message = "* [" + methodDescriptor.methodName + "] " + ( description.length > 0 ? description : "" ) + time;
this._log( this.setColor( message, "green" ) );
}
}

public function onFail( descriptor : TestClassDescriptor, timeElapsed : Float, error : Exception ) : Void
Expand Down
17 changes: 11 additions & 6 deletions src/hex/unittest/notifier/TraceNotifier.hx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ class TraceNotifier implements ITestClassResultListener

var _tabs : String;
var _errorBubbling : Bool;
var _hideSuccessTest : Bool;

#if flash
public function new( loaderInfo : LoaderInfo, errorBubbling : Bool = false )
public function new( loaderInfo : LoaderInfo, errorBubbling : Bool = false, hideSuccessTest : Bool = false )
{
this._errorBubbling = errorBubbling;
this._hideSuccessTest = hideSuccessTest;
loaderInfo.uncaughtErrorEvents.addEventListener( UncaughtErrorEvent.UNCAUGHT_ERROR, this._uncaughtErrorHandler );
}

Expand Down Expand Up @@ -131,11 +133,14 @@ class TraceNotifier implements ITestClassResultListener

public function onSuccess( descriptor : TestClassDescriptor, timeElapsed : Float ) : Void
{
var methodDescriptor = descriptor.currentMethodDescriptor();
var description = methodDescriptor.description;
var time = " " + timeElapsed + "ms";
var message = "* [" + methodDescriptor.methodName + "] " + ( description.length > 0 ? description : "" ) + time;
this._log( message );
if( !this._hideSuccessTest )
{
var methodDescriptor = descriptor.currentMethodDescriptor();
var description = methodDescriptor.description;
var time = " " + timeElapsed + "ms";
var message = "* [" + methodDescriptor.methodName + "] " + ( description.length > 0 ? description : "" ) + time;
this._log( message );
}
}

public function onFail( descriptor : TestClassDescriptor, timeElapsed : Float, error : Exception ) : Void
Expand Down
2 changes: 1 addition & 1 deletion test/MainUnitTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MainUnitTest
var emu = new ExMachinaUnitCore();

#if flash
emu.addListener( new TraceNotifier( Lib.current.loaderInfo ) );
emu.addListener( new TraceNotifier( Lib.current.loaderInfo, false, true ) );
#elseif js
emu.addListener( new ConsoleNotifier( false ) );
#else
Expand Down

0 comments on commit 72f38e2

Please sign in to comment.