dart-lang / dart-lang/test

Support worker plugins

Open
#710 0 comments 1 reaction 0 assignees View on GitHub
plugin API status-blocked type-enhancement
Dominant language
Dart
Stars
536
Forks
232
Avg merge
1d 10h
Merged PRs (30d)
10

Description

It would be very useful to allow plugins to provide code to run in the remote workers (iframes, isolates, etc). The plugin could define a file with a method like this:

```dart
void runInWorker() {
// ...
}
```

that's invoked in the declarer context for each test suite, before any of the user's code, and define `setUp()`s and so on. This would be especially useful to combine with other plugin types so that they can set up communication and invoke code in the worker context.

This does present a tricky implementation question. It's currently up to each `PlatformPlugin` to compile and invoke Dart code; it can do whatever it wants as long as it invokes `serializeSuite()` from `remote_platform_helpers.dart`. But importing a totally static `package:` URL won't work when we need to import and invoke worker plugins based on the user's configuration.

I think worker plugins are valuable enough to be worth adding complexity to the `PlatformPlugin` API, but there's an open question about what that complexity should look like. One possibility would be to have `PlatformPlugin.load()` and `.loadChannel()` take a custom URL to import instead of `remote_platform_helpers.dart` that provides an implementation of `serializeSuite()` that handles plugin-loading. Another would be to require plugins to extend (rather than implement) `PlatformPlugin` and define that URL as a getter that's set privately by the loader.

Contributor guide

Open the contributing guide

Research direction

Start by reading remote_platform_helpers.dart and the PlatformPlugin API, especially load() and loadChannel(), to understand how serializeSuite() is currently invoked. Compare the proposed approaches for loading worker-plugin code from user configuration and define the API behavior needed for plugins to run setup code in each worker context. Done means a documented, tested design and implementation that supports worker plugins across the relevant platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.