Add a surround() function.
- Dominant language
- Dart
- Stars
- 536
- Forks
- 232
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 10
Description
Given Dart's Zone-based asynchrony, there are a number of use-cases for being able to wrap entire tests—including the setup and teardown—in a single zone (see for example [this thread](https://github.com/dart-lang/observe/pull/84#discussion_r47805618)). A straightforward way to accomplish this would be to provide a `void surround(Future callback(Future runTest()))` function that defines a callback to run around the test and any inner setups or teardowns. For example:
``` dart
void main() {
surround((runTest) {
return runZoned(runTest, zoneSpecification: myZoneSpecificiation);
});
// ..
}
```
There are a lot of edge-cases that would need to be worked out, and it's possible that one of them will make this not work. But it's something to keep in mind.
Contributor guide
Research direction
Start by reviewing the test lifecycle around setup, teardown, and Dart's Zone-based asynchrony, then examine how runZoned could wrap runTest. Determine whether a surround() callback can cover the entire test lifecycle and document the edge cases or constraints that decide whether the feature is viable.
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