Skip to content

Instantly share code, notes, and snippets.

@Elergy
Last active June 4, 2017 12:23
Show Gist options
  • Save Elergy/6b4471d244e1d7591ee0d1d9ff745d88 to your computer and use it in GitHub Desktop.
Save Elergy/6b4471d244e1d7591ee0d1d9ff745d88 to your computer and use it in GitHub Desktop.
var noop = function() {};
describe('describe title', function() {
var i = 0;
beforeEach(function () {
if (i++ > 1) {
throw new Error('BEFORE EACH FAIL');
}
});
it('one', noop);
it('two', noop);
it('three', noop);
});
@Elergy
Copy link
Author

Elergy commented Jun 4, 2017

When I run the test, Mocha tells me:

 describe title
    ✓ one
    ✓ two
    1) "before each" hook for "three"


  2 passing (12ms)
  1 failing

  1) describe title "before each" hook for "three":
     Error: BEFORE EACH FAIL
      at Context.<anonymous> (test/fail-inside-before-each.js:8:19)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment