@@ -479,7 +479,7 @@ describe("LifecycleService", () => {
479479 ] ) ;
480480 } ) ;
481481
482- it ( "rejects removing a dirty worktree" , async ( ) => {
482+ it ( "force removes a dirty worktree" , async ( ) => {
483483 const repoRoot = await initRepo ( ) ;
484484 const runtime = new ProjectRuntime ( ) ;
485485 const tmux = new FakeTmuxGateway ( ) ;
@@ -491,16 +491,14 @@ describe("LifecycleService", () => {
491491 const worktreePath = join ( repoRoot , "__worktrees" , "feature-dirty" ) ;
492492 await Bun . write ( join ( worktreePath , "README.md" ) , "# dirty\n" ) ;
493493
494- await expect ( lifecycle . removeWorktree ( "feature-dirty" ) ) . rejects . toThrow (
495- "Worktree has uncommitted changes: feature-dirty" ,
496- ) ;
494+ await lifecycle . removeWorktree ( "feature-dirty" ) ;
497495
498- expect ( hooks . calls . filter ( ( call ) => call . name === "preRemove" ) ) . toHaveLength ( 0 ) ;
499- expect ( new BunGitGateway ( ) . listWorktrees ( repoRoot ) . some ( ( entry ) => entry . path === worktreePath ) ) . toBe ( true ) ;
500- expect ( run ( [ "git" , "branch" , "--list" , "feature-dirty" ] , repoRoot ) ) . toContain ( "feature-dirty ") ;
496+ expect ( hooks . calls . filter ( ( call ) => call . name === "preRemove" ) ) . toHaveLength ( 1 ) ;
497+ expect ( new BunGitGateway ( ) . listWorktrees ( repoRoot ) . some ( ( entry ) => entry . path === worktreePath ) ) . toBe ( false ) ;
498+ expect ( run ( [ "git" , "branch" , "--list" , "feature-dirty" ] , repoRoot ) ) . toBe ( " ") ;
501499 } ) ;
502500
503- it ( "rejects removing a clean worktree that is ahead of its upstream" , async ( ) => {
501+ it ( "force removes a worktree that is ahead of its upstream" , async ( ) => {
504502 const repoRoot = await initRepo ( ) ;
505503 const runtime = new ProjectRuntime ( ) ;
506504 const tmux = new FakeTmuxGateway ( ) ;
@@ -518,12 +516,10 @@ describe("LifecycleService", () => {
518516
519517 await lifecycle . createWorktree ( { branch : "feature-ahead" } ) ;
520518
521- await expect ( lifecycle . removeWorktree ( "feature-ahead" ) ) . rejects . toThrow (
522- "Worktree has unpushed commits: feature-ahead" ,
523- ) ;
519+ await lifecycle . removeWorktree ( "feature-ahead" ) ;
524520
525- expect ( hooks . calls . filter ( ( call ) => call . name === "preRemove" ) ) . toHaveLength ( 0 ) ;
526- expect ( run ( [ "git" , "branch" , "--list" , "feature-ahead" ] , repoRoot ) ) . toContain ( "feature-ahead ") ;
521+ expect ( hooks . calls . filter ( ( call ) => call . name === "preRemove" ) ) . toHaveLength ( 1 ) ;
522+ expect ( run ( [ "git" , "branch" , "--list" , "feature-ahead" ] , repoRoot ) ) . toBe ( " ") ;
527523 } ) ;
528524
529525 it ( "removes the sandbox container before deleting a docker worktree" , async ( ) => {
0 commit comments