diff --git a/apps/console/src/mocks/createKernel.ts b/apps/console/src/mocks/createKernel.ts index fbb03c7cb..becd93db9 100644 --- a/apps/console/src/mocks/createKernel.ts +++ b/apps/console/src/mocks/createKernel.ts @@ -25,6 +25,16 @@ export interface KernelOptions { skipSystemValidation?: boolean; /** MSWPlugin options; when provided, MSWPlugin is added to the kernel. */ mswOptions?: MSWPluginOptions; + /** + * InMemoryDriver persistence configuration. + * + * - `'auto'` (default) — auto-detect environment (browser → localStorage, Node.js → file) + * - `'local'` — force localStorage persistence (browser only) + * - `false` — disable persistence entirely (useful in tests) + * + * When omitted, defaults to `'auto'`. + */ + persistence?: false | 'auto' | 'local' | 'file'; } export interface KernelResult { @@ -154,9 +164,11 @@ function patchDriverCreate(driver: InMemoryDriver): void { * so that kernel setup logic is not duplicated. */ export async function createKernel(options: KernelOptions): Promise { - const { appConfig, skipSystemValidation = true, mswOptions } = options; + const { appConfig, skipSystemValidation = true, mswOptions, persistence } = options; - const driver = new InMemoryDriver(); + const driver = new InMemoryDriver( + persistence !== undefined ? { persistence } : undefined, + ); const kernel = new ObjectKernel({ skipSystemValidation @@ -190,5 +202,16 @@ export async function createKernel(options: KernelOptions): Promise