Skip to content

Add afterAll hook #11

@nonkor

Description

@nonkor

We have a way to define some common, unrepeatable actions before a group of specs. We need just place the code inside description - it would be run before nested context. Unfortunately, we cannot do something similar as a result action after all nested specs - it would be anyway performed before nested specs.

Let's see an example. Consider, I need only one affiliate for some group of specs - all next action would be about reservations and they do not require re-creation of the affiliate. But if I want to clean up my db modifications after all, there is no way except to create affiliate before each spec and delete it after each spec. With afterAll hook I could escape redundant calls and improve reliability:

describe 'test' spec {
  createAffAPI

  describe 'add reservation' spec {
    //...
  }
  describe 'modify reservation' spec {
    //...
  }

  afterAll { deleteAffAPI }
}

I would even recommend introducing 'beforeAll' hook for consistency and restrict performing any code without wrapping in hooks or specs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions