@polyengine/ct-runner 0.1.0-pre.g633468a → 0.2.0-pre.g20030fc
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 +1 -1
- package/esm/context.js +12 -1
- package/esm/run-suite.js +7 -1
- package/esm/tags.js +31 -5
- package/package.json +2 -8
- package/types/context.d.ts +12 -1
- package/types/run-suite.d.ts +7 -1
- package/types/tags.d.ts +38 -6
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install @polyengine/ct-runner
|
|
|
15
15
|
import * as api from "@polyengine/ct-runner";
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Entry points: `.`, `./
|
|
18
|
+
Entry points: `.`, `./imports`, `./run`.
|
|
19
19
|
|
|
20
20
|
ESM only, Node >= 22.14. Documentation, examples and the embedder API contract
|
|
21
21
|
live in the [repository](https://github.com/polymorph-components/polyengine).
|
package/esm/context.js
CHANGED
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
// context-provider component, reimplemented host-side rather than composed in
|
|
12
12
|
// as wasm — permitted as long as it stays behaviorally equivalent to the
|
|
13
13
|
// layered path. It must never grow beyond what `test-context` names.
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The frozen L1 interface id `test-context` is provided under.
|
|
16
|
+
*
|
|
17
|
+
* @internal — test-only export; wired automatically by `runSuite()`, which
|
|
18
|
+
* is the public entry point. No caller supplies or overrides this key.
|
|
19
|
+
*/
|
|
15
20
|
export const TEST_CONTEXT_INTERFACE = "polymorph:test/test-context@0.1.0";
|
|
16
21
|
/**
|
|
17
22
|
* One case's diagnostic sink. Host-side: no reps, no side tables — see
|
|
@@ -21,6 +26,9 @@ export const TEST_CONTEXT_INTERFACE = "polymorph:test/test-context@0.1.0";
|
|
|
21
26
|
* in-process host implementation never blocks (no backpressure to model),
|
|
22
27
|
* so it resolves immediately — still a valid `async func` implementation
|
|
23
28
|
* (contracts/embedder-api.md: "sync implementations remain legal").
|
|
29
|
+
*
|
|
30
|
+
* @internal — constructed only by `runSuite()`'s internal wiring; no
|
|
31
|
+
* `RunSuiteOptions` field accepts or overrides a `Context` instance.
|
|
24
32
|
*/
|
|
25
33
|
export class Context {
|
|
26
34
|
#onDiagnostic;
|
|
@@ -42,6 +50,9 @@ export class Context {
|
|
|
42
50
|
* cases run against that instance; the runner never asks the guest to
|
|
43
51
|
* construct a `context` (the WIT resource has no constructor — the host
|
|
44
52
|
* always initiates the borrow itself when calling `run`).
|
|
53
|
+
*
|
|
54
|
+
* @internal — called only by `runSuite()`'s internal import-merging; the
|
|
55
|
+
* public entry point is `runSuite()` itself.
|
|
45
56
|
*/
|
|
46
57
|
export function testContextImportRecord() {
|
|
47
58
|
return { [TEST_CONTEXT_INTERFACE]: { Context } };
|
package/esm/run-suite.js
CHANGED
|
@@ -14,7 +14,13 @@ import { instantiate, Trap, ComponentException, } from "@polyengine/runtime/embe
|
|
|
14
14
|
import { Context, testContextImportRecord } from "./context.js";
|
|
15
15
|
import { requireImportsResolved } from "./import-analysis.js";
|
|
16
16
|
import { applies, firstExcluding, loadTagsInventory, tagsOf, } from "./tags.js";
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The suite's `tests` interface id (wit/tests.wit `interface tests`, v0.1.0).
|
|
19
|
+
*
|
|
20
|
+
* @internal — used only inside this module's export lookup; no importer
|
|
21
|
+
* (including this package's own tests) references it. The public entry
|
|
22
|
+
* point is `runSuite()`.
|
|
23
|
+
*/
|
|
18
24
|
export const TESTS_INTERFACE = "polymorph:test/tests@0.1.0";
|
|
19
25
|
/** `js/viewer/harness.mjs`'s `resolveTestsExport`, ported: the suite's
|
|
20
26
|
* `tests` interface from an instantiated component, whichever spelling the
|
package/esm/tags.js
CHANGED
|
@@ -20,7 +20,12 @@
|
|
|
20
20
|
// the JS-leg reference this mirrors.
|
|
21
21
|
// - Drift policy: harness.mjs `runCases` — an enumerated case that no
|
|
22
22
|
// record covers throws (the run is unsound, not failing).
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* The custom-section name (component-test-core `name::TAGS_SECTION`).
|
|
25
|
+
*
|
|
26
|
+
* @internal — test-only export; wired automatically by `runSuite()`'s tag
|
|
27
|
+
* scheduling, the public entry point.
|
|
28
|
+
*/
|
|
24
29
|
export const TAGS_SECTION = "component-test:tags@0.1";
|
|
25
30
|
const MAGIC = [0x00, 0x61, 0x73, 0x6d]; // "\0asm"
|
|
26
31
|
function hasWasmMagic(bytes, at = 0) {
|
|
@@ -49,6 +54,10 @@ function lebU32(bytes, pos) {
|
|
|
49
54
|
* core modules (section id 1) and nested components (section id 4), which
|
|
50
55
|
* both embed complete wasm binaries. Returns null when no section exists
|
|
51
56
|
* anywhere (a suite not built with their SDK).
|
|
57
|
+
*
|
|
58
|
+
* @internal — used only by `loadTagsInventory()` and this package's own
|
|
59
|
+
* tests; the public entry point is `runSuite()`, which schedules tag
|
|
60
|
+
* gating automatically.
|
|
52
61
|
*/
|
|
53
62
|
export function collectTagsSections(bytes) {
|
|
54
63
|
if (!hasWasmMagic(bytes))
|
|
@@ -106,6 +115,9 @@ export function collectTagsSections(bytes) {
|
|
|
106
115
|
* record per line, `name tag...`, blank lines skipped, duplicate names and
|
|
107
116
|
* empty tags rejected. Grammar validation beyond that (WIT-label checks)
|
|
108
117
|
* is the producer's job — their SDK validates at macro-expansion time.
|
|
118
|
+
*
|
|
119
|
+
* @internal — used only by `loadTagsInventory()` and this package's own
|
|
120
|
+
* tests; the public entry point is `runSuite()`.
|
|
109
121
|
*/
|
|
110
122
|
export function parseTagsRecords(bytes) {
|
|
111
123
|
const text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
@@ -136,13 +148,21 @@ export function parseTagsRecords(bytes) {
|
|
|
136
148
|
}
|
|
137
149
|
return inv;
|
|
138
150
|
}
|
|
139
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Convenience: scan + parse; null when the suite carries no inventory.
|
|
153
|
+
*
|
|
154
|
+
* @internal — used only by `run-suite.ts`'s automatic tag scheduling and
|
|
155
|
+
* this package's own tests; the public entry point is `runSuite()`.
|
|
156
|
+
*/
|
|
140
157
|
export function loadTagsInventory(bytes) {
|
|
141
158
|
const sections = collectTagsSections(bytes);
|
|
142
159
|
return sections === null ? null : parseTagsRecords(sections);
|
|
143
160
|
}
|
|
144
161
|
/** The tags covering `name`: exact record, else a generated-row prefix
|
|
145
|
-
* record (leaves live below `prefix/`), else undefined (inventory drift).
|
|
162
|
+
* record (leaves live below `prefix/`), else undefined (inventory drift).
|
|
163
|
+
*
|
|
164
|
+
* @internal — used only by `run-suite.ts`'s per-case scheduling and this
|
|
165
|
+
* package's own tests; the public entry point is `runSuite()`. */
|
|
146
166
|
export function tagsOf(inv, name) {
|
|
147
167
|
const exact = inv.exact.get(name);
|
|
148
168
|
if (exact !== undefined)
|
|
@@ -153,12 +173,18 @@ export function tagsOf(inv, name) {
|
|
|
153
173
|
}
|
|
154
174
|
return undefined;
|
|
155
175
|
}
|
|
156
|
-
/** harness.mjs `applies()`: `!f` needs f missing; `f` needs f present.
|
|
176
|
+
/** harness.mjs `applies()`: `!f` needs f missing; `f` needs f present.
|
|
177
|
+
*
|
|
178
|
+
* @internal — used only by `run-suite.ts`'s scheduling and this package's
|
|
179
|
+
* own tests; the public entry point is `runSuite()`. */
|
|
157
180
|
export function applies(tags, missing) {
|
|
158
181
|
return tags.every((t) => t.startsWith("!") ? missing.includes(t.slice(1)) : !missing.includes(t));
|
|
159
182
|
}
|
|
160
183
|
/** The N/A row's `detail`: the first unsatisfied mark (harness.mjs's
|
|
161
|
-
* `excluding`), empty string if somehow none (mirrors `excluding ?? ""`).
|
|
184
|
+
* `excluding`), empty string if somehow none (mirrors `excluding ?? ""`).
|
|
185
|
+
*
|
|
186
|
+
* @internal — used only by `run-suite.ts`'s scheduling and this package's
|
|
187
|
+
* own tests; the public entry point is `runSuite()`. */
|
|
162
188
|
export function firstExcluding(tags, missing) {
|
|
163
189
|
return tags.find((t) => t.startsWith("!") ? !missing.includes(t.slice(1)) : missing.includes(t)) ?? "";
|
|
164
190
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polyengine/ct-runner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-pre.g20030fc",
|
|
4
4
|
"description": "The polyengine execution runner for component-test-results (L1) conformance suites.",
|
|
5
5
|
"homepage": "https://github.com/polymorph-components/polyengine#readme",
|
|
6
6
|
"repository": {
|
|
@@ -20,12 +20,6 @@
|
|
|
20
20
|
"default": "./esm/mod.js"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
"./context": {
|
|
24
|
-
"import": {
|
|
25
|
-
"types": "./types/context.d.ts",
|
|
26
|
-
"default": "./esm/context.js"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
23
|
"./imports": {
|
|
30
24
|
"import": {
|
|
31
25
|
"types": "./types/import-analysis.d.ts",
|
|
@@ -49,7 +43,7 @@
|
|
|
49
43
|
"access": "public"
|
|
50
44
|
},
|
|
51
45
|
"dependencies": {
|
|
52
|
-
"@polyengine/runtime": "0.
|
|
46
|
+
"@polyengine/runtime": "0.2.0-pre.g20030fc"
|
|
53
47
|
},
|
|
54
48
|
"_generatedBy": "dnt@0.43.2"
|
|
55
49
|
}
|
package/types/context.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The frozen L1 interface id `test-context` is provided under.
|
|
3
|
+
*
|
|
4
|
+
* @internal — test-only export; wired automatically by `runSuite()`, which
|
|
5
|
+
* is the public entry point. No caller supplies or overrides this key.
|
|
6
|
+
*/
|
|
2
7
|
export declare const TEST_CONTEXT_INTERFACE = "polymorph:test/test-context@0.1.0";
|
|
3
8
|
/**
|
|
4
9
|
* One case's diagnostic sink. Host-side: no reps, no side tables — see
|
|
@@ -8,6 +13,9 @@ export declare const TEST_CONTEXT_INTERFACE = "polymorph:test/test-context@0.1.0
|
|
|
8
13
|
* in-process host implementation never blocks (no backpressure to model),
|
|
9
14
|
* so it resolves immediately — still a valid `async func` implementation
|
|
10
15
|
* (contracts/embedder-api.md: "sync implementations remain legal").
|
|
16
|
+
*
|
|
17
|
+
* @internal — constructed only by `runSuite()`'s internal wiring; no
|
|
18
|
+
* `RunSuiteOptions` field accepts or overrides a `Context` instance.
|
|
11
19
|
*/
|
|
12
20
|
export declare class Context {
|
|
13
21
|
#private;
|
|
@@ -24,5 +32,8 @@ export declare class Context {
|
|
|
24
32
|
* cases run against that instance; the runner never asks the guest to
|
|
25
33
|
* construct a `context` (the WIT resource has no constructor — the host
|
|
26
34
|
* always initiates the borrow itself when calling `run`).
|
|
35
|
+
*
|
|
36
|
+
* @internal — called only by `runSuite()`'s internal import-merging; the
|
|
37
|
+
* public entry point is `runSuite()` itself.
|
|
27
38
|
*/
|
|
28
39
|
export declare function testContextImportRecord(): Record<string, unknown>;
|
package/types/run-suite.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { type ComponentArtifacts } from "@polyengine/runtime/embedder";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The suite's `tests` interface id (wit/tests.wit `interface tests`, v0.1.0).
|
|
4
|
+
*
|
|
5
|
+
* @internal — used only inside this module's export lookup; no importer
|
|
6
|
+
* (including this package's own tests) references it. The public entry
|
|
7
|
+
* point is `runSuite()`.
|
|
8
|
+
*/
|
|
3
9
|
export declare const TESTS_INTERFACE = "polymorph:test/tests@0.1.0";
|
|
4
10
|
export interface RunSuiteOptions {
|
|
5
11
|
/**
|
package/types/tags.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The custom-section name (component-test-core `name::TAGS_SECTION`).
|
|
3
|
+
*
|
|
4
|
+
* @internal — test-only export; wired automatically by `runSuite()`'s tag
|
|
5
|
+
* scheduling, the public entry point.
|
|
6
|
+
*/
|
|
2
7
|
export declare const TAGS_SECTION = "component-test:tags@0.1";
|
|
3
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Parsed static inventory: exact case records + generated-row prefixes.
|
|
10
|
+
*
|
|
11
|
+
* @internal — an internal shape passed between this module's own
|
|
12
|
+
* functions and `run-suite.ts`; not part of `runSuite()`'s public
|
|
13
|
+
* options/return shape.
|
|
14
|
+
*/
|
|
4
15
|
export interface TagsInventory {
|
|
5
16
|
exact: Map<string, string[]>;
|
|
6
17
|
prefixes: Array<{
|
|
@@ -14,6 +25,10 @@ export interface TagsInventory {
|
|
|
14
25
|
* core modules (section id 1) and nested components (section id 4), which
|
|
15
26
|
* both embed complete wasm binaries. Returns null when no section exists
|
|
16
27
|
* anywhere (a suite not built with their SDK).
|
|
28
|
+
*
|
|
29
|
+
* @internal — used only by `loadTagsInventory()` and this package's own
|
|
30
|
+
* tests; the public entry point is `runSuite()`, which schedules tag
|
|
31
|
+
* gating automatically.
|
|
17
32
|
*/
|
|
18
33
|
export declare function collectTagsSections(bytes: Uint8Array): Uint8Array | null;
|
|
19
34
|
/**
|
|
@@ -21,15 +36,32 @@ export declare function collectTagsSections(bytes: Uint8Array): Uint8Array | nul
|
|
|
21
36
|
* record per line, `name tag...`, blank lines skipped, duplicate names and
|
|
22
37
|
* empty tags rejected. Grammar validation beyond that (WIT-label checks)
|
|
23
38
|
* is the producer's job — their SDK validates at macro-expansion time.
|
|
39
|
+
*
|
|
40
|
+
* @internal — used only by `loadTagsInventory()` and this package's own
|
|
41
|
+
* tests; the public entry point is `runSuite()`.
|
|
24
42
|
*/
|
|
25
43
|
export declare function parseTagsRecords(bytes: Uint8Array): TagsInventory;
|
|
26
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Convenience: scan + parse; null when the suite carries no inventory.
|
|
46
|
+
*
|
|
47
|
+
* @internal — used only by `run-suite.ts`'s automatic tag scheduling and
|
|
48
|
+
* this package's own tests; the public entry point is `runSuite()`.
|
|
49
|
+
*/
|
|
27
50
|
export declare function loadTagsInventory(bytes: Uint8Array): TagsInventory | null;
|
|
28
51
|
/** The tags covering `name`: exact record, else a generated-row prefix
|
|
29
|
-
* record (leaves live below `prefix/`), else undefined (inventory drift).
|
|
52
|
+
* record (leaves live below `prefix/`), else undefined (inventory drift).
|
|
53
|
+
*
|
|
54
|
+
* @internal — used only by `run-suite.ts`'s per-case scheduling and this
|
|
55
|
+
* package's own tests; the public entry point is `runSuite()`. */
|
|
30
56
|
export declare function tagsOf(inv: TagsInventory, name: string): string[] | undefined;
|
|
31
|
-
/** harness.mjs `applies()`: `!f` needs f missing; `f` needs f present.
|
|
57
|
+
/** harness.mjs `applies()`: `!f` needs f missing; `f` needs f present.
|
|
58
|
+
*
|
|
59
|
+
* @internal — used only by `run-suite.ts`'s scheduling and this package's
|
|
60
|
+
* own tests; the public entry point is `runSuite()`. */
|
|
32
61
|
export declare function applies(tags: string[], missing: string[]): boolean;
|
|
33
62
|
/** The N/A row's `detail`: the first unsatisfied mark (harness.mjs's
|
|
34
|
-
* `excluding`), empty string if somehow none (mirrors `excluding ?? ""`).
|
|
63
|
+
* `excluding`), empty string if somehow none (mirrors `excluding ?? ""`).
|
|
64
|
+
*
|
|
65
|
+
* @internal — used only by `run-suite.ts`'s scheduling and this package's
|
|
66
|
+
* own tests; the public entry point is `runSuite()`. */
|
|
35
67
|
export declare function firstExcluding(tags: string[], missing: string[]): string;
|