Merge upstream: sharded test runs, auto-release follows CI (3.1.0)
Some checks failed
CI / plan (push) Waiting to run
CI / part (push) Blocked by required conditions
CI / build (push) Waiting to run
CI / translations (push) Waiting to run
CI / test (push) Blocked by required conditions
CI / timings (push) Blocked by required conditions
Container image / test (push) Has been cancelled
Container image / publish (push) Has been cancelled

The fork's Unreleased bullets stay above upstream's 3.1.0 section. The dark
mode test reads the theme script from the page's HTML, since the harness
now runs script bodies outside the DOM.
This commit is contained in:
jvanvik 2026-11-07 10:29:33 +01:00
commit 4b922aba02
22 changed files with 287 additions and 128 deletions

View file

@ -0,0 +1,18 @@
// A node:test reporter that writes how long each test file took, as JSON {"tests/x.test.js": seconds}, to its
// destination. scripts/test.js adds it next to the usual output with --timings FILE; CI merges the parts' files
// into tests/durations.json, which the next run splits its parts by.
const path = require('node:path');
module.exports = async function* timings(source) {
const sec = {};
for await (const { type, data } of source) {
// Top-level tests only: their durations include their subtests.
if ((type === 'test:pass' || type === 'test:fail') && data.nesting === 0 && data.file && data.details) {
const f = path.relative(process.cwd(), data.file).split(path.sep).join('/');
sec[f] = (sec[f] || 0) + (data.details.duration_ms || 0) / 1000;
}
}
const out = {};
for (const f of Object.keys(sec).sort()) out[f] = Math.round(sec[f] * 10) / 10;
yield JSON.stringify(out, null, 1) + '\n';
};