Alex's Slip-box

These are my org-mode notes in sort of Zettelkasten style

Mocha before callbacks

# TL’DR

  • All before block run first in top down order
  • Then all beforeEach blocks run in top down order

# Example

This is from before.js gist:

1: describe('mocha before hooks', function () {
2:   before(() => console.log('*** top-level before()'));
3:   beforeEach(() => console.log('*** top-level beforeEach()'));
4:   describe('nesting', function () {
5:     before(() => console.log('*** nested before()'));
6:     beforeEach(() => console.log('*** nested beforeEach()'));
7:     it('is a nested spec', () => true);
8:   });
9: });
  mocha before hooks
*** top-level before()
    nesting
*** nested before()
*** top-level beforeEach()
*** nested beforeEach()
      ✓ is a nested spec


  1 passing (8ms)