Skip to content

Commit

Permalink
fix load modules of test
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroki0525 committed Jan 11, 2024
1 parent 5ce0359 commit dc70e96
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/cli/src/core/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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<typeof import("@dandori/libs")>();
return {
...actualModule,
getLogLevel: () => "info",
getLogger: vi.fn(() => ({
error: mockLogError,
})),
loadFile: actualLoadFile,
};
});

Expand Down

0 comments on commit dc70e96

Please sign in to comment.