A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/c4848c53e6 below:

cleanup global event listeners after run · nodejs/node@c4848c5 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+20

-2

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+20

-2

lines changed Original file line number Diff line number Diff line change

@@ -170,8 +170,13 @@ function setup(root) {

170 170

kCancelledByParent));

171 171 172 172

hook.disable();

173 -

process.removeListener('unhandledRejection', rejectionHandler);

174 173

process.removeListener('uncaughtException', exceptionHandler);

174 +

process.removeListener('unhandledRejection', rejectionHandler);

175 +

process.removeListener('beforeExit', exitHandler);

176 +

if (globalOptions.isTestRunner) {

177 +

process.removeListener('SIGINT', terminationHandler);

178 +

process.removeListener('SIGTERM', terminationHandler);

179 +

}

175 180

};

176 181 177 182

const terminationHandler = () => {

Original file line number Diff line number Diff line change

@@ -564,6 +564,7 @@ function run(options = kEmptyObject) {

564 564

}

565 565 566 566

let postRun = () => root.postRun();

567 +

let teardown = () => root.harness.teardown();

567 568

let filesWatcher;

568 569

const opts = {

569 570

__proto__: null,

@@ -578,6 +579,7 @@ function run(options = kEmptyObject) {

578 579

if (watch) {

579 580

filesWatcher = watchFiles(testFiles, opts);

580 581

postRun = undefined;

582 +

teardown = undefined;

581 583

}

582 584

const runFiles = () => {

583 585

root.harness.bootstrapComplete = true;

@@ -589,7 +591,8 @@ function run(options = kEmptyObject) {

589 591

});

590 592

};

591 593 592 -

PromisePrototypeThen(PromisePrototypeThen(PromiseResolve(setup?.(root.reporter)), runFiles), postRun);

594 +

const setupPromise = PromiseResolve(setup?.(root.reporter));

595 +

PromisePrototypeThen(PromisePrototypeThen(PromisePrototypeThen(setupPromise, runFiles), postRun), teardown);

593 596 594 597

return root.reporter;

595 598

}

Original file line number Diff line number Diff line change

@@ -551,3 +551,13 @@ describe('forceExit', () => {

551 551

});

552 552

});

553 553

});

554 + 555 + 556 +

// exitHandler doesn't run until after the tests / after hooks finish.

557 +

process.on('exit', () => {

558 +

assert.strictEqual(process.listeners('uncaughtException').length, 0);

559 +

assert.strictEqual(process.listeners('unhandledRejection').length, 0);

560 +

assert.strictEqual(process.listeners('beforeExit').length, 0);

561 +

assert.strictEqual(process.listeners('SIGINT').length, 0);

562 +

assert.strictEqual(process.listeners('SIGTERM').length, 0);

563 +

});

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4