From dc70e96cc51ba10babbd5fb48020804ccfd933a8 Mon Sep 17 00:00:00 2001 From: Hiroki Miyaji Date: Thu, 11 Jan 2024 13:47:10 +0900 Subject: [PATCH] fix load modules of test --- packages/cli/src/core/__tests__/index.test.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/core/__tests__/index.test.ts b/packages/cli/src/core/__tests__/index.test.ts index 85d5fc1..c40a57f 100644 --- a/packages/cli/src/core/__tests__/index.test.ts +++ b/packages/cli/src/core/__tests__/index.test.ts @@ -16,13 +16,6 @@ import generateDandoriTasks, { OptionalTaskPropsOption, } from "@dandori/core"; -const { actualLoadFile } = await vi.hoisted(async () => { - const actualModule = await import("@dandori/libs"); - return { - actualLoadFile: actualModule.loadFile, - }; -}); - const tasks: DandoriTask[] = [ { id: "1", @@ -39,13 +32,14 @@ vi.mock("@dandori/core", () => ({ const mockLogError = vi.fn(); -vi.mock("@dandori/libs", () => { +vi.mock("@dandori/libs", async (importOriginal) => { + const actualModule = await importOriginal(); return { + ...actualModule, getLogLevel: () => "info", getLogger: vi.fn(() => ({ error: mockLogError, })), - loadFile: actualLoadFile, }; });