import * as glob from 'glob' ; import * as Mocha from 'mocha' ; import * as path from 'path' ; export function run ( testsRoot , cb ) { const mocha = new Mocha ( { ui : 'tdd' , } ) . useColors ( true ) ; glob ( '**/**.test.js' , { cwd : testsRoot } , ( err , files ) => { if ( err ) { return cb ( err ) ; } files . forEach ( f => mocha . addFile ( path . resolve ( testsRoot , f ) ) ) ; try { mocha . run ( failures => { cb ( null , failures ) ; } ) ; } catch ( err ) { cb ( err ) ; } } ) ; }