paperlint 20.1.1 → 20.2.0
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 +6 -2
- package/CONTRIBUTING.md +2 -2
- package/{action.harness.mjs → action.test.mjs} +147 -138
- package/dist/adapters/venue-corpus/index.d.ts +345 -0
- package/dist/adapters/venue-corpus/index.d.ts.map +1 -0
- package/dist/adapters/venue-corpus/index.js +205 -0
- package/dist/adapters/venue-corpus/index.js.map +1 -0
- package/dist/domain/licence.d.ts +51 -0
- package/dist/domain/licence.d.ts.map +1 -0
- package/dist/domain/licence.js +61 -0
- package/dist/domain/licence.js.map +1 -0
- package/dist/domain/venue-corpus.d.ts +120 -0
- package/dist/domain/venue-corpus.d.ts.map +1 -0
- package/dist/domain/venue-corpus.js +13 -0
- package/dist/domain/venue-corpus.js.map +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.d.ts.map +1 -1
- package/dist/eslint-rules/CLAUDE.md.spec.js +1 -0
- package/dist/eslint-rules/CLAUDE.md.spec.js.map +1 -1
- 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/dist/ports/venue-corpus-codec.d.ts +11 -0
- package/dist/ports/venue-corpus-codec.d.ts.map +1 -0
- package/dist/ports/venue-corpus-codec.js +2 -0
- package/dist/ports/venue-corpus-codec.js.map +1 -0
- package/dist/skill-chunks/chunk-5KCU4WTN.js +108 -0
- package/dist/skill-chunks/{chunk-X4VKG4KT.js → chunk-6YEM4VDI.js} +11 -9
- package/dist/skill-chunks/{chunk-L3NJUJUP.js → chunk-CXAGKT44.js} +5 -3
- package/dist/skill-chunks/{chunk-6NU6CXUS.js → chunk-J5XYPERO.js} +12 -72
- package/dist/skill-chunks/{chunk-IREAROCV.js → chunk-Z5YMDZYW.js} +4 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences-core.d.ts +54 -0
- package/dist/skills/study-accepted-papers/scripts/corpus-licences.d.ts +2 -0
- package/docs/design/venue-corpus.md +250 -0
- package/docs/e2e.md +9 -9
- package/docs/testing.md +3 -4
- package/docs/venues.md +144 -21
- package/eslint-rules/CLAUDE.md +5 -1
- package/eslint-rules/CLAUDE.md.spec.ts +3 -0
- 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 +4 -3
- package/presets/acm-acmsmall.jsonc +1 -1
- package/scripts/bundle-skills.ts +1 -0
- 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/scripts/venue-corpus-schema.test.ts +39 -0
- package/scripts/venue-corpus-schema.ts +17 -0
- package/skills/argument-arc/scripts/headings.js +6 -4
- package/skills/cold-read-diff/scripts/cold-read.js +6 -4
- 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/extract-ref-facts.js +6 -5
- 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/pc-panel-review/scripts/prior-reviews.js +7 -5
- 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/skills/study-accepted-papers/SKILL.md +28 -2
- package/skills/study-accepted-papers/SKILL.md.spec.ts +27 -1
- package/skills/study-accepted-papers/papers.schema.json +427 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.js +180 -0
- package/skills/study-accepted-papers/scripts/corpus-licences-core.ts +302 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.js +383 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.test.ts +485 -0
- package/skills/study-accepted-papers/scripts/corpus-licences.ts +27 -0
- package/skills/verify-citations/scripts/bib-authors.js +6 -5
- package/skills/verify-citations/scripts/verify-cites.js +6 -5
- package/src/adapters/pdfjs/fill.test.ts +1 -1
- package/src/adapters/venue-corpus/index.test.ts +279 -0
- package/src/adapters/venue-corpus/index.ts +286 -0
- 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/domain/licence.test.ts +122 -0
- package/src/domain/licence.ts +95 -0
- package/src/domain/venue-corpus.ts +130 -0
- 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/ports/venue-corpus-codec.ts +11 -0
- 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
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
* install and verify logic — the part that decides success — and what is faked is only TeX.
|
|
9
9
|
* The real TeX Live half is `test/e2e/tex/toolchain.e2e.ts`.
|
|
10
10
|
*
|
|
11
|
-
* Tables, in order:
|
|
11
|
+
* Run by vitest (`it` per table). Tables, in order:
|
|
12
12
|
* 1. the pure pieces (year, profile, tlmgr's unknown names, cache location);
|
|
13
13
|
* 2. the download: mirror fallback, archive check, the time limit;
|
|
14
14
|
* 3. the command: fresh install, second run is a no-op, --check, partial add, and the three
|
|
15
15
|
* ways an install must FAIL naming the package;
|
|
16
16
|
* 4. banal, the command's second half: a stand-in banal served from `file://`, never HotCRP —
|
|
17
|
-
* the installer's own tests are `banal
|
|
17
|
+
* the installer's own tests are in `src/adapters/banal/`; here only the wiring into the command.
|
|
18
18
|
*/
|
|
19
19
|
import { spawnSync } from "node:child_process";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
@@ -32,7 +32,10 @@ import {
|
|
|
32
32
|
import { tmpdir } from "node:os";
|
|
33
33
|
import { dirname, join } from "node:path";
|
|
34
34
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
35
|
-
import {
|
|
35
|
+
import { afterAll, beforeAll, expect, it, vi } from "vitest";
|
|
36
|
+
|
|
37
|
+
// Several tests here run real ESLint, spawn processes or walk the repository.
|
|
38
|
+
vi.setConfig({ testTimeout: 120_000 });
|
|
36
39
|
|
|
37
40
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
38
41
|
const FIXTURE = join(HERE, "..", "fixtures", "toolchain-mirror");
|
|
@@ -43,106 +46,112 @@ const B = await import(join(HERE, "adapters", "banal", "index.ts"));
|
|
|
43
46
|
const N = await import(join(HERE, "adapters", "node", "index.ts"));
|
|
44
47
|
const C = await import(join(HERE, "adapters", "curl", "index.ts"));
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
/** One soft assertion: a failed check does not stop the checks after it in the same test. */
|
|
50
|
+
const check = (label, cond, detail) =>
|
|
51
|
+
expect
|
|
52
|
+
.soft(cond, detail === undefined ? label : `${label}\n${detail}`)
|
|
53
|
+
.toBe(true);
|
|
47
54
|
|
|
48
55
|
// ── 1. pure pieces ──────────────────────────────────────────────────────────────────────
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"2026"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
profile.includes("
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
T.mirrorsFrom({}).
|
|
101
|
-
)
|
|
102
|
-
|
|
56
|
+
it("1. pure pieces", () => {
|
|
57
|
+
check(
|
|
58
|
+
"tlYear: the year from release-texlive.txt's first line",
|
|
59
|
+
T.tlYear("TeX Live (https://tug.org/texlive) version 2026\n\nmore") ===
|
|
60
|
+
"2026",
|
|
61
|
+
);
|
|
62
|
+
check(
|
|
63
|
+
"tlYear: a year on a LATER line is not the release",
|
|
64
|
+
T.tlYear("something else\nversion 2026") === null,
|
|
65
|
+
);
|
|
66
|
+
const profile = T.tlProfile("/c/2026");
|
|
67
|
+
check(
|
|
68
|
+
"tlProfile: scheme-basic, TEXDIR and every tree variable inside it, no docs, no sources",
|
|
69
|
+
profile.includes("selected_scheme scheme-basic\n") &&
|
|
70
|
+
profile.includes("TEXDIR /c/2026\n") &&
|
|
71
|
+
profile.includes("TEXMFHOME /c/2026/texmf-home\n") &&
|
|
72
|
+
profile.includes("tlpdbopt_install_docfiles 0\n") &&
|
|
73
|
+
profile.includes("tlpdbopt_install_srcfiles 0\n"),
|
|
74
|
+
profile,
|
|
75
|
+
);
|
|
76
|
+
check(
|
|
77
|
+
"unknownPackages: tlmgr's own wording names the package",
|
|
78
|
+
JSON.stringify(
|
|
79
|
+
T.unknownPackages(
|
|
80
|
+
"tlmgr install: package urw-base35 not present in repository.\npackage already present: acmart\n",
|
|
81
|
+
),
|
|
82
|
+
) === '["urw-base35"]',
|
|
83
|
+
);
|
|
84
|
+
check(
|
|
85
|
+
"cacheRoot: PAPERLINT_TEXLIVE_DIR wins",
|
|
86
|
+
T.cacheRoot(
|
|
87
|
+
{ PAPERLINT_TEXLIVE_DIR: "/ci/tl", XDG_CACHE_HOME: "/x" },
|
|
88
|
+
"/h",
|
|
89
|
+
) === "/ci/tl",
|
|
90
|
+
);
|
|
91
|
+
check(
|
|
92
|
+
"cacheRoot: then XDG_CACHE_HOME",
|
|
93
|
+
T.cacheRoot({ XDG_CACHE_HOME: "/x" }, "/h") === "/x/paperlint/texlive",
|
|
94
|
+
);
|
|
95
|
+
check(
|
|
96
|
+
"cacheRoot: then ~/.cache",
|
|
97
|
+
T.cacheRoot({}, "/h") === "/h/.cache/paperlint/texlive",
|
|
98
|
+
);
|
|
99
|
+
check(
|
|
100
|
+
"mirrorsFrom: PAPERLINT_CTAN_MIRROR is the ONLY mirror, trailing slash dropped",
|
|
101
|
+
JSON.stringify(
|
|
102
|
+
T.mirrorsFrom({ PAPERLINT_CTAN_MIRROR: "https://m/tlnet/" }),
|
|
103
|
+
) === '["https://m/tlnet"]',
|
|
104
|
+
);
|
|
105
|
+
check(
|
|
106
|
+
"mirrorsFrom: several defaults, every one https",
|
|
107
|
+
T.mirrorsFrom({}).length > 1 &&
|
|
108
|
+
T.mirrorsFrom({}).every((m) => m.startsWith("https://")),
|
|
109
|
+
);
|
|
110
|
+
check("formatDuration", T.formatDuration(118_400) === "1m58s");
|
|
103
111
|
|
|
104
|
-
// tlmgr's two wordings for "the repository is another TeX Live year" (tlmgr.pl 7644-7648, 7655-7663).
|
|
105
|
-
const OLDER =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const INCOMPAT = (local, remote) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
check(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
);
|
|
119
|
-
check(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
);
|
|
124
|
-
// Guards: the direction of the year check — an outdated mirror would trigger a whole new install.
|
|
125
|
-
check(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
);
|
|
129
|
-
check(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
);
|
|
135
|
-
// Guards: the complete-tree preference — an interrupted new-year install would otherwise be the
|
|
136
|
-
// tree the build uses.
|
|
137
|
-
check(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
);
|
|
141
|
-
check(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
);
|
|
145
|
-
check("usableTree: an empty cache", T.usableTree([], () => true) === null);
|
|
112
|
+
// tlmgr's two wordings for "the repository is another TeX Live year" (tlmgr.pl 7644-7648, 7655-7663).
|
|
113
|
+
const OLDER =
|
|
114
|
+
"tlmgr: Local TeX Live (2026) is older than remote repository (2027).\n" +
|
|
115
|
+
"Cross release updates are only supported with\n" +
|
|
116
|
+
" update-tlmgr-latest(.sh/.exe) -- --upgrade\n";
|
|
117
|
+
const INCOMPAT = (local, remote) =>
|
|
118
|
+
"tlmgr: The TeX Live versions of the local installation\n" +
|
|
119
|
+
"and the repository are not compatible:\n" +
|
|
120
|
+
` local: ${local}\n` +
|
|
121
|
+
` repository: ${remote} (https://m/tlnet)\n` +
|
|
122
|
+
"Perhaps that particular CTAN mirror is outdated? Just a guess.\n";
|
|
123
|
+
check(
|
|
124
|
+
"releaseGap: 'Local TeX Live (Y) is older than remote repository (Y)' — both years",
|
|
125
|
+
JSON.stringify(T.releaseGap(OLDER)) === '{"local":"2026","remote":"2027"}',
|
|
126
|
+
);
|
|
127
|
+
check(
|
|
128
|
+
"releaseGap: the 'not compatible' wording with a NEWER repository",
|
|
129
|
+
JSON.stringify(T.releaseGap(INCOMPAT("2026", "2027"))) ===
|
|
130
|
+
'{"local":"2026","remote":"2027"}',
|
|
131
|
+
);
|
|
132
|
+
// Guards: the direction of the year check — an outdated mirror would trigger a whole new install.
|
|
133
|
+
check(
|
|
134
|
+
"releaseGap: a STALE mirror (repository older than the tree) is not a new release",
|
|
135
|
+
T.releaseGap(INCOMPAT("2027", "2026")) === null,
|
|
136
|
+
);
|
|
137
|
+
check(
|
|
138
|
+
"releaseGap: ordinary tlmgr output is not a release gap",
|
|
139
|
+
T.releaseGap(
|
|
140
|
+
"tlmgr install: package urw-base35 not present in repository.\n",
|
|
141
|
+
) === null,
|
|
142
|
+
);
|
|
143
|
+
// Guards: the complete-tree preference — an interrupted new-year install would otherwise be the
|
|
144
|
+
// tree the build uses.
|
|
145
|
+
check(
|
|
146
|
+
"usableTree: the newest COMPLETE tree, not simply the newest",
|
|
147
|
+
T.usableTree(["2027", "2026", "2025"], (y) => y !== "2027") === "2026",
|
|
148
|
+
);
|
|
149
|
+
check(
|
|
150
|
+
"usableTree: nothing complete — the newest, so packages go where the next build will look",
|
|
151
|
+
T.usableTree(["2027", "2026"], () => false) === "2027",
|
|
152
|
+
);
|
|
153
|
+
check("usableTree: an empty cache", T.usableTree([], () => true) === null);
|
|
154
|
+
});
|
|
146
155
|
|
|
147
156
|
// ── the fake mirror ────────────────────────────────────────────────────────────────────
|
|
148
157
|
const work = realpathSync(
|
|
@@ -151,45 +160,47 @@ const work = realpathSync(
|
|
|
151
160
|
const good = join(work, "good");
|
|
152
161
|
const garbage = join(work, "garbage");
|
|
153
162
|
const staging = join(work, "staging", "install-tl-20260924");
|
|
154
|
-
|
|
155
|
-
mkdirSync(
|
|
156
|
-
mkdirSync(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"stub-pdflatex",
|
|
160
|
-
"stub-kpsewhich",
|
|
161
|
-
"stub-tlmgr",
|
|
162
|
-
"stub-fmtutil-sys",
|
|
163
|
-
"release-texlive.txt",
|
|
164
|
-
])
|
|
165
|
-
copyFileSync(join(FIXTURE, f), join(staging, f));
|
|
166
|
-
spawnSync("chmod", [
|
|
167
|
-
"+x",
|
|
168
|
-
...[
|
|
163
|
+
beforeAll(() => {
|
|
164
|
+
mkdirSync(staging, { recursive: true });
|
|
165
|
+
mkdirSync(good);
|
|
166
|
+
mkdirSync(garbage);
|
|
167
|
+
for (const f of [
|
|
169
168
|
"install-tl",
|
|
170
169
|
"stub-pdflatex",
|
|
171
170
|
"stub-kpsewhich",
|
|
172
171
|
"stub-tlmgr",
|
|
173
172
|
"stub-fmtutil-sys",
|
|
174
|
-
|
|
175
|
-
])
|
|
176
|
-
|
|
177
|
-
"
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
173
|
+
"release-texlive.txt",
|
|
174
|
+
])
|
|
175
|
+
copyFileSync(join(FIXTURE, f), join(staging, f));
|
|
176
|
+
spawnSync("chmod", [
|
|
177
|
+
"+x",
|
|
178
|
+
...[
|
|
179
|
+
"install-tl",
|
|
180
|
+
"stub-pdflatex",
|
|
181
|
+
"stub-kpsewhich",
|
|
182
|
+
"stub-tlmgr",
|
|
183
|
+
"stub-fmtutil-sys",
|
|
184
|
+
].map((f) => join(staging, f)),
|
|
185
|
+
]);
|
|
186
|
+
spawnSync(
|
|
187
|
+
"tar",
|
|
188
|
+
[
|
|
189
|
+
"czf",
|
|
190
|
+
join(good, "install-tl-unx.tar.gz"),
|
|
191
|
+
"-C",
|
|
192
|
+
dirname(staging),
|
|
193
|
+
"install-tl-20260924",
|
|
194
|
+
],
|
|
195
|
+
{ stdio: "inherit" },
|
|
196
|
+
);
|
|
197
|
+
copyFileSync(join(FIXTURE, "catalog.txt"), join(good, "catalog.txt"));
|
|
198
|
+
copyFileSync(join(FIXTURE, "release-year"), join(good, "release-year"));
|
|
199
|
+
writeFileSync(
|
|
200
|
+
join(garbage, "install-tl-unx.tar.gz"),
|
|
201
|
+
"<html>503 Service Unavailable</html>",
|
|
202
|
+
);
|
|
203
|
+
});
|
|
193
204
|
const url = (dir) => pathToFileURL(dir).href;
|
|
194
205
|
const MISSING = url(join(work, "no-such-mirror"));
|
|
195
206
|
|
|
@@ -208,7 +219,7 @@ const recorder = () => {
|
|
|
208
219
|
};
|
|
209
220
|
|
|
210
221
|
// ── 2. the download ─────────────────────────────────────────────────────────────────────
|
|
211
|
-
{
|
|
222
|
+
it("2. the download: download: falls through a missing mirror and a non-archive to the good one", () => {
|
|
212
223
|
const lines = [];
|
|
213
224
|
const { run, calls } = recorder();
|
|
214
225
|
const dest = join(work, "dl.tar.gz");
|
|
@@ -249,8 +260,8 @@ const recorder = () => {
|
|
|
249
260
|
"download: -f — an HTTP error page is a failure, not a file",
|
|
250
261
|
curls.every((c) => c.args[0].includes("f")),
|
|
251
262
|
);
|
|
252
|
-
}
|
|
253
|
-
{
|
|
263
|
+
});
|
|
264
|
+
it("2. the download: download: no good mirror → null, not a half file", () => {
|
|
254
265
|
const lines = [];
|
|
255
266
|
const got = T.downloadInstaller(
|
|
256
267
|
{ run: spawnSync, log: (l) => lines.push(l), env: process.env },
|
|
@@ -258,7 +269,7 @@ const recorder = () => {
|
|
|
258
269
|
join(work, "dl2.tar.gz"),
|
|
259
270
|
);
|
|
260
271
|
check("download: no good mirror → null, not a half file", got === null);
|
|
261
|
-
}
|
|
272
|
+
});
|
|
262
273
|
|
|
263
274
|
// ── 3. the command ─────────────────────────────────────────────────────────────────────
|
|
264
275
|
const TEX = {
|
|
@@ -280,13 +291,14 @@ const env = {
|
|
|
280
291
|
};
|
|
281
292
|
// A stand-in banal: a Perl script that prints what banal prints for a one-page, 10 pt probe.
|
|
282
293
|
const fakeBanal = join(work, "fake-banal");
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
);
|
|
294
|
+
const FAKE_BANAL_SOURCE =
|
|
295
|
+
'print qq({"bodyfontsize": 10.3, "columns": 1, "pages": [{}]}\\n);\n';
|
|
296
|
+
beforeAll(() => {
|
|
297
|
+
writeFileSync(fakeBanal, FAKE_BANAL_SOURCE);
|
|
298
|
+
});
|
|
287
299
|
const BANAL = {
|
|
288
300
|
url: url(fakeBanal),
|
|
289
|
-
sha256: createHash("sha256").update(
|
|
301
|
+
sha256: createHash("sha256").update(FAKE_BANAL_SOURCE).digest("hex"),
|
|
290
302
|
};
|
|
291
303
|
/** banal's installer over the real ports, every process going through the recorder. */
|
|
292
304
|
const installer = (e, source, run) => {
|
|
@@ -320,7 +332,7 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
320
332
|
return { code, out: out.join("\n"), err: err.join("\n"), calls: rec.calls };
|
|
321
333
|
};
|
|
322
334
|
|
|
323
|
-
{
|
|
335
|
+
it("3. the command: --check on an empty cache: exit 1, says nothing is installed and what the command installs", () => {
|
|
324
336
|
const r = cmd({ check: true });
|
|
325
337
|
check(
|
|
326
338
|
"--check on an empty cache: exit 1, says nothing is installed and what the command installs",
|
|
@@ -330,8 +342,8 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
330
342
|
r.out,
|
|
331
343
|
);
|
|
332
344
|
check("--check changes nothing", !existsSync(join(root, "2026")));
|
|
333
|
-
}
|
|
334
|
-
{
|
|
345
|
+
});
|
|
346
|
+
it("3. the command: fresh install: exit 0", () => {
|
|
335
347
|
const r = cmd();
|
|
336
348
|
check("fresh install: exit 0", r.code === 0, `${r.out}\n${r.err}`);
|
|
337
349
|
check(
|
|
@@ -352,8 +364,8 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
352
364
|
tlmgr.trim() === `${url(good)} acmart latex texcount`,
|
|
353
365
|
tlmgr,
|
|
354
366
|
);
|
|
355
|
-
}
|
|
356
|
-
{
|
|
367
|
+
});
|
|
368
|
+
it("3. the command: second run: exit 0 and says there is nothing to do", () => {
|
|
357
369
|
const r = cmd();
|
|
358
370
|
// Guards: idempotence — the second run must not touch the network or say it did work.
|
|
359
371
|
check(
|
|
@@ -372,11 +384,11 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
372
384
|
!r.calls.some(installs),
|
|
373
385
|
JSON.stringify(r.calls.map((c) => [c.cmd, ...c.args])),
|
|
374
386
|
);
|
|
375
|
-
}
|
|
387
|
+
});
|
|
376
388
|
// Guards: a tree with every venue package can still be broken. install-tl that lost a package
|
|
377
389
|
// to a mirror prints "continuing anyway"; seen 2026-09-26 with unicode-data, after which the
|
|
378
390
|
// pdflatex format was never built and every build died before writing a log.
|
|
379
|
-
{
|
|
391
|
+
it("3. the command: 🔴 a dropped base dependency: --check does not call the tree complete", () => {
|
|
380
392
|
const tree = join(root, "2026");
|
|
381
393
|
writeFileSync(join(tree, "missing-deps.txt"), "unicode-data\n");
|
|
382
394
|
const check1 = cmd({ check: true });
|
|
@@ -397,16 +409,16 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
397
409
|
"a dropped base dependency: the tree is whole afterwards",
|
|
398
410
|
readFileSync(join(tree, "missing-deps.txt"), "utf8").trim() === "",
|
|
399
411
|
);
|
|
400
|
-
}
|
|
401
|
-
{
|
|
412
|
+
});
|
|
413
|
+
it("3. the command: --check on a complete tree: exit 0", () => {
|
|
402
414
|
const r = cmd({ check: true });
|
|
403
415
|
check(
|
|
404
416
|
"--check on a complete tree: exit 0",
|
|
405
417
|
r.code === 0 && r.out.includes("has all 3 declared packages"),
|
|
406
418
|
r.out,
|
|
407
419
|
);
|
|
408
|
-
}
|
|
409
|
-
{
|
|
420
|
+
});
|
|
421
|
+
it("3. the command: --check names the missing package WITH its proof file", () => {
|
|
410
422
|
// A package declared LATER: the tree exists, so only tlmgr runs, for that package alone.
|
|
411
423
|
const tex = {
|
|
412
424
|
...TEX,
|
|
@@ -431,8 +443,8 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
431
443
|
.split("\n")
|
|
432
444
|
.at(-1) === `${url(good)} libertine`,
|
|
433
445
|
);
|
|
434
|
-
}
|
|
435
|
-
{
|
|
446
|
+
});
|
|
447
|
+
it("3. the command: 🔴 an unknown package name fails and is NAMED", () => {
|
|
436
448
|
const r = cmd({
|
|
437
449
|
tex: { ...TEX, packages: { ...TEX.packages, bogus: ["bogus.sty"] } },
|
|
438
450
|
});
|
|
@@ -443,8 +455,8 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
443
455
|
r.code === 1 && r.err.includes("tlmgr does not know: bogus"),
|
|
444
456
|
r.err,
|
|
445
457
|
);
|
|
446
|
-
}
|
|
447
|
-
{
|
|
458
|
+
});
|
|
459
|
+
it("3. the command: 🔴 tlmgr 'installs' it but the proof file is absent: FAIL, package and file named", () => {
|
|
448
460
|
const r = cmd({
|
|
449
461
|
tex: { ...TEX, packages: { ...TEX.packages, liar: ["liar.sty"] } },
|
|
450
462
|
});
|
|
@@ -455,8 +467,8 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
455
467
|
r.code === 1 && r.err.includes("still lacks, after tlmgr: liar (liar.sty)"),
|
|
456
468
|
r.err,
|
|
457
469
|
);
|
|
458
|
-
}
|
|
459
|
-
{
|
|
470
|
+
});
|
|
471
|
+
it("3. the command: 🔴 a declared tool with no executable fails, named", () => {
|
|
460
472
|
// A tool whose program never appears in the bin directory.
|
|
461
473
|
appendFileSync(join(good, "catalog.txt"), "checkcites checkcites.lua\n");
|
|
462
474
|
const r = cmd({
|
|
@@ -467,16 +479,16 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
467
479
|
r.code === 1 && r.err.includes("checkcites (checkcites)"),
|
|
468
480
|
r.err,
|
|
469
481
|
);
|
|
470
|
-
}
|
|
471
|
-
{
|
|
482
|
+
});
|
|
483
|
+
it("3. the command: Windows: a clear refusal, nothing touched", () => {
|
|
472
484
|
const r = cmd({ platform: "win32" });
|
|
473
485
|
check(
|
|
474
486
|
"Windows: a clear refusal, nothing touched",
|
|
475
487
|
r.code === 1 && r.err.includes("Windows is not supported"),
|
|
476
488
|
r.err,
|
|
477
489
|
);
|
|
478
|
-
}
|
|
479
|
-
{
|
|
490
|
+
});
|
|
491
|
+
it("3. the command: install-tl failing: exit 1 and its own last lines are shown", () => {
|
|
480
492
|
const fresh = join(work, "cache-fail");
|
|
481
493
|
const r = cmd({
|
|
482
494
|
env: {
|
|
@@ -492,8 +504,8 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
492
504
|
r.err.includes("simulated failure"),
|
|
493
505
|
r.err,
|
|
494
506
|
);
|
|
495
|
-
}
|
|
496
|
-
{
|
|
507
|
+
});
|
|
508
|
+
it("3. the command: no mirror answers: exit 1, names the mirrors and the override", () => {
|
|
497
509
|
const r = cmd({
|
|
498
510
|
env: {
|
|
499
511
|
...env,
|
|
@@ -508,7 +520,7 @@ const cmd = ({ banal = BANAL, ...over } = {}) => {
|
|
|
508
520
|
r.err.includes("PAPERLINT_CTAN_MIRROR"),
|
|
509
521
|
r.err,
|
|
510
522
|
);
|
|
511
|
-
}
|
|
523
|
+
});
|
|
512
524
|
|
|
513
525
|
// ── 4. a new TeX Live year on CTAN ─────────────────────────────────────────────────────
|
|
514
526
|
/**
|
|
@@ -548,7 +560,10 @@ const mirrorFor = (name, year, installerYear = year) => {
|
|
|
548
560
|
writeFileSync(join(dir, "release-year"), `${year}\n`);
|
|
549
561
|
return url(dir);
|
|
550
562
|
};
|
|
551
|
-
|
|
563
|
+
let next;
|
|
564
|
+
beforeAll(() => {
|
|
565
|
+
next = mirrorFor("good2027", "2027");
|
|
566
|
+
});
|
|
552
567
|
const years = join(work, "cache-years");
|
|
553
568
|
const withLibertine = {
|
|
554
569
|
...TEX,
|
|
@@ -563,11 +578,13 @@ const inYears = (mirror, over = {}) =>
|
|
|
563
578
|
},
|
|
564
579
|
...over,
|
|
565
580
|
});
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
)
|
|
570
|
-
|
|
581
|
+
it("4. a new TeX Live year on CTAN: years: a 2026 tree to start from", () => {
|
|
582
|
+
check(
|
|
583
|
+
"years: a 2026 tree to start from",
|
|
584
|
+
inYears(url(good)).code === 0 && existsSync(join(years, "2026")),
|
|
585
|
+
);
|
|
586
|
+
});
|
|
587
|
+
it("4. a new TeX Live year on CTAN: 🔴 years: a complete 2026 tree and a 2027 mirror, nothing new declared — NO upgrade", () => {
|
|
571
588
|
const r = inYears(next);
|
|
572
589
|
check(
|
|
573
590
|
"🔴 years: a complete 2026 tree and a 2027 mirror, nothing new declared — NO upgrade",
|
|
@@ -578,8 +595,8 @@ check(
|
|
|
578
595
|
!r.calls.some(installs),
|
|
579
596
|
`${r.out}\n${JSON.stringify(r.calls.map((c) => c.cmd))}`,
|
|
580
597
|
);
|
|
581
|
-
}
|
|
582
|
-
{
|
|
598
|
+
});
|
|
599
|
+
it("4. a new TeX Live year on CTAN: 🔴 years: a new package on a 2027 mirror — tlmgr's refusal installs a 2027 tree beside the old one", () => {
|
|
583
600
|
const r = inYears(next, { tex: withLibertine });
|
|
584
601
|
// Guards: the recovery — a new TeX Live year would fail every newly declared package, loudly and
|
|
585
602
|
// forever.
|
|
@@ -608,8 +625,8 @@ check(
|
|
|
608
625
|
r.out.includes("MB); delete that directory to free the space"),
|
|
609
626
|
r.out,
|
|
610
627
|
);
|
|
611
|
-
}
|
|
612
|
-
{
|
|
628
|
+
});
|
|
629
|
+
it("4. a new TeX Live year on CTAN: years: the next run uses 2027 and does nothing", () => {
|
|
613
630
|
const r = inYears(next, { tex: withLibertine });
|
|
614
631
|
check(
|
|
615
632
|
"years: the next run uses 2027 and does nothing",
|
|
@@ -619,8 +636,8 @@ check(
|
|
|
619
636
|
),
|
|
620
637
|
r.out,
|
|
621
638
|
);
|
|
622
|
-
}
|
|
623
|
-
{
|
|
639
|
+
});
|
|
640
|
+
it("4. a new TeX Live year on CTAN: 🔴 years: mirrors that disagree about the release fail, and install-tl is not run over the old tree", () => {
|
|
624
641
|
// tlmgr says 2027, but the installer the mirrors hand out is still 2026.
|
|
625
642
|
const split = join(work, "cache-split");
|
|
626
643
|
cmd({ env: { ...env, PAPERLINT_TEXLIVE_DIR: split } });
|
|
@@ -641,10 +658,10 @@ check(
|
|
|
641
658
|
!r.calls.some((c) => c.cmd.endsWith("install-tl")),
|
|
642
659
|
r.err,
|
|
643
660
|
);
|
|
644
|
-
}
|
|
661
|
+
});
|
|
645
662
|
|
|
646
663
|
// ── 4. banal, the second half of the command ───────────────────────────────────────────
|
|
647
|
-
{
|
|
664
|
+
it("4. banal, the second half of the command: banal: --check with TeX Live complete and no banal exits 1 and names banal", () => {
|
|
648
665
|
const dir = join(work, "banal-4");
|
|
649
666
|
const e = { ...env, PAPERLINT_BANAL_DIR: dir };
|
|
650
667
|
const before = cmd({ env: e, check: true });
|
|
@@ -670,8 +687,8 @@ check(
|
|
|
670
687
|
again.out,
|
|
671
688
|
);
|
|
672
689
|
check("banal: --check now passes", cmd({ env: e, check: true }).code === 0);
|
|
673
|
-
}
|
|
674
|
-
{
|
|
690
|
+
});
|
|
691
|
+
it("4. banal, the second half of the command: 🔴 banal with the wrong sha256: exit 1, the refusal named, and TeX Live still reported ready", () => {
|
|
675
692
|
const r = cmd({
|
|
676
693
|
env: { ...env, PAPERLINT_BANAL_DIR: join(work, "banal-bad") },
|
|
677
694
|
banal: { ...BANAL, sha256: "0".repeat(64) },
|
|
@@ -685,7 +702,8 @@ check(
|
|
|
685
702
|
r.out.includes("nothing to do"),
|
|
686
703
|
`${r.out}\n${r.err}`,
|
|
687
704
|
);
|
|
688
|
-
}
|
|
705
|
+
});
|
|
689
706
|
|
|
690
|
-
|
|
691
|
-
|
|
707
|
+
afterAll(() => {
|
|
708
|
+
rmSync(work, { recursive: true, force: true });
|
|
709
|
+
});
|