Skip to content
Merged
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
6 changes: 4 additions & 2 deletions docs/_data/sitenav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
sub:
- name: Getting Started
href: /intro/
- name: Download
href: /intro/#download
- name: Browser Runner
href: /browser/
- name: Browser Support
href: /browser/#browser-support
- name: Command-line Interface
href: /cli/
- name: Download
href: /intro/#download
- name: Test lifecycle
href: /lifecycle/
- name: QUnit 2.0 Upgrade Guide
href: /upgrade-guide-2.x/
- name: Documentation
Expand Down
8 changes: 4 additions & 4 deletions docs/api/QUnit/hooks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: page-api
title: QUnit.hooks
excerpt: Add global callbacks to run before or after each test.
excerpt: Add global callbacks to run before or after every test.
groups:
- extension
redirect_from:
Expand All @@ -12,15 +12,15 @@ version_added: "2.18.0"
`QUnit.hooks.beforeEach( callback )`<br>
`QUnit.hooks.afterEach( callback )`

Register a global callback to run before or after each test.
Register a global callback to run before or after every test.

| parameter | description |
|-----------|-------------|
| callback (function) | Callback to execute. Called with an [assert](../assert/index.md) argument. |

This is the equivalent of applying a `QUnit.module()` hook to all modules and all tests, including global tests that are not associated with any module.
This is the equivalent of adding a hook in all modules, and all tests, including global tests that are not grouped in a module.

Similar to module hooks, global hooks support async functions or returning a Promise, which will be waited for before QUnit continues executing tests. Each global hook also has access to the same `assert` object and test context as the [QUnit.test](./test.md) that the hook is running for.
As with module hooks, global hooks may be async functions or return a Promise, which will be waited for before QUnit continues executing tests. Each global hook also has access to the same `assert` object and test context as the [QUnit.test](./test.md) that the hook is running for.

For more details about hooks, refer to [QUnit.module § Hooks](./module.md#hooks).

Expand Down
Loading