@unframework.dev/testing 0.0.0-stage → 0.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/README.md +536 -2
- package/dist/browser/axe.js +34 -0
- package/dist/browser/behaviour.js +59 -0
- package/dist/browser/capabilities.js +58 -0
- package/dist/browser/clock.d.ts +17 -0
- package/dist/browser/clock.js +69 -0
- package/dist/browser/console.d.ts +27 -0
- package/dist/browser/console.js +142 -0
- package/dist/browser/determinism.js +108 -0
- package/dist/browser/element-timeout.js +28 -0
- package/dist/browser/events.js +68 -0
- package/dist/browser/geometry.js +135 -0
- package/dist/browser/keys.js +62 -0
- package/dist/browser/matchers.d.ts +39 -0
- package/dist/browser/matchers.js +78 -0
- package/dist/browser/navigation.js +38 -0
- package/dist/browser/parity.d.ts +10 -0
- package/dist/browser/parity.js +93 -0
- package/dist/browser/spec.d.ts +25 -0
- package/dist/browser/spec.js +38 -0
- package/dist/browser/target.d.ts +16 -0
- package/dist/browser/target.js +27 -0
- package/dist/browser/text-runs.js +68 -0
- package/dist/browser/thrown.js +71 -0
- package/dist/browser/trace.d.ts +21 -0
- package/dist/browser/trace.js +73 -0
- package/dist/browser/user.d.ts +45 -0
- package/dist/browser/user.js +184 -0
- package/dist/browser/view.d.ts +114 -0
- package/dist/browser/view.js +282 -0
- package/dist/browser/visual.d.ts +20 -0
- package/dist/browser/visual.js +36 -0
- package/dist/cli.d.ts +23 -0
- package/dist/cli.js +90 -0
- package/dist/commands.d.ts +107 -0
- package/dist/config/broadcast.js +29 -0
- package/dist/config/cases.d.ts +28 -0
- package/dist/config/cases.js +94 -0
- package/dist/config/index.d.ts +82 -0
- package/dist/config/index.js +295 -0
- package/dist/config/project-vite.d.ts +40 -0
- package/dist/config/project-vite.js +152 -0
- package/dist/diff.d.ts +14 -0
- package/dist/diff.js +92 -0
- package/dist/dom/serialize.js +236 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.js +38 -0
- package/dist/harness.d.ts +189 -0
- package/dist/harness.js +53 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +12 -0
- package/dist/internal.d.ts +8 -0
- package/dist/internal.js +6 -0
- package/dist/layers.d.ts +183 -0
- package/dist/layers.js +241 -0
- package/dist/node/browser.d.ts +33 -0
- package/dist/node/browser.js +64 -0
- package/dist/node/commands.d.ts +137 -0
- package/dist/node/commands.js +139 -0
- package/dist/node/context.d.ts +28 -0
- package/dist/node/context.js +55 -0
- package/dist/node/events.d.ts +25 -0
- package/dist/node/events.js +50 -0
- package/dist/node/finished.d.ts +12 -0
- package/dist/node/finished.js +28 -0
- package/dist/node/index.d.ts +21 -0
- package/dist/node/index.js +20 -0
- package/dist/node/matrix.d.ts +219 -0
- package/dist/node/matrix.js +309 -0
- package/dist/node/mode.d.ts +103 -0
- package/dist/node/mode.js +204 -0
- package/dist/node/names.d.ts +4 -0
- package/dist/node/names.js +5 -0
- package/dist/node/policy.d.ts +44 -0
- package/dist/node/policy.js +140 -0
- package/dist/node/reporter.d.ts +101 -0
- package/dist/node/reporter.js +251 -0
- package/dist/node/summary.d.ts +99 -0
- package/dist/node/summary.js +352 -0
- package/dist/node/thrown.js +78 -0
- package/dist/node/viewport.d.ts +7 -0
- package/dist/node/viewport.js +8 -0
- package/dist/node/visual.d.ts +85 -0
- package/dist/node/visual.js +373 -0
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/protocol.d.ts +23930 -0
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/structs.d.ts +22 -0
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/types.d.ts +22221 -0
- package/dist/normalize/display.js +309 -0
- package/dist/normalize/index.d.ts +34 -0
- package/dist/normalize/index.js +38 -0
- package/dist/normalize/pipeline.d.ts +19 -0
- package/dist/normalize/pipeline.js +45 -0
- package/dist/normalize/print.js +103 -0
- package/dist/normalize/rules/angular-hosts.js +53 -0
- package/dist/normalize/rules/aria-hosts.js +48 -0
- package/dist/normalize/rules/comments.js +16 -0
- package/dist/normalize/rules/control-values.js +65 -0
- package/dist/normalize/rules/engine-aliases.js +34 -0
- package/dist/normalize/rules/framework-attributes.js +85 -0
- package/dist/normalize/rules/generated-ids.js +64 -0
- package/dist/normalize/rules/ordering.js +39 -0
- package/dist/normalize/rules/qwik-styles.js +21 -0
- package/dist/normalize/rules/qwik-templates.js +20 -0
- package/dist/normalize/rules/values.js +125 -0
- package/dist/normalize/rules/whitespace.js +381 -0
- package/dist/normalize/style.js +121 -0
- package/dist/normalize/targets.d.ts +8 -0
- package/dist/normalize/targets.js +17 -0
- package/dist/normalize/tree.d.ts +1 -0
- package/dist/normalize/tree.js +151 -0
- package/dist/setup.d.ts +1 -0
- package/dist/setup.js +149 -0
- package/dist/ssr/index.d.ts +10 -0
- package/dist/ssr/index.js +103 -0
- package/dist/ssr/spec.d.ts +1 -0
- package/dist/ssr/spec.js +7 -0
- package/dist/targets/angular.d.ts +1 -0
- package/dist/targets/angular.js +5 -0
- package/dist/targets/astro.d.ts +1 -0
- package/dist/targets/astro.js +5 -0
- package/dist/targets/qwik.d.ts +1 -0
- package/dist/targets/qwik.js +5 -0
- package/dist/targets/react.d.ts +1 -0
- package/dist/targets/react.js +5 -0
- package/dist/targets/solid.d.ts +1 -0
- package/dist/targets/solid.js +5 -0
- package/dist/targets/svelte.d.ts +1 -0
- package/dist/targets/svelte.js +5 -0
- package/dist/targets/vue.d.ts +1 -0
- package/dist/targets/vue.js +5 -0
- package/dist/visual-types.d.ts +92 -0
- package/dist/visual-types.js +24 -0
- package/package.json +146 -3
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { BROWSER_ENGINES, caseOfFile } from "../harness.js";
|
|
2
|
+
import { errorMessages } from "../errors.js";
|
|
3
|
+
import { buildPartialMatrix, narrowing, settleQuarantine, stringifyMatrix, withoutProjects } from "./matrix.js";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { join, resolve } from "node:path";
|
|
6
|
+
//#region src/node/reporter.ts
|
|
7
|
+
/** The parity reporter. Add it to `test.reporters` next to Vitest's own. */
|
|
8
|
+
var ParityReporter = class {
|
|
9
|
+
#options;
|
|
10
|
+
#vitest;
|
|
11
|
+
/** The matrix of the last finished run, for tooling and tests. */
|
|
12
|
+
matrix;
|
|
13
|
+
constructor(options) {
|
|
14
|
+
this.#options = options;
|
|
15
|
+
}
|
|
16
|
+
onInit(vitest) {
|
|
17
|
+
this.#vitest = vitest;
|
|
18
|
+
}
|
|
19
|
+
onTestRunEnd(testModules, errors, reason) {
|
|
20
|
+
const vitest = this.#vitest;
|
|
21
|
+
if (!vitest) throw new Error("[uf:parity] onTestRunEnd ran before onInit.");
|
|
22
|
+
if (reason === "interrupted") {
|
|
23
|
+
vitest.logger.error("[uf:parity] The run was interrupted: no parity matrix written.");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const projects = [...new Set(vitest.projects.map((project) => project.name))].sort();
|
|
27
|
+
const harness = vitest.projects.map((project) => project.getProvidedContext().ufHarness).find((context) => context !== void 0);
|
|
28
|
+
const filtered = filterOf(vitest);
|
|
29
|
+
const shard = vitest.config.shard ? {
|
|
30
|
+
index: vitest.config.shard.index,
|
|
31
|
+
count: vitest.config.shard.count
|
|
32
|
+
} : null;
|
|
33
|
+
const narrowed = narrowing({
|
|
34
|
+
filtered,
|
|
35
|
+
shard
|
|
36
|
+
});
|
|
37
|
+
const problems = [];
|
|
38
|
+
const counts = new Map(projects.map((name) => [name, 0]));
|
|
39
|
+
const records = [];
|
|
40
|
+
const named = /* @__PURE__ */ new Set();
|
|
41
|
+
for (const module of testModules) {
|
|
42
|
+
const fileRecord = module.meta().uf;
|
|
43
|
+
if (fileRecord) records.push({
|
|
44
|
+
project: module.project.name,
|
|
45
|
+
record: fileRecord
|
|
46
|
+
});
|
|
47
|
+
for (const test of module.children.allTests()) {
|
|
48
|
+
counts.set(test.project.name, (counts.get(test.project.name) ?? 0) + 1);
|
|
49
|
+
const meta = test.meta().uf;
|
|
50
|
+
const record = meta && {
|
|
51
|
+
...meta,
|
|
52
|
+
test: testKey(test.fullName, meta.target)
|
|
53
|
+
};
|
|
54
|
+
if (record) {
|
|
55
|
+
records.push({
|
|
56
|
+
project: test.project.name,
|
|
57
|
+
record
|
|
58
|
+
});
|
|
59
|
+
const identity = JSON.stringify([
|
|
60
|
+
test.project.name,
|
|
61
|
+
record.case,
|
|
62
|
+
record.test
|
|
63
|
+
]);
|
|
64
|
+
if (named.has(identity)) problems.push(`${test.project.name}: two tests of ${record.case} are named "${record.test}". Each test of a case has a name of its own: the summary compares each target's tests with the reference's by name.`);
|
|
65
|
+
named.add(identity);
|
|
66
|
+
}
|
|
67
|
+
if (!filtered && test.result().state === "skipped" && !skipsWithReasons(record)) problems.push(`${test.project.name}: "${test.fullName}" was skipped without recording why. A harness test never skips silently (plan §7.7): record each layer it skips, with the reason, before skipping.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const empty = projects.filter((name) => !counts.get(name));
|
|
71
|
+
if (empty.length) {
|
|
72
|
+
if (narrowed) vitest.logger.log(`[uf:parity] Not checking for empty projects: the run covers only ${narrowed}. Empty: ${empty.join(", ")}.`);
|
|
73
|
+
else problems.push(`${empty.length} selected project(s) collected zero tests: ${empty.join(", ")}. A project that runs nothing verifies nothing.`);
|
|
74
|
+
}
|
|
75
|
+
const all = runName(projects, this.#options.allProjects);
|
|
76
|
+
const complete = !narrowed && all === "all" && this.#options.allProjects !== void 0;
|
|
77
|
+
const matrix = buildPartialMatrix({
|
|
78
|
+
run: [
|
|
79
|
+
all,
|
|
80
|
+
...shard ? [`shard-${shard.index}-of-${shard.count}`] : [],
|
|
81
|
+
...filtered ? [`filtered-${hash(filtered)}`] : []
|
|
82
|
+
].join("+"),
|
|
83
|
+
projects,
|
|
84
|
+
records,
|
|
85
|
+
finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
86
|
+
mode: harness ? {
|
|
87
|
+
update: harness.update,
|
|
88
|
+
pixels: harness.pixels,
|
|
89
|
+
canary: harness.canary
|
|
90
|
+
} : null,
|
|
91
|
+
filtered,
|
|
92
|
+
shard,
|
|
93
|
+
empty,
|
|
94
|
+
quarantine: harness?.quarantine ?? [],
|
|
95
|
+
reference: harness?.reference ?? null,
|
|
96
|
+
references: Object.fromEntries(Object.entries(harness?.cases ?? {}).flatMap(([id, config]) => config.reference ? [[id, config.reference]] : [])),
|
|
97
|
+
errors: [...new Set(errors.map((error) => errorMessages(error).join("; caused by: ")))]
|
|
98
|
+
});
|
|
99
|
+
if (complete) problems.push(...settleQuarantine(matrix.cases, matrix.quarantine, { stale: true }));
|
|
100
|
+
else if (matrix.quarantine.length) vitest.logger.log("[uf:parity] Quarantine entries are checked for staleness when every project runs (or in the merged summary).");
|
|
101
|
+
this.matrix = matrix;
|
|
102
|
+
if (this.#options.canaryDir) {
|
|
103
|
+
mkdirSync(this.#options.canaryDir, { recursive: true });
|
|
104
|
+
writeFileSync(join(this.#options.canaryDir, "parity-matrix.json"), stringifyMatrix(matrix));
|
|
105
|
+
} else {
|
|
106
|
+
mkdirSync(this.#options.reportsDir, { recursive: true });
|
|
107
|
+
const file = join(this.#options.reportsDir, `parity-matrix.${matrix.run}.json`);
|
|
108
|
+
writeFileSync(file, stringifyMatrix(matrix));
|
|
109
|
+
if (!narrowed) {
|
|
110
|
+
const scopes = scopesOf(vitest.projects, records, harness);
|
|
111
|
+
for (const line of supersede(this.#options.reportsDir, file, new Set(projects), scopes)) vitest.logger.log(`[uf:parity] ${line}`);
|
|
112
|
+
}
|
|
113
|
+
vitest.logger.log(`[uf:parity] ${records.length} record(s) from ${projects.length} project(s) → ${file}`);
|
|
114
|
+
}
|
|
115
|
+
if (problems.length) {
|
|
116
|
+
vitest.logger.error(`[uf:parity] ${problems.length} problem(s) beyond the failed tests:\n ${problems.join("\n ")}`);
|
|
117
|
+
process.exitCode = 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Why a run covers only part of its projects' tests besides its shard, or `null`. Such a run,
|
|
123
|
+
* like a shard, cannot tell an empty project or a stale entry from a filtered one, and
|
|
124
|
+
* supersedes nothing; unlike a shard's, its skipped tests may be ones it filtered out.
|
|
125
|
+
*/
|
|
126
|
+
function filterOf(vitest) {
|
|
127
|
+
const reasons = [];
|
|
128
|
+
if (vitest.filenamePattern?.length) reasons.push(`files matching ${vitest.filenamePattern.join(", ")}`);
|
|
129
|
+
if (vitest.config.testNamePattern) reasons.push(`tests named ${vitest.config.testNamePattern}`);
|
|
130
|
+
const { changed, related, tagsFilter } = vitest.config;
|
|
131
|
+
if (changed) reasons.push(`files affected by ${changed === true ? "uncommitted changes" : `changes since ${changed}`}`);
|
|
132
|
+
else if (related?.length) reasons.push(`tests related to ${related.join(", ")}`);
|
|
133
|
+
if (tagsFilter?.length) reasons.push(`tests tagged ${tagsFilter.join(" ")}`);
|
|
134
|
+
if (vitest.config.watch) reasons.push("watch mode, which reruns only what changed");
|
|
135
|
+
return reasons.length ? reasons.join("; ") : null;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A test's name without the target `describeTargets` puts in its suite's name (`state/counter
|
|
139
|
+
* [vue] > increments` → `state/counter > increments`): the same on every target.
|
|
140
|
+
*/
|
|
141
|
+
function testKey(fullName, target) {
|
|
142
|
+
const suffix = ` [${target}]`;
|
|
143
|
+
return fullName.split(" > ").map((part) => part.endsWith(suffix) ? part.slice(0, -suffix.length) : part).join(" > ");
|
|
144
|
+
}
|
|
145
|
+
/** Whether a skipped test recorded every layer it skipped, each with a reason. */
|
|
146
|
+
function skipsWithReasons(record) {
|
|
147
|
+
const outcomes = Object.values(record?.layers ?? {});
|
|
148
|
+
return outcomes.length > 0 && outcomes.every((outcome) => outcome.status === "skip");
|
|
149
|
+
}
|
|
150
|
+
/** A file-name-safe name for the selected projects: `all`, or the project names. */
|
|
151
|
+
function runName(projects, allProjects) {
|
|
152
|
+
const selected = [...new Set(projects)].sort();
|
|
153
|
+
if (allProjects && [...new Set(allProjects)].sort().join("\n") === selected.join("\n")) return "all";
|
|
154
|
+
const joined = selected.map((name) => name.replace(/[^a-zA-Z0-9-]+/g, "-")).join("+");
|
|
155
|
+
if (joined.length <= 80) return joined || "none";
|
|
156
|
+
return `${joined.slice(0, 60)}+${hash(joined)}`;
|
|
157
|
+
}
|
|
158
|
+
function hash(text) {
|
|
159
|
+
let value = 0;
|
|
160
|
+
for (const char of text) value = Math.imul(value, 31) + char.charCodeAt(0) >>> 0;
|
|
161
|
+
return value.toString(36);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Whether a file name is a partial matrix's, `parity-matrix.<run>.json`. An engine's merged
|
|
165
|
+
* matrix, `parity-matrix.<engine>.json` (ADR-0066), is not: no run is named after an engine.
|
|
166
|
+
*/
|
|
167
|
+
function isPartialMatrixFile(name) {
|
|
168
|
+
const run = /^parity-matrix\.(.+)\.json$/.exec(name)?.[1];
|
|
169
|
+
return run !== void 0 && !BROWSER_ENGINES.includes(run);
|
|
170
|
+
}
|
|
171
|
+
/** The partial matrices in a directory, by file. Throws on one that is not a current matrix. */
|
|
172
|
+
function readPartialMatrices(reportsDir) {
|
|
173
|
+
const matrices = /* @__PURE__ */ new Map();
|
|
174
|
+
if (!existsSync(reportsDir)) return matrices;
|
|
175
|
+
for (const name of readdirSync(reportsDir).sort()) {
|
|
176
|
+
if (!isPartialMatrixFile(name)) continue;
|
|
177
|
+
const file = join(reportsDir, name);
|
|
178
|
+
const matrix = JSON.parse(readFileSync(file, "utf8"));
|
|
179
|
+
if (matrix.version !== 5 || !matrix.byProject) throw new Error(`[uf] ${file} is a parity matrix of version ${String(matrix.version)}, not 5: rerun the tests to replace it.`);
|
|
180
|
+
matrices.set(file, matrix);
|
|
181
|
+
}
|
|
182
|
+
return matrices;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* What this run re-judged of each project it ran: the targets it recorded there, as a run of
|
|
186
|
+
* some targets (`UF_TARGETS`) records only theirs, and only some cases where the run added the
|
|
187
|
+
* project for the cases that name its target as their own reference (ADR-0057). The SSR
|
|
188
|
+
* project is told those cases (`ufOnly`), and the browser project includes their specs alone.
|
|
189
|
+
* Both come from the project itself, so they hold when a spec failed to load and the project
|
|
190
|
+
* recorded nothing, whichever other projects the run selected. A project that recorded nothing
|
|
191
|
+
* and names no cases re-judged all of it.
|
|
192
|
+
*/
|
|
193
|
+
function scopesOf(projects, records, harness) {
|
|
194
|
+
const scopes = /* @__PURE__ */ new Map();
|
|
195
|
+
for (const project of projects) {
|
|
196
|
+
const targets = new Set(records.filter((entry) => entry.project === project.name).map((entry) => entry.record.target));
|
|
197
|
+
const cases = project.getProvidedContext().ufOnly ?? includedCases(project, harness);
|
|
198
|
+
scopes.set(project.name, {
|
|
199
|
+
...targets.size ? { targets } : {},
|
|
200
|
+
...cases ? { cases: new Set(cases) } : {}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
return scopes;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The cases whose specs a project includes file by file, or none when it includes a pattern or a
|
|
207
|
+
* file outside every case: the harness lists the specs of a browser project it adds for some
|
|
208
|
+
* cases alone, and gives every other project a pattern or a harness file.
|
|
209
|
+
*/
|
|
210
|
+
function includedCases(project, harness) {
|
|
211
|
+
const { root, include } = project.config;
|
|
212
|
+
if (!harness || !include.length || include.some((entry) => /[*?[\]{}!]/.test(entry))) return;
|
|
213
|
+
try {
|
|
214
|
+
return include.map((entry) => caseOfFile(resolve(root, entry), harness));
|
|
215
|
+
} catch {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Removes the records this run re-judged from every other partial matrix: those of the projects
|
|
221
|
+
* it ran, within each one's scope (see `scopesOf`). They are stale, also the cells this run no
|
|
222
|
+
* longer records. A matrix left without projects is deleted; one of another version is deleted
|
|
223
|
+
* too, as nothing can merge it. Returns what it did.
|
|
224
|
+
*/
|
|
225
|
+
function supersede(reportsDir, written, projects, scopes) {
|
|
226
|
+
const done = [];
|
|
227
|
+
for (const name of readdirSync(reportsDir).sort()) {
|
|
228
|
+
if (!isPartialMatrixFile(name)) continue;
|
|
229
|
+
const file = join(reportsDir, name);
|
|
230
|
+
if (file === written) continue;
|
|
231
|
+
const matrix = JSON.parse(readFileSync(file, "utf8"));
|
|
232
|
+
if (matrix.version !== 5 || !matrix.byProject) {
|
|
233
|
+
rmSync(file);
|
|
234
|
+
done.push(`Removed ${name}: a matrix of an older format.`);
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
const kept = withoutProjects(matrix, projects, scopes);
|
|
238
|
+
if (kept === matrix) continue;
|
|
239
|
+
if (kept) {
|
|
240
|
+
writeFileSync(file, stringifyMatrix(kept));
|
|
241
|
+
const superseded = matrix.projects.filter((project) => !kept.projects.includes(project) || kept.byProject[project] !== matrix.byProject[project] || kept.scenariosByProject[project] !== matrix.scenariosByProject[project] || kept.testsByProject[project] !== matrix.testsByProject[project]);
|
|
242
|
+
done.push(`Superseded ${superseded.length} project(s) of ${name}.`);
|
|
243
|
+
} else {
|
|
244
|
+
rmSync(file);
|
|
245
|
+
done.push(`Superseded ${name}.`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return done;
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
export { ParityReporter, isPartialMatrixFile, readPartialMatrices, runName, testKey };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { LayerName } from "../layers.js";
|
|
2
|
+
import { BrowserEngine } from "../harness.js";
|
|
3
|
+
import { MergedMatrix, PartialMatrix } from "./matrix.js";
|
|
4
|
+
//#region src/node/summary.d.ts
|
|
5
|
+
/** What a complete run covers. */
|
|
6
|
+
export interface SummaryExpectations {
|
|
7
|
+
/** Every project the config defines (for the selected targets). */
|
|
8
|
+
projects: readonly string[];
|
|
9
|
+
/** Every case id in the corpus. */
|
|
10
|
+
cases: readonly string[];
|
|
11
|
+
targets: readonly string[];
|
|
12
|
+
/** The layers live in this milestone: each needs a cell for every case and target. */
|
|
13
|
+
liveLayers: readonly LayerName[];
|
|
14
|
+
/** The skip reason recorded for the layers that are not live yet. */
|
|
15
|
+
notLiveReason: string;
|
|
16
|
+
/**
|
|
17
|
+
* A live layer only one project records, which the default run leaves out (L15, `bench`): a
|
|
18
|
+
* run without that project in full fills its cells as skipped, never missing. CI's parity job
|
|
19
|
+
* (`requireComplete`) requires them all the same.
|
|
20
|
+
*/
|
|
21
|
+
recordedOnlyBy?: Partial<Record<LayerName, string>>;
|
|
22
|
+
/**
|
|
23
|
+
* Every capability name: a skip by capability on a live layer (`requires <name>: …`) must
|
|
24
|
+
* name one. Without it, any kebab-case name passes.
|
|
25
|
+
*/
|
|
26
|
+
capabilities?: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
/** Why a live layer's skip is not one the summary accepts, or nothing when it is. */
|
|
29
|
+
export declare function unacceptedSkip(reason: string, capabilities?: readonly string[]): string | undefined;
|
|
30
|
+
/** How to judge the merged matrix. */
|
|
31
|
+
export interface SummaryJudgement {
|
|
32
|
+
/**
|
|
33
|
+
* Every expected project must have run all its tests: a missing one, one that only a filtered
|
|
34
|
+
* run covered, and each missing cell, is a problem rather than a partial run. For CI, whose
|
|
35
|
+
* parity job merges one partial matrix per job: a job that never reported is a hole, not a
|
|
36
|
+
* subset someone chose. `writeSummary` defaults it to whether `CI` is set.
|
|
37
|
+
*/
|
|
38
|
+
requireComplete?: boolean | undefined;
|
|
39
|
+
/** The engine the browser projects ran in; Chromium by default. The Markdown names another. */
|
|
40
|
+
browser?: BrowserEngine | undefined;
|
|
41
|
+
}
|
|
42
|
+
/** Options for {@link writeSummary}. */
|
|
43
|
+
export interface SummaryOptions extends SummaryJudgement {
|
|
44
|
+
reportsDir: string;
|
|
45
|
+
expected: SummaryExpectations;
|
|
46
|
+
/** `$GITHUB_STEP_SUMMARY`: the Markdown is appended there too. */
|
|
47
|
+
stepSummary?: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Only the partial matrices of runs that ended at or after this time: a local `pnpm test`
|
|
50
|
+
* summarises its own run, not an earlier one's leftovers. None is an error: the run wrote no
|
|
51
|
+
* matrix.
|
|
52
|
+
*/
|
|
53
|
+
since?: Date | undefined;
|
|
54
|
+
}
|
|
55
|
+
/** What {@link writeSummary} produced. */
|
|
56
|
+
export interface SummaryResult {
|
|
57
|
+
matrix: MergedMatrix;
|
|
58
|
+
markdown: string;
|
|
59
|
+
/** Everything that makes the run not green; empty when it is. */
|
|
60
|
+
problems: string[];
|
|
61
|
+
/**
|
|
62
|
+
* Whether every expected project ran all its tests (in a run without a file, test-name or
|
|
63
|
+
* other filter, or in every shard of one), so completeness and stale quarantine entries were
|
|
64
|
+
* checked.
|
|
65
|
+
*/
|
|
66
|
+
complete: boolean;
|
|
67
|
+
}
|
|
68
|
+
/** Which expected projects the merged runs do not cover in full. */
|
|
69
|
+
export interface Coverage {
|
|
70
|
+
/** No run has records of them. */
|
|
71
|
+
missingProjects: readonly string[];
|
|
72
|
+
/** Only filtered runs ran them: project → why each such run was filtered. */
|
|
73
|
+
partialProjects: ReadonlyMap<string, readonly string[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Every shard ran them, and none collected a test of them. An unfiltered run fails on such a
|
|
76
|
+
* project itself; one shard cannot tell, as it may hold none of the project's files.
|
|
77
|
+
*/
|
|
78
|
+
emptyProjects: readonly string[];
|
|
79
|
+
}
|
|
80
|
+
/** Merges the partial matrices in `reportsDir`, writes the merged matrix and its Markdown. */
|
|
81
|
+
export declare function writeSummary(options: SummaryOptions): SummaryResult;
|
|
82
|
+
/**
|
|
83
|
+
* The merged matrix's file name, without its extension: `parity-matrix` for Chromium, and
|
|
84
|
+
* `parity-matrix.<engine>` for another engine (ADR-0066), which `isPartialMatrixFile` never
|
|
85
|
+
* reads back as a partial matrix.
|
|
86
|
+
*/
|
|
87
|
+
export declare function summaryName(browser: BrowserEngine): string;
|
|
88
|
+
/** Merges matrices, fills the layers that are not live, and lists the problems. Pure. */
|
|
89
|
+
export declare function summarise(partials: readonly PartialMatrix[], expected: SummaryExpectations, judgement?: SummaryJudgement): SummaryResult;
|
|
90
|
+
/** The matrix for people: where it came from, one table per case, then the problems. */
|
|
91
|
+
export declare function renderMarkdown(matrix: MergedMatrix, expected: SummaryExpectations, status: Coverage & {
|
|
92
|
+
problems: readonly string[];
|
|
93
|
+
requireComplete: boolean;
|
|
94
|
+
/** How many quarantine entries the newest run applied, which judged every record. */
|
|
95
|
+
quarantined: number;
|
|
96
|
+
/** The engine the browser projects ran in, when it is not Chromium. */
|
|
97
|
+
browser?: BrowserEngine | undefined;
|
|
98
|
+
}): string;
|
|
99
|
+
//#endregion
|