fix(test): add nested beforeEach for mainSessionID test isolation

Previous test was setting mainSessionID to 'main-session-123' and the
next test expected undefined. The outer beforeEach wasn't properly
resetting state between tests in the nested describe block.

Adding a nested beforeEach ensures proper test isolation.
This commit is contained in:
justsisyphus
2026-01-17 16:47:56 +09:00
parent 5cb5dbef42
commit f6d4201d7d
2 changed files with 14 additions and 2 deletions

View File

@@ -232,10 +232,17 @@ async function publishAllPackages(version: string): Promise<void> {
} }
async function buildPackages(): Promise<void> { async function buildPackages(): Promise<void> {
const skipPlatform = process.env.SKIP_PLATFORM_PACKAGES === "true"
console.log("\nBuilding packages...") console.log("\nBuilding packages...")
await $`bun run clean && bun run build` await $`bun run clean && bun run build`
console.log("Building platform binaries...")
await $`bun run build:binaries` if (skipPlatform) {
console.log("⏭️ Skipping platform binaries (SKIP_PLATFORM_PACKAGES=true)")
} else {
console.log("Building platform binaries...")
await $`bun run build:binaries`
}
} }
async function gitTagAndRelease(newVersion: string, notes: string[]): Promise<void> { async function gitTagAndRelease(newVersion: string, notes: string[]): Promise<void> {

View File

@@ -82,6 +82,11 @@ describe("claude-code-session-state", () => {
}) })
describe("mainSessionID", () => { describe("mainSessionID", () => {
beforeEach(() => {
// #given - ensure clean state for mainSessionID tests
setMainSession(undefined)
})
test("should store and retrieve main session ID", () => { test("should store and retrieve main session ID", () => {
// #given // #given
const mainID = "main-session-123" const mainID = "main-session-123"