Skip to content

test: add integration tests for post-commit hook execution #1705

Closed

Description

@worktrunk-bot

Missing Coverage

The post-commit hook type was added in #1679 (hook rationalization) and is wired into wt step commit and wt step squash. However, there are no integration tests verifying that post-commit hooks actually execute after a commit.

Completion tests confirm the hook name appears in the CLI, but no test configures a post-commit hook, runs a commit operation, and verifies the hook ran.

Suggested Tests

Add tests in tests/integration_tests/user_hooks.rs (or a new file) that:

  1. Configure a post-commit hook that writes a marker file
  2. Run wt step commit
  3. Use wait_for_file to verify the hook ran
  4. Test failure behavior (background hook — should not affect exit code)

Similar pattern to existing user_post_merge_executes test.

Activity

  1. max-sixty commented on Mar 24, 2026

    @max-sixty
    Owner
  2. added a commit that references this issue on Mar 24, 2026
    03f98db
  3. worktrunk-bot commented on Mar 24, 2026

    @worktrunk-bot
    CollaboratorAuthor

    Added integration tests for post-commit hook execution in #1711.

    Three tests covering wt step commit:

    1. test_user_post_commit_hook_executes — configures a post-commit hook that writes a marker file, runs wt step commit, verifies the hook ran via wait_for_file_content
    2. test_user_post_commit_skipped_with_no_verify — verifies --no-verify skips post-commit hooks
    3. test_user_post_commit_failure_does_not_block_commit — verifies failing background hook doesn't affect exit code

    One observation: post-commit hooks don't appear to fire during wt merge (when merge auto-commits dirty changes). The code path in CommitOptions::commit() spawns them, but the merge output shows no "Running post-commit" message. This might be worth a separate investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions