Make jest-worker use jest-serializer#5613
Conversation
| * saved until there is enough information to parse a payload, then a "message" | ||
| * event is emitted. | ||
| */ | ||
| export default class extends EventEmitter { |
There was a problem hiding this comment.
How about renaming it Communications? I guess that was the original intent, but shortened.
There was a problem hiding this comment.
Comms seems pretty weird, yeah. How about "Channel"?
There was a problem hiding this comment.
Yeah, now that I read Channel, I prefer it rather than Communications. Changing it again 😅
| constructor(stream: Duplex) { | ||
| super(); | ||
|
|
||
| this._size = Buffer.allocUnsafe(4); |
There was a problem hiding this comment.
@mjesun This is v5+ API, so technically we break Node 4 compat :/
There was a problem hiding this comment.
Should probably use https://github.com/LinusU/buffer-alloc-unsafe or something, then. Would be great to keep around node 4 support (unofficial though it is) until it's EOL in a couple of months
|
I'm still investigating how to merge this (if we are going to merge it at all). The internal IPC implementation seems to bypass a bunch of Node layers (e.g. writes directly into the socket via Performance results using The fact that |
|
TL;DR: Using Command
|
Codecov Report
@@ Coverage Diff @@
## master #5613 +/- ##
==========================================
+ Coverage 63.73% 63.89% +0.16%
==========================================
Files 216 217 +1
Lines 7938 7969 +31
Branches 3 3
==========================================
+ Hits 5059 5092 +33
+ Misses 2878 2876 -2
Partials 1 1
Continue to review full report at Codecov.
|
|
So what do you wanna do with this PR? |
|
Ping @mjesun shall we close this for now? |
|
Yep, let's close it for the moment. A follow up could be to be able to inject the serializer / deserializer; but I'm not going to do that ATM. |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR implements
jest-serializeras a new layer for data transmission between the parent process and all the child ones. Since IPC is a custom Node layer, we re-implemented the data transmission as well to work directly with binary buffers, using an extra file descriptor (number4).The
Commsclass wraps around thefdSocket, and provides an almost 1:1 compatible interface withprocess, providing asendmethod and amessageevent. This way, putting theCommsinstance was relatively easy.Tests cover all
Commsclass, plus some modification to the originaljest-workertests so that they keep passing.