Skip to content

Commit

Permalink
Docs: Write a page for QUnit.config.modules
Browse files Browse the repository at this point in the history
Used by HTML Reporter, and by plugins such as `steal-qunit`.

Ref #1118
  • Loading branch information
Krinkle committed Jul 12, 2023
1 parent 7d9719a commit 8444f81
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/config/current.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Internal object representing the currently running test.
<table>
<tr>
<th>type</th>
<td markdown="span">`object`</td>
<td markdown="span">`object` (read-only)</td>
</tr>
</table>

Expand Down
39 changes: 39 additions & 0 deletions docs/config/modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
layout: page-api
title: QUnit.config.modules
excerpt: List of defined test modules.
groups:
- config
- extension
version_added: "1.16.0"
---

List of defined test modules.

<table>
<tr>
<th>type</th>
<td markdown="span">`Array<Module>` (read-only)</td>
</tr>
</table>

This property is exposed under `QUnit.config` for use by plugins and other integrations. It returns an array of internal `Module` objects, one for each call to [`QUnit.module()`](../QUnit/module.md).

Before accessing this property, wait for the [`QUnit.on('runStart')`](../callbacks/QUnit.on.md#the-runstart-event) event, or use a [`QUnit.begin()`](../callbacks/QUnit.begin.md) callback.

### Module object

The following properties are considered publicly supported:

| property | description |
|-----------|-------------|
| `name` (string) | Module name, as passed to [`QUnit.module()`](../QUnit/module.md).
| `moduleId` (string) | Hashed identifier, for the [QUnit.config.moduleId](./moduleId.md) filter.

## Example

```js
QUnit.on('runStart', () => {
console.log(QUnit.config.modules.map(mod => mod.name));
});
```

0 comments on commit 8444f81

Please sign in to comment.