Skip to content

Commit

Permalink
fix: update the tc
Browse files Browse the repository at this point in the history
This removes the assertion where the child process might be referred.
  • Loading branch information
daeyeon committed Apr 14, 2022
1 parent 1f500a3 commit 24eff20
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions test/parallel/test-child-process-hasref.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ assert.strictEqual(child.hasRef(), false);
child.ref();
assert.strictEqual(child.hasRef(), true);

function mustHasRef() {
return common.mustCall(() => assert.strictEqual(child.hasRef(), true));
}

function mustHasNoRef() {
return common.mustCall(() => assert.strictEqual(child.hasRef(), false));
}

child.stdout.on('data', mustHasRef());
child.stdout.on('end', mustHasRef());
child.stdout.on('close', mustHasNoRef());
child.on('exit', mustHasNoRef());
child.on('close', mustHasNoRef());
child.stdout.on(
'data',
common.mustCall(() => assert.strictEqual(child.hasRef(), true)),
);

child.stdout.on(
'end',
common.mustCall(() => assert.strictEqual(child.hasRef(), true)),
);

child.on(
'exit',
common.mustCall(() => assert.strictEqual(child.hasRef(), false)),
);

child.on(
'close',
common.mustCall(() => assert.strictEqual(child.hasRef(), false)),
);

0 comments on commit 24eff20

Please sign in to comment.