|
6 | 6 | ArrayPrototypeShift, |
7 | 7 | ArrayPrototypeSlice, |
8 | 8 | ArrayPrototypeSome, |
| 9 | + ArrayPrototypeForEach, |
9 | 10 | ArrayPrototypeUnshift, |
10 | 11 | FunctionPrototype, |
11 | 12 | MathMax, |
@@ -122,6 +123,30 @@ class TestContext { |
122 | 123 |
|
123 | 124 | constructor(test) { |
124 | 125 | this.#test = test; |
| 126 | + |
| 127 | + this.test = (name, options, fn) => { |
| 128 | + const overrides = { |
| 129 | + __proto__: null, |
| 130 | + loc: getCallerLocation(), |
| 131 | + }; |
| 132 | + // eslint-disable-next-line no-use-before-define |
| 133 | + const subtest = this.#test.createSubtest(Test, name, options, fn, overrides); |
| 134 | + return subtest.start(); |
| 135 | + }; |
| 136 | + |
| 137 | + ArrayPrototypeForEach(['skip', 'todo', 'only'], (keyword) => { |
| 138 | + this.test[keyword] = (name, options, fn) => { |
| 139 | + const overrides = { |
| 140 | + __proto__: null, |
| 141 | + [keyword]: true, |
| 142 | + loc: getCallerLocation(), |
| 143 | + }; |
| 144 | + |
| 145 | + // eslint-disable-next-line no-use-before-define |
| 146 | + const subtest = this.#test.createSubtest(Test, name, options, fn, overrides); |
| 147 | + return subtest.start(); |
| 148 | + }; |
| 149 | + }); |
125 | 150 | } |
126 | 151 |
|
127 | 152 | get signal() { |
@@ -153,20 +178,6 @@ class TestContext { |
153 | 178 | this.#test.todo(message); |
154 | 179 | } |
155 | 180 |
|
156 | | - test(name, options, fn) { |
157 | | - const overrides = { |
158 | | - __proto__: null, |
159 | | - loc: getCallerLocation(), |
160 | | - }; |
161 | | - |
162 | | - const subtest = this.#test.createSubtest( |
163 | | - // eslint-disable-next-line no-use-before-define |
164 | | - Test, name, options, fn, overrides, |
165 | | - ); |
166 | | - |
167 | | - return subtest.start(); |
168 | | - } |
169 | | - |
170 | 181 | before(fn, options) { |
171 | 182 | this.#test.createHook('before', fn, options); |
172 | 183 | } |
|
0 commit comments