fix(tests): stabilize auto-update-checker isolation under bun
This commit is contained in:
parent
8c726f5589
commit
b4183339e7
@ -1,4 +1,4 @@
|
|||||||
import { describe, it, expect, mock } from "bun:test"
|
import { afterEach, describe, it, expect, mock } from "bun:test"
|
||||||
|
|
||||||
const mockShowConfigErrorsIfAny = mock(async () => {})
|
const mockShowConfigErrorsIfAny = mock(async () => {})
|
||||||
const mockShowModelCacheWarningIfNeeded = mock(async () => {})
|
const mockShowModelCacheWarningIfNeeded = mock(async () => {})
|
||||||
@ -42,6 +42,11 @@ mock.module("../../shared/logger", () => ({
|
|||||||
|
|
||||||
const { createAutoUpdateCheckerHook } = await import("./hook")
|
const { createAutoUpdateCheckerHook } = await import("./hook")
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
delete process.env.OPENCODE_CLI_RUN_MODE
|
||||||
|
mock.restore()
|
||||||
|
})
|
||||||
|
|
||||||
describe("createAutoUpdateCheckerHook", () => {
|
describe("createAutoUpdateCheckerHook", () => {
|
||||||
it("skips startup toasts and checks in CLI run mode", async () => {
|
it("skips startup toasts and checks in CLI run mode", async () => {
|
||||||
//#given - CLI run mode enabled
|
//#given - CLI run mode enabled
|
||||||
@ -78,6 +83,5 @@ describe("createAutoUpdateCheckerHook", () => {
|
|||||||
expect(mockShowVersionToast).not.toHaveBeenCalled()
|
expect(mockShowVersionToast).not.toHaveBeenCalled()
|
||||||
expect(mockRunBackgroundUpdateCheck).not.toHaveBeenCalled()
|
expect(mockRunBackgroundUpdateCheck).not.toHaveBeenCalled()
|
||||||
|
|
||||||
delete process.env.OPENCODE_CLI_RUN_MODE
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -40,7 +40,7 @@ mock.module("../../../shared/logger", () => ({
|
|||||||
log: () => {},
|
log: () => {},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const { runBackgroundUpdateCheck } = await import("./background-update-check")
|
const { runBackgroundUpdateCheck } = await import("./background-update-check?test")
|
||||||
|
|
||||||
describe("runBackgroundUpdateCheck", () => {
|
describe("runBackgroundUpdateCheck", () => {
|
||||||
const mockCtx = { directory: "/test" } as any
|
const mockCtx = { directory: "/test" } as any
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user