diff --git a/.gitignore b/.gitignore index 90d431ec0..14f9ac533 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,5 @@ Thumbs.db # Complete static website output, including generated language editions. website/_site/ +# Temporary translation output prepared before replacing the complete site. +website/.i18n-*/ diff --git a/tests/boundary/filesystem/staticCheckReports.test.ts b/tests/boundary/filesystem/staticCheckReports.test.ts index c2708e1db..7d022da72 100644 --- a/tests/boundary/filesystem/staticCheckReports.test.ts +++ b/tests/boundary/filesystem/staticCheckReports.test.ts @@ -1,6 +1,6 @@ import { spawnSync } from "node:child_process"; import { access, mkdir, readFile, writeFile } from "node:fs/promises"; -import { join, sep } from "node:path"; +import { dirname, join, sep } from "node:path"; import { fileURLToPath } from "node:url"; import { expect, it } from "vitest"; import { z } from "zod"; @@ -138,6 +138,36 @@ it("keeps lint errors failing and visible alongside the retained warnings", asyn ); }); +it("excludes translation staging while retaining authored website errors", async () => { + const root = await fixture(); + for (const name of [".gitignore", ".oxlintrc.json"]) + await writeFile(join(root, name), await readFile(join(repository, name))); + const authored = "website/public/assets/authored.js"; + const staged = + "website/.i18n-regression/site/examples/notes-electron/main.js"; + for (const name of [authored, staged]) { + const path = join(root, name); + await mkdir(dirname(path), { recursive: true }); + await writeFile( + path, + 'const source = require("node:fs");\nconsole.log(source);\n', + ); + } + + const result = invoke(root, "lint"); + expect(result.error).toBeUndefined(); + expect(result.status).toBe(1); + expect(result.stdout).toContain("1 errors, 0 warnings"); + expect(result.stderr).toContain(authored); + expect(await lintDiagnostics(root)).toEqual([ + expect.objectContaining({ + severity: "error", + code: "typescript(no-var-requires)", + filename: authored, + }), + ]); +}); + it("keeps malformed source failing with its parser diagnostic", async () => { const root = await fixture(); await writeFile(join(root, "src/malformed.js"), "const value = ;\n");