Skip to content

test: CheckpointService tests timing out in beforeEach hook #2614

@KJ7LNW

Description

@KJ7LNW

Version

v3.11.16

What happened?

Two tests in the CheckpointService test suite are failing due to timeout errors in the beforeEach hook:

  1. RepoPerTaskCheckpointService#events › emits checkpoint event when saving checkpoint
  2. RepoPerTaskCheckpointService#events › emits error event when an error occurs

The error indicates that the beforeEach hook exceeded the default Jest timeout of 5000ms. The specific error occurs in ShadowCheckpointService.test.ts:65.

Error message:

thrown: "Exceeded timeout of 5000 ms for a hook.
Add a timeout value to this test to increase the timeout, if this is a long-running test."

Steps to reproduce

  1. Run the test suite with npm run test
  2. Observe the failures in CheckpointService tests
  3. Note that the beforeEach hook at line 65 in src/services/checkpoints/tests/ShadowCheckpointService.test.ts times out

Relevant output

  ● CheckpointService › RepoPerTaskCheckpointService#events › emits checkpoint event when saving checkpoint

    thrown: "Exceeded timeout of 5000 ms for a hook.
    Add a timeout value to this test to increase the timeout, if this is a long-running test. See https://jestjs.io/docs/api#testname-fn-timeout."

      63 | 	let service: RepoPerTaskCheckpointService | RepoPerWorkspaceCheckpointService
      64 |
    > 65 | 	beforeEach(async () => {
         | 	^
      66 | 		jest.mocked(require("globby").globby).mockClear().mockResolvedValue([])
      67 |
      68 | 		const shadowDir = path.join(tmpDir, `${prefix}-${Date.now()}`)

Additional context

  • The failing tests are in the CheckpointService test suite
  • The issue appears to be in the beforeEach hook setup
  • The hook involves mocking globby and setting up a shadow directory
  • The default Jest timeout of 5000ms is being exceeded
  • This may indicate that the beforeEach hook is performing operations that are taking longer than expected
  • The test suite overall ran 1382 tests with 1358 passing, 2 failing, and 22 pending

cc @cte

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Unassigned / ActionableClear and approved. Available for contributors to pick up.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions