Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ export default {
| `beforeEach` / `afterEach` | Run before/after each test. Called like `run` — same `this`, same arguments. Inherited. Sync or async |
| `beforeAll` / `afterAll` | Run before/after all tests in the group where defined. Called with no arguments. **Not inherited** |

In nested groups, `beforeAll` runs top-down (parent → child) and `afterAll` runs bottom-up (child → parent); async cleanup is awaited before the next level fires.

A child that defines its own `beforeEach`/`afterEach` **overrides** the parent's — they are not chained automatically.

To invoke the parent's hook from a child override, call `this.parent.beforeEach()` (or whichever hook). You control where the parent's logic runs — before, after, or in the middle of the child's:
Expand Down
4 changes: 4 additions & 0 deletions docs/define/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ This gives you full control over where the parent's logic runs — before your o
}
```

#### Ordering

In nested groups, `beforeAll` runs **top-down** — the outermost group's setup runs first, then its children's. `afterAll` runs **bottom-up** — the innermost group's teardown completes (including any async work) before its parent's starts. This matches the convention in Jest, Vitest, and Mocha.

#### Error handling

If a hook throws, the test is **skipped** — not failed.
Expand Down