adds claude-generated commit messages and a recent commits panel to the git view - adds log tailing in the explorer, branch merging and a clean up button
This commit is contained in:
@@ -171,6 +171,84 @@ import Testing
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@Suite struct TerminalStoreTailTests {
|
||||
private let environment = ["SHELL": "/bin/zsh", "HOME": "/Users/me"]
|
||||
|
||||
@Test func aTailRunsTailOnThePathInTheProjectWithoutALoginShell() {
|
||||
let store = TerminalStore(projectRoot: "/code/app", environment: environment)
|
||||
store.startTail("storage/logs/laravel.log")
|
||||
let tail = FakeTerminal()
|
||||
store.start(.tail, on: tail)
|
||||
#expect(store.tailedPath == "storage/logs/laravel.log")
|
||||
#expect(store.tail === tail)
|
||||
#expect(tail.starts.first?.launch.executable == "/usr/bin/tail")
|
||||
#expect(tail.starts.first?.launch.arguments == ["-f", "storage/logs/laravel.log"])
|
||||
#expect(tail.starts.first?.launch.workingDirectory == "/code/app")
|
||||
#expect(tail.starts.first?.argv0 == "tail")
|
||||
}
|
||||
|
||||
@Test func withoutATailedPathThePaneSpawnsNothing() {
|
||||
let store = TerminalStore(projectRoot: "/p", environment: environment)
|
||||
let tail = FakeTerminal()
|
||||
store.start(.tail, on: tail)
|
||||
#expect(tail.starts.isEmpty)
|
||||
#expect(store.tail == nil)
|
||||
}
|
||||
|
||||
@Test func tailingAnotherFileTerminatesTheOldTailAndAsksForAFreshPane() {
|
||||
let store = TerminalStore(projectRoot: "/p", environment: environment)
|
||||
store.startTail("a.log")
|
||||
let first = FakeTerminal()
|
||||
store.start(.tail, on: first)
|
||||
let generation = store.tailGeneration
|
||||
store.startTail("b.log")
|
||||
#expect(first.terminations == 1)
|
||||
#expect(store.tail == nil)
|
||||
#expect(store.tailedPath == "b.log")
|
||||
#expect(store.tailGeneration != generation)
|
||||
let second = FakeTerminal()
|
||||
store.start(.tail, on: second)
|
||||
#expect(second.starts.first?.launch.arguments == ["-f", "b.log"])
|
||||
#expect(first.starts.count == 1)
|
||||
}
|
||||
|
||||
@Test func closeTerminatesTheTailAndRemovesTheBlock() {
|
||||
let store = TerminalStore(projectRoot: "/p", environment: environment)
|
||||
store.startTail("a.log")
|
||||
let tail = FakeTerminal()
|
||||
store.start(.tail, on: tail)
|
||||
store.closeTail()
|
||||
#expect(tail.terminations == 1)
|
||||
#expect(store.tail == nil)
|
||||
#expect(store.tailedPath == nil)
|
||||
}
|
||||
|
||||
@Test func terminateAllEndsTheTailToo() {
|
||||
let store = TerminalStore(projectRoot: "/p", environment: environment)
|
||||
let agent = FakeTerminal(), shell = FakeTerminal(), tail = FakeTerminal()
|
||||
store.start(.agent, on: agent)
|
||||
store.start(.shell, on: shell)
|
||||
store.startTail("a.log")
|
||||
store.start(.tail, on: tail)
|
||||
store.terminateAll()
|
||||
#expect([agent, shell, tail].allSatisfy { $0.terminations == 1 })
|
||||
#expect(store.tail == nil)
|
||||
#expect(store.tailedPath == nil)
|
||||
store.release(tail)
|
||||
#expect(tail.terminations == 1)
|
||||
}
|
||||
|
||||
@Test func aTailExitIsReportedOnItsOwn() {
|
||||
let store = TerminalStore(projectRoot: "/p", environment: environment)
|
||||
store.startTail("a.log")
|
||||
store.start(.tail, on: FakeTerminal())
|
||||
store.processExited(.tail, exitCode: 1)
|
||||
#expect(store.hasExited(.tail))
|
||||
#expect(!store.hasExited(.shell))
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@Suite struct TerminalPseudoTerminalTests {
|
||||
@Test(.tags(.realProcess), .timeLimit(.minutes(1)))
|
||||
|
||||
Reference in New Issue
Block a user