Discussion: mochajs/mocha#362
Last active
February 21, 2016 03:41
-
-
Save balupton/2306572 to your computer and use it in GitHub Desktop.
Failing async test for Mocha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mocha test/async.js | |
✔ 0 tests complete (1ms) | |
$ node test/async.js | |
multiply | |
addition | |
should know 5+5 | |
should know 5*5 | |
$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment