Files
hyperframes/packages/cli/src/commands/init.nonAsciiPath.test.ts
T
Miguel Ángel d58d3edd39 fix(cli): init writes the project into a folder with a non-ASCII name on Windows (#5833)
* 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
2026-10-18 22:13:37 +00:00

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 });
}
});