-
Notifications
You must be signed in to change notification settings - Fork 213
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
Why does making the callback function async break expect? #2312
Comments
I've got the same question – what's the cause of this behavior? Here's my example. I expect the below test to pass, but it times out instead. import 'package:fake_async/fake_async.dart';
import 'package:test/test.dart';
void main() {
test('test smoke test -- this test should pass', () async {
await fakeAsync((async) async {
final future = doWork();
async.elapse(const Duration(seconds: 2));
final value = await future;
expect(value, 1);
});
});
}
Future<int> doWork() async {
await Future<void>.delayed(const Duration(seconds: 1));
return 1;
}
|
This appears to be the same issue as #2307, and can probably be closed as a duplicate. (I have the same question, and am curious about the answer!) |
I like that this issue has code that can be copy-pasted to reproduce the problem. |
Sure. The fix for that is to copy the information over into a single thread 🙂 — done as https://github.com/dart-lang/fake_async/issues/38#issuecomment-1551771957 . |
Haha nice :) this one can be closed now. |
I can close this issue. It's been quite a long time though, I am unsure the dart team is interested in addressing this |
@CorvetteCole That's a good idea, everything is already in #2307. |
I think I just don't understand this, but why does this test fail (as expected):
But this one passes:
I don't understand this behavior, and I think it is the root of several bugs within my tests
The text was updated successfully, but these errors were encountered: