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 9a5f852
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 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,17 @@ 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.on(
'exit',
common.mustCall(() => assert.strictEqual(child.hasRef(), false)),
);

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

0 comments on commit 9a5f852

Please sign in to comment.