fix(guide): escape quotes that broke app.js; add a syntax check for src/ (1.89.1)

This commit is contained in:
larssand committed 2026-11-10 16:05:53 +01:00
1 parent 89c7afee2f
commit 379dd52c7f
6 files changed
+33 -5

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
// Every browser file must parse: unit tests never load app.js, so a stray quote in a
// translation string would otherwise only show up as a blank page.
import test from "node:test";
import assert from "node:assert/strict";
import { spawnSync } from "node:child_process";
import { copyFileSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
test("every file in src/ parses as JavaScript", () => {
const src = new URL("../src/", import.meta.url).pathname;
const dir = mkdtempSync(join(tmpdir(), "rc-syntax-"));
try {
const bad = readdirSync(src).filter((name) => name.endsWith(".js")).filter((name) => {
const copy = join(dir, name.replace(/\.js$/, ".mjs"));
copyFileSync(join(src, name), copy);
return spawnSync(process.execPath, ["--check", copy], { encoding: "utf8" }).status !== 0;
});
assert.deepEqual(bad, []);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});