jinyus / dart_beacon

A reactive primitive (signals) and state management library for dart and flutter
https://pub.dev/packages/state_beacon
27 stars 2 forks source link

fix: Flaky test 'should transform input values when use mid-chain/2' #111

Closed yehorh closed 5 months ago

yehorh commented 5 months ago

Description The test in my environment is very unstable.

$ dart --version
Dart SDK version: 3.3.4 (stable) (Tue Apr 16 19:56:12 2024 +0000) on "macos_arm64"
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-UA)
    • Flutter version 3.19.6 on channel stable at /Users/yehorh/opt/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (7 days ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

example output:

$ for run in {1..20}; do dart test --name='should transform input values when use mid-chain/2'; done
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +0 -1: test/src/extensions/chain_test.dart: should transform input values when use mid-chain/2 [E]                                                                                                                                                                                                            
  Expected: should do the following in order:
            • emit an event that <1>
            • emit an event that <3>
            • emit an event that <5>
    Actual: <Instance of '_BroadcastStream<int>'>
     Which: emitted • 1
                    • 5
              which didn't emit an event that <3>

  test/src/extensions/chain_test.dart 617:5  main.<fn>

To run this test again: /Users/yehorh/opt/flutter/bin/cache/dart-sdk/bin/dart test test/src/extensions/chain_test.dart -p vm --plain-name 'should transform input values when use mid-chain/2'
00:00 +0 -1: Some tests failed.                                                                                                                                                                                                                                                                                     

Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'dart test --chain-stack-traces'.
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:30 +0 -1: test/src/extensions/chain_test.dart: should transform input values when use mid-chain/2 [E]                                                                                                                                                                                                            
  TimeoutException after 0:00:30.000000: Test timed out after 30 seconds. See https://pub.dev/packages/test#timeouts
  dart:isolate  _RawReceivePort._handleMessage

To run this test again: /Users/yehorh/opt/flutter/bin/cache/dart-sdk/bin/dart test test/src/extensions/chain_test.dart -p vm --plain-name 'should transform input values when use mid-chain/2'
00:30 +0 -1: Some tests failed.                                                                                                                                                                                                                                                                                     

Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'dart test --chain-stack-traces'.
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:30 +0 -1: test/src/extensions/chain_test.dart: should transform input values when use mid-chain/2 [E]                                                                                                                                                                                                            
  TimeoutException after 0:00:30.000000: Test timed out after 30 seconds. See https://pub.dev/packages/test#timeouts
  dart:isolate  _RawReceivePort._handleMessage

To run this test again: /Users/yehorh/opt/flutter/bin/cache/dart-sdk/bin/dart test test/src/extensions/chain_test.dart -p vm --plain-name 'should transform input values when use mid-chain/2'
00:30 +0 -1: Some tests failed.                                                                                                                                                                                                                                                                                     

Consider enabling the flag chain-stack-traces to receive more detailed exceptions.
For example, 'dart test --chain-stack-traces'.
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!                                                                                                                                                                                                                                                                                         
00:00 +1: All tests passed!      
jinyus commented 5 months ago

Thanks for reporting, I bet it's the stream that's the issue...I will fix

jinyus commented 5 months ago

This should work now.

yehorh commented 5 months ago

Thanks! ☺️