test
test copied to clipboard
`fail` API may not cause a test to fail if it's running in a zone with an uncaught async error handler
Since fail
is throw TestFailure
we can get into a situation where an async failing expect
call in some error handling zone will not result in a test failure.
https://github.com/dart-lang/test/blob/e0be5ec076c59d621de1892b108727f560f217bc/pkgs/test_api/lib/src/expect/expect.dart#L109
There is code that relies on catching TestFailure
exceptions in some cases, so I don't think we want to make all failures directly fail a test. It could be confusing to have both fail
which throws, and TestHandle.current.markFailed
which doesn't throw.
Should it maybe do both? Not throwing means the test would continue running, which we generally probably don't want.