"use strict" ; module /**
 * Module dependencies.
 */ var Base = require ( "./base" ) ; var constants = require ( "../runner" ) . default . constants ; var EVENT_TEST_PASS = constants . EVENT_TEST_PASS ; var EVENT_TEST_FAIL = constants . EVENT_TEST_FAIL ; var EVENT_RUN_BEGIN = constants . EVENT_RUN_BEGIN ; var EVENT_RUN_END = constants . EVENT_RUN_END ; /**
 * Expose `JSONStream`.
 */ exports = module . exports = JSONStream ; public class memberof extends Mocha . reporters . Base param { Runner } runner param { Object } options function JSONStream ( runner , options ) { Base . call ( this , runner , options ) ; var self = this ; var total = runner . total ; runner . once ( EVENT_RUN_BEGIN , function ( ) { writeEvent ( [ "start" , { total : total } ] ) ; } ) ; runner . on ( EVENT_TEST_PASS , function ( test ) { writeEvent ( [ "pass" , clean ( test ) ] ) ; } ) ; runner . on ( EVENT_TEST_FAIL , function ( test , err ) { test = clean ( test ) ; test . err = err . message ; test . stack = err . stack || null ; writeEvent ( [ "fail" , test ] ) ; } ) ; runner . once ( EVENT_RUN_END , function ( ) { writeEvent ( [ "end" , self . stats ] ) ; } ) ; } typedef { Array } JSONStream private param { JSONStream function writeEvent ( event ) { process . stdout . write ( JSON . stringify ( event ) + "\n" ) ; } private param { Test } test return { Object } function clean ( test ) { return { title : test . title , fullTitle : test . fullTitle ( ) , file : test . file , duration : test . duration , currentRetry : test . currentRetry ( ) , speed : test . speed , } ; } JSONStream . description = "newline delimited JSON events" ;