mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 11:26:02 +00:00
* test(cli): init scaffolds into a folder with a Cyrillic name * fix(cli): init writes the project into a folder with a non-ASCII name on Windows
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { afterEach, expect, it, vi } from "vitest";
|
|
import { existsSync, mkdtempSync, rmSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { runCommand } from "citty";
|
|
import init from "./init.js";
|
|
|
|
vi.mock("../telemetry/events.js", () => ({ trackInitTemplate: vi.fn() }));
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
vi.unstubAllEnvs();
|
|
});
|
|
|
|
// Node 22's native directory copy wrote nothing to such a path on Windows, without an error.
|
|
it("scaffolds the template into a folder with a Cyrillic name", async () => {
|
|
const dir = mkdtempSync(join(tmpdir(), "hf-init-cyrillic-"));
|
|
const project = join(dir, "Проект");
|
|
vi.stubEnv("HYPERFRAMES_SKIP_SKILLS", "1");
|
|
vi.spyOn(console, "log").mockImplementation(() => {});
|
|
try {
|
|
await runCommand(init, { rawArgs: [project, "--example", "blank", "--non-interactive"] });
|
|
expect(existsSync(join(project, "index.html"))).toBe(true);
|
|
expect(existsSync(join(project, "hyperframes.json"))).toBe(true);
|
|
} finally {
|
|
rmSync(dir, { recursive: true, force: true });
|
|
}
|
|
});
|