Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Tests

on:
pull_request:
push:
branches: [main]
schedule:
- cron: '0 8 * * *' # daily at 8am UTC

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

- run: ./test/bats/bin/bats test/unit/ test/integration/ test/e2e/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Worktree Toolkit

[![Tests](https://github.com/block/wt/actions/workflows/test.yml/badge.svg)](https://github.com/block/wt/actions/workflows/test.yml)

A streamlined workflow for developing in large Bazel + IntelliJ monorepos using Git worktrees.

Enables instant IntelliJ context switching between worktrees—no re-imports, no re-indexing—and scales to support parallel development by humans and AI agents alike.
Expand Down
1 change: 1 addition & 0 deletions test/e2e/workflow.bats
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ teardown() {
assert_equal "$current" "second-repo"

# Load and verify variables (wt_load_context_config reads from ~/.wt/current)
source "$TEST_HOME/.wt/lib/wt-common"
source "$TEST_HOME/.wt/lib/wt-context"
wt_load_context_config
assert_equal "$WT_MAIN_REPO_ROOT" "$REPO2"
Expand Down
4 changes: 2 additions & 2 deletions test/integration/wt-cd.bats
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ teardown() {
@test "wt-cd fails for non-existent path" {
run "$TEST_HOME/.wt/bin/wt-cd" "/nonexistent/path/xyz"
assert_failure
assert_output --partial "does not exist"
assert_output --partial "not found"
}

@test "wt-cd fails for non-worktree directory" {
Expand All @@ -69,7 +69,7 @@ teardown() {
}

@test "wt-cd fails with empty argument" {
run --separate-stderr "$TEST_HOME/.wt/bin/wt-cd" ""
run --separate-stderr "$TEST_HOME/.wt/bin/wt-cd" "" < /dev/null
assert_failure
# No path should be written to stdout
assert_output ""
Expand Down
4 changes: 2 additions & 2 deletions test/integration/wt-remove.bats
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ create_removable_worktree() {
@test "wt-remove fails for non-existent path" {
run "$TEST_HOME/.wt/bin/wt-remove" -y "/nonexistent/worktree/path"
assert_failure
assert_output --partial "does not exist"
assert_output --partial "not found"
}

@test "wt-remove fails for path that is not a worktree" {
Expand All @@ -150,7 +150,7 @@ create_removable_worktree() {

run "$TEST_HOME/.wt/bin/wt-remove" -y "$not_worktree"
assert_failure
assert_output --partial "not a working tree"
assert_output --partial "not a git repository or worktree"
# Directory should not have been deleted
assert [ -d "$not_worktree" ]
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/wt-switch.bats
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ teardown() {
# Create a known symlink so we can verify it's not modified
ln -sf "$REPO" "$WT_ACTIVE_WORKTREE"

run "$TEST_HOME/.wt/bin/wt-switch" ""
run "$TEST_HOME/.wt/bin/wt-switch" "" < /dev/null
assert_failure

# Verify symlink was not modified
Expand Down