Search code examples
javascriptava

How to include before/after hooks in test report with AVA?


I have the following test.js file:

const test = require("ava");
test.before("foo", t => {
    someSetupThatMightThrow();
});
test("bar", t => {
    t.pass();
});
test.after("baz", t => {
    someTeardownThatMightThrow();
});

After running ava --verbose, if any of the hooks throw, I get a red X in the test report, which is great. But if nothing throws, I get only one green checkmark for the bar test:

green-checkmark bar 1 test passed

I would like to see green checkmarks relative to the before/after hooks as well, instead of them simply being omitted. How can I do this?


Solution

  • We won't output those in our regular reporters, sorry. I'd say don't worry: the hooks will run.

    (Eventually down the line maybe we'd have a much more low-level reporter which would include this information, that you could build your own reporter on, but that's a ways away.)