testdouble / teenytest

A very simple, zero-config test runner for Node.js
MIT License
96 stars 14 forks source link

allow for nested tests #11

Closed searls closed 8 years ago

searls commented 8 years ago

object-exporting tests should allow nesting. Given a test:

module.exports = {
  beforeAll: function () { console.log('A') },
  beforeEach: function () { console.log('B') },
  test1: function () { console.log('C') },
  sub: {
    beforeAll: function () { console.log('D') },
    beforeEach: function () { console.log('E') },
    test2: function () { console.log('F') },
    test3: function () { console.log('G') },
    afterEach: function () { console.log('H') },
    afterAll: function () { console.log('I') }
  },
  afterEach: function () { console.log('J') },
  afterAll: function () { console.log('K') }
}

If we ran this, we should see some output like:

A
B
C
J
D
B
E
F
H
J
B
E
G
H
J
I
K