perf(secrets): lazy-load apply test runtime

This commit is contained in:
Vincent Koc
2026-04-07 10:06:04 +01:00
parent 7f6f6d8023
commit ea5faa9b39

View File

@@ -1,16 +1,17 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import {
buildTalkTestProviderConfig,
TALK_TEST_PROVIDER_API_KEY_PATH,
TALK_TEST_PROVIDER_API_KEY_PATH_SEGMENTS,
TALK_TEST_PROVIDER_ID,
} from "../test-utils/talk-test-provider.js";
import { runSecretsApply } from "./apply.js";
import type { SecretsApplyPlan } from "./plan.js";
import { clearSecretsRuntimeSnapshot } from "./runtime.js";
let runSecretsApply: typeof import("./apply.js").runSecretsApply;
let clearSecretsRuntimeSnapshot: typeof import("./runtime.js").clearSecretsRuntimeSnapshot;
const OPENAI_API_KEY_ENV_REF = {
source: "env",
@@ -179,6 +180,11 @@ function createOneWayScrubOptions(): NonNullable<SecretsApplyPlan["options"]> {
describe("secrets apply", () => {
let fixture: ApplyFixture;
beforeAll(async () => {
({ runSecretsApply } = await import("./apply.js"));
({ clearSecretsRuntimeSnapshot } = await import("./runtime.js"));
});
beforeEach(async () => {
clearSecretsRuntimeSnapshot();
fixture = await createApplyFixture();