Skip to content

0.7.0

Compare
Choose a tag to compare
@sindresorhus sindresorhus released this 30 Nov 06:44
· 1745 commits to main since this release

Breaking changes

There are some breaking changes in this release that significantly improves the test interface.

test() is now only for synchronous or promise/observable returning tests

The main test() interface is now synchronous by default and can be made asynchronous by returning a promise/observable or using a async/generator function (which implicitly returns a promise).

You no longer have to call t.end() in synchronous tests:

 test(t => {
    t.pass();
-   t.end();
})

You can no longer use test() for callback-style APIs, so we've introduced a new "callback mode" test.cb().

-test(t => {
+test.cb(t => {
    fn(err => {
        t.ifError(err);
        t.end();
    });
 });

387c30a 7170308

t.plan() will no longer auto-end tests

You will now have to explicitly end tests with callback-style APIs. Previously, t.plan() doubled as both an assert counter and ending the test when the assertion count was reached. This was a mistake. It's now only an assert counter. We are now able to warn on too many async assertion which were previously not possible. Note that t.end() only works in "callback mode" test.cb().

-test(t => {
+test.cb(t => {
    t.plan(1);

    fn(err => {
        t.ifError(err);
+       t.end();
    });
 });

More info here: https://github.com/sindresorhus/ava#warning-recent-breaking-change

f816815

Highlights

  • Test methods are now chainable. You can for example do test.serial.skip(). d874ec9
  • Use the local AVA version if available when running $ ava from the CLI. 2f7ac92
  • Guard against time manipulation by mocking modules like Sinon. b88c2ba
  • Improve the behavior of the --serial flag. 7ad7501

Changes

v0.6.1...v0.7.0