tp / tsaga

Typesafe and lightweight way to write Redux-connected functions with asynchronous side-effects that are easily testable.
Apache License 2.0
8 stars 1 forks source link

Why do tests pass before the saga is completed? #8

Closed tp closed 5 years ago

tp commented 5 years ago

Branch feature/complete-approach

Log:

[...]

  console.error src/custom-middleware/lib/CancellationToken.ts:5
    cancelling via token

  console.error src/custom-middleware/app/user-sagas.ts:53
    about to sleep

 PASS  src/custom-middleware/app/__tests__/middleware.test.ts (6.978s)
  ✓ Bottom up sample (45ms)
  ✓ Bottom up sample (latest) (3030ms)
  ✓ Bottom up sample (latest) (4ms)
  ✓ Bottom up sample (latest) (3015ms)

Test Suites: 1 passed, 1 total
Tests:       4 passed, 4 total
Snapshots:   0 total
Time:        7.44s
Ran all test suites matching /src\/custom-middleware/i.
  console.error src/custom-middleware/app/user-sagas.ts:57
    sleep done

  console.error src/custom-middleware/app/user-sagas.ts:57
    sleep done

[...]

Is this an error in logging, or is the test runner not waiting long enough?

tp commented 5 years ago

Just the behavior of jest logging, it output all log messages after the test.