/
githubmirror
/
lerna
Обзор
Документация
Войти
/
githubmirror
/
lerna
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
libs/commands/info/src/lib/info-command.spec.ts
46 строк
1 KB
James Henry
chore(repo): migrate from jest to vitest (#4389)
13 июл 2026, 20:06
Не верифицирован
13 июл 2026, 20:06
1f7e109
Код
Авторство
О чём код?
import { output as _output } from "@lerna/core"; import { commandRunner, initFixtureFactory } from "@lerna/test-helpers"; import _envinfo from "envinfo"; const initFixture = initFixtureFactory(__dirname); vi.mock("envinfo"); const envinfo = vi.mocked(_envinfo); envinfo.run.mockResolvedValue("MOCK_ENVINFO"); // file under test import command from "../command"; const lernaInfo = commandRunner(command); vi.mock("@lerna/core", async () => ({ ...(await vi.importActual("@lerna/core")), ...(await import("@lerna/test-helpers/__mocks__/@lerna/core")), })); // The mock modifies the exported symbols and therefore types const output = _output as any; describe("lerna info", () => { describe("in a basic repo", () => { let testDir: string; beforeAll(async () => { testDir = await initFixture("basic"); }); it("outputs result of envinfo()", async () => { await lernaInfo(testDir)(); expect(envinfo.run).toHaveBeenLastCalledWith( expect.objectContaining({ npmPackages: ["lerna"], }) ); expect(output.logged()).toMatch("MOCK_ENVINFO"); }); }); });