Skip to content

Commit 14ddff0

Browse files
committed
style: add comments to the code
1 parent 9dd6e67 commit 14ddff0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/jest-worker/src/workers/messageParent.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export default function messageParent(
2020
parentProcess.send([PARENT_MESSAGE_CUSTOM, message]);
2121
} catch (e: any) {
2222
if (/circular structure/.test(e?.message)) {
23+
// We can safely send a message to the parent process again
24+
// because previous sending was halted by "TypeError: Converting circular structure to JSON".
25+
// But this time the message will be cleared from circular references.
2326
parentProcess.send([
2427
PARENT_MESSAGE_CUSTOM,
2528
withoutCircularRefs(message),

packages/jest-worker/src/workers/processChild.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ function reportSuccess(result: unknown) {
101101
try {
102102
process.send([PARENT_MESSAGE_OK, result]);
103103
} catch (e: any) {
104+
// We can safely send a message to the parent process again
105+
// because previous sending was halted by "TypeError: Converting circular structure to JSON".
106+
// But this time the message will be cleared from circular references.
104107
if (e && /circular structure/.test(e?.message)) {
105108
process.send([PARENT_MESSAGE_OK, withoutCircularRefs(result)]);
106109
} else {

0 commit comments

Comments
 (0)