paperlint 20.1.1 → 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.
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/ci.yml +7 -0
- package/CLAUDE.md +2 -2
- package/CONTRIBUTING.md +2 -2
- package/{action.harness.mjs → action.test.mjs} +147 -138
- package/dist/eslint-rules/papers.js +1 -1
- package/dist/latex-log.d.ts +1 -1
- package/dist/latex-log.js +1 -1
- package/dist/latex-loop.d.ts +1 -1
- package/dist/latex-loop.js +1 -1
- package/dist/lib/paper-config.d.ts +3 -3
- package/dist/lib/paper-config.js +3 -3
- package/docs/e2e.md +9 -9
- package/docs/testing.md +3 -4
- package/eslint-rules/{install-path-literals.harness.mjs → install-path-literals.test.mjs} +14 -13
- package/eslint-rules/{latex-language.harness.mjs → latex-language-rules.test.mjs} +61 -51
- package/eslint-rules/{paper-stages.harness.mjs → paper-stages-rule.test.mjs} +66 -69
- package/eslint-rules/{papers.harness.mjs → papers.test.mjs} +41 -30
- package/eslint-rules/papers.ts +1 -1
- package/eslint-rules/{pdf-last-page-balance.harness.mjs → pdf-last-page-balance.test.mjs} +27 -15
- package/eslint-rules/{temp-root-realpath.harness.mjs → temp-root-realpath.test.mjs} +24 -24
- package/eslint-rules/{tex-build.harness.mjs → tex-build.test.mjs} +292 -271
- package/eslint.config.mjs +15 -2
- package/fixtures/pdf-facts/README.md +1 -1
- package/fixtures/render-paper/build-clean.sh +1 -1
- package/fixtures/toolchain-mirror/install-tl +1 -1
- package/lib/{agent-cli-version.harness.mjs → agent-cli-version.test.mjs} +17 -18
- package/lib/{paper-config.harness.mjs → paper-config.test.mjs} +21 -20
- package/lib/paper-config.ts +3 -3
- package/lib/{skill-trigger-cases.harness.mjs → skill-trigger-cases-carrier.test.mjs} +78 -115
- package/package.json +3 -3
- package/presets/acm-acmsmall.jsonc +1 -1
- package/scripts/check-workflow.test.ts +368 -0
- package/scripts/check.ts +2 -2
- package/scripts/eslint-file-length.mjs +9 -9
- package/scripts/eslint-report-guard.mjs +1 -1
- package/scripts/eslint-report-guard.test.mjs +1 -1
- package/scripts/harness-api.test.ts +7 -46
- package/scripts/{rules-see-files.harness.mjs → rules-see-files-rule.test.mjs} +10 -6
- package/scripts/rules-see-files.mjs +1 -1
- package/skills/paper-pipeline/{paper-pipeline.harness.mjs → paper-pipeline.test.mjs} +45 -46
- package/skills/paper-pipeline/scripts/{consumer.harness.mjs → consumer-paths.test.mjs} +66 -59
- package/skills/paper-pipeline/scripts/consumer.mjs +3 -3
- package/skills/paper-pipeline/scripts/{extract-ref-facts.harness.mjs → extract-ref-facts-cli.test.mjs} +29 -31
- package/skills/paper-pipeline/scripts/fixtures/real-bib/refs.bib +1 -1
- package/skills/paper-pipeline/scripts/{generated-code.harness.mjs → generated-code-fixtures.test.mjs} +39 -46
- package/skills/render-paper/{extract-pdf-facts.harness.ts → extract-pdf-facts.test.ts} +20 -13
- package/skills/render-paper/{render-paper.harness.mjs → render-paper.test.mjs} +41 -40
- package/src/adapters/pdfjs/fill.test.ts +1 -1
- package/src/{build-engine.harness.mjs → build-engine-prepare.test.mjs} +98 -81
- package/src/{build.harness.mjs → build-fake-tex.test.mjs} +61 -28
- package/src/{cli.harness.mjs → cli-e2e.test.mjs} +108 -102
- package/src/cli.test.ts +1 -1
- package/src/{doctor.harness.mjs → doctor-install.test.mjs} +28 -29
- package/src/{engine.harness.mjs → engine.test.mjs} +120 -106
- package/src/facts-file.test.ts +1 -1
- package/src/{hooks-settings.harness.ts → hooks-settings.test.ts} +161 -146
- package/src/latex-log.test.ts +395 -0
- package/src/latex-log.ts +1 -1
- package/src/latex-loop.test.ts +553 -0
- package/src/latex-loop.ts +1 -1
- package/src/{link-skills.harness.ts → link-skills-fs.test.ts} +26 -26
- package/src/{new-paper.harness.mjs → new-paper-scaffold.test.mjs} +31 -19
- package/src/{pdf-facts.harness.ts → pdf-facts-tables.test.ts} +28 -22
- package/src/{pdf-geometry.harness.ts → pdf-geometry.test.ts} +93 -75
- package/src/{rules-config.harness.ts → rules-config.test.ts} +41 -31
- package/src/{structure.harness.ts → structure.test.ts} +12 -10
- package/src/{tex-requirements.harness.ts → tex-requirements-tables.test.ts} +106 -85
- package/src/{toolchain.harness.mjs → toolchain-mirror.test.mjs} +204 -186
- package/scripts/check.harness.ts +0 -343
- package/scripts/harness-api.frozen.json +0 -41
- package/src/latex-log.harness.ts +0 -382
- package/src/latex-loop.harness.ts +0 -515
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
* doctor has exactly the same property — it will print a cheerful list of checkmarks and never
|
|
8
8
|
* notice a mismatch. That is, the check for a silent failure can itself fail silently, and only
|
|
9
9
|
* this file can tell the two apart.
|
|
10
|
-
*
|
|
11
|
-
* Run: npx vigiles test src/doctor.harness.mjs
|
|
12
10
|
*/
|
|
11
|
+
import { expect, it } from "vitest";
|
|
13
12
|
import { PAPERS_DIR_FIELD } from "../lib/paper-config.ts";
|
|
14
13
|
import {
|
|
15
14
|
mkdtempSync,
|
|
@@ -21,14 +20,18 @@ import {
|
|
|
21
20
|
import { tmpdir } from "node:os";
|
|
22
21
|
import { dirname, join } from "node:path";
|
|
23
22
|
import { fileURLToPath } from "node:url";
|
|
24
|
-
import { createChecker } from "../lib/check.ts";
|
|
25
23
|
|
|
26
24
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
27
25
|
const { doctor, detectPapers, PROGRAMS, found } = await import(
|
|
28
26
|
join(HERE, "doctor.ts")
|
|
29
27
|
);
|
|
30
28
|
|
|
31
|
-
|
|
29
|
+
// A failed check is recorded and the rest of the test keeps running.
|
|
30
|
+
const check = (label, cond, detail) => {
|
|
31
|
+
expect
|
|
32
|
+
.soft(cond, detail === undefined ? label : `${label}\n${String(detail)}`)
|
|
33
|
+
.toBeTruthy();
|
|
34
|
+
};
|
|
32
35
|
|
|
33
36
|
/** A consumer on disk: a papers directory, and maybe a declaration in the root paperlint.json. */
|
|
34
37
|
function consumer({ papersDir, declared, makeDir = true }) {
|
|
@@ -70,7 +73,7 @@ const runDoctor = (
|
|
|
70
73
|
};
|
|
71
74
|
|
|
72
75
|
// ── I. A CONSISTENT INSTALL IS SILENT ───────────────────────────────────────────────────────
|
|
73
|
-
{
|
|
76
|
+
it("I. A CONSISTENT INSTALL IS SILENT", () => {
|
|
74
77
|
const dir = consumer({ papersDir: "papers", declared: "papers" });
|
|
75
78
|
const r = runDoctor(dir, { cliPapers: "papers" });
|
|
76
79
|
check("a consistent install — exit ZERO", r.code === 0);
|
|
@@ -79,12 +82,12 @@ const runDoctor = (
|
|
|
79
82
|
/linted\s+papers$/m.test(r.out),
|
|
80
83
|
);
|
|
81
84
|
rmSync(dir, { recursive: true, force: true });
|
|
82
|
-
}
|
|
85
|
+
});
|
|
83
86
|
|
|
84
87
|
// ── II. THE VERY DEFECT: THE PAPERS LIVE SOMEWHERE THE SETTINGS DO NOT NAME ─────────────────
|
|
85
88
|
// The install that motivated doctor (issue #33): nothing declared, so lint and the hooks both
|
|
86
89
|
// watch `papers/`, while the papers are in another directory.
|
|
87
|
-
{
|
|
90
|
+
it("II. THE VERY DEFECT: THE PAPERS LIVE SOMEWHERE THE SETTINGS DO NOT NAME", () => {
|
|
88
91
|
const dir = consumer({ papersDir: "writing/drafts" });
|
|
89
92
|
const r = runDoctor(dir, { cliPapers: "papers" });
|
|
90
93
|
check(
|
|
@@ -100,11 +103,11 @@ const runDoctor = (
|
|
|
100
103
|
/papers look like they live in: writing\/drafts/.test(r.out),
|
|
101
104
|
);
|
|
102
105
|
rmSync(dir, { recursive: true, force: true });
|
|
103
|
-
}
|
|
106
|
+
});
|
|
104
107
|
|
|
105
108
|
// ── II-bis. NO paperlint.json — EVERY DEFAULT, AND THAT IS A VALID PROJECT ─────────────────
|
|
106
109
|
// The CLI and the hooks both take `papers` when nothing is declared, so they cannot disagree.
|
|
107
|
-
{
|
|
110
|
+
it("II-bis. NO paperlint.json — EVERY DEFAULT, AND THAT IS A VALID PROJECT", () => {
|
|
108
111
|
const dir = consumer({ papersDir: "papers" });
|
|
109
112
|
const r = runDoctor(dir, { cliPapers: "papers" });
|
|
110
113
|
check("no paperlint.json — exit ZERO", r.code === 0);
|
|
@@ -115,10 +118,10 @@ const runDoctor = (
|
|
|
115
118
|
),
|
|
116
119
|
);
|
|
117
120
|
rmSync(dir, { recursive: true, force: true });
|
|
118
|
-
}
|
|
121
|
+
});
|
|
119
122
|
|
|
120
123
|
// ── II-quater. A paperlint.json THAT DOES NOT PARSE — lint refuses to run ────────────────
|
|
121
|
-
{
|
|
124
|
+
it("II-quater. A paperlint.json THAT DOES NOT PARSE — lint refuses to run", () => {
|
|
122
125
|
const dir = consumer({ papersDir: "papers" });
|
|
123
126
|
writeFileSync(join(dir, "paperlint.json"), '{ "papersDir": <<<<<<< HEAD\n');
|
|
124
127
|
const r = runDoctor(dir, { cliPapers: "papers" });
|
|
@@ -129,13 +132,13 @@ const runDoctor = (
|
|
|
129
132
|
/`paperlint lint` refuses to run/.test(r.out),
|
|
130
133
|
);
|
|
131
134
|
rmSync(dir, { recursive: true, force: true });
|
|
132
|
-
}
|
|
135
|
+
});
|
|
133
136
|
|
|
134
137
|
// ── II-ter. A FRESH PROJECT WITH NO PAPERS YET IS NOT BROKEN ───────────────────────────────
|
|
135
138
|
// `init --yes` declares the default and creates no paper. The declared directory does not exist,
|
|
136
139
|
// and no papers live anywhere else: there is nothing to check yet. A warning with the next
|
|
137
140
|
// step, not a failure. (A missing directory while papers DO live elsewhere stays ✗ — case II.)
|
|
138
|
-
{
|
|
141
|
+
it("II-ter. A FRESH PROJECT WITH NO PAPERS YET IS NOT BROKEN", () => {
|
|
139
142
|
const dir = consumer({
|
|
140
143
|
papersDir: "papers",
|
|
141
144
|
declared: "papers",
|
|
@@ -150,10 +153,10 @@ const runDoctor = (
|
|
|
150
153
|
!/watching nothing/.test(r.out),
|
|
151
154
|
);
|
|
152
155
|
rmSync(dir, { recursive: true, force: true });
|
|
153
|
-
}
|
|
156
|
+
});
|
|
154
157
|
|
|
155
158
|
// ── V. A SETTING THAT NAMES NO DIRECTORY IS NAMED, NOT TURNED INTO ONE ─────────────────────
|
|
156
|
-
{
|
|
159
|
+
it("V. A SETTING THAT NAMES NO DIRECTORY IS NAMED, NOT TURNED INTO ONE", () => {
|
|
157
160
|
const dir = consumer({ papersDir: "papers", declared: "" });
|
|
158
161
|
const r = runDoctor(dir, { cliPapers: null });
|
|
159
162
|
check(
|
|
@@ -161,10 +164,10 @@ const runDoctor = (
|
|
|
161
164
|
/name no directory/.test(r.out),
|
|
162
165
|
);
|
|
163
166
|
rmSync(dir, { recursive: true, force: true });
|
|
164
|
-
}
|
|
167
|
+
});
|
|
165
168
|
|
|
166
169
|
// ── VI. EXTERNAL PROGRAMS ARE A FACT, NOT A VERDICT ─────────────────────────────────────────
|
|
167
|
-
{
|
|
170
|
+
it("VI. EXTERNAL PROGRAMS ARE A FACT, NOT A VERDICT", () => {
|
|
168
171
|
const dir = consumer({ papersDir: "papers", declared: "papers" });
|
|
169
172
|
const none = runDoctor(dir, { cliPapers: "papers", have: () => 1 });
|
|
170
173
|
check(
|
|
@@ -197,10 +200,10 @@ const runDoctor = (
|
|
|
197
200
|
none.out,
|
|
198
201
|
);
|
|
199
202
|
rmSync(dir, { recursive: true, force: true });
|
|
200
|
-
}
|
|
203
|
+
});
|
|
201
204
|
|
|
202
205
|
// ── VII. DETECTING THE PAPERS DIRECTORY ─────────────────────────────────────────────────────
|
|
203
|
-
{
|
|
206
|
+
it("VII. DETECTING THE PAPERS DIRECTORY", () => {
|
|
204
207
|
const dir = realpathSync(mkdtempSync(join(tmpdir(), "paperlint-detect-")));
|
|
205
208
|
mkdirSync(join(dir, "writing", "drafts", "p1"), { recursive: true });
|
|
206
209
|
writeFileSync(join(dir, "writing", "drafts", "p1", "paper.tex"), "x");
|
|
@@ -233,13 +236,13 @@ const runDoctor = (
|
|
|
233
236
|
!detectPapers(dir).includes("only-template"),
|
|
234
237
|
);
|
|
235
238
|
rmSync(dir, { recursive: true, force: true });
|
|
236
|
-
}
|
|
239
|
+
});
|
|
237
240
|
|
|
238
241
|
// ── VII-bis. SKILLS THAT ARE NOT LINKED ARE NAMED — AND DO NOT FAIL THE RUN ─────────────────
|
|
239
242
|
// Before this section a consumer without `.claude/skills/` links had no `/paper-pipeline`, and
|
|
240
|
-
// nothing anywhere said so. The link state itself is `link-skills.
|
|
243
|
+
// nothing anywhere said so. The link state itself is `link-skills-fs.test.ts`'s subject; here
|
|
241
244
|
// only doctor's REPORTING of it is judged, so the state is handed in rather than built on disk.
|
|
242
|
-
{
|
|
245
|
+
it("VII-bis. SKILLS THAT ARE NOT LINKED ARE NAMED — AND DO NOT FAIL THE RUN", () => {
|
|
243
246
|
const dir = consumer({ papersDir: "papers", declared: "papers" });
|
|
244
247
|
const state = {
|
|
245
248
|
ok: true,
|
|
@@ -274,17 +277,13 @@ const runDoctor = (
|
|
|
274
277
|
/✓ all 1 shipped skills are reachable/.test(all.out),
|
|
275
278
|
);
|
|
276
279
|
rmSync(dir, { recursive: true, force: true });
|
|
277
|
-
}
|
|
280
|
+
});
|
|
278
281
|
|
|
279
282
|
// ── VIII. `found` ASKS THE SYSTEM, IT DOES NOT GUESS BY NAME ────────────────────────────────
|
|
280
|
-
{
|
|
283
|
+
it("VIII. `found` ASKS THE SYSTEM, IT DOES NOT GUESS BY NAME", () => {
|
|
281
284
|
check("a program that really exists is found", found("node") === true);
|
|
282
285
|
check(
|
|
283
286
|
"a made-up one is not (otherwise the check answers the form, not the subject)",
|
|
284
287
|
found("paperlint-definitely-not-a-real-binary-xyz") === false,
|
|
285
288
|
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
console.log(
|
|
289
|
-
`✓ ${check.count} assertions passed — paperlint doctor: an install can vouch for itself`,
|
|
290
|
-
);
|
|
289
|
+
});
|
|
@@ -18,7 +18,10 @@ import {
|
|
|
18
18
|
import { tmpdir } from "node:os";
|
|
19
19
|
import { dirname, join } from "node:path";
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
21
|
-
import {
|
|
21
|
+
import { expect, it, vi } from "vitest";
|
|
22
|
+
|
|
23
|
+
// Several tests here run real ESLint, spawn processes or walk the repository.
|
|
24
|
+
vi.setConfig({ testTimeout: 120_000 });
|
|
22
25
|
|
|
23
26
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
24
27
|
const {
|
|
@@ -32,7 +35,11 @@ const {
|
|
|
32
35
|
supportedPlatform,
|
|
33
36
|
} = await import(join(HERE, "engine.ts"));
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
/** One soft assertion: a failed check does not stop the checks after it in the same test. */
|
|
39
|
+
const check = (label, cond, detail) =>
|
|
40
|
+
expect
|
|
41
|
+
.soft(cond, detail === undefined ? label : `${label}\n${detail}`)
|
|
42
|
+
.toBe(true);
|
|
36
43
|
|
|
37
44
|
// ── 1. resolveEngine ────────────────────────────────────────────────────────────────────
|
|
38
45
|
const tree = (label, missing = []) => ({ label, bin: `/${label}`, missing });
|
|
@@ -102,20 +109,22 @@ const ROWS = [
|
|
|
102
109
|
{ kind: "use-system", tree: COMPLETE_SYS },
|
|
103
110
|
],
|
|
104
111
|
];
|
|
105
|
-
|
|
106
|
-
const
|
|
112
|
+
it("1. resolveEngine", () => {
|
|
113
|
+
for (const [label, f, want] of ROWS) {
|
|
114
|
+
const got = resolveEngine(f);
|
|
115
|
+
check(
|
|
116
|
+
`resolveEngine: ${label}`,
|
|
117
|
+
JSON.stringify(got) === JSON.stringify(want),
|
|
118
|
+
JSON.stringify(got),
|
|
119
|
+
);
|
|
120
|
+
}
|
|
107
121
|
check(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
122
|
+
"supportedPlatform: linux and darwin, not win32",
|
|
123
|
+
supportedPlatform("linux") &&
|
|
124
|
+
supportedPlatform("darwin") &&
|
|
125
|
+
!supportedPlatform("win32"),
|
|
111
126
|
);
|
|
112
|
-
}
|
|
113
|
-
check(
|
|
114
|
-
"supportedPlatform: linux and darwin, not win32",
|
|
115
|
-
supportedPlatform("linux") &&
|
|
116
|
-
supportedPlatform("darwin") &&
|
|
117
|
-
!supportedPlatform("win32"),
|
|
118
|
-
);
|
|
127
|
+
});
|
|
119
128
|
|
|
120
129
|
// ── 2. the fact readers ─────────────────────────────────────────────────────────────────
|
|
121
130
|
const PKGS = {
|
|
@@ -123,47 +132,50 @@ const PKGS = {
|
|
|
123
132
|
latex: ["latex.ltx", "article.cls"],
|
|
124
133
|
libertine: ["libertine.sty"],
|
|
125
134
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
missingTools
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
135
|
+
it("2. the fact readers: missingPackages, missingTools, whichOnPath", () => {
|
|
136
|
+
check(
|
|
137
|
+
"missingPackages: matched by FILE NAME of each printed path, sorted",
|
|
138
|
+
JSON.stringify(
|
|
139
|
+
missingPackages(PKGS, "/t/tex/latex/acmart/acmart.cls\n"),
|
|
140
|
+
) === '["latex","libertine"]',
|
|
141
|
+
);
|
|
142
|
+
// Guards: a package counts as present only when EVERY file that proves it resolves.
|
|
143
|
+
check(
|
|
144
|
+
"missingPackages: one proof of two missing is enough to count the package missing",
|
|
145
|
+
missingPackages(
|
|
146
|
+
{ latex: ["latex.ltx", "article.cls"] },
|
|
147
|
+
"/t/latex.ltx\n",
|
|
148
|
+
).includes("latex"),
|
|
149
|
+
);
|
|
150
|
+
check(
|
|
151
|
+
"missingPackages: all present → none",
|
|
152
|
+
missingPackages(
|
|
153
|
+
PKGS,
|
|
154
|
+
"/a/acmart.cls\n/b/latex.ltx\n/b/article.cls\n/c/libertine.sty\n",
|
|
155
|
+
).length === 0,
|
|
156
|
+
);
|
|
157
|
+
check(
|
|
158
|
+
"missingTools: by executable in the bin directory",
|
|
159
|
+
JSON.stringify(
|
|
160
|
+
missingTools(
|
|
161
|
+
{ texcount: ["texcount"], checkcites: ["checkcites"] },
|
|
162
|
+
"/bin",
|
|
163
|
+
(p) => p === "/bin/texcount",
|
|
164
|
+
),
|
|
165
|
+
) === '["checkcites"]',
|
|
166
|
+
);
|
|
167
|
+
check(
|
|
168
|
+
"whichOnPath: the first directory that has it; empty segments skipped",
|
|
169
|
+
whichOnPath("pdflatex", ":/a:/b:/c", (p) =>
|
|
170
|
+
["/b/pdflatex", "/c/pdflatex"].includes(p),
|
|
171
|
+
) === "/b",
|
|
172
|
+
);
|
|
173
|
+
check(
|
|
174
|
+
"whichOnPath: nowhere → null",
|
|
175
|
+
whichOnPath("pdflatex", "/a:/b", () => false) === null,
|
|
176
|
+
);
|
|
177
|
+
});
|
|
178
|
+
it("2. the fact readers: probeTree through a fake runner", () => {
|
|
167
179
|
const calls = [];
|
|
168
180
|
const run = (cmd, args) => {
|
|
169
181
|
calls.push([cmd, args]);
|
|
@@ -181,20 +193,22 @@ check(
|
|
|
181
193
|
"probeTree: kpsewhich's exit code is not the verdict — the printed paths are",
|
|
182
194
|
JSON.stringify(missing) === '["latex","libertine"]',
|
|
183
195
|
);
|
|
184
|
-
}
|
|
196
|
+
});
|
|
185
197
|
// Guards: "could not ask" must never read as "nothing missing" — a broken tree would be used.
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)
|
|
198
|
+
it("2. the fact readers: a kpsewhich that cannot start finds nothing", () => {
|
|
199
|
+
check(
|
|
200
|
+
"🔴 probeTree: a kpsewhich that cannot start finds NOTHING — never 'all present'",
|
|
201
|
+
JSON.stringify(
|
|
202
|
+
probeTree("/none", PKGS, () => ({ error: new Error("ENOENT") })),
|
|
203
|
+
) === '["acmart","latex","libertine"]',
|
|
204
|
+
);
|
|
205
|
+
});
|
|
192
206
|
|
|
193
207
|
// ── 3. "installed" means a regular file that can be run — on a REAL filesystem ─────────────
|
|
194
208
|
// 🔴 `existsSync` says yes to a directory and to a file without the execute bit; both then fail
|
|
195
209
|
// to start, while `paperlint toolchain --check` reported the tree verified. Checked on disk, not
|
|
196
210
|
// through an injected predicate, because the predicate is exactly what was wrong.
|
|
197
|
-
{
|
|
211
|
+
it('3. "installed" means a regular file that can be run — on a REAL filesystem', () => {
|
|
198
212
|
const bin = realpathSync(
|
|
199
213
|
mkdtempSync(join(tmpdir(), "paperlint-engine-bin-")),
|
|
200
214
|
);
|
|
@@ -246,7 +260,7 @@ check(
|
|
|
246
260
|
} finally {
|
|
247
261
|
rmSync(bin, { recursive: true, force: true });
|
|
248
262
|
}
|
|
249
|
-
}
|
|
263
|
+
});
|
|
250
264
|
|
|
251
265
|
// ── missingDependencies: what an install that "continued anyway" left out ──────────────────
|
|
252
266
|
// Real stdout of `tlmgr check depends` on a tree whose install-tl lost unicode-data to a mirror
|
|
@@ -256,7 +270,7 @@ const BROKEN_DEPENDS =
|
|
|
256
270
|
"\f DEPENDS WITHOUT PACKAGES:\n" +
|
|
257
271
|
"unicode-data in: collection-basic latex-bin luahbtex luatex\n" +
|
|
258
272
|
"\f PACKAGES NOT IN ANY COLLECTION: acmart booktabs caption\n";
|
|
259
|
-
{
|
|
273
|
+
it('missingDependencies: what an install that "continued anyway" left out', () => {
|
|
260
274
|
const calls = [];
|
|
261
275
|
const run = (cmd, args) => {
|
|
262
276
|
calls.push([cmd, args]);
|
|
@@ -280,45 +294,45 @@ const BROKEN_DEPENDS =
|
|
|
280
294
|
JSON.stringify(missing) === '["unicode-data"]',
|
|
281
295
|
JSON.stringify(missing),
|
|
282
296
|
);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
)
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
)
|
|
299
|
-
|
|
300
|
-
check(
|
|
301
|
-
"missingDependencies: a tlmgr that cannot start reports nothing (the tree is judged by probeTree alone)",
|
|
302
|
-
JSON.stringify(
|
|
303
|
-
missingDependencies("/tl/bin", () => ({ error: new Error("ENOENT") })),
|
|
304
|
-
) === "[]",
|
|
305
|
-
);
|
|
306
|
-
check(
|
|
307
|
-
"missingDependencies: a section that runs to the end of the output, with no header after it",
|
|
308
|
-
JSON.stringify(
|
|
309
|
-
missingDependencies("/tl/bin", () => ({
|
|
310
|
-
stdout:
|
|
311
|
-
"\f DEPENDS WITHOUT PACKAGES:\nunicode-data in: latex-bin\nhyphen-base in: x",
|
|
312
|
-
status: 2,
|
|
313
|
-
})),
|
|
314
|
-
) === '["hyphen-base","unicode-data"]',
|
|
315
|
-
);
|
|
316
|
-
check(
|
|
317
|
-
"a runner that returns no stdout at all: tlmgr lists nothing, kpsewhich finds nothing",
|
|
318
|
-
JSON.stringify(missingDependencies("/tl/bin", () => ({ status: 0 }))) ===
|
|
319
|
-
"[]" &&
|
|
320
|
-
JSON.stringify(probeTree("/tl/bin", PKGS, () => ({ status: 0 }))) ===
|
|
321
|
-
JSON.stringify(Object.keys(PKGS).sort()),
|
|
322
|
-
);
|
|
297
|
+
});
|
|
298
|
+
it("missingDependencies: the other cases", () => {
|
|
299
|
+
check(
|
|
300
|
+
"missingDependencies: packages outside any collection are not gaps",
|
|
301
|
+
JSON.stringify(
|
|
302
|
+
missingDependencies("/tl/bin", () => ({
|
|
303
|
+
stdout: "\f PACKAGES NOT IN ANY COLLECTION: acmart booktabs\n",
|
|
304
|
+
status: 2,
|
|
305
|
+
})),
|
|
306
|
+
) === "[]",
|
|
307
|
+
);
|
|
308
|
+
check(
|
|
309
|
+
"missingDependencies: a clean tree has none",
|
|
310
|
+
JSON.stringify(
|
|
311
|
+
missingDependencies("/tl/bin", () => ({ stdout: "", status: 0 })),
|
|
312
|
+
) === "[]",
|
|
313
|
+
);
|
|
323
314
|
|
|
324
|
-
|
|
315
|
+
check(
|
|
316
|
+
"missingDependencies: a tlmgr that cannot start reports nothing (the tree is judged by probeTree alone)",
|
|
317
|
+
JSON.stringify(
|
|
318
|
+
missingDependencies("/tl/bin", () => ({ error: new Error("ENOENT") })),
|
|
319
|
+
) === "[]",
|
|
320
|
+
);
|
|
321
|
+
check(
|
|
322
|
+
"missingDependencies: a section that runs to the end of the output, with no header after it",
|
|
323
|
+
JSON.stringify(
|
|
324
|
+
missingDependencies("/tl/bin", () => ({
|
|
325
|
+
stdout:
|
|
326
|
+
"\f DEPENDS WITHOUT PACKAGES:\nunicode-data in: latex-bin\nhyphen-base in: x",
|
|
327
|
+
status: 2,
|
|
328
|
+
})),
|
|
329
|
+
) === '["hyphen-base","unicode-data"]',
|
|
330
|
+
);
|
|
331
|
+
check(
|
|
332
|
+
"a runner that returns no stdout at all: tlmgr lists nothing, kpsewhich finds nothing",
|
|
333
|
+
JSON.stringify(missingDependencies("/tl/bin", () => ({ status: 0 }))) ===
|
|
334
|
+
"[]" &&
|
|
335
|
+
JSON.stringify(probeTree("/tl/bin", PKGS, () => ({ status: 0 }))) ===
|
|
336
|
+
JSON.stringify(Object.keys(PKGS).sort()),
|
|
337
|
+
);
|
|
338
|
+
});
|
package/src/facts-file.test.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The document is assembled from hand-made measurements (pure), and `measurePaper` runs on
|
|
5
5
|
* in-memory files with a FAKE pdf.js reader and a FAKE measurer, so each outcome — read failed, not
|
|
6
6
|
* measured, measured — is chosen rather than hoped for. Reading real PDFs is
|
|
7
|
-
* `pdf-facts.
|
|
7
|
+
* `pdf-facts-tables.test.ts`'s job; banal as the measurer is `adapters/banal/index.test.ts`, and the
|
|
8
8
|
* real banal is `test/e2e/tex/banal.e2e.ts`.
|
|
9
9
|
*/
|
|
10
10
|
import assert from "node:assert/strict";
|