paperlint 20.1.0 → 20.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/ci.yml +7 -0
  3. package/CLAUDE.md +2 -2
  4. package/CONTRIBUTING.md +2 -2
  5. package/{action.harness.mjs → action.test.mjs} +147 -138
  6. package/dist/domain/paper-layout.d.ts +18 -6
  7. package/dist/domain/paper-layout.d.ts.map +1 -1
  8. package/dist/domain/paper-layout.js +44 -38
  9. package/dist/domain/paper-layout.js.map +1 -1
  10. package/dist/eslint-rules/papers.js +1 -1
  11. package/dist/folder-layout-hook.js +1 -1
  12. package/dist/latex-log.d.ts +1 -1
  13. package/dist/latex-log.js +1 -1
  14. package/dist/latex-loop.d.ts +1 -1
  15. package/dist/latex-loop.js +1 -1
  16. package/dist/lib/paper-config.d.ts +3 -3
  17. package/dist/lib/paper-config.js +3 -3
  18. package/docs/e2e.md +9 -9
  19. package/docs/install.md +11 -11
  20. package/docs/rules/paper/allowed-files-only.md +31 -28
  21. package/docs/testing.md +3 -4
  22. package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
  23. package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
  24. package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
  25. package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
  26. package/eslint-rules/papers.ts +1 -1
  27. package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
  28. package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
  29. package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
  30. package/eslint.config.mjs +15 -2
  31. package/fixtures/pdf-facts/README.md +1 -1
  32. package/fixtures/render-paper/build-clean.sh +1 -1
  33. package/fixtures/toolchain-mirror/install-tl +1 -1
  34. package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
  35. package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
  36. package/lib/paper-config.ts +3 -3
  37. package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
  38. package/package.json +3 -3
  39. package/presets/acm-acmsmall.jsonc +1 -1
  40. package/scripts/check-workflow.test.ts +368 -0
  41. package/scripts/check.ts +2 -2
  42. package/scripts/eslint-file-length.mjs +9 -9
  43. package/scripts/eslint-report-guard.mjs +1 -1
  44. package/scripts/eslint-report-guard.test.mjs +1 -1
  45. package/scripts/harness-api.test.ts +7 -46
  46. package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
  47. package/scripts/rules-see-files.mjs +1 -1
  48. package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
  49. package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
  50. package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
  51. package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
  52. package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
  53. package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
  54. package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
  55. package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
  56. package/src/adapters/pdfjs/fill.test.ts +1 -1
  57. package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
  58. package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
  59. package/src/{cli.harness.mjs → cli-e2e.test.mjs} +109 -103
  60. package/src/cli.test.ts +2 -2
  61. package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
  62. package/src/domain/paper-layout.test.ts +89 -49
  63. package/src/domain/paper-layout.ts +61 -42
  64. package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
  65. package/src/facts-file.test.ts +1 -1
  66. package/src/folder-layout-hook.test.ts +1 -1
  67. package/src/folder-layout-hook.ts +1 -1
  68. package/src/folder-layout-rule.test.ts +1 -1
  69. package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
  70. package/src/latex-log.test.ts +395 -0
  71. package/src/latex-log.ts +1 -1
  72. package/src/latex-loop.test.ts +553 -0
  73. package/src/latex-loop.ts +1 -1
  74. package/src/layout-docs.test.ts +47 -0
  75. package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
  76. package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
  77. package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
  78. package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
  79. package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
  80. package/src/{structure.harness.ts → structure.test.ts} +12 -10
  81. package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
  82. package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
  83. package/scripts/check.harness.ts +0 -343
  84. package/scripts/harness-api.frozen.json +0 -41
  85. package/src/latex-log.harness.ts +0 -382
  86. package/src/latex-loop.harness.ts +0 -515
@@ -8,6 +8,7 @@
8
8
  * 2. prepareEngine: use the cache · use the system · refuse without a human · ask, decline,
9
9
  * accept and install · dry-run never asks or installs.
10
10
  */
