Added before-test and after-test macros.
These macros correspond to two new test hooks in AVA. Evidently, these allow you to add tests that are run before and after all tests. It's important to note that the use of these tests should be for the testing of stateful code or code external to your package (within reason, of course) as AVA encourages atomic testing over chained tests.
require-macros: ava-earl ->
{test, serial-test, before-test, after-test}
var before-after-num = 0
before-test .before-everything-test:
before-after-num += 1
@is-true(before-after-num == 1)
@end()
serial-test .after-before-hook-test:
before-after-num += 1
@is-true(before-after-num == 2)
@end()
test .somewhere-in-the-middle-test:
@plan(1)
before-after-num += 1
@equals(before-after-num, 3)
after-test .after-everything-test:
before-after-num += 1
@is-true(before-after-num == 4)
@end()