Skip to content

Commit b65f4be

Browse files
betegonclaude
andcommitted
fix(test): use dynamic import for rcTokenHint to preserve logger mock
Static imports are hoisted and evaluate before mock.module() runs, so login.ts would bind the real consola logger instead of fakeLog — breaking the interactive prompt tests. Pull rcTokenHint into the existing dynamic import block that was already there for this reason. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 9aee126 commit b65f4be

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

test/commands/auth/login.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ mock.module("../../../src/lib/logger.js", () => ({
7777
}));
7878

7979
// Dynamic import: must run AFTER mock.module() so login.ts picks up fakeLog.
80-
const { loginCommand } = await import("../../../src/commands/auth/login.js");
80+
const { loginCommand, rcTokenHint } = await import(
81+
"../../../src/commands/auth/login.js"
82+
);
8183

82-
import { rcTokenHint } from "../../../src/commands/auth/login.js";
8384
// biome-ignore lint/performance/noNamespaceImport: needed for spyOn mocking
8485
import * as apiClient from "../../../src/lib/api-client.js";
8586
// biome-ignore lint/performance/noNamespaceImport: needed for spyOn mocking

0 commit comments

Comments
 (0)