Dashboard › cli › Testing Stricli command func() bodies v…
01a0266d-248b-770d-a01a-a75651a96de5Testing Stricli command func() bodies: (1) const func = await cmd.loader(); func.call(mockContext, flags, ...args) with mock stdout, stderr, cwd, setContext. loader() return type union causes .call() LSP false-positives that pass tsc --noEmit. (2) When API functions are renamed, update both spy target AND mock return shape. (3) normalizeSlug replaces _→- but does NOT lowercase. (4) Bun mockFetch() replaces globalThis.fetch — use one unified mock dispatching by URL. (5) mock.module() pollutes module registry for ALL subsequent files — put in test/isolated/ and run via test:isolated. (6) For Bun.spawn, use direct property assignment in beforeEach/afterEach.