Adds a done-friendly beforeAll setup to jasmine
WARNING: This plugin relies on internal Jasmine code that was refactored or removed in Jasmine 2.0. Currently compatible with Jasmine 1.x only
jasmine-before-all is a standalone plugin that you can load after jasmine that adds global
afterAll functions that call
afterEach, respectively, at most one time per callback definition.
Importantly, they play nicely with
done mechanisms like those found in minijasminenode.
afterAll is typically a bad idea for unit tests, but if you're using Jasmine for integration tests, it'll probably come in handy as soon as your setup becomes expensive.
Does what it says on the tin. This would pass, for instance:
describe 'intentional pollution'->foo = 0beforeAll -> foo += 1context '1'->Then -> foo == 1context '2'->Then -> foo == 1context '3'->Then -> foo == 1afterAll -> foo++; expectfootoEqual2
And if your test runner includes a "done" callback (or you've included one as a helper), this should also work:
describe '(asynchronous) intentional pollution'->bar = 3beforeAllsetTimeout ->bar -= 1done100context '1'->Then -> bar == 2context '2'->Then -> bar == 2context '3'->Then -> bar == 2