Improve the ergonomics of power-assert

Major +1 on promoting power-assert. If only I could do t(result === null) 😉

-- @novemberborn https://github.com/avajs/ava/pull/663#issuecomment-200040513

The last time I used AVA, I thought power-assert had been disabled by default, as I couldn't see evidence of its helpful diagnostics in the output of various failed assertions. I've only just noticed recently that this is because it's only available via t.true (edit: and t.truthy), which I don't use that often, and which is not a particularly obvious way to unlock it.

Other test frameworks force you to use an ever-growing list of assertions and matchers, but power-assert renders almost all of these methods redundant. It would be nice to bring it center stage rather than hiding it behind the facade of its less idiomatic alternatives.

I'd like to suggest two solutions to this:

  1. make power-assertions more explicit by adding an assert function:
t.assert(foo >= bar)
  1. make power-assertions more convenient by making t itself the t.assert function:
t(foo >= bar)

The former can be achieved by adding assert as an alias for true truthy (or vice versa). The latter can be achieved by making the t object a function, which is trivial if it's a plain object and not hard if it's an instance, e.g. via: