1- angular [ 'scenario' ] = ( angular [ 'scenario' ] = { } ) ;
2- angular . scenario [ 'dsl' ] = ( angular . scenario [ 'dsl' ] = { } ) ;
1+ angular [ 'scenario' ] = angular [ 'scenario' ] || ( angular [ 'scenario' ] = { } ) ;
2+ angular . scenario [ 'dsl' ] = angular . scenario [ 'dsl' ] || ( angular . scenario [ 'dsl' ] = { } ) ;
33
44angular . scenario . Runner = function ( scope , jQuery ) {
55 var self = scope . $scenario = this ;
66 this . scope = scope ;
77 this . jQuery = jQuery ;
8- angular . extend ( scope , angular . scenario . dsl ) ;
98
109 var specs = this . specs = { } ;
1110 var path = [ ] ;
@@ -30,7 +29,7 @@ angular.scenario.Runner = function(scope, jQuery){
3029 self . currentSpec = null ;
3130 } ;
3231 this . logger = function returnNoop ( ) {
33- return angular . extend ( returnNoop , { close :angular . noop , fail :angular . noop } ) ; ;
32+ return _ ( returnNoop ) . extend ( { close :_ . identity , fail :_ . identity } ) ; ;
3433 } ;
3534} ;
3635
@@ -60,7 +59,7 @@ angular.scenario.Runner.prototype = {
6059 var element = jQuery ( '<li class="running ' + type + '"><span></span></li>' ) ;
6160 element . find ( 'span' ) . text ( text ) ;
6261 container . append ( element ) ;
63- return angular . extend ( logger ( element ) , {
62+ return _ ( logger ( element ) ) . extend ( {
6463 close : function ( ) {
6564 element . removeClass ( 'running' ) ;
6665 if ( ! element . hasClass ( 'fail' ) )
@@ -81,7 +80,7 @@ angular.scenario.Runner.prototype = {
8180 }
8281 this . logger = logger ( console ) ;
8382 var specNames = [ ] ;
84- angular . foreach ( this . specs , function ( spec , name ) {
83+ _ ( this . specs ) . each ( function ( spec , name ) {
8584 specNames . push ( name ) ;
8685 } , this ) ;
8786 specNames . sort ( ) ;
@@ -109,7 +108,7 @@ angular.scenario.Runner.prototype = {
109108 result . passed = false ;
110109 result . failed = true ;
111110 result . error = error ;
112- result . log ( 'fail' , angular . isString ( error ) ? error : angular . toJson ( error ) ) . fail ( ) ;
111+ result . log ( 'fail' , _ ( error ) . isString ( ) ? error : toJson ( error ) ) . fail ( ) ;
113112 }
114113 } ;
115114 specThis = {
@@ -122,18 +121,19 @@ angular.scenario.Runner.prototype = {
122121 function done ( ) {
123122 result . finished = true ;
124123 stepLogger . close ( ) ;
125- ( callback || angular . noop ) . call ( specThis ) ;
124+ ( callback || _ . identity ) . call ( specThis ) ;
126125 }
127126 function next ( ) {
128127 var step = spec . steps [ spec . nextStepIndex ] ;
129- ( result . log || { close :angular . noop } ) . close ( ) ;
128+ ( result . log || { close :_ . identity } ) . close ( ) ;
130129 result . log = null ;
131130 if ( step ) {
132131 spec . nextStepIndex ++ ;
133132 result . log = stepLogger ( 'step' , step . name ) ;
134133 try {
135134 step . fn . call ( specThis , next ) ;
136135 } catch ( e ) {
136+ console . error ( e ) ;
137137 result . fail ( e ) ;
138138 done ( ) ;
139139 }
0 commit comments