Skip to content

Instantly share code, notes, and snippets.

@chakrit
Created May 7, 2013 06:03
Show Gist options
  • Save chakrit/5530541 to your computer and use it in GitHub Desktop.
Save chakrit/5530541 to your computer and use it in GitHub Desktop.
initial before.
․initial after.
second before.
․calling second after.
// run with `mocha --bail test.js`
describe('Initial test', function() {
before(function() { console.log('initial before.'); });
describe('test will fail', function() {
it('will fail', function() { throw new Error('failed'); });
});
after(function() {
console.log('initial after.');
});
});
describe('Second test', function() {
before(function() { console.log('second before.'); });
describe('second test does not matter', function() {
it('this test should not run', function() {
throw new Error('I do not matter');
});
});
after(function() { console.log('calling second after.'); });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment