Commit 3143566
test_runner: add assert.register() API
This commit adds a top level assert.register() API to the test
runner. This function allows users to define their own custom
assertion functions on the TestContext.
Fixes: #52033
PR-URL: #56434
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>1 parent 332ce54 commit 3143566Copy full SHA for 3143566
File tree
Expand file treeCollapse file tree
5 files changed
+166
-34
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- internal/test_runner
- test/parallel
Expand file treeCollapse file tree
5 files changed
+166
-34
lines changedOpen diff view settings
Collapse file
+23Lines changed: 23 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1748 | 1748 | |
1749 | 1749 | |
1750 | 1750 | |
| 1751 | + |
| 1752 | + |
| 1753 | + |
| 1754 | + |
| 1755 | + |
| 1756 | + |
| 1757 | + |
| 1758 | + |
| 1759 | + |
| 1760 | + |
| 1761 | + |
| 1762 | + |
| 1763 | + |
| 1764 | + |
| 1765 | + |
| 1766 | + |
| 1767 | + |
| 1768 | + |
| 1769 | + |
| 1770 | + |
| 1771 | + |
| 1772 | + |
| 1773 | + |
1751 | 1774 | |
1752 | 1775 | |
1753 | 1776 | |
|
Collapse file
lib/internal/test_runner/assert.js
Copy file name to clipboard+50Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
Collapse file
lib/internal/test_runner/test.js
Copy file name to clipboardExpand all lines: lib/internal/test_runner/test.js+18-34Lines changed: 18 additions & 34 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
100 | 100 | |
101 | 101 | |
102 | 102 | |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | | - |
109 | | - |
110 | | - |
111 | | - |
112 | | - |
113 | | - |
114 | | - |
115 | | - |
116 | | - |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
128 | 108 | |
129 | | - |
130 | | - |
| 109 | + |
| 110 | + |
| 111 | + |
131 | 112 | |
132 | 113 | |
133 | 114 | |
| ||
264 | 245 | |
265 | 246 | |
266 | 247 | |
267 | | - |
268 | | - |
269 | | - |
270 | | - |
| 248 | + |
| 249 | + |
| 250 | + |
| 251 | + |
| 252 | + |
| 253 | + |
| 254 | + |
| 255 | + |
271 | 256 | |
272 | | - |
273 | | - |
274 | 257 | |
275 | | - |
| 258 | + |
| 259 | + |
276 | 260 | |
277 | 261 | |
278 | 262 | |
|
Collapse file
+12Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
61 | 61 | |
62 | 62 | |
63 | 63 | |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
Collapse file
test/parallel/test-runner-custom-assertions.js
Copy file name to clipboard+63Lines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
0 commit comments