@kmcid/cypress-parallel-cli
Version:
CLI app for running parallel cypress tests
1 lines • 806 B
JavaScript
;var Base=require("mocha/lib/reporters/base"),constants=require("mocha/lib/runner").constants,path=require("path"),fs=require("fs");const t=path.join(process.cwd(),"parallel-cli-results"),{EVENT_SUITE_END:e}=constants;function JSONStreamCustom(s,i){Base.call(this,s,i);var n=this;s.total,s.on(e,function(){writeFile({...n.stats,duration:calculateDuration(n.stats.start,n.stats.end),file:n.runner.suite.file})})}function calculateDuration(s,i){return i=i||new Date,new Date(i).getTime()-new Date(s).getTime()}function writeFile(s){let i=s.file.replace(/\\|\//g,"_");fs.existsSync(t)||fs.mkdirSync(t);let n=path.join(t,`${i}.json`);fs.writeFileSync(n,JSON.stringify(s,null,2))}exports=module.exports=JSONStreamCustom,JSONStreamCustom.description="Writes statistics per spec file to result files";