11
+ import { afterAll, beforeAll, expect, it } from "vitest";
11
12
  import {
12
13
  chmodSync,
13
14
  mkdirSync,
@@ -19,70 +20,81 @@ import {
19
20
  import { tmpdir } from "node:os";
20
21
  import { basename, delimiter, dirname, join } from "node:path";
21
22
  import { fileURLToPath } from "node:url";
22
- import { createChecker } from "../lib/check.ts";
23
23
 
24
24
  const HERE = dirname(fileURLToPath(import.meta.url));
25
25
  const E = await import(join(HERE, "build-engine.ts"));
26
26
 
27
- const check = createChecker();
27
+ // A failed check is recorded and the rest of the test keeps running.
28
+ const check = (label, cond, detail) => {
29
+ expect
30
+ .soft(cond, detail === undefined ? label : `${label}\n${String(detail)}`)
31
+ .toBeTruthy();
32
+ };
28
33
 
29
34
  // ── 1. texts ────────────────────────────────────────────────────────────────────────────
30
- const noCache = {
31
- supported: true,
32
- cache: null,
33
- system: null,
34
- interactive: true,
35
- required: ["acmart", "libertine"],
36
- };
37
- check(
38
- "question: no TeX Live at all — size, time, and where it goes",
39
- E.question(noCache, "/c") ===
40
- "TeX Live is not installed (needed to compile paper.tex, ~230 MB, ~2 min). Install it now into /c? [Y/n] ",
41
- );
42
- check(
43
- "question: a partial cache — only its gaps are offered",
44
- E.question(
45
- { ...noCache, cache: { label: "c", bin: "/c/b", missing: ["kastrup"] } },
46
- "/c",
47
- ) === "TeX Live in /c lacks 1 package(s): kastrup. Install them now? [Y/n] ",
48
- );
49
- const refused = E.refusal(
50
- { kind: "refuse", reason: "not-installed", missing: ["acmart", "libertine"] },
51
- {
52
- ...noCache,
53
- interactive: false,
54
- system: { label: "s", bin: "/usr/bin", missing: ["cm-super"] },
55
- },
56
- );
57
- // Guards: the one line a CI log shows — without `npx paperlint toolchain` in it, the reader does not know
58
- // the cure.
59
- check(
60
- "refusal: ONE line naming `npx paperlint toolchain`, the missing packages, and why the system TeX was passed over",
61
- !refused.includes("\n") &&
62
- refused.includes("run `npx paperlint toolchain`") &&
63
- refused.includes("missing: 2 package(s): acmart, libertine") &&
64
- refused.includes("/usr/bin/pdflatex lacks: cm-super"),
65
- refused,
66
- );
67
- check(
68
- "refusal on an unsupported platform says so",
69
- E.refusal(
70
- { kind: "refuse", reason: "unsupported", missing: ["x"] },
71
- noCache,
72
- ).includes("Windows is not supported"),
73
- );
74
- for (const [a, yes] of [
75
- // Guards: the default answer — [Y/n] promises that Enter installs.
76
- ["", true],
77
- ["y", true],
78
- ["YES", true],
79
- [" y ", true],
80
- ["n", false],
81
- ["no", false],
82
- ["maybe", false],
83
- [null, false],
84
- ])
85
- check(`isYes(${JSON.stringify(a)}) is ${yes}`, E.isYes(a) === yes);
35
+ it("1. texts: the question, the refusal line, what counts as yes", () => {
36
+ const noCache = {
37
+ supported: true,
38
+ cache: null,
39
+ system: null,
40
+ interactive: true,
41
+ required: ["acmart", "libertine"],
42
+ };
43
+ check(
44
+ "question: no TeX Live at all — size, time, and where it goes",
45
+ E.question(noCache, "/c") ===
46
+ "TeX Live is not installed (needed to compile paper.tex, ~230 MB, ~2 min). Install it now into /c? [Y/n] ",
47
+ );
48
+ check(
49
+ "question: a partial cache — only its gaps are offered",
50
+ E.question(
51
+ { ...noCache, cache: { label: "c", bin: "/c/b", missing: ["kastrup"] } },
52
+ "/c",
53
+ ) ===
54
+ "TeX Live in /c lacks 1 package(s): kastrup. Install them now? [Y/n] ",
55
+ );
56
+ const refused = E.refusal(
57
+ {
58
+ kind: "refuse",
59
+ reason: "not-installed",
60
+ missing: ["acmart", "libertine"],
61
+ },
62
+ {
63
+ ...noCache,
64
+ interactive: false,
65
+ system: { label: "s", bin: "/usr/bin", missing: ["cm-super"] },
66
+ },
67
+ );
68
+ // Guards: the one line a CI log shows — without `npx paperlint toolchain` in it, the reader does not know
69
+ // the cure.
70
+ check(
71
+ "refusal: ONE line naming `npx paperlint toolchain`, the missing packages, and why the system TeX was passed over",
72
+ !refused.includes("\n") &&
73
+ refused.includes("run `npx paperlint toolchain`") &&
74
+ refused.includes("missing: 2 package(s): acmart, libertine") &&
75
+ refused.includes("/usr/bin/pdflatex lacks: cm-super"),
76
+ refused,
77
+ );
78
+ check(
79
+ "refusal on an unsupported platform says so",
80
+ E.refusal(
81
+ { kind: "refuse", reason: "unsupported", missing: ["x"] },
82
+ noCache,
83
+ ).includes("Windows is not supported"),
84
+ );
85
+ for (const [a, yes] of [
86
+ // Guards: the default answer — [Y/n] promises that Enter installs.
87
+ ["", true],
88
+ ["y", true],
89
+ ["YES", true],
90
+ [" y ", true],
91
+ ["n", false],
92
+ ["no", false],
93
+ ["maybe", false],
94
+ [null, false],
95
+ ])
96
+ check(`isYes(${JSON.stringify(a)}) is ${yes}`, E.isYes(a) === yes);
97
+ });
86
98
 
87
99
  // ── 2. prepareEngine ────────────────────────────────────────────────────────────────────
88
100
  const work = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-engine-h-")));
@@ -101,10 +113,16 @@ const texAt = (dir) => {
101
113
  chmodSync(join(dir, "pdflatex"), 0o755);
102
114
  return dir;
103
115
  };
104
- const cacheBin = texAt(join(work, "cache", "2026", "bin", "x86_64-linux"));
105
- const sysBin = texAt(join(work, "usr", "bin"));
106
- const emptyBin = join(work, "nothing");
107
- mkdirSync(emptyBin);
116
+ let cacheBin;
117
+ let sysBin;
118
+ let emptyBin;
119
+ beforeAll(() => {
120
+ cacheBin = texAt(join(work, "cache", "2026", "bin", "x86_64-linux"));
121
+ sysBin = texAt(join(work, "usr", "bin"));
122
+ emptyBin = join(work, "nothing");
123
+ mkdirSync(emptyBin);
124
+ });
125
+ afterAll(() => {});
108
126
 
109
127
  /** kpsewhich answers per tree: `found[bin]` is what it prints. */
110
128
  const fakeRun = (found) => (cmd) => ({
@@ -144,7 +162,7 @@ const envWith = (cacheRoot, path) => ({
144
162
  PATH: path,
145
163
  });
146
164
 
147
- {
165
+ it("a complete cache: used, named, and PATH starts with its bin", async () => {
148
166
  const x = await go({
149
167
  env: envWith(join(work, "cache"), sysBin),
150
168
  run: fakeRun({ [cacheBin]: ALL, [sysBin]: ALL }),
@@ -158,8 +176,8 @@ const envWith = (cacheRoot, path) => ({
158
176
  x.r.env.PATH.split(delimiter)[0] === cacheBin,
159
177
  `${x.out} ${JSON.stringify(x.r)}`,
160
178
  );
161
- }
162
- {
179
+ });
180
+ it("🔴 two years, the newer incomplete: the newest COMPLETE one builds", async () => {
163
181
  // Two TeX Live years in the cache: a 2027 install that stopped after install-tl, and 2026.
164
182
  const years = join(work, "years");
165
183
  const old = texAt(join(years, "2026", "bin", "x86_64-linux"));
@@ -186,8 +204,8 @@ const envWith = (cacheRoot, path) => ({
186
204
  y.r.ok && y.r.env.PATH.split(delimiter)[0] === cut,
187
205
  y.out,
188
206
  );
189
- }
190
- {
207
+ });
208
+ it("a partial cache, a complete system TeX: the system one, PATH untouched", async () => {
191
209
  const x = await go({
192
210
  env: envWith(join(work, "cache"), sysBin),
193
211
  run: fakeRun({ [cacheBin]: "/t/acmart.cls\n", [sysBin]: ALL }),
@@ -201,8 +219,8 @@ const envWith = (cacheRoot, path) => ({
201
219
  x.r.env.PATH === sysBin,
202
220
  x.out,
203
221
  );
204
- }
205
- {
222
+ });
223
+ it("🔴 no human, nothing qualifies: refused in one line, NOTHING asked, NOTHING installed", async () => {
206
224
  const x = await go({
207
225
  env: envWith(join(work, "none"), `${emptyBin}${delimiter}${sysBin}`),
208
226
  run: fakeRun({ [sysBin]: "/t/acmart.cls\n" }),
@@ -220,8 +238,8 @@ const envWith = (cacheRoot, path) => ({
220
238
  x.installs() === 0,
221
239
  x.err,
222
240
  );
223
- }
224
- {
241
+ });
242
+ it("a terminal, declined: asked ONCE, nothing installed, refusal printed", async () => {
225
243
  const x = await go({
226
244
  env: envWith(join(work, "none"), emptyBin),
227
245
  run: fakeRun({}),
@@ -236,8 +254,8 @@ const envWith = (cacheRoot, path) => ({
236
254
  x.err.includes("npx paperlint toolchain"),
237
255
  JSON.stringify(x),
238
256
  );
239
- }
240
- {
257
+ });
258
+ it("a question that cannot be answered (Ctrl+D) is a no, not a crash", async () => {
241
259
  const x = await go({
242
260
  env: envWith(join(work, "none"), emptyBin),
243
261
  run: fakeRun({}),
@@ -250,10 +268,10 @@ const envWith = (cacheRoot, path) => ({
250
268
  "a question that cannot be answered (Ctrl+D) is a no, not a crash",
251
269
  !x.r.ok && x.installs() === 0,
252
270
  );
253
- }
271
+ });
254
272
  // The accept path needs the fake kpsewhich to answer for a tree that appears DURING the run.
255
273
  const x_run = { found: {} };
256
- {
274
+ it("a terminal, Enter (default yes): installs once, then builds with the cache", async () => {
257
275
  const fresh = join(work, "fresh2");
258
276
  const x = await go({
259
277
  env: envWith(fresh, emptyBin),
@@ -277,8 +295,8 @@ const x_run = { found: {} };
277
295
  basename(x.r.env.PATH.split(delimiter)[0]) === "x86_64-linux",
278
296
  `${x.out}\n${x.err}`,
279
297
  );
280
- }
281
- {
298
+ });
299
+ it("an install that fails stops the build", async () => {
282
300
  const x = await go({
283
301
  env: envWith(join(work, "none"), emptyBin),
284
302
  run: fakeRun({}),
@@ -287,8 +305,8 @@ const x_run = { found: {} };
287
305
  onInstall: () => ({ ok: false }),
288
306
  });
289
307
  check("an install that fails stops the build", !x.r.ok && x.installs() === 1);
290
- }
291
- {
308
+ });
309
+ it("--dry-run: prints what would stop the build, never asks, never installs", async () => {
292
310
  const x = await go({
293
311
  env: envWith(join(work, "none"), emptyBin),
294
312
  run: fakeRun({}),
@@ -304,7 +322,6 @@ const x_run = { found: {} };
304
322
  x.out.includes("engine: none — a real run would stop here"),
305
323
  x.out,
306
324
  );
307
- }
325
+ });
308
326
 
309
327
  rmSync(work, { recursive: true, force: true });
310
- console.log(`build-engine: ${check.count} checks passed`);
@@ -22,7 +22,10 @@ import {
22
22
  import { tmpdir } from "node:os";
23
23
  import { join, dirname, delimiter } from "node:path";
24
24
  import { fileURLToPath } from "node:url";
25
- import { createChecker } from "../lib/check.ts";
25
+ import { afterAll, expect, it, vi } from "vitest";
26
+
27
+ // Several tests here run real ESLint, spawn processes or walk the repository.
28
+ vi.setConfig({ testTimeout: 120_000 });
26
29
 
27
30
  const HERE = dirname(fileURLToPath(import.meta.url));
28
31
  const {
@@ -42,7 +45,11 @@ const {
42
45
  } = await import(join(HERE, "build.ts"));
43
46
  const { texInputsDir } = await import(join(HERE, "package-dirs.ts"));
44
47
 
45
- const check = createChecker();
48
+ /** One soft assertion: a failed check does not stop the checks after it in the same test. */
49
+ const check = (label, cond, detail) =>
50
+ expect
51
+ .soft(cond, detail === undefined ? label : `${label}\n${detail}`)
52
+ .toBe(true);
46
53
 
47
54
  const root = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-build-")));
48
55
  // 🔴 banal is looked for under the temp root, never in the developer's cache: with the real
@@ -134,11 +141,14 @@ const fakeRead = async (pdf) => {
134
141
  };
135
142
  const CLEAN_TEX = "\\documentclass{article}\\begin{document}x\\end{document}";
136
143
 
137
- try {
138
- // ── inputs: paperlint's own TeX inputs directory, no configuration ────────────────────────────
144
+ // Shared by the tests below, which run in order.
145
+ let venues, facts, clean, r, bare;
146
+
147
+ // ── inputs: paperlint's own TeX inputs directory, no configuration ────────────────────────────
148
+ it("inputs: paperlint's own TeX inputs directory, no configuration", () => {
139
149
  // First: the facts below resolve a paper's venue preset in this same directory, so a wrong one
140
150
  // must be named HERE, not as a missing venue label two checks later.
141
- const venues = texInputsDir();
151
+ venues = texInputsDir();
142
152
  check(
143
153
  "the TeX inputs directory is paperlint's own and holds paper-guards.tex",
144
154
  existsSync(join(venues, "paper-guards.tex")),
@@ -152,8 +162,10 @@ try {
152
162
  withTexInputs({ TEXINPUTS: `/mine${delimiter}` }, [venues]).TEXINPUTS ===
153
163
  `${venues}${delimiter}/mine${delimiter}`,
154
164
  );
165
+ });
155
166
 
156
- // ── facts: parsed from the paper, not configured ──────────────────────────────────────
167
+ // ── facts: parsed from the paper, not configured ──────────────────────────────────────
168
+ it("facts: parsed from the paper, not configured", () => {
157
169
  check(
158
170
  "documentclass and options come from the parser",
159
171
  JSON.stringify(
@@ -179,7 +191,7 @@ try {
179
191
  }),
180
192
  "build.sh": "exit 0\n",
181
193
  });
182
- const facts = readFacts(venued);
194
+ facts = readFacts(venued);
183
195
  check(
184
196
  "the venue comes from paperlint.json",
185
197
  facts.venue === "agenticdev-2026",
@@ -189,8 +201,10 @@ try {
189
201
  JSON.stringify(facts.ignoredScripts) === JSON.stringify(["build.sh"]) &&
190
202
  IGNORED_SCRIPTS.includes("repro/build-submission.sh"),
191
203
  );
204
+ });
192
205
 
193
- // ── the plan ──────────────────────────────────────────────────────────────────────────
206
+ // ── the plan ──────────────────────────────────────────────────────────────────────────
207
+ it("the plan", () => {
194
208
  const plan = planFor(facts);
195
209
  check(
196
210
  "the plan has one line per step, in order, each with a why",
@@ -203,8 +217,10 @@ try {
203
217
  /article/.test(plan[1].why) &&
204
218
  /agenticdev/.test(plan[1].why),
205
219
  );
220
+ });
206
221
 
207
- // ── pdflatex arguments ────────────────────────────────────────────────────────────────
222
+ // ── pdflatex arguments ────────────────────────────────────────────────────────────────
223
+ it("pdflatex arguments", () => {
208
224
  check(
209
225
  "every pass is nonstop, halts on error, and reports file:line",
210
226
  ["-interaction=nonstopmode", "-halt-on-error", "-file-line-error"].every(
@@ -216,9 +232,11 @@ try {
216
232
  pdflatexArgs(true).includes("-jobname=paper") &&
217
233
  pdflatexArgs(true).at(-1) === "\\def\\finalpass{}\\input{paper.tex}",
218
234
  );
235
+ });
219
236
 
220
- // ── a clean build, with leftover scripts that must NOT run ────────────────────────────
221
- const clean = paper("clean", {
237
+ // ── a clean build, with leftover scripts that must NOT run ────────────────────────────
238
+ it("a clean build, with leftover scripts that must NOT run", async () => {
239
+ clean = paper("clean", {
222
240
  "paper.tex": CLEAN_TEX,
223
241
  "build.sh": '#!/usr/bin/env bash\ntouch "$(dirname "$0")/RAN"\nexit 1\n',
224
242
  "repro/build-submission.sh":
@@ -226,7 +244,7 @@ try {
226
244
  });
227
245
  const events = [];
228
246
  const tex = fakeTex();
229
- const r = await buildPaper(clean, {
247
+ r = await buildPaper(clean, {
230
248
  cwd: root,
231
249
  readPdf: fakeRead,
232
250
  run: (...a) => {
@@ -272,8 +290,10 @@ try {
272
290
  (c) => c.texinputs === `.${delimiter}${venues}${delimiter}`,
273
291
  ),
274
292
  );
293
+ });
275
294
 
276
- // ── the measure step: facts for the lint rules ────────────────────────────────────────
295
+ // ── the measure step: facts for the lint rules ────────────────────────────────────────
296
+ it("the measure step: facts for the lint rules", async () => {
277
297
  const factsFile = join(clean, "_build", "paper.facts.json");
278
298
  check(
279
299
  "measure: the plan's measure step writes the facts, and says it judges nothing",
@@ -325,8 +345,10 @@ try {
325
345
  /could not read .*pdf\.js \(unreadable\)/.test(ur.failure.lines[0]) &&
326
346
  !existsSync(join(unread, "_build", "paper.facts.json")),
327
347
  );
348
+ });
328
349
 
329
- // ── the bibtex path ───────────────────────────────────────────────────────────────────
350
+ // ── the bibtex path ───────────────────────────────────────────────────────────────────
351
+ it("the bibtex path", async () => {
330
352
  const cited = paper("cited", {
331
353
  "paper.tex": CLEAN_TEX,
332
354
  "refs.bib": "@misc{k, title={T}}",
@@ -353,8 +375,10 @@ try {
353
375
  btex.calls[1].bin === "bibtex" &&
354
376
  btex.calls.at(-1).args.at(-1).includes("\\finalpass"),
355
377
  );
378
+ });
356
379
 
357
- // ── a failing build: the error, its context, and NO stale PDF ─────────────────────────
380
+ // ── a failing build: the error, its context, and NO stale PDF ─────────────────────────
381
+ it("a failing build: the error, its context, and NO stale PDF", async () => {
358
382
  const broken = paper("broken", {
359
383
  "paper.tex": CLEAN_TEX,
360
384
  "paper.pdf": "%PDF-stale-from-yesterday",
@@ -397,8 +421,10 @@ try {
397
421
  );
398
422
  check("…and says the PDF was removed", /paper\.pdf removed/.test(shown));
399
423
  check("a failed pass is not retried", ftex.calls.length === 1);
424
+ });
400
425
 
401
- // ── pdflatex dies before writing a log ────────────────────────────────────────────────
426
+ // ── pdflatex dies before writing a log ────────────────────────────────────────────────
427
+ it("pdflatex dies before writing a log", async () => {
402
428
  // Seen 2026-09-26: a TeX Live whose pdflatex format was never built. pdflatex exits 1 having
403
429
  // printed the reason, and paper.log is either absent or left over from an earlier build.
404
430
  const nolog = paper("nolog", {
@@ -437,8 +463,10 @@ try {
437
463
  !shownN.includes("full log:") && shownN.includes("wrote no paper.log"),
438
464
  shownN,
439
465
  );
466
+ });
440
467
 
441
- // ── pdflatex not installed ────────────────────────────────────────────────────────────
468
+ // ── pdflatex not installed ────────────────────────────────────────────────────────────
469
+ it("pdflatex not installed", async () => {
442
470
  const rm = await buildPaper(clean, {
443
471
  cwd: root,
444
472
  readPdf: fakeRead,
@@ -451,8 +479,10 @@ try {
451
479
  rm.status === "failed" &&
452
480
  /pdflatex could not be started/.test(rm.failure.lines.join("\n")),
453
481
  );
482
+ });
454
483
 
455
- // ── 🔴 --dry-run runs NOTHING, checked by effect ──────────────────────────────────────
484
+ // ── 🔴 --dry-run runs NOTHING, checked by effect ──────────────────────────────────────
485
+ it("🔴 --dry-run runs NOTHING, checked by effect", async () => {
456
486
  const dryDir = paper("dry", {
457
487
  "paper.tex": CLEAN_TEX,
458
488
  "paper.pdf": "%PDF-untouched",
@@ -483,9 +513,11 @@ try {
483
513
  dry.dry === true &&
484
514
  /--dry-run/.test(formatResult(dry)),
485
515
  );
516
+ });
486
517
 
487
- // ── no paper.tex: a REFUSAL, not a skip ───────────────────────────────────────────────
488
- const bare = paper("bare", { "PIPELINE-STATUS.md": "# x" });
518
+ // ── no paper.tex: a REFUSAL, not a skip ───────────────────────────────────────────────
519
+ it("no paper.tex: a REFUSAL, not a skip", async () => {
520
+ bare = paper("bare", { "PIPELINE-STATUS.md": "# x" });
489
521
  const ntex = fakeTex();
490
522
  const nr = await buildPaper(bare, {
491
523
  cwd: root,
@@ -508,8 +540,10 @@ try {
508
540
  /paper\.tex/.test(remedyFor([nr])),
509
541
  );
510
542
  check("on full success there is no remedy", remedyFor([r]) === "");
543
+ });
511
544
 
512
- // ── 🔴 A STALE PDF NEVER SURVIVES A RUN THAT DID NOT REPLACE IT — every path of buildPapers ──
545
+ // ── 🔴 A STALE PDF NEVER SURVIVES A RUN THAT DID NOT REPLACE IT — every path of buildPapers ──
546
+ it("🔴 A STALE PDF NEVER SURVIVES A RUN THAT DID NOT REPLACE IT — every path of buildPapers", async () => {
513
547
  // The order matters here: the up-front removal is exercised by the no-engine case below, the
514
548
  // existence check by the empty-document case, and neither depends on the other defence.
515
549
  const REMOVED =
@@ -653,8 +687,10 @@ try {
653
687
  "✗ compile: pdflatex exited 0 but wrote no paper.pdf — does the document have any pages?",
654
688
  ),
655
689
  );
690
+ });
656
691
 
657
- // ── walking the corpus ────────────────────────────────────────────────────────────────
692
+ // ── walking the corpus ────────────────────────────────────────────────────────────────
693
+ it("walking the corpus", () => {
658
694
  paper("not-a-paper", { "NOTES.md": "x" });
659
695
  paper(".hidden-paper", { "PIPELINE-STATUS.md": "x" });
660
696
  const found = papersIn(join(root, "papers")).map((d) => d.split("/").pop());
@@ -674,10 +710,7 @@ try {
674
710
  "a nonexistent root does not crash",
675
711
  papersIn(join(root, "nope")).length === 0,
676
712
  );
677
- } finally {
713
+ });
714
+ afterAll(() => {
678
715
  rmSync(root, { recursive: true, force: true });
679
- }
680
-
681
- console.log(
682
- `✓ ${String(check.count)} assertions passed — build: paperlint compiles, build.sh never runs, a red build leaves no PDF`,
683
- );
716
+ });