Skip to content

Commit 851dcdd

Browse files
committed
doc: add context.assert docs
When context.assert was added, no docs were added. This commit adds initial documentation for context.assert because the snapshot() function requires them. PR-URL: nodejs#53169 Refs: nodejs#52860 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
1 parent 90e81aa commit 851dcdd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

doc/api/test.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,6 +3024,24 @@ test('top level test', async (t) => {
30243024
});
30253025
```
30263026

3027+
### `context.assert`
3028+
3029+
<!-- YAML
3030+
added:
3031+
- v22.2.0
3032+
-->
3033+
3034+
An object containing assertion methods bound to `context`. The top-level
3035+
functions from the `node:assert` module are exposed here for the purpose of
3036+
creating test plans.
3037+
3038+
```js
3039+
test('test', (t) => {
3040+
t.plan(1);
3041+
t.assert.strictEqual(true, true);
3042+
});
3043+
```
3044+
30273045
### `context.diagnostic(message)`
30283046

30293047
<!-- YAML

0 commit comments

Comments
 (0)