Issue with Effect.sleep in Tests Timing Out

Am I doing something wrong here? I noticed Effect.sleep no matter the duration results in tests timing out, so I crafted this test.

import { Clock, Duration, Effect, TestClock } from 'effect';
import { describe, expect, it } from '@effect/vitest';

describe('Sleep', () => {
  it.effect('should sleep for 2 seconds', () =>
    Effect.gen(function* () {
      yield* TestClock.adjust(0);

      const start = yield* Clock.currentTimeMillis;
      yield* Effect.sleep(Duration.seconds(2));
      const end = yield* Clock.currentTimeMillis;

      expect(end - start).toBeGreaterThan(2000);
    }),
  );
});
Was this page helpful?