chore: silence node:sqlite ExperimentalWarning in tests, fix QR mock type
Patch process.emitWarning in the shared vitest setup to drop the "SQLite is an experimental feature" notice; align the test mock for getQrPayload with the canonical RemoteQrPayload signature. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ function makeInteractiveData(opts: {
|
||||
regeneratePersistentToken: () => Promise<{ maskedToken?: string; tokenType: "persistent"; expiresAt: null }>;
|
||||
generateShortLivedToken: (ttlMs: number) => Promise<{ token?: string; tokenType: "short-lived"; expiresAt: string | null }>;
|
||||
getRemoteUrl: (tokenType: "persistent" | "short-lived", ttlMs?: number) => Promise<{ url: string; tokenType: "persistent" | "short-lived"; expiresAt: string | null }>;
|
||||
getQrPayload: (tokenType: "persistent" | "short-lived", ttlMs?: number) => Promise<{ url: string; expiresAt: string | null; format: "text" | "image/svg"; data?: string }>;
|
||||
getQrPayload: (tokenType: "persistent" | "short-lived", ttlMs?: number, format?: "text" | "terminal" | "image/svg") => Promise<{ url: string; expiresAt: string | null; format: "text" | "image/svg" | "terminal"; data?: string }>;
|
||||
}>;
|
||||
} = {}) {
|
||||
const projects = opts.projects ?? [];
|
||||
|
||||
@@ -46,6 +46,16 @@ const DEFAULT_TEST_SUBPROCESS_TIMEOUT_MS = Math.max(
|
||||
const BLOCKED_TEST_CLI_PATTERN =
|
||||
/(^|[\s"'\\/])(?:claude|droid|paperclipai|hermes|openclaw)(?:\.(?:cmd|bat|ps1|exe))?(?=$|[\s"'\\/])/i;
|
||||
|
||||
const originalEmitWarning = process.emitWarning.bind(process);
|
||||
process.emitWarning = ((warning: string | Error, ...args: unknown[]) => {
|
||||
const message = typeof warning === "string" ? warning : warning?.message ?? "";
|
||||
const type = typeof args[0] === "string" ? args[0] : (args[0] as { type?: string } | undefined)?.type;
|
||||
if (type === "ExperimentalWarning" && message.includes("SQLite is an experimental feature")) {
|
||||
return;
|
||||
}
|
||||
return (originalEmitWarning as (...a: unknown[]) => void)(warning, ...args);
|
||||
}) as typeof process.emitWarning;
|
||||
|
||||
const originalCwd = process.cwd.bind(process);
|
||||
|
||||
function ensureValidCwd(): string {
|
||||
|
||||
Reference in New Issue
Block a user