nl_tokens: Initialize a new Teamcity reporter .
pl_tokens: function Teamcity ( runner , options ) { options = options || { } ; const reporterOptions = <mask> . reporterOptions || { } ; let flowId , useStdError , recordHookFailures ; ( reporterOptions . flowId ) ? flowId = reporterOptions . flowId : flowId = process . env [ 'MOCHA_TEAMCITY_FLOWID' ] || processPID ; ( reporterOptions . useStdError ) ? useStdError = reporterOptions . useStdError : useStdError = process . env [ 'USE_STD_ERROR' ] ; ( reporterOptions . recordHookFailures ) ? recordHookFailures = reporterOptions . recordHookFailures : recordHookFailures = process . env [ 'RECORD_HOOK_FAILURES' ] ; ( useStdError ) ? useStdError = ( useStdError . toLowerCase ( ) === 'true' ) : useStdError = false ; ( recordHookFailures ) ? recordHookFailures = ( recordHookFailures . toLowerCase ( ) === 'true' ) : recordHookFailures = false ; Base . call ( this , runner ) ; let stats = this . stats ; const topLevelSuite = reporterOptions . topLevelSuite || process . env [ 'MOCHA_TEAMCITY_TOP_LEVEL_SUITE' ] ; runner . on ( 'suite' , function ( suite ) { if ( suite . root ) { if ( topLevelSuite ) { log ( formatString ( SUITE_START , topLevelSuite , flowId ) ) ; } return ; } suite . startDate = new Date ( ) ; log ( formatString ( SUITE_START , suite . title , flowId ) ) ; } ) ; runner . on ( 'test' , function ( test ) { log ( formatString ( TEST_START , test . title , flowId ) ) ; } ) ; runner . on ( 'fail' , function ( test , err ) { if ( useStdError ) { logError ( formatString ( TEST_FAILED , test . title , err . message , err . stack , flowId ) ) ; } else { log ( formatString ( TEST_FAILED , test . title , err . message , err . stack , flowId ) ) ; } } ) ; runner . on ( 'pending' , function ( test ) { log ( formatString ( TEST_IGNORED , test . title , test . title , flowId ) ) ; } ) ; runner . on ( 'test end' , function ( test ) { log ( formatString ( TEST_END , test . title , test . duration , flowId ) ) ; } ) ; runner . on ( 'hook' , function ( test ) { if ( recordHookFailures ) { log ( formatString ( TEST_START , test . title , flowId ) ) ; } } ) ; runner . on ( 'suite end' , function ( suite ) { if ( suite . root ) return ; log ( formatString ( SUITE_END , suite . title , new Date ( ) - suite . startDate , flowId ) ) ; } ) ; runner . on ( 'end' , function ( ) { if ( topLevelSuite ) { log ( formatString ( SUITE_END , topLevelSuite , stats . duration , flowId ) ) ; } log ( formatString ( SUITE_END , 'mocha.suite' , stats . duration , flowId ) ) ; } ) ; }