@unframework.dev/testing 0.2.0 → 0.2.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/dist/browser/axe.js +1 -2
- package/dist/browser/behaviour.js +1 -2
- package/dist/browser/capabilities.js +2 -3
- package/dist/browser/clock.d.ts +1 -3
- package/dist/browser/clock.js +1 -2
- package/dist/browser/console.d.ts +1 -3
- package/dist/browser/console.js +1 -2
- package/dist/browser/determinism.js +1 -2
- package/dist/browser/element-timeout.js +1 -2
- package/dist/browser/events.js +1 -2
- package/dist/browser/geometry.js +1 -2
- package/dist/browser/keys.js +1 -2
- package/dist/browser/matchers.d.ts +1 -3
- package/dist/browser/matchers.js +4 -5
- package/dist/browser/navigation.js +1 -2
- package/dist/browser/parity.d.ts +3 -5
- package/dist/browser/parity.js +3 -4
- package/dist/browser/spec.d.ts +2 -4
- package/dist/browser/spec.js +6 -7
- package/dist/browser/target.d.ts +1 -3
- package/dist/browser/target.js +1 -2
- package/dist/browser/text-runs.js +1 -2
- package/dist/browser/thrown.js +3 -4
- package/dist/browser/trace.d.ts +1 -3
- package/dist/browser/trace.js +0 -1
- package/dist/browser/user.d.ts +1 -3
- package/dist/browser/user.js +1 -2
- package/dist/browser/view.d.ts +2 -4
- package/dist/browser/view.js +8 -9
- package/dist/browser/visual.d.ts +2 -4
- package/dist/browser/visual.js +1 -2
- package/dist/cli.d.ts +1 -3
- package/dist/cli.js +1 -2
- package/dist/commands.d.ts +1 -3
- package/dist/config/broadcast.js +1 -2
- package/dist/config/cases.d.ts +1 -3
- package/dist/config/cases.js +1 -2
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.js +2 -3
- package/dist/config/project-vite.d.ts +1 -3
- package/dist/config/project-vite.js +1 -2
- package/dist/diff.d.ts +1 -3
- package/dist/diff.js +1 -2
- package/dist/dom/serialize.js +2 -3
- package/dist/errors.d.ts +1 -3
- package/dist/errors.js +1 -2
- package/dist/harness.d.ts +1 -3
- package/dist/harness.js +1 -2
- package/dist/index.d.ts +3 -5
- package/dist/index.js +1 -2
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +2 -2
- package/dist/layers.d.ts +1 -3
- package/dist/layers.js +1 -2
- package/dist/node/browser.d.ts +0 -2
- package/dist/node/browser.js +2 -3
- package/dist/node/commands.d.ts +2 -4
- package/dist/node/commands.js +1 -2
- package/dist/node/context.d.ts +1 -3
- package/dist/node/context.js +1 -2
- package/dist/node/events.d.ts +1 -3
- package/dist/node/events.js +1 -2
- package/dist/node/finished.d.ts +1 -3
- package/dist/node/finished.js +1 -2
- package/dist/node/index.d.ts +10 -10
- package/dist/node/index.js +11 -11
- package/dist/node/matrix.d.ts +2 -4
- package/dist/node/matrix.js +1 -2
- package/dist/node/mode.d.ts +2 -4
- package/dist/node/mode.js +1 -2
- package/dist/node/names.d.ts +1 -3
- package/dist/node/names.js +1 -2
- package/dist/node/policy.d.ts +1 -3
- package/dist/node/policy.js +1 -2
- package/dist/node/reporter.d.ts +2 -3
- package/dist/node/reporter.js +2 -3
- package/dist/node/summary.d.ts +2 -4
- package/dist/node/summary.js +3 -4
- package/dist/node/thrown.js +1 -2
- package/dist/node/viewport.d.ts +1 -3
- package/dist/node/viewport.js +1 -2
- package/dist/node/visual.d.ts +1 -3
- package/dist/node/visual.js +2 -3
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/protocol.d.ts +1 -2
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/structs.d.ts +16 -3
- package/dist/node_modules/.pnpm/playwright-core@1.63.0/node_modules/playwright-core/types/types.d.ts +16 -2
- package/dist/normalize/display.js +1 -2
- package/dist/normalize/index.d.ts +1 -3
- package/dist/normalize/index.js +2 -3
- package/dist/normalize/pipeline.d.ts +1 -3
- package/dist/normalize/pipeline.js +2 -3
- package/dist/normalize/print.js +1 -2
- package/dist/normalize/rules/angular-hosts.js +1 -2
- package/dist/normalize/rules/aria-hosts.js +1 -2
- package/dist/normalize/rules/comments.js +1 -2
- package/dist/normalize/rules/control-values.js +1 -2
- package/dist/normalize/rules/engine-aliases.js +1 -2
- package/dist/normalize/rules/framework-attributes.js +1 -2
- package/dist/normalize/rules/generated-ids.js +1 -2
- package/dist/normalize/rules/ordering.js +1 -2
- package/dist/normalize/rules/qwik-styles.js +1 -2
- package/dist/normalize/rules/qwik-templates.js +1 -2
- package/dist/normalize/rules/values.js +1 -2
- package/dist/normalize/rules/whitespace.js +2 -3
- package/dist/normalize/style.js +1 -2
- package/dist/normalize/targets.d.ts +1 -3
- package/dist/normalize/targets.js +1 -2
- package/dist/normalize/tree.d.ts +1 -1
- package/dist/normalize/tree.js +1 -2
- package/dist/setup.js +8 -9
- package/dist/ssr/index.d.ts +0 -2
- package/dist/ssr/index.js +4 -5
- package/dist/ssr/spec.js +1 -2
- package/dist/targets/angular.js +1 -2
- package/dist/targets/astro.js +1 -2
- package/dist/targets/qwik.js +1 -2
- package/dist/targets/react.js +1 -2
- package/dist/targets/solid.js +1 -2
- package/dist/targets/svelte.js +1 -2
- package/dist/targets/vue.js +1 -2
- package/dist/visual-types.d.ts +1 -3
- package/dist/visual-types.js +1 -2
- package/package.json +14 -14
package/dist/browser/axe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axe from "axe-core";
|
|
2
|
-
|
|
2
|
+
// src/browser/axe.ts
|
|
3
3
|
/**
|
|
4
4
|
* axe runs on the mount container, so its page-level rules (one `<main>`, a level-one heading,
|
|
5
5
|
* a bypass block) do not apply: they need the whole page as their context. `region` (all
|
|
@@ -30,5 +30,4 @@ async function compareAxe(element, expected) {
|
|
|
30
30
|
missing: wanted.filter((id) => !actual.includes(id))
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
//#endregion
|
|
34
33
|
export { compareAxe };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { formatError } from "../errors.js";
|
|
2
2
|
import { LAYERS, LayerFailure, recordLayer } from "../layers.js";
|
|
3
3
|
import "vitest";
|
|
4
|
-
|
|
4
|
+
// src/browser/behaviour.ts
|
|
5
5
|
/** The error Vitest records for a test without assertions under `expect.requireAssertions`. */
|
|
6
6
|
const NO_ASSERTIONS = "expected any number of assertion, but got none";
|
|
7
7
|
/** The layer failures each test consumed with `expectLayerFailure`. */
|
|
@@ -55,5 +55,4 @@ function describeTestError(error) {
|
|
|
55
55
|
const name = error.name ?? "Error";
|
|
56
56
|
return `${name}: ${name === "VitestBrowserElementError" ? message.replace(PAGE_HTML, "") : message}`;
|
|
57
57
|
}
|
|
58
|
-
//#endregion
|
|
59
58
|
export { judgeTest };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { currentTarget } from "./target.js";
|
|
2
1
|
import { noOutputSkip, requiresSkip } from "../layers.js";
|
|
2
|
+
import { currentTarget } from "./target.js";
|
|
3
3
|
import { inject } from "vitest";
|
|
4
|
-
|
|
4
|
+
// src/browser/capabilities.ts
|
|
5
5
|
/** The target's capability matrix, as the project provides it. */
|
|
6
6
|
function capabilityCells() {
|
|
7
7
|
const cells = inject("ufCapabilities");
|
|
@@ -54,5 +54,4 @@ function assertInteractive(what, cells = capabilityCells(), target = currentTarg
|
|
|
54
54
|
if (cell.support !== "unsupported") return;
|
|
55
55
|
throw new Error(`${what}: ${target} runs no client code (${cell.reason}). A test that interacts or reads emitted events declares it: it(name, { requires: ["interactivity"] }, fn).`);
|
|
56
56
|
}
|
|
57
|
-
//#endregion
|
|
58
57
|
export { assertInteractive, capabilityCell, capabilityCells, noOutputReason, requiredSkip, standInCause };
|
package/dist/browser/clock.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/browser/clock.d.ts
|
|
2
1
|
/** The page's fake clock, as a view mounted with `{ clock: true }` advances it. */
|
|
3
2
|
export interface ViewClock {
|
|
4
3
|
/**
|
|
@@ -13,5 +12,4 @@ export interface ViewClock {
|
|
|
13
12
|
* throws for a view mounted without a clock, and on a target that runs no client code.
|
|
14
13
|
*/
|
|
15
14
|
tick(ms: number): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
15
|
+
}
|
package/dist/browser/clock.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { vi } from "vitest";
|
|
2
|
-
|
|
2
|
+
// src/browser/clock.ts
|
|
3
3
|
/** Whether a view of the current test has installed the clock. */
|
|
4
4
|
let installed = false;
|
|
5
5
|
/**
|
|
@@ -65,5 +65,4 @@ function checkTick(ms) {
|
|
|
65
65
|
if (typeof ms === "number" && Number.isSafeInteger(ms) && ms > 0) return;
|
|
66
66
|
throw new TypeError(`view.clock.tick: the time to advance is a positive whole number of milliseconds, not ${typeof ms === "number" ? String(ms) : typeof ms}.`);
|
|
67
67
|
}
|
|
68
|
-
//#endregion
|
|
69
68
|
export { advanceClock, checkTick, installClock, restoreClock };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/browser/console.d.ts
|
|
2
1
|
/** A captured console message. */
|
|
3
2
|
export interface ConsoleEntry {
|
|
4
3
|
level: "warn" | "error";
|
|
@@ -23,5 +22,4 @@ export declare function capturedConsole(): readonly ConsoleEntry[];
|
|
|
23
22
|
* Formats console arguments as the console prints them, including printf-style substitutions,
|
|
24
23
|
* which React uses (`console.error("…%s", name)`), so allowlist patterns match the real text.
|
|
25
24
|
*/
|
|
26
|
-
export declare function formatConsoleArgs(args: readonly unknown[]): string;
|
|
27
|
-
//#endregion
|
|
25
|
+
export declare function formatConsoleArgs(args: readonly unknown[]): string;
|
package/dist/browser/console.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/browser/console.ts
|
|
2
2
|
const entries = [];
|
|
3
3
|
const allowances = [];
|
|
4
4
|
let installed = false;
|
|
@@ -138,5 +138,4 @@ function safeJson(value) {
|
|
|
138
138
|
return Object.prototype.toString.call(value);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { allowConsole, beginSpecFileConsole, beginTestConsole, captureExternalConsole, capturedConsole, consoleMark, describeConsole, endSpecFileConsole, endTestConsole, excuseConsoleSince, formatConsoleArgs, installConsoleCapture, unexpectedConsole, watchConsoleErrors };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import regular from "@fontsource/inter/files/inter-latin-400-normal.woff2?url";
|
|
2
2
|
import bold from "@fontsource/inter/files/inter-latin-700-normal.woff2?url";
|
|
3
|
-
|
|
3
|
+
// src/browser/determinism.ts
|
|
4
4
|
/** The only family allowed to render text in a capture. No system has a font by this name. */
|
|
5
5
|
const FONT_FAMILY = "UF Test Sans";
|
|
6
6
|
/** The attribute that marks a mount root; the reset below gives it a tight, padded box. */
|
|
@@ -104,5 +104,4 @@ async function settleFrame(targetSettle) {
|
|
|
104
104
|
requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
//#endregion
|
|
108
107
|
export { COLOR_SCHEME_WAIT_MS, FONT_FAMILY, ROOT_ATTRIBUTE, checkEnvironment, installDeterminism, prepareSpecFile, settleFrame };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "vitest";
|
|
2
2
|
import { server } from "vitest/browser";
|
|
3
|
-
|
|
3
|
+
// src/browser/element-timeout.ts
|
|
4
4
|
// @vitest/browser 5.0.3). A locator that never matches would then hold its test for the whole
|
|
5
5
|
let bound = false;
|
|
6
6
|
/**
|
|
@@ -24,5 +24,4 @@ function boundElementTimeout() {
|
|
|
24
24
|
...options
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { boundElementTimeout };
|
package/dist/browser/events.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { renameGeneratedIds } from "../normalize/rules/generated-ids.js";
|
|
2
|
-
|
|
2
|
+
// src/browser/events.ts
|
|
3
3
|
/** A payload no trace can record, refused with the event's name and where in it the value was. */
|
|
4
4
|
var PayloadError = class extends Error {
|
|
5
5
|
name = "PayloadError";
|
|
@@ -64,5 +64,4 @@ function groupEvents(events) {
|
|
|
64
64
|
for (const { name, args } of events) groups.set(name, [...groups.get(name) ?? [], args]);
|
|
65
65
|
return Object.fromEntries([...groups.keys()].sort().map((name) => [name, groups.get(name)]));
|
|
66
66
|
}
|
|
67
|
-
//#endregion
|
|
68
67
|
export { PayloadError, copyPayload, groupEvents, renumberIds };
|
package/dist/browser/geometry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/browser/geometry.ts
|
|
2
2
|
/** The computed properties that explain how a box looks. Width and height come from the box. */
|
|
3
3
|
const GEOMETRY_STYLE_PROPERTIES = [
|
|
4
4
|
"display",
|
|
@@ -131,5 +131,4 @@ function flatten(parent) {
|
|
|
131
131
|
else if (child.nodeType === Node.TEXT_NODE || child instanceof Element) out.push(child);
|
|
132
132
|
return out;
|
|
133
133
|
}
|
|
134
|
-
//#endregion
|
|
135
134
|
export { GEOMETRY_STYLE_PROPERTIES, captureGeometry };
|
package/dist/browser/keys.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/browser/keys.ts
|
|
2
2
|
/** The syntax, for the refusals. */
|
|
3
3
|
const SYNTAX = "a character types itself, {Enter} presses and releases a key as Playwright names it ({Escape}, {ArrowDown}, {Backspace}), {Shift>} holds it and {/Shift} releases it, and {{ and [[ type a brace and a bracket";
|
|
4
4
|
/**
|
|
@@ -58,5 +58,4 @@ function isCharacter(key) {
|
|
|
58
58
|
function characters(text) {
|
|
59
59
|
return Array.from(text);
|
|
60
60
|
}
|
|
61
|
-
//#endregion
|
|
62
61
|
export { isCharacter, parseKeys };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "../commands.js";
|
|
2
|
-
//#region src/browser/matchers.d.ts
|
|
3
2
|
/** Options for `toHaveNoAxeViolations`. */
|
|
4
3
|
export interface NoAxeViolationsOptions {
|
|
5
4
|
/**
|
|
@@ -35,5 +34,4 @@ declare module "vitest" {
|
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
/** Registers the matchers. The setup file calls it once, before any spec runs. */
|
|
38
|
-
export declare function installMatchers(): void;
|
|
39
|
-
//#endregion
|
|
37
|
+
export declare function installMatchers(): void;
|
package/dist/browser/matchers.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { diffLines } from "../diff.js";
|
|
2
|
-
import { currentTarget } from "./target.js";
|
|
3
|
-
import { renameGeneratedIds } from "../normalize/rules/generated-ids.js";
|
|
4
|
-
import { isNormalizeTarget } from "../normalize/targets.js";
|
|
5
2
|
import { normalizeDomWithIds } from "../dom/serialize.js";
|
|
6
3
|
import { inlineHosts } from "../normalize/rules/aria-hosts.js";
|
|
4
|
+
import { renameGeneratedIds } from "../normalize/rules/generated-ids.js";
|
|
5
|
+
import { isNormalizeTarget } from "../normalize/targets.js";
|
|
7
6
|
import { compareAxe } from "./axe.js";
|
|
7
|
+
import { currentTarget } from "./target.js";
|
|
8
8
|
import { expect } from "vitest";
|
|
9
9
|
import { commands, page } from "vitest/browser";
|
|
10
|
-
|
|
10
|
+
// src/browser/matchers.ts
|
|
11
11
|
/** Registers the matchers. The setup file calls it once, before any spec runs. */
|
|
12
12
|
function installMatchers() {
|
|
13
13
|
expect.extend({
|
|
@@ -74,5 +74,4 @@ function asTree(text) {
|
|
|
74
74
|
const indent = Math.min(...lines.filter(Boolean).map((line) => line.length - line.trimStart().length));
|
|
75
75
|
return lines.map((line) => line.slice(Number.isFinite(indent) ? indent : 0)).join("\n");
|
|
76
76
|
}
|
|
77
|
-
//#endregion
|
|
78
77
|
export { installMatchers };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/browser/navigation.ts
|
|
2
2
|
/** What the guard prevented since a test last took the list. */
|
|
3
3
|
const prevented = [];
|
|
4
4
|
let installed = false;
|
|
@@ -34,5 +34,4 @@ function describe(target) {
|
|
|
34
34
|
const name = target.getAttribute("id") ?? target.getAttribute("name");
|
|
35
35
|
return `<${target.localName}${name ? ` "${name}"` : ""}>`;
|
|
36
36
|
}
|
|
37
|
-
//#endregion
|
|
38
37
|
export { installNavigationGuard, takePreventedNavigations };
|
package/dist/browser/parity.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { PixelTolerance } from "../visual-types.js";
|
|
2
1
|
import "../commands.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { PixelTolerance } from "../visual-types.js";
|
|
3
|
+
import "vitest/browser";
|
|
5
4
|
/** Options for `expectParity`. */
|
|
6
5
|
export interface ParityOptions {
|
|
7
6
|
/** A pixel tolerance for this scenario. Zero by default; any tolerance needs a reason. */
|
|
8
7
|
tolerance?: PixelTolerance;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
8
|
+
}
|
package/dist/browser/parity.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { caseOfFile } from "../harness.js";
|
|
2
|
-
import { KEBAB_CASE } from "../node/names.js";
|
|
3
|
-
import { LIVE_REFERENCE_SKIP, referenceNotRunSkip } from "../visual-types.js";
|
|
4
2
|
import { NO_INTERACTION_SKIP, recordLayerChecks, recordScenario } from "../layers.js";
|
|
3
|
+
import { KEBAB_CASE } from "../node/names.js";
|
|
5
4
|
import { renameGeneratedIds } from "../normalize/rules/generated-ids.js";
|
|
5
|
+
import { LIVE_REFERENCE_SKIP, referenceNotRunSkip } from "../visual-types.js";
|
|
6
6
|
import { compareAxe } from "./axe.js";
|
|
7
7
|
import { traceFile } from "./trace.js";
|
|
8
8
|
import { captureVisual } from "./visual.js";
|
|
9
9
|
import { TestRunner, inject } from "vitest";
|
|
10
10
|
import { commands } from "vitest/browser";
|
|
11
|
-
|
|
11
|
+
// src/browser/parity.ts
|
|
12
12
|
/** The scenarios each spec file has checked, by file: a name names one scenario of a case. */
|
|
13
13
|
const checked = /* @__PURE__ */ new Map();
|
|
14
14
|
/**
|
|
@@ -89,5 +89,4 @@ async function expectParity(view, name, options = {}) {
|
|
|
89
89
|
function asFile(text) {
|
|
90
90
|
return `${text.replace(/\n+$/, "")}\n`;
|
|
91
91
|
}
|
|
92
|
-
//#endregion
|
|
93
92
|
export { expectParity };
|
package/dist/browser/spec.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TestFunction, TestOptions } from "vitest";
|
|
2
2
|
import { CapabilityName } from "@unframework.dev/codegen";
|
|
3
|
-
//#region src/browser/spec.d.ts
|
|
4
3
|
/** The options of Vitest's that a corpus test may not set. */
|
|
5
4
|
declare const REFUSED: readonly ["skip", "only", "todo", "fails", "retry", "repeats", "concurrent", "tags"];
|
|
6
5
|
/** A corpus test's options: Vitest's (a timeout, metadata), and the capabilities it requires. */
|
|
@@ -18,8 +17,7 @@ export interface SpecTest {
|
|
|
18
17
|
(name: string, options: SpecOptions, fn: TestFunction): void;
|
|
19
18
|
}
|
|
20
19
|
/** Declares a corpus test, with the capabilities it requires (see {@link SpecOptions}). */
|
|
21
|
-
declare const it
|
|
20
|
+
export declare const it: SpecTest;
|
|
22
21
|
/** {@link it}, by its other name. */
|
|
23
22
|
export declare const test: SpecTest;
|
|
24
|
-
|
|
25
|
-
export { it$1 as it };
|
|
23
|
+
export {};
|
package/dist/browser/spec.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { capabilityCell } from "./capabilities.js";
|
|
2
|
-
import { it } from "vitest";
|
|
3
|
-
|
|
2
|
+
import { it as it$1 } from "vitest";
|
|
3
|
+
// src/browser/spec.ts
|
|
4
4
|
/** The options of Vitest's that a corpus test may not set. */
|
|
5
5
|
const REFUSED = [
|
|
6
6
|
"skip",
|
|
@@ -13,7 +13,7 @@ const REFUSED = [
|
|
|
13
13
|
"tags"
|
|
14
14
|
];
|
|
15
15
|
/** Declares a corpus test, with the capabilities it requires (see {@link SpecOptions}). */
|
|
16
|
-
const it
|
|
16
|
+
const it = (name, optionsOrFn, maybeFn) => {
|
|
17
17
|
const options = typeof optionsOrFn === "function" ? {} : optionsOrFn;
|
|
18
18
|
const fn = typeof optionsOrFn === "function" ? optionsOrFn : maybeFn;
|
|
19
19
|
if (!fn) throw new TypeError(`it("${name}"): a test needs a function.`);
|
|
@@ -24,7 +24,7 @@ const it$1 = (name, optionsOrFn, maybeFn) => {
|
|
|
24
24
|
if (!Array.isArray(requires) || !requires.length) throw new TypeError(`it("${name}"): requires names one or more capabilities.`);
|
|
25
25
|
for (const capability of requires) capabilityCell(capability);
|
|
26
26
|
}
|
|
27
|
-
it(name, {
|
|
27
|
+
it$1(name, {
|
|
28
28
|
...rest,
|
|
29
29
|
meta: {
|
|
30
30
|
...meta,
|
|
@@ -33,6 +33,5 @@ const it$1 = (name, optionsOrFn, maybeFn) => {
|
|
|
33
33
|
}, fn);
|
|
34
34
|
};
|
|
35
35
|
/** {@link it}, by its other name. */
|
|
36
|
-
const test = it
|
|
37
|
-
|
|
38
|
-
export { it$1 as it, test };
|
|
36
|
+
const test = it;
|
|
37
|
+
export { it, test };
|
package/dist/browser/target.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MountAdapter, MountEvent } from "@unframework.dev/codegen";
|
|
2
|
-
//#region src/browser/target.d.ts
|
|
3
2
|
/** What a registration may add to its adapter. */
|
|
4
3
|
export interface TargetOptions {
|
|
5
4
|
/**
|
|
@@ -12,5 +11,4 @@ export interface TargetOptions {
|
|
|
12
11
|
/** Registers the project's mount adapter. One adapter per project: a second target is a bug. */
|
|
13
12
|
export declare function registerTarget(target: string, mount: MountAdapter, options?: TargetOptions): void;
|
|
14
13
|
/** The target this project verifies (`test.provide.target`). */
|
|
15
|
-
export declare function currentTarget(): string;
|
|
16
|
-
//#endregion
|
|
14
|
+
export declare function currentTarget(): string;
|
package/dist/browser/target.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inject } from "vitest";
|
|
2
|
-
|
|
2
|
+
// src/browser/target.ts
|
|
3
3
|
let registration;
|
|
4
4
|
/** Registers the project's mount adapter. One adapter per project: a second target is a bug. */
|
|
5
5
|
function registerTarget(target, mount, options = {}) {
|
|
@@ -23,5 +23,4 @@ function registeredAdapter() {
|
|
|
23
23
|
if (registration.target !== target) throw new Error(`The registered adapter is for "${registration.target}", but this project verifies "${target}".`);
|
|
24
24
|
return registration;
|
|
25
25
|
}
|
|
26
|
-
//#endregion
|
|
27
26
|
export { currentTarget, registerTarget, registeredAdapter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/browser/text-runs.ts
|
|
2
2
|
/** Elements whose text is not laid out as text: raw text, and a form control's value. */
|
|
3
3
|
const SKIPPED = /* @__PURE__ */ new Set([
|
|
4
4
|
"script",
|
|
@@ -64,5 +64,4 @@ function runFrom(first) {
|
|
|
64
64
|
function textOf(node) {
|
|
65
65
|
return node instanceof Text ? node.data : "";
|
|
66
66
|
}
|
|
67
|
-
//#endregion
|
|
68
67
|
export { mergeTextRuns, withMergedTextRuns };
|
package/dist/browser/thrown.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { caseOfFile } from "../harness.js";
|
|
2
|
-
import { currentTarget } from "./target.js";
|
|
3
|
-
import { consoleMark, excuseConsoleSince, watchConsoleErrors } from "./console.js";
|
|
4
2
|
import { recordLayer } from "../layers.js";
|
|
3
|
+
import { consoleMark, excuseConsoleSince, watchConsoleErrors } from "./console.js";
|
|
4
|
+
import { currentTarget } from "./target.js";
|
|
5
5
|
import { TestRunner, expect, inject } from "vitest";
|
|
6
6
|
import { commands } from "vitest/browser";
|
|
7
|
-
|
|
7
|
+
// src/browser/thrown.ts
|
|
8
8
|
/** Why the messages of the throwing step are excused from L13: the step throws on purpose. */
|
|
9
9
|
const EXCUSE = "the step throws on purpose, and each framework reports that in its own words";
|
|
10
10
|
/** The rounds of waiting for an error a framework rethrows in a task of its own. */
|
|
@@ -67,5 +67,4 @@ async function problem(caseId, error) {
|
|
|
67
67
|
});
|
|
68
68
|
return message;
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
export { expectThrown };
|
package/dist/browser/trace.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/browser/trace.d.ts
|
|
2
1
|
/** One scripted step, after it settled. */
|
|
3
2
|
export interface TraceStep {
|
|
4
3
|
/**
|
|
@@ -17,5 +16,4 @@ export interface TraceStep {
|
|
|
17
16
|
* one run triggers is not part of the contract, ADR-0050).
|
|
18
17
|
*/
|
|
19
18
|
events: Record<string, unknown[][]>;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
19
|
+
}
|
package/dist/browser/trace.js
CHANGED
package/dist/browser/user.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "../commands.js";
|
|
2
2
|
import { Locator, UserEventWheelOptions } from "vitest/browser";
|
|
3
|
-
//#region src/browser/user.d.ts
|
|
4
3
|
/** Where a click presses: a point from the element's top left corner, its centre by default. */
|
|
5
4
|
export interface ClickOptions {
|
|
6
5
|
position?: {
|
|
@@ -41,5 +40,4 @@ export interface ViewUser {
|
|
|
41
40
|
selectOptions(target: Locator, values: string | readonly string[]): Promise<void>;
|
|
42
41
|
/** Moves the mouse onto the element, then turns the wheel, a step at a time. */
|
|
43
42
|
wheel(target: Locator, options: UserEventWheelOptions): Promise<void>;
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
43
|
+
}
|
package/dist/browser/user.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assertInteractive } from "./capabilities.js";
|
|
2
2
|
import { isCharacter, parseKeys } from "./keys.js";
|
|
3
3
|
import { commands, userEvent } from "vitest/browser";
|
|
4
|
-
|
|
4
|
+
// src/browser/user.ts
|
|
5
5
|
/**
|
|
6
6
|
* The keys held down, across actions, as the page's keyboard holds them: `{Shift>}` adds one,
|
|
7
7
|
* `{/Shift}` removes it. The page is one per test file, so this is too.
|
|
@@ -180,5 +180,4 @@ function underRoot(testId, target, kind) {
|
|
|
180
180
|
function nonEmpty(options) {
|
|
181
181
|
return options && Object.keys(options).length ? options : void 0;
|
|
182
182
|
}
|
|
183
|
-
//#endregion
|
|
184
183
|
export { createUser, releaseKeys };
|
package/dist/browser/view.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "../commands.js";
|
|
2
|
-
import { ParityOptions } from "./parity.js";
|
|
3
2
|
import { ViewClock } from "./clock.js";
|
|
3
|
+
import { ParityOptions } from "./parity.js";
|
|
4
4
|
import { ViewUser } from "./user.js";
|
|
5
5
|
import { Locator } from "vitest/browser";
|
|
6
6
|
import { MountOptions } from "@unframework.dev/codegen";
|
|
7
|
-
//#region src/browser/view.d.ts
|
|
8
7
|
/** Props as an adapter takes them. */
|
|
9
8
|
export type Props = Readonly<Record<string, unknown>>;
|
|
10
9
|
/** A mounted component. Queries are scoped to its container. */
|
|
@@ -110,5 +109,4 @@ export declare function mountScenario<P>(component: (props: P) => unknown, name:
|
|
|
110
109
|
/** Mounts what is not a function component, such as a test stub, with a scenario's props. */
|
|
111
110
|
export declare function mountScenario<C extends object>(component: NotAFunction<C>, name: string, options?: ViewOptions): Promise<View>;
|
|
112
111
|
/** Unmounts every view the current test left mounted, newest first. */
|
|
113
|
-
export declare function cleanup(): Promise<void>;
|
|
114
|
-
//#endregion
|
|
112
|
+
export declare function cleanup(): Promise<void>;
|
package/dist/browser/view.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { registeredAdapter } from "./target.js";
|
|
3
|
-
import { captureExternalConsole } from "./console.js";
|
|
1
|
+
import { normalizeDomWithIds } from "../dom/serialize.js";
|
|
4
2
|
import { formatError } from "../errors.js";
|
|
3
|
+
import { caseOfFile } from "../harness.js";
|
|
5
4
|
import { recordLayer } from "../layers.js";
|
|
6
|
-
import { assertInteractive } from "./capabilities.js";
|
|
7
|
-
import { isNormalizeTarget } from "../normalize/targets.js";
|
|
8
|
-
import { normalizeDomWithIds } from "../dom/serialize.js";
|
|
9
5
|
import { inlineHosts } from "../normalize/rules/aria-hosts.js";
|
|
6
|
+
import { isNormalizeTarget } from "../normalize/targets.js";
|
|
7
|
+
import { assertInteractive } from "./capabilities.js";
|
|
10
8
|
import { advanceClock, checkTick, installClock } from "./clock.js";
|
|
9
|
+
import { captureExternalConsole } from "./console.js";
|
|
11
10
|
import { ROOT_ATTRIBUTE, installDeterminism, settleFrame } from "./determinism.js";
|
|
12
11
|
import { copyPayload, renumberIds } from "./events.js";
|
|
13
12
|
import { takePreventedNavigations } from "./navigation.js";
|
|
14
|
-
import { Trace } from "./trace.js";
|
|
15
13
|
import { expectParity } from "./parity.js";
|
|
14
|
+
import { registeredAdapter } from "./target.js";
|
|
16
15
|
import { expectThrown } from "./thrown.js";
|
|
16
|
+
import { Trace } from "./trace.js";
|
|
17
17
|
import { createUser } from "./user.js";
|
|
18
18
|
import { TestRunner, inject } from "vitest";
|
|
19
19
|
import { commands, page } from "vitest/browser";
|
|
20
|
-
|
|
20
|
+
// src/browser/view.ts
|
|
21
21
|
/** The rounds of settling after an action before the page counts as never quiet. */
|
|
22
22
|
const SETTLE_ROUNDS = 10;
|
|
23
23
|
const mounted = /* @__PURE__ */ new Set();
|
|
@@ -278,5 +278,4 @@ async function cleanup() {
|
|
|
278
278
|
if (errors.length === 1) throw errors[0];
|
|
279
279
|
if (errors.length) throw new AggregateError(errors, `${errors.length} views failed to unmount.`);
|
|
280
280
|
}
|
|
281
|
-
//#endregion
|
|
282
281
|
export { cleanup, mount, mountScenario };
|
package/dist/browser/visual.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { CaptureRequest, CaptureResult, PixelTolerance } from "../visual-types.js";
|
|
2
1
|
import "../commands.js";
|
|
2
|
+
import { CaptureRequest, CaptureResult, PixelTolerance } from "../visual-types.js";
|
|
3
3
|
import { RunnerTestCase } from "vitest";
|
|
4
4
|
import { Locator } from "vitest/browser";
|
|
5
|
-
//#region src/browser/visual.d.ts
|
|
6
5
|
/** Sends a capture to Node: `ufVisualCapture` for a case, or another package's own command. */
|
|
7
6
|
export type CaptureCommand = (request: CaptureRequest) => Promise<CaptureResult>;
|
|
8
7
|
/**
|
|
@@ -16,5 +15,4 @@ export declare function captureVisual(test: RunnerTestCase, input: {
|
|
|
16
15
|
container: HTMLElement;
|
|
17
16
|
locator: Locator;
|
|
18
17
|
tolerance?: PixelTolerance;
|
|
19
|
-
}, send?: CaptureCommand): Promise<CaptureResult>;
|
|
20
|
-
//#endregion
|
|
18
|
+
}, send?: CaptureCommand): Promise<CaptureResult>;
|
package/dist/browser/visual.js
CHANGED
|
@@ -2,7 +2,7 @@ import { captureGeometry } from "./geometry.js";
|
|
|
2
2
|
import { withMergedTextRuns } from "./text-runs.js";
|
|
3
3
|
import { recordArtifact } from "vitest";
|
|
4
4
|
import { commands } from "vitest/browser";
|
|
5
|
-
|
|
5
|
+
// src/browser/visual.ts
|
|
6
6
|
let markers = 0;
|
|
7
7
|
/**
|
|
8
8
|
* Captures a settled container and compares it under the run's policy. `send` is the command
|
|
@@ -32,5 +32,4 @@ async function captureVisual(test, input, send = (request) => commands.ufVisualC
|
|
|
32
32
|
input.container.removeAttribute("data-uf-capture");
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
//#endregion
|
|
36
35
|
export { captureVisual };
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cli.d.ts
|
|
2
1
|
/** Where the command runs and writes: the shape of `@unframework.dev/cli`'s `Io`. */
|
|
3
2
|
export interface TestIo {
|
|
4
3
|
cwd: string;
|
|
@@ -19,5 +18,4 @@ export declare function parseTestArguments(args: readonly string[]): TestArgumen
|
|
|
19
18
|
* usage or configuration error, which it reports, as the CLI's other commands do (ADR-0076).
|
|
20
19
|
* Vitest's own options (`--reporter`, a file filter) follow `--`.
|
|
21
20
|
*/
|
|
22
|
-
export declare function run(args: string[], io: TestIo): Promise<number>;
|
|
23
|
-
//#endregion
|
|
21
|
+
export declare function run(args: string[], io: TestIo): Promise<number>;
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync } from "node:fs";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { TARGET_NAMES } from "@unframework.dev/compiler";
|
|
5
5
|
import { parseCLI, startVitest } from "vitest/node";
|
|
6
|
-
|
|
6
|
+
// src/cli.ts
|
|
7
7
|
/** The files a project's own Vitest configuration may have, the first one found winning. */
|
|
8
8
|
const VITEST_CONFIGS = [
|
|
9
9
|
"vitest.config.ts",
|
|
@@ -86,5 +86,4 @@ function restore(name, value) {
|
|
|
86
86
|
if (value === void 0) delete process.env[name];
|
|
87
87
|
else process.env[name] = value;
|
|
88
88
|
}
|
|
89
|
-
//#endregion
|
|
90
89
|
export { parseTestArguments, run };
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ColorScheme } from "./harness.js";
|
|
2
2
|
import { CaptureRequest, CaptureResult } from "./visual-types.js";
|
|
3
3
|
import { MountEvent } from "@unframework.dev/codegen";
|
|
4
|
-
//#region src/commands.d.ts
|
|
5
4
|
/** A shared expectation the browser computed, to settle under the write policy (ADR-0029). */
|
|
6
5
|
export interface ArtefactRequest {
|
|
7
6
|
case: string;
|
|
@@ -103,5 +102,4 @@ declare module "vitest/browser" {
|
|
|
103
102
|
/** Maps a thrown error's stack through the project's module graph and checks its top frame. */
|
|
104
103
|
ufMapStack: (request: MapStackRequest) => Promise<MapStackResult>;
|
|
105
104
|
}
|
|
106
|
-
}
|
|
107
|
-
//#endregion
|
|
105
|
+
}
|
package/dist/config/broadcast.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/config/broadcast.ts
|
|
2
2
|
/** The plugin's name, which a test finds it by. */
|
|
3
3
|
const NO_ERROR_BROADCAST = "uf-testing:no-error-broadcast";
|
|
4
4
|
/**
|
|
@@ -25,5 +25,4 @@ function noErrorBroadcast() {
|
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { NO_ERROR_BROADCAST, noErrorBroadcast };
|
package/dist/config/cases.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CaseConfig } from "../harness.js";
|
|
2
|
-
//#region src/config/cases.d.ts
|
|
3
2
|
/** One case of a project. */
|
|
4
3
|
export interface ProjectCase {
|
|
5
4
|
/** The directory relative to the project's root, with forward slashes. */
|
|
@@ -24,5 +23,4 @@ export interface DiscoverOptions {
|
|
|
24
23
|
* files, a case with no main source, a test file at the root itself and a malformed `case.json`:
|
|
25
24
|
* a case that cannot be told apart would have nowhere to go in the run.
|
|
26
25
|
*/
|
|
27
|
-
export declare function discoverCases(options: DiscoverOptions): ProjectCase[];
|
|
28
|
-
//#endregion
|
|
26
|
+
export declare function discoverCases(options: DiscoverOptions): ProjectCase[];
|
package/dist/config/cases.js
CHANGED
|
@@ -3,7 +3,7 @@ import { KEBAB_CASE } from "../node/names.js";
|
|
|
3
3
|
import { existsSync, globSync, readFileSync, readdirSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { TARGET_NAMES } from "@unframework.dev/compiler";
|
|
6
|
-
|
|
6
|
+
// src/config/cases.ts
|
|
7
7
|
/** What a test file never lies in: installed packages and build output. */
|
|
8
8
|
const EXCLUDED = ["**/node_modules/**", "**/dist/**"];
|
|
9
9
|
/** The keys of a project's `case.json`: the public ones (ADR-0085). */
|
|
@@ -90,5 +90,4 @@ function readCaseConfig(id, file) {
|
|
|
90
90
|
if (problems.length) throw new Error(`[uf] Case ${id}: case.json has ${problems.join("; ")}.`);
|
|
91
91
|
return record;
|
|
92
92
|
}
|
|
93
|
-
//#endregion
|
|
94
93
|
export { EXCLUDED, discoverCases, readCaseConfig };
|
package/dist/config/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { OWNED_KEYS, OWNED_SERVER_KEYS, PASS_THROUGH_DECLARATIONS, ProjectPlugin
|
|
|
4
4
|
import { TargetName } from "@unframework.dev/compiler";
|
|
5
5
|
import { ViteUserConfig } from "vitest/config";
|
|
6
6
|
import { Toolchain } from "@unframework.dev/codegen";
|
|
7
|
-
//#region src/config/index.d.ts
|
|
8
7
|
/** The options of {@link defineTestConfig}. */
|
|
9
8
|
export interface TestConfigOptions {
|
|
10
9
|
/** The targets to test: `unframework.config.ts`'s `targets` by default. */
|
|
@@ -78,5 +77,4 @@ export declare function loadToolchain(target: TargetName): Promise<Toolchain>;
|
|
|
78
77
|
* path, since the project need not install the target package (pnpm keeps it out of reach).
|
|
79
78
|
*/
|
|
80
79
|
export declare function toolchainClientFile(toolchain: Toolchain): string;
|
|
81
|
-
//#endregion
|
|
82
80
|
export { type DiscoverOptions, OWNED_KEYS, OWNED_SERVER_KEYS, PASS_THROUGH_DECLARATIONS, type ProjectCase, type ProjectPlugins, type ProjectVite, discoverCases, passThroughDeclarations, projectPlugins, withProjectVite };
|
package/dist/config/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { caseReferences } from "../harness.js";
|
|
2
|
+
import { parityBrowser } from "../node/browser.js";
|
|
2
3
|
import { recordCompiledModule } from "../node/events.js";
|
|
3
4
|
import { createHarnessRun, groupOrder, resolveHarnessMode } from "../node/mode.js";
|
|
4
|
-
import { parityBrowser } from "../node/browser.js";
|
|
5
5
|
import { ufMapStack } from "../node/thrown.js";
|
|
6
6
|
import { noErrorBroadcast } from "./broadcast.js";
|
|
7
7
|
import { EXCLUDED, discoverCases } from "./cases.js";
|
|
@@ -11,7 +11,7 @@ import { join, resolve } from "node:path";
|
|
|
11
11
|
import { TARGET_NAMES, builtinTargets, loadConfig, resolveConfig } from "@unframework.dev/compiler";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
import { mergeConfig } from "vitest/config";
|
|
14
|
-
|
|
14
|
+
// src/config/index.ts
|
|
15
15
|
/** The test files a project's run finds by default. */
|
|
16
16
|
const DEFAULT_INCLUDE = ["**/*.test.ts"];
|
|
17
17
|
/**
|
|
@@ -291,5 +291,4 @@ async function ssrProject(setup, target) {
|
|
|
291
291
|
})
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
|
-
//#endregion
|
|
295
294
|
export { DEFAULT_INCLUDE, OWNED_KEYS, OWNED_SERVER_KEYS, PASS_THROUGH_DECLARATIONS, TARGET_PACKAGES, TESTING_PACKAGE, defineTestConfig, discoverCases, loadToolchain, passThroughDeclarations, projectPlugins, runTargets, selectedTargets, toolchainClientFile, toolchainDirOf, withProjectVite };
|