public
Last active

Failing async test for Mocha

  • Download Gist
README.md
Markdown
async.test.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
// Requires
var assert = require('assert');
 
// Describe Test
var runInstant = function(name,next){
console.log(name);
next()
};
var it = global.it || runInstant
var describe = global.describe || runInstant
 
// Async Tests
setTimeout(function(){
 
// Multiply
describe('multiply',function(){
// 25=5*5 after 2 seconds
setTimeout(function(){
it('should know 5*5',function(){
assert.equal(25,5*5);
});
},2000);
});
 
 
// Addition
describe('addition',function(){
// 10=5+5 after 1 seconds
setTimeout(function(){
it('should know 5+5',function(){
assert.equal(10,5+5);
});
},1000);
});
 
},5000);
results.txt
1 2 3 4 5 6 7 8 9 10 11 12
$ mocha test/async.js
 
 
✔ 0 tests complete (1ms)
 
$ node test/async.js
multiply
addition
should know 5+5
should know 5*5
$

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.