Skip to content

Releases: MadcapJake/ava-earl

Release list

v0.3.0

Choose a tag to compare

@MadcapJake MadcapJake released this 10 Sep 14:08

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()

v0.2.0

Choose a tag to compare

@MadcapJake MadcapJake released this 06 Sep 13:35
  • Added an async-test macro to easily handle asynchronous testing needs using builtin Earl-Grey async/await keywords.
async-test .async-macro-test:
   @plan(1)
   file = await read-file("./test/test.js")
   @equals(file.to-string().split(" ")[1], .test)

async keyword can still be used normally as a block but async-test removes the need to initiate the block (and one level of indentation).

test .internal-async-test:
   @plan(1)
   async:
      file = await read-file("./test/test.js")
      @equals(file.to-string().split(" ")[0], .var)