()
| 221 | } |
| 222 | |
| 223 | check() { |
| 224 | if (this.#planMet()) { |
| 225 | if (this.#timeoutId) { |
| 226 | clearTimeout(this.#timeoutId); |
| 227 | this.#timeoutId = null; |
| 228 | } |
| 229 | if (this.#planPromise) { |
| 230 | const { resolve } = this.#planPromise; |
| 231 | resolve(); |
| 232 | this.#planPromise = null; |
| 233 | } |
| 234 | return; |
| 235 | } |
| 236 | |
| 237 | if (!this.#shouldWait()) { |
| 238 | throw new ERR_TEST_FAILURE( |
| 239 | `plan expected ${this.expected} assertions but received ${this.actual}`, |
| 240 | kTestCodeFailure, |
| 241 | ); |
| 242 | } |
| 243 | |
| 244 | if (!this.#planPromise) { |
| 245 | const { promise, resolve, reject } = PromiseWithResolvers(); |
| 246 | this.#planPromise = { __proto__: null, promise, resolve, reject }; |
| 247 | |
| 248 | if (!this.#waitIndefinitely) { |
| 249 | this.#timeoutId = this.#createTimeout(reject); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | return this.#planPromise.promise; |
| 254 | } |
| 255 | |
| 256 | count() { |
| 257 | this.actual++; |
no test coverage detected