fake_async icon indicating copy to clipboard operation
fake_async copied to clipboard

Fake asynchronous events for deterministic testing.

Results 13 fake_async issues
Sort by recently updated
recently updated
newest added

I have stumbled across a difference in behavior between stream.[first](https://api.flutter.dev/flutter/dart-async/Stream/first.html) and stream.[firstOrNull](https://api.flutter.dev/flutter/async/StreamExtensions/firstOrNull.html) when using timeouts with fakeAsync: ```dart // Passes as expected test('stream.first with timeout', () async { fakeAsync((FakeAsync async)...

I have a test that passes normally if run without FakeAsync, but freezes mid execution under FakeAsync. After some time debugging, it looks like the problem is somehow related to...

This test: ```dart test('Should interrupt on timeout', () { //given var controller = StreamController(); const expectedError = 'No response'; //when result() { final comleter = Completer(); controller.stream.timeout( Duration(seconds: 5), onTimeout:...

If `autoMicrotasks` is set to `true` when creating `FakeAsync` or calling `fakeAsync`, the microtask queue will automatically be flushed by a microtask from the parent zone. For tests that only...

See this discussion here : https://github.com/dart-lang/sdk/issues/54769#issuecomment-1918787842. I'd like to vary the precision of Duration so that we have a finer grained precision - say down to picoseconds. This is for...

Hi! I'm having trouble with using `fakeAsync` with code that depends on asynchronous generator. Possibly it's something that I don't understand about async*/yield* that causes this, but I'd like to...

Sometimes it's nice to be able to have a little block of `async/await` code in your test. `await` is _very_ tricky to use in a fake async zone since it...

type-enhancement

I think I just don't understand this, but why does this test fail (as expected): ```dart test('test smoke test -- this test should fail', () { fakeAsync((async) { expect(true, isFalse);...

I use fakeAsync for some test cases in my daily work. I have accidentally written a test case which looks like this: ```dart FakeAsync().run((fakeAsync) async { functionWithTimer(); fakeAsync.elapse(t); final x...

I think that while the ability to mock microtasks can be useful, most use-cases don't really care about this. Instead, people likely use fake_async for Duration based APIs like clocks...