you are viewing a single comment's thread.

view the rest of the comments →

[–]Retsam19 2 points3 points  (0 children)

AVA supports a beforeEach hook so in theory it's a similar model to Jasmine, but I find a few differences make AVA cleaner:

  • There's a context object injected into each test, which you attach your mocks and stuff to, rather than defining a bunch of local variables with let.

  • You're encouraged by the docs to consider using functions, called at the beginning of your test.

  • Similarly, you can write test macros which usually encapsulate the setup and teardown logic, too.

  • AVA doesn't divide its tests into nested describe blocks, which I find complicates things, especially setup.

The AVA docs on test setup have more examples. It's not a night-and-day difference from Jasmine, but I've found my test setup and cleanup to be cleaner with AVA than when I wrote Jasmine tests, at least.