Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept: Shared worker plugins #2478

Merged
merged 4 commits into from
Sep 20, 2020
Merged

Conversation

novemberborn
Copy link
Member

@novemberborn novemberborn commented Apr 27, 2020

"Shared workers" are code that runs in AVA's main process, that can communicate with test workers.

The idea is that a test file can require a module which registers itself as a plugin. The main process launches a worker thread (so this is a Node.js 12+ feature) which can communicate with all test files.

The worker thread would survive across watcher runs, under the assumption that the worker code came from a third-party and so doesn't need to be reloaded.

Advanced serialization is used for the communication between the test worker, main processes and worker thread. Consequently this requires Node.js 12.16. Though I'm also using some features introduced in Node.js 12.17.

This should give us the low-level primitives for #2048 and #1366.

@novemberborn novemberborn force-pushed the shared-worker-plugins branch 4 times, most recently from 5a01bf5 to d673850 Compare May 9, 2020 15:38
@novemberborn
Copy link
Member Author

Wow I think I got this working (let's see what CI says). There's a proof of concept here: https://github.com/avajs/ava/tree/shared-worker-plugins/test/shared-workers/proof-of-concept/fixtures

But I'll try and build something real on top of this next.

@novemberborn
Copy link
Member Author

I think I have full code coverage… will try and update my other proof-of-concept packages and then see if I can sneak this into a release.

@novemberborn novemberborn marked this pull request as ready for review September 20, 2020 09:00
@novemberborn novemberborn merged commit 5124547 into master Sep 20, 2020
@novemberborn novemberborn deleted the shared-worker-plugins branch September 20, 2020 09:05
@novemberborn
Copy link
Member Author

I'm looking to sneak this into a release, but I still have to update the issues, plan work, document things, and ship some example packages…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant