question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not cooperate well with runTest

See original GitHub issue

When using turbine to test flows, delays are not skipped which causes tests to run with full delays. I would expect turbine to skip the delays.

Tested with:

  • Turbine 0.8.0
  • Coroutines 1.6.3

Reproducer:

  @Test
  fun turbineDelay() {
    val delayingFlow = flow {
      delay(2.seconds)
      emit(Unit)
    }
    measureTime {
      runTest {
        delayingFlow.test {
          awaitItem()
          awaitComplete()
        }
      }
    }.also { println("turbine test took $it") }
    measureTime {
      runTest {
        delayingFlow.collect()
      }
    }.also { println("regular runTest took $it") }
  }

This prints on my machine:

turbine test took 2.061758791s
regular runTest took 2.227208ms

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
PaulWoitaschekcommented, Sep 6, 2022

Yes, thanks!

turbine test took 67.152292ms
regular runTest took 569.333us
1reaction
JakeWhartoncommented, Jul 27, 2022

It releases when it releases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A 12-Minute Run to Check Aerobic Fitness - Cooper Test
The Cooper test, a 12-minute run test, is a basic test used by coaches, trainers, and athletes to assess their current fitness and...
Read more >
Run jest for unit tests of modified files only | by SunCommander
The problem with this option is that once you commit or push your changes, it won't be able to find changed files so...
Read more >
dbunit - gradle test doesn't work well - Stack Overflow
When I run test in IntelliJ, it works well, but if I run it by command line like. gradle test or gradle clean...
Read more >
Testing Kotlin coroutines on Android
runTest is a coroutine builder designed for testing. Use this to wrap any tests that include coroutines. Note that coroutines can be started...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
Only run test methods and classes that match the pattern or substring. This option may be used multiple times, in which case all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found