diff --git a/packages/cli/src/utils/lintProject.test.ts b/packages/cli/src/utils/lintProject.test.ts index 0c778d583..25bd371bf 100644 --- a/packages/cli/src/utils/lintProject.test.ts +++ b/packages/cli/src/utils/lintProject.test.ts @@ -1,14 +1,12 @@ import { describe, it, expect, afterEach } from "vitest"; -import { mkdirSync, writeFileSync, rmSync } from "node:fs"; +import { mkdirSync, mkdtempSync, writeFileSync, rmSync } from "node:fs"; import { join } from "node:path"; import { tmpdir } from "node:os"; import { lintProject, shouldBlockRender } from "./lintProject.js"; import type { ProjectDir } from "./project.js"; function tmpProject(name: string): string { - const dir = join(tmpdir(), `hf-test-${name}-${Date.now()}`); - mkdirSync(dir, { recursive: true }); - return dir; + return mkdtempSync(join(tmpdir(), `hf-test-${name}-`)); } function validHtml(compId = "main"): string { @@ -182,6 +180,29 @@ function validHtmlWithAudio(compId = "main"): string { `; } +function validHtmlWithAudioSrc(src: string): string { + return ` +
+ +
+ +`; +} + +function validHtmlWithMaskImageUrl(url: string): string { + return ` +
+
TEXT
+
+ + +`; +} + describe("audio_file_without_element", () => { it("warns when audio file exists but no