We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b3c4090 commit f98a881Copy full SHA for f98a881
docs/recipes/typescript.md
@@ -50,6 +50,23 @@ test(async (t) => {
50
});
51
```
52
53
+## Working with [macros](https://github.com/avajs/ava#test-macros)
54
+
55
+In order to be able to assign the `title` property to a macro:
56
57
+```ts
58
+import test, { AssertContext, Macro } from 'ava';
59
60
+const macro: Macro<AssertContext> = (t, input, expected) => {
61
+ t.is(eval(input), expected);
62
+}
63
64
+macro.title = (providedTitle, input, expected) => `${providedTitle} ${input} = ${expected}`.trim();
65
66
+test(macro, '2 + 2', 4);
67
+test(macro, '2 * 3', 6);
68
+test('providedTitle', macro, '3 * 3', 9);
69
+```
70
71
## Working with [`context`](https://github.com/avajs/ava#test-context)
72
0 commit comments