Use a TCP server to listen to streaming test events #3388
+381
−249
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Closes #3359
This PR starts using a TCP server to listen to test events on the extension side. The logic was getting quite complicated, so I made an attempt to extract a
StreamingRunner
class, which I really hope made the code a bit easier to follow for others.Implementation
In terms of behaviour changes, there isn't much. We use
net.server
to start a TCP server and then we pass the port as an environment variable, so that the server side integration can connect.The rest was just moving stuff into the
StreamingRunner
class, so that the implementation is a bit more organized.EDIT
I pushed a second commit that makes the TCP server persistent.
This allows us to do some interesting magic for the run in terminal profile. Since the TCP server is always on and we can control the initial terminal creation, even if the user runs tests manually inside the terminal we are still able to update the explorer statuses.
I would really like to hear people's opinion about the organization of the code afterwards.
Automated Tests
Updated our existing tests.