|
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() { |
@@ -161,20 +186,6 @@ class TestContext { |
161 | 186 | this.#test.todo(message); |
162 | 187 | } |
163 | 188 |
|
164 | | - test(name, options, fn) { |
165 | | - const overrides = { |
166 | | - __proto__: null, |
167 | | - loc: getCallerLocation(), |
168 | | - }; |
169 | | - |
170 | | - const subtest = this.#test.createSubtest( |
171 | | - // eslint-disable-next-line no-use-before-define |
172 | | - Test, name, options, fn, overrides, |
173 | | - ); |
174 | | - |
175 | | - return subtest.start(); |
176 | | - } |
177 | | - |
178 | 189 | before(fn, options) { |
179 | 190 | this.#test.createHook('before', fn, options); |
180 | 191 | } |
|
0 commit comments