kiro 0.1.38: the tests keep kiro-cli's Windows sign-in under their own HOME (#966)
On Windows the plugin reads kiro-cli's database from %APPDATA%\kiro-cli,
while accounts.test.mjs and builderid.test.mjs wrote and removed it under
~/.local/share. With #1067's EBUSY fix in, these were the last 2 of
#966's 8 Windows reds: "kiro-cli's sign-in, with no way known, keeps the
bare email" and "kiro-cli's Builder ID sign-in ... Builder ID's profile".
The tests now set APPDATA inside the temp HOME before loading the plugin,
so no real %APPDATA% is read or removed, and use that folder on win32.
The version bump releases #1067's statement finalizing.
Run: packages/kiro on Windows 11 (Bun 1.4.2, temp HOME/USERPROFILE)
183 pass 0 fail (2 fail at a9f16031 without this); WSL Ubuntu 24.04
183 pass 0 fail; bun scripts/check.mjs kiro ok.
Not tried: macOS (the change is win32-only).
Fixes #966
This commit is contained in:
@@ -22,6 +22,8 @@ beforeAll(async () => {
|
|||||||
// Bun reads HOME once, at start: run as HOME=$(mktemp -d) bun test, so
|
// Bun reads HOME once, at start: run as HOME=$(mktemp -d) bun test, so
|
||||||
// no real sign-in is ever read or written
|
// no real sign-in is ever read or written
|
||||||
if (![tmpdir(), realpathSync(tmpdir())].some((t) => homedir().startsWith(t))) throw new Error("run with HOME=$(mktemp -d) bun test")
|
if (![tmpdir(), realpathSync(tmpdir())].some((t) => homedir().startsWith(t))) throw new Error("run with HOME=$(mktemp -d) bun test")
|
||||||
|
// kiro-cli keeps its sign-in under %APPDATA% on Windows: keep that in HOME too
|
||||||
|
if (process.platform === "win32") process.env.APPDATA = join(homedir(), "AppData", "Roaming")
|
||||||
;({ KiroAuthPlugin: plugin } = await import("./index.mjs"))
|
;({ KiroAuthPlugin: plugin } = await import("./index.mjs"))
|
||||||
})
|
})
|
||||||
const offline = async () => { throw new Error("no network in tests") }
|
const offline = async () => { throw new Error("no network in tests") }
|
||||||
@@ -29,7 +31,8 @@ const real = globalThis.fetch
|
|||||||
globalThis.fetch = offline
|
globalThis.fetch = offline
|
||||||
afterAll(() => (globalThis.fetch = real))
|
afterAll(() => (globalThis.fetch = real))
|
||||||
const cliDir = () =>
|
const cliDir = () =>
|
||||||
process.platform === "darwin" ? join(homedir(), "Library", "Application Support", "kiro-cli") : join(homedir(), ".local", "share", "kiro-cli")
|
process.platform === "win32" ? join(homedir(), "AppData", "Roaming", "kiro-cli")
|
||||||
|
: process.platform === "darwin" ? join(homedir(), "Library", "Application Support", "kiro-cli") : join(homedir(), ".local", "share", "kiro-cli")
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
globalThis.fetch = offline
|
globalThis.fetch = offline
|
||||||
rmSync(cliDir(), { recursive: true, force: true })
|
rmSync(cliDir(), { recursive: true, force: true })
|
||||||
|
|||||||
@@ -15,13 +15,16 @@ beforeAll(async () => {
|
|||||||
// Bun reads HOME once, at start: run as HOME=$(mktemp -d) bun test, so
|
// Bun reads HOME once, at start: run as HOME=$(mktemp -d) bun test, so
|
||||||
// no real sign-in (~/.kiro, ~/.aws, kiro-cli's) is ever read or written
|
// no real sign-in (~/.kiro, ~/.aws, kiro-cli's) is ever read or written
|
||||||
if (![tmpdir(), realpathSync(tmpdir())].some((t) => homedir().startsWith(t))) throw new Error("run with HOME=$(mktemp -d) bun test")
|
if (![tmpdir(), realpathSync(tmpdir())].some((t) => homedir().startsWith(t))) throw new Error("run with HOME=$(mktemp -d) bun test")
|
||||||
|
// kiro-cli keeps its sign-in under %APPDATA% on Windows: keep that in HOME too
|
||||||
|
if (process.platform === "win32") process.env.APPDATA = join(homedir(), "AppData", "Roaming")
|
||||||
;({ KiroAuthPlugin: plugin } = await import("./index.mjs"))
|
;({ KiroAuthPlugin: plugin } = await import("./index.mjs"))
|
||||||
})
|
})
|
||||||
const offline = async () => { throw new Error("no network in tests") }
|
const offline = async () => { throw new Error("no network in tests") }
|
||||||
const real = globalThis.fetch
|
const real = globalThis.fetch
|
||||||
globalThis.fetch = offline
|
globalThis.fetch = offline
|
||||||
const cliDir = () =>
|
const cliDir = () =>
|
||||||
process.platform === "darwin" ? join(homedir(), "Library", "Application Support", "kiro-cli") : join(homedir(), ".local", "share", "kiro-cli")
|
process.platform === "win32" ? join(homedir(), "AppData", "Roaming", "kiro-cli")
|
||||||
|
: process.platform === "darwin" ? join(homedir(), "Library", "Application Support", "kiro-cli") : join(homedir(), ".local", "share", "kiro-cli")
|
||||||
const ideDir = () => join(homedir(), ".aws", "sso", "cache")
|
const ideDir = () => join(homedir(), ".aws", "sso", "cache")
|
||||||
const clean = () => {
|
const clean = () => {
|
||||||
rmSync(cliDir(), { recursive: true, force: true })
|
rmSync(cliDir(), { recursive: true, force: true })
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@magpie-community/opencode-kiro-auth",
|
"name": "@magpie-community/opencode-kiro-auth",
|
||||||
"version": "0.1.37",
|
"version": "0.1.38",
|
||||||
"description": "Kiro subscriptions (Free, Pro, Pro+, Power) in OpenCode and magpie",
|
"description": "Kiro subscriptions (Free, Pro, Pro+, Power) in OpenCode and magpie",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./opencode.mjs",
|
"main": "./opencode.mjs",
|
||||||
|
|||||||
Reference in New Issue
Block a user