Initial commit
Build, test, deploy / site (push) Failing after 15m13s

This commit is contained in:
alexm committed 2026-11-12 22:24:02 -05:00
commit e092cb029c
252 files changed
+35037

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
// SPDX-FileCopyrightText: 2026 Scientific Computing Studio, LLC
// SPDX-License-Identifier: Apache-2.0
// THIRD_PARTY.md is written by hand; these tests hold it to the files that say what is bundled, copied, loaded
// and installed, so a rebuilt CodeMirror, a new copied stylesheet, a self-hosted font or a moved tool fails here
// until the inventory says so. They read files only: no build and no core/ needed.
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
const ROOT = new URL('..', import.meta.url).pathname;
const read = (p) => fs.readFileSync(path.join(ROOT, p), 'utf8');
const doc = read('THIRD_PARTY.md');
const row = (name) => doc.split('\n').find((l) => l.startsWith(`| ${name} `)) ?? '';
test('every package bundled into codemirror.js has a row with its version and a copyright notice', () => {
const banner = read('src/vendor/codemirror.js').split('\n').slice(0, 3).join('\n');
const pkgs = [...banner.matchAll(/(@?[a-z0-9-]+(?:\/[a-z0-9-]+)?)@(\d+\.\d+\.\d+)/g)].map((m) => [m[1], m[2]]);
assert.ok(pkgs.length >= 10, `only ${pkgs.length} packages read from the banner`);
for (const [name, version] of pkgs) {
const r = row(name);
assert.ok(r.includes(`| ${version} |`), `${name}@${version} has no row with that version`);
assert.match(r, /\| Copyright \(C\) \d{4}(-\d{4})? by .+ \|$/, `${name} has no copyright notice`);
}
const rows = doc.split('\n').filter((l) => /^\| (@[a-z0-9-]+\/)?[a-z0-9-]+ \| \d+\.\d+\.\d+ \| /.test(l));
assert.equal(rows.length, pkgs.length, 'a row for a package the bundle does not hold');
// the permission notice is the one the vendored license file carries
const permission = read('src/vendor/CODEMIRROR-LICENSE').split('\n').slice(4).join('\n').trim();
assert.ok(doc.includes(permission), 'the MIT permission notice differs from src/vendor/CODEMIRROR-LICENSE');
});
test('every copied course stylesheet and syntax definition is named', () => {
for (const dir of ['styles/course', 'quarto/_extensions/pplus/course', 'quarto/_extensions/pplus/syntax']) {
for (const f of fs.readdirSync(path.join(ROOT, dir))) if (/\.(css|xml)$/.test(f)) assert.ok(doc.includes(`\`${f}\``), `${dir}/${f} is not named`);
}
});
test('the fonts the page loads are named, and a font file in the repository has its license beside it', () => {
const html = read('index.html');
for (const m of html.matchAll(/family=([A-Za-z+]+)/g)) assert.ok(doc.includes(m[1].replace(/\+/g, ' ')), `${m[1]} is not named`);
const fonts = [];
const walk = (d) => {
for (const e of fs.readdirSync(path.join(ROOT, d), { withFileTypes: true })) {
const p = path.join(d, e.name);
if (e.isDirectory()) { if (!['node_modules', 'dist', 'core', '.git', '.pixi', 'site', 'scratch', '_site', '.quarto'].includes(e.name)) walk(p); } // _site and .quarto: what `pixi run quarto-example` leaves, with Quarto's own fonts
else if (/\.(woff2?|ttf|otf)$/i.test(e.name)) fonts.push(p);
}
};
walk('.');
for (const f of fonts) {
const dir = path.dirname(f);
assert.ok(fs.readdirSync(path.join(ROOT, dir)).some((n) => /^(OFL|LICENSE)/i.test(n)), `${f} has no OFL or LICENSE file beside it`);
}
if (fonts.length) assert.ok(/IBM Plex/.test(doc), 'font files are served but THIRD_PARTY.md names no font');
});
test('the tools in pixi.lock and package-lock.json have their versions and licenses', () => {
const lock = read('pixi.lock');
const conda = (pkg) => {
const m = lock.match(new RegExp(`\\n- conda: \\S*/${pkg}-(\\d[^-/]*)-[^/\\s]*\\.conda\\n(?: .*\\n)*? license: (.+)`));
assert.ok(m, `${pkg} is not in pixi.lock`);
return { version: m[1], license: m[2].trim() };
};
for (const [name, pkg] of [['Mojo', 'mojo'], ['Node.js', 'nodejs'], ['Python', 'python'], ['pandoc', 'pandoc']]) {
const c = conda(pkg);
assert.ok(row(name).includes(`| ${c.version} |`) && row(name).includes(c.license), `${name} ${c.version}, ${c.license}`);
}
const pkgs = JSON.parse(read('package-lock.json')).packages;
assert.deepEqual(Object.keys(pkgs).filter((k) => k), ['node_modules/typescript'], 'a new npm package needs a row here (and AGENTS.md allows none)');
const ts = pkgs['node_modules/typescript'];
assert.ok(row('TypeScript').includes(`| ${ts.version} |`) && row('TypeScript').includes(`| ${ts.license} |`), `TypeScript ${ts.version}, ${ts.license}`);
});