Skip to content

Instantly share code, notes, and snippets.

@domenic
Created April 13, 2012 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domenic/2378684 to your computer and use it in GitHub Desktop.
Save domenic/2378684 to your computer and use it in GitHub Desktop.
Mocha unexpected async behavior
describe("Outer", function () {
var promise = null;
beforeEach(function () {
setTimeout(function () {
console.error("Outer beforeEach");
}, 0);
});
describe("Inner A", function () {
beforeEach(function () {
console.error("Inner beforeEach A");
});
it("Inner A", function () {
console.error("Inner A");
});
});
describe("Inner B", function () {
beforeEach(function () {
console.error("Inner beforeEach B");
});
it("Inner B", function () {
console.error("Inner B");
});
});
});
Outer beforeEach
Inner beforeEach A
Inner A
Inner beforeEach B
Inner B
Outer beforeEach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment