Skip to content

Commit

Permalink
Review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
andreubotella committed Jul 12, 2022
1 parent 60bdf18 commit 0d2c792
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/parallel/test-process-beforeexit.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function tryTimer() {
function tryListen() {
net.createServer()
.listen(0)
.on('listening', common.mustCall(function() {
.on('listening', common.mustCall(function () {
this.close();
process.once('beforeExit', common.mustCall(tryRepeatedTimer));
}));
Expand All @@ -55,27 +55,27 @@ function tryListen() {
function tryRepeatedTimer() {
const N = 5;
let n = 0;
const repeatedTimer = common.mustCall(function() {
const repeatedTimer = common.mustCall(function () {
if (++n < N)
setTimeout(repeatedTimer, 1);
else // n == N
process.once('beforeExit', common.mustCall(tryNextTick1));
process.once('beforeExit', common.mustCall(tryNextTickSetImmediate));
}, N);
setTimeout(repeatedTimer, 1);
}

// Test if the callback of `process.nextTick` can be invoked.
function tryNextTick1() {
process.nextTick(common.mustCall(function() {
function tryNextTickSetImmediate() {
process.nextTick(common.mustCall(function () {
setImmediate(common.mustCall(() => {
process.once('beforeExit', common.mustCall(tryNextTick2));
process.once('beforeExit', common.mustCall(tryNextTick));
}));
}));
}

// Test that `process.nextTick` won't keep the event loop running by itself.
function tryNextTick2() {
process.nextTick(common.mustCall(function() {
function tryNextTick() {
process.nextTick(common.mustCall(function () {
process.once('beforeExit', common.mustNotCall());
}));
}

0 comments on commit 0d2c792

Please sign in to comment.