You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require('node_modules/mocha/mocha');classMyReporterextendsMocha.reporters.Base{constructor(runner){super(runner);runner.on('start',()=>{console.log('testcase start...');});runner.on('pass',(test)=>{console.log(`pass: ${test.fullTitle()}`);});runner.on('fail',(test,err)=>{console.error(`fail: ${test.fullTitle()} - error: ${err.message}`);});runner.on('end',()=>{console.log('all done');});}}constmocha=newMocha({reporter: MyReporter,});mocha.suite.addSuite(newMocha.Suite('Array').addTest(newMocha.Test('should start empty',function(){constarr=[];if(arr.length!==0){thrownewError('array is not empty');}})).addTest(newMocha.Test('should push one element',function(){constarr=[];arr.push(1);if(arr.length!==1){thrownewError('array length is not 1');}})).addTest(newMocha.Test('should fail this test',function(){constarr=[];arr.push(1);if(arr.length!==2){thrownewError('array length is not 2');}})));mocha.run(failures=>{console.log('failures:',failures);});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Beta Was this translation helpful? Give feedback.
All reactions