/
deka
/
buffer
Обзор
Документация
Войти
/
deka
/
buffer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
tests/build-lab-fresh.test.mjs
24 строки
874 B
Maksim Ratnikov
build-lab: cwd-independent freshness test, fail-fast on leftover ESM
08 май 2026, 16:11
08 май 2026, 16:11
3f51a59
Код
Авторство
О чём код?
import assert from "node:assert/strict"; import { execFileSync } from "node:child_process"; import { readFileSync, mkdtempSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { fileURLToPath } from "node:url"; const labPath = fileURLToPath(new URL("../lab/wiki-clipboard-lab.html", import.meta.url)); const buildScriptPath = fileURLToPath(new URL("../tools/build-lab.mjs", import.meta.url)); const committed = readFileSync(labPath, "utf8"); const tmpDir = mkdtempSync(join(tmpdir(), "lab-build-")); const tmpOut = join(tmpDir, "lab.html"); execFileSync("node", [buildScriptPath, "--out", tmpOut], { stdio: "pipe" }); const fresh = readFileSync(tmpOut, "utf8"); assert.equal( fresh, committed, "lab/wiki-clipboard-lab.html is stale — run `node tools/build-lab.mjs`" ); console.log("build-lab freshness test passed");