(kill)
| 260 | setupFailureStateFile(root, globalOptions); |
| 261 | |
| 262 | const exitHandler = async (kill) => { |
| 263 | if (root.subtests.length === 0 && (root.hooks.before.length > 0 || root.hooks.after.length > 0)) { |
| 264 | // Run global before/after hooks in case there are no tests |
| 265 | await root.run(); |
| 266 | } |
| 267 | |
| 268 | if (kill !== true && root.subtestsPromise !== null) { |
| 269 | // Wait for all subtests to finish, but keep the process alive in case |
| 270 | // there are no ref'ed handles left. |
| 271 | const keepAlive = setInterval(() => {}, TIMEOUT_MAX); |
| 272 | await root.subtestsPromise.promise; |
| 273 | clearInterval(keepAlive); |
| 274 | } |
| 275 | |
| 276 | root.postRun(new ERR_TEST_FAILURE( |
| 277 | 'Promise resolution is still pending but the event loop has already resolved', |
| 278 | kCancelledByParent)); |
| 279 | |
| 280 | if (root.harness.globalTeardownFunction) { |
| 281 | await root.harness.globalTeardownFunction(); |
| 282 | root.harness.globalTeardownFunction = null; |
| 283 | } |
| 284 | |
| 285 | hook.disable(); |
| 286 | process.removeListener('uncaughtException', exceptionHandler); |
| 287 | process.removeListener('unhandledRejection', rejectionHandler); |
| 288 | process.removeListener('beforeExit', exitHandler); |
| 289 | if (globalOptions.isTestRunner) { |
| 290 | process.removeListener('SIGINT', terminationHandler); |
| 291 | process.removeListener('SIGTERM', terminationHandler); |
| 292 | } |
| 293 | }; |
| 294 | |
| 295 | const findRunningTests = (test, running = []) => { |
| 296 | if (test.startTime !== null && !test.finished) { |
no test coverage detected
searching dependent graphs…