|
6 | 6 | ArrayPrototypeShift, |
7 | 7 | ArrayPrototypeSlice, |
8 | 8 | ArrayPrototypeSome, |
| 9 | + ArrayPrototypeForEach, |
9 | 10 | ArrayPrototypeUnshift, |
10 | 11 | FunctionPrototype, |
11 | 12 | MathMax, |
@@ -153,18 +154,32 @@ class TestContext { |
153 | 154 | this.#test.todo(message); |
154 | 155 | } |
155 | 156 |
|
156 | | - test(name, options, fn) { |
157 | | - const overrides = { |
158 | | - __proto__: null, |
159 | | - loc: getCallerLocation(), |
| 157 | + get test() { |
| 158 | + const testCreator = (name, options, fn) => { |
| 159 | + const overrides = { |
| 160 | + __proto__: null, |
| 161 | + loc: getCallerLocation(), |
| 162 | + }; |
| 163 | + // eslint-disable-next-line no-use-before-define |
| 164 | + const subtest = this.#test.createSubtest(Test, name, options, fn, overrides); |
| 165 | + return subtest.start(); |
160 | 166 | }; |
161 | 167 |
|
162 | | - const subtest = this.#test.createSubtest( |
163 | | - // eslint-disable-next-line no-use-before-define |
164 | | - Test, name, options, fn, overrides, |
165 | | - ); |
| 168 | + ArrayPrototypeForEach(['skip', 'todo', 'only'], (keyword) => { |
| 169 | + testCreator[keyword] = (name, options, fn) => { |
| 170 | + const overrides = { |
| 171 | + __proto__: null, |
| 172 | + [keyword]: true, |
| 173 | + loc: getCallerLocation(), |
| 174 | + }; |
| 175 | + |
| 176 | + // eslint-disable-next-line no-use-before-define |
| 177 | + const subtest = this.#test.createSubtest(Test, name, options, fn, overrides); |
| 178 | + return subtest.start(); |
| 179 | + }; |
| 180 | + }); |
166 | 181 |
|
167 | | - return subtest.start(); |
| 182 | + return testCreator; |
168 | 183 | } |
169 | 184 |
|
170 | 185 | before(fn, options) { |
|
0 commit comments