Improve two-way communication test #621
Open
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.
Hello! 👋
TLDR;
This PR improves the two-way communication test to fail if
WireValueTypeandMessageTypewould happen to overlap again in the future.Full story
First, I want to thank you for your work on Comlink. This is one of the most elegant, well written library I've ever come across ⭐ 👏
I recently noticed that the test for two-way communication does not do enough work to actually fail in versions of
Comlink< 4.3.1. I encountered this issue while trying to port two-way communication to our fork which is stuck at 4.3.0.To see how this PR helps you can use this bash script:
If you run this script you'll see this error in your console (you might need to scroll up a bit 📜):
If you run the script again but replace
BRANCH=fix-two-way-iframe-testbyorigin/main(or equivalent), you can see that the test pass (you'll need to scroll up again to view the result of the firstkarma start):This shows that the test is missing a few bits.