commit | 81ae295bbafe360f494921daf248ec00dd436e94 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch1@gmail.com> | Wed Jun 17 08:06:10 2020 -0700 |
committer | GitHub <noreply@github.com> | Wed Jun 17 08:06:10 2020 -0700 |
tree | 2b20f02942834c06bf692a9c13f433145978f305 | |
parent | fccb9bba6db75c211ebacc908c2029e40bbc1c3f [diff] |
Use a more consistent wait-for-callbacks pattern (#1270) There are two guarantees in play around outstanding callbacks: - `tearDown` callbacks are not called until after outstanding callbacks from the test body are complete. - The overall test is not considered complete until after outstanding callbacks from `tearDown` callbacks are also complete. Previously these two guarantees were split in two locations. In `Declarer` the setups and test body are wrapped with `Invoker.waitForOutstandingCallbacks` to handle the first guarantee. In `Invoker` a _separate_ outstanding callbacks counter wraps the zone where the setups and test body are run, and it only counts the callbacks from the teardown callbacks. It is immediately awaited after spawning the future that runs the entire case - setups, test body, and teardowns. Now the two guarantees are handled together in sequence with a pattern that matches the intent - there are two calls to `waitForOutstandingCallbacks` so that both guarantees are clear. - Remove the call to `waitForOutstandingCallbacks` in `Declarer`. - Remove the wrapping in `Future` in `Invoker`. Since we immediately awaited the async counter the only thing that the Future wrapping was accomplishing was to delay the start of the test body - this is now accomplished with `await Future(() {});`. - Use two calls to `waitForOutstandingCallbacks` instead of wrapping a different levels - remove the counter zone key from the surrounding zone.
This repository contains packages for writing and running Dart tests.
A full featured packaged for writing and running Dart tests on various platforms, e.g. VM, Chrome, Node etc.
A minimal package for writing tests. This package is used by package:test
and package:test_core
.
A minimal package for writing and running tests. It also contains extensions for implementing a custom test runner. This package is used by package:test
.