@hydranium/conformance 1.0.0-next.10

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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -0
  3. package/lib/conformance-suite.d.ts +97 -0
  4. package/lib/conformance-suite.d.ts.map +1 -0
  5. package/lib/conformance-suite.js +97 -0
  6. package/lib/conformance-suite.js.map +1 -0
  7. package/lib/data/index.d.ts +69 -0
  8. package/lib/data/index.d.ts.map +1 -0
  9. package/lib/data/index.js +223 -0
  10. package/lib/data/index.js.map +1 -0
  11. package/lib/glsp/index.d.ts +124 -0
  12. package/lib/glsp/index.d.ts.map +1 -0
  13. package/lib/glsp/index.js +99 -0
  14. package/lib/glsp/index.js.map +1 -0
  15. package/lib/index.d.ts +11 -0
  16. package/lib/index.d.ts.map +1 -0
  17. package/lib/index.js +19 -0
  18. package/lib/index.js.map +1 -0
  19. package/lib/jest/index.d.ts +34 -0
  20. package/lib/jest/index.d.ts.map +1 -0
  21. package/lib/jest/index.js +59 -0
  22. package/lib/jest/index.js.map +1 -0
  23. package/lib/lsp/index.d.ts +88 -0
  24. package/lib/lsp/index.d.ts.map +1 -0
  25. package/lib/lsp/index.js +198 -0
  26. package/lib/lsp/index.js.map +1 -0
  27. package/lib/model.d.ts +111 -0
  28. package/lib/model.d.ts.map +1 -0
  29. package/lib/model.js +28 -0
  30. package/lib/model.js.map +1 -0
  31. package/lib/vitest/index.d.ts +48 -0
  32. package/lib/vitest/index.d.ts.map +1 -0
  33. package/lib/vitest/index.js +45 -0
  34. package/lib/vitest/index.js.map +1 -0
  35. package/package.json +120 -0
  36. package/src/conformance-suite.ts +148 -0
  37. package/src/data/index.ts +297 -0
  38. package/src/glsp/index.ts +217 -0
  39. package/src/index.ts +20 -0
  40. package/src/jest/index.ts +81 -0
  41. package/src/lsp/index.ts +269 -0
  42. package/src/model.ts +122 -0
  43. package/src/vitest/index.ts +81 -0
@@ -0,0 +1,124 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import type { Harness } from '@hydranium/protocol/testing';
10
+ import type { ConformanceCheck } from '../conformance-suite.js';
11
+ /**
12
+ * The GLSP driver port — a live GLSP server driven through the action
13
+ * round-trip. Generic over the adopter action type `TAction` so the kit names
14
+ * no `@eclipse-glsp/*` type. `@hydranium/glsp-server/testing`'s `GlspHarness`
15
+ * satisfies it structurally with `TAction = Action`. `extends Harness` gives
16
+ * the kit the universal `dispose()` teardown.
17
+ */
18
+ export interface GlspConformanceDriver<TAction> extends Harness {
19
+ /** Drive `initialize` + `initializeClientSession`; resolve once the session exists. */
20
+ start(): Promise<void>;
21
+ /** Send an action to the server. Fire-and-forget (GLSP `process` is `void`). */
22
+ dispatch(action: TAction): void;
23
+ /** Resolve with the next captured action whose `kind` matches; reject on timeout. */
24
+ nextAction<T extends TAction = TAction>(kind: string, timeoutMs?: number): Promise<T>;
25
+ }
26
+ /**
27
+ * Opt-in create-operation spec. The adopter supplies the operation action, the
28
+ * expected response kind it settles with, and a matcher reading the mutated
29
+ * source model off the concrete driver.
30
+ */
31
+ export interface GlspCreateOperationSpec<TAction, TDriver extends GlspConformanceDriver<TAction>> {
32
+ /**
33
+ * Construct the create operation to dispatch.
34
+ *
35
+ * Receives the driver, and is called AFTER the initial `requestModel` has
36
+ * settled — so the loaded model is available here. Two things depend on that:
37
+ *
38
+ * - **Capturing a "before" snapshot.** {@link expectMutated} gets no
39
+ * pre-operation state, so an adopter that wants a delta rather than an
40
+ * absolute count records it here, in its own closure.
41
+ * - **Operations that need real element ids.** A `CreateEdgeOperation` names
42
+ * a source and target from the index, which do not exist until the model is
43
+ * loaded.
44
+ */
45
+ readonly action: (driver: TDriver) => TAction;
46
+ /** The action kind the server settles the operation with (e.g. a re-`RequestBounds` for client-laid-out diagrams). */
47
+ readonly expectedResponseKind: string;
48
+ /**
49
+ * Returns whether the source model gained the element — the adopter reads its
50
+ * concrete state off `driver`.
51
+ *
52
+ * **Receives no pre-operation snapshot of its own**, because the kit owns no
53
+ * source-model type and cannot capture one generically. An adopter wanting a
54
+ * delta rather than an absolute count records the before-state in
55
+ * {@link GlspCreateOperationSpec.action}, which does get the driver and does
56
+ * run after the model has loaded.
57
+ *
58
+ * Sticking to an absolute count is fine too, with one caveat: it couples the
59
+ * fixture to its input document, so a fixture whose input was MUTATED by an
60
+ * earlier check silently expects the wrong number. Give each check pristine
61
+ * input, or take the delta route above.
62
+ */
63
+ readonly expectMutated: (driver: TDriver) => boolean;
64
+ }
65
+ /**
66
+ * Per-diagram-type GLSP fixture, generic over the adopter action type and the
67
+ * concrete driver. The `prepare` hook covers both fidelities: LIGHT seeds a
68
+ * source root directly (`driver.seedSourceRoot(...)`); FAITHFUL no-ops and lets
69
+ * the `requestModel` action carry a source URI a real storage loads.
70
+ */
71
+ export interface GlspFixture<TAction, TDriver extends GlspConformanceDriver<TAction>> {
72
+ /**
73
+ * **Title only** — the label every check for this fixture is tagged with.
74
+ *
75
+ * It is NOT the diagram type the server runs: `connect` supplies that to the
76
+ * harness. Appending a fidelity or document suffix here is what makes two
77
+ * fixtures over ONE diagram type read apart in the report. Nothing validates
78
+ * this string, so treat it as free-form and make it descriptive; a value that
79
+ * is only ever displayed is checked by nothing.
80
+ */
81
+ readonly diagramType: string;
82
+ /** Seed (light) or no-op (faithful) after `start`, before the first `requestModel` dispatch. */
83
+ readonly prepare: (driver: TDriver) => void | Promise<void>;
84
+ /**
85
+ * Construct the `RequestModel` action (light: bare; faithful: carrying a
86
+ * source URI).
87
+ *
88
+ * A THUNK, called per check and always AFTER `connect` — so a faithful fixture
89
+ * may read a root that `connect` just created, which is how an adopter gives
90
+ * every check pristine on-disk input. The `/data` and `/lsp` slices get the
91
+ * same per-check resolution from `ConformanceModel`'s deferrable fields.
92
+ */
93
+ readonly requestModel: () => TAction;
94
+ /** The action kind the server responds to `requestModel` with (e.g. `RequestBoundsAction.KIND`). */
95
+ readonly expectedResponseKind: string;
96
+ /** Optional matcher over the response action — the adopter digs into the projected GModel (the kit owns no GModel types). */
97
+ readonly expectResponse?: (response: TAction) => boolean;
98
+ /** Opt-in: a create operation that must mutate the source model. */
99
+ readonly createOperation?: GlspCreateOperationSpec<TAction, TDriver>;
100
+ }
101
+ /** Options for `runGlspConformance`. */
102
+ export interface GlspConformanceOptions<TAction, TDriver extends GlspConformanceDriver<TAction>> {
103
+ /**
104
+ * Establish a freshly-wired GLSP driver (NOT started — the kit drives
105
+ * `start()` per check). Called once per check for isolation; the kit
106
+ * disposes it. The faithful path must build the workspace here first, so
107
+ * storage has something to load.
108
+ */
109
+ readonly connect: () => TDriver | Promise<TDriver>;
110
+ /** Per-diagram-type fixtures. */
111
+ readonly diagrams: ReadonlyArray<GlspFixture<TAction, TDriver>>;
112
+ /** Suite title override. Default `'conformance: glsp'`. */
113
+ readonly suiteTitle?: string;
114
+ }
115
+ /**
116
+ * Build the GLSP check battery — per diagram type: `start()` resolves;
117
+ * `RequestModel` responds with the expected kind (+ optional `expectResponse`
118
+ * matcher); and an OPT-IN create-operation check (absent ⇒ `it.skip` with a
119
+ * named reason). Each check connects a fresh driver, drives `start` + the
120
+ * fixture's `prepare`, and disposes the driver. Exported for the kit's own
121
+ * unit tests; adopters call `runGlspConformance`.
122
+ */
123
+ export declare function buildGlspChecks<TAction, TDriver extends GlspConformanceDriver<TAction>>(options: GlspConformanceOptions<TAction, TDriver>): ConformanceCheck[];
124
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/glsp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAoBlF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,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AE,OAAO,KAAK,OAAO,CAAC;IACzD,oEAAoE;IACpE,QAAQ,CAAC,eAAe,CAAC,EAAE,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;CACvE;AAED,wCAAwC;AACxC,MAAM,WAAW,sBAAsB,CAAC,OAAO,EAAE,OAAO,SAAS,qBAAqB,CAAC,OAAO,CAAC;IAC5F;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,iCAAiC;IACjC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,SAAS,qBAAqB,CAAC,OAAO,CAAC,EACpF,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,GACjD,gBAAgB,EAAE,CAoEpB"}
@@ -0,0 +1,99 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /**
10
+ * The `@hydranium/conformance/glsp` slice — protocol conformance for the GLSP
11
+ * head, generic over the adopter's action type `TAction`. The kit imports NO
12
+ * `@eclipse-glsp/*` types: the FIXTURE supplies the native actions
13
+ * (`requestModel()`, `createOperation.action()`) and the kit matches responses
14
+ * by `kind` (a `string`) via the driver's `nextAction`.
15
+ *
16
+ * The driver port (`GlspConformanceDriver<TAction>`) is the minimal
17
+ * `start` / `dispatch` / `nextAction` surface that `@hydranium/glsp-server/
18
+ * testing`'s `GlspHarness` satisfies with no adapter. Grammar-specific setup
19
+ * and assertions (seeding a source root for the light path, reading the
20
+ * mutated source model) are the adopter's via `prepare` / `expectResponse` /
21
+ * `createOperation.expectMutated`, which receive the CONCRETE driver `TDriver`
22
+ * — so the port stays grammar-agnostic while the adopter keeps full access to
23
+ * its harness.
24
+ */
25
+ import assert from 'node:assert/strict';
26
+ /**
27
+ * Build the GLSP check battery — per diagram type: `start()` resolves;
28
+ * `RequestModel` responds with the expected kind (+ optional `expectResponse`
29
+ * matcher); and an OPT-IN create-operation check (absent ⇒ `it.skip` with a
30
+ * named reason). Each check connects a fresh driver, drives `start` + the
31
+ * fixture's `prepare`, and disposes the driver. Exported for the kit's own
32
+ * unit tests; adopters call `runGlspConformance`.
33
+ */
34
+ export function buildGlspChecks(options) {
35
+ const { connect } = options;
36
+ const checks = [];
37
+ for (const diagram of options.diagrams) {
38
+ const tag = `[${diagram.diagramType}]`;
39
+ checks.push({
40
+ title: `start() initialises a client session ${tag}`,
41
+ body: async () => {
42
+ const driver = await connect();
43
+ try {
44
+ await driver.start();
45
+ }
46
+ finally {
47
+ driver.dispose();
48
+ }
49
+ }
50
+ });
51
+ checks.push({
52
+ title: `RequestModel responds with ${diagram.expectedResponseKind} ${tag}`,
53
+ body: async () => {
54
+ const driver = await connect();
55
+ try {
56
+ await driver.start();
57
+ await diagram.prepare(driver);
58
+ driver.dispatch(diagram.requestModel());
59
+ const response = await driver.nextAction(diagram.expectedResponseKind);
60
+ if (diagram.expectResponse) {
61
+ assert.ok(diagram.expectResponse(response), `expectResponse was false for the ${diagram.expectedResponseKind} response`);
62
+ }
63
+ }
64
+ finally {
65
+ driver.dispose();
66
+ }
67
+ }
68
+ });
69
+ const operation = diagram.createOperation;
70
+ if (operation) {
71
+ checks.push({
72
+ title: `create operation mutates the source model ${tag}`,
73
+ body: async () => {
74
+ const driver = await connect();
75
+ try {
76
+ await driver.start();
77
+ await diagram.prepare(driver);
78
+ driver.dispatch(diagram.requestModel());
79
+ await driver.nextAction(diagram.expectedResponseKind);
80
+ driver.dispatch(operation.action(driver));
81
+ await driver.nextAction(operation.expectedResponseKind);
82
+ assert.ok(operation.expectMutated(driver), 'expectMutated was false — the create operation did not mutate the source model');
83
+ }
84
+ finally {
85
+ driver.dispose();
86
+ }
87
+ }
88
+ });
89
+ }
90
+ else {
91
+ checks.push({
92
+ title: `create operation mutates the source model ${tag}`,
93
+ skipReason: 'fixture supplied no createOperation'
94
+ });
95
+ }
96
+ }
97
+ return checks;
98
+ }
99
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/glsp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAgHxC;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC5B,OAAiD;IAEjD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,MAAM,MAAM,GAAuB,EAAE,CAAC;IAEtC,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,WAAW,GAAG,CAAC;QAEvC,MAAM,CAAC,IAAI,CAAC;YACT,KAAK,EAAE,wCAAwC,GAAG,EAAE;YACpD,IAAI,EAAE,KAAK,IAAI,EAAE;gBACd,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE,CAAC;gBAC/B,IAAI,CAAC;oBACF,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;gBACxB,CAAC;wBAAS,CAAC;oBACR,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,CAAC;YACJ,CAAC;SACH,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC;YACT,KAAK,EAAE,8BAA8B,OAAO,CAAC,oBAAoB,IAAI,GAAG,EAAE;YAC1E,IAAI,EAAE,KAAK,IAAI,EAAE;gBACd,MAAM,MAAM,GAAG,MAAM,OAAO,EAAE,CAA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ACN,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,EAC/B,gFAAgF,CAClF,CAAC;oBACL,CAAC;4BAAS,CAAC;wBACR,MAAM,CAAC,OAAO,EAAE,CAAC;oBACpB,CAAC;gBACJ,CAAC;aACH,CAAC,CAAC;QACN,CAAC;aAAM,CAAC;YACL,MAAM,CAAC,IAAI,CAAC;gBACT,KAAK,EAAE,6CAA6C,GAAG,EAAE;gBACzD,UAAU,EAAE,qCAAqC;aACnD,CAAC,CAAC;QACN,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AACjB,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ export * from './model.js';
10
+ export * from './conformance-suite.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AASlF,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,19 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ // Head-agnostic core of the hydranium conformance kit (TCK). Exports the
10
+ // shared fixture model + the check/run-loop/reporting primitives the per-head
11
+ // slices build on. Each head ships as a SEPARATE subpath — `@hydranium/
12
+ // conformance/data`, `.../lsp`, `.../glsp` — so importing one slice never
13
+ // pulls another head's protocol types in (the no-root-hub rule). This root
14
+ // barrel deliberately re-exports NONE of the slices.
15
+ export * from './model.js';
16
+ export * from './conformance-suite.js';
17
+ // `waitFor` / `tick` belong to `@hydranium/protocol/testing`, the shared
18
+ // server-free test primitives — import them from there, not from the kit.
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,yEAAyE;AACzE,8EAA8E;AAC9E,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,qDAAqD;AAErD,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,yEAAyE;AACzE,0EAA0E"}
@@ -0,0 +1,34 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import type { TransferDiagnostic, TransferElement } from '@hydranium/protocol';
10
+ import { type DataConformanceOptions } from '../data/index.js';
11
+ import { type LspConformanceOptions } from '../lsp/index.js';
12
+ import { type GlspConformanceDriver, type GlspConformanceOptions } from '../glsp/index.js';
13
+ export type { DataConformanceDriver, DataConformanceOptions } from '../data/index.js';
14
+ export type { LspConformanceCompletionList, LspConformanceDiagnostic, LspConformanceDriver, LspConformanceInitializeResult, LspConformanceOptions } from '../lsp/index.js';
15
+ export type { GlspConformanceDriver, GlspConformanceOptions, GlspCreateOperationSpec, GlspFixture } from '../glsp/index.js';
16
+ /**
17
+ * Run the data-server conformance battery against an adopter's live server
18
+ * under Jest. Emits a `describe` with one `it` per check (server-level once,
19
+ * grammar-bearing per language) and a ran-vs-skipped summary.
20
+ */
21
+ export declare function runDataConformance<TTransfer extends TransferElement, TDiagnostic extends TransferDiagnostic = TransferDiagnostic>(options: DataConformanceOptions<TTransfer, TDiagnostic>): void;
22
+ /**
23
+ * Run the LSP conformance battery against an adopter's live server under Jest.
24
+ * Emits a `describe` with one `it` per check (server-level once, grammar-bearing
25
+ * per language) and a ran-vs-skipped summary.
26
+ */
27
+ export declare function runLspConformance(options: LspConformanceOptions): void;
28
+ /**
29
+ * Run the GLSP conformance battery against an adopter's live diagram server
30
+ * under Jest. Emits a `describe` with one `it` per check (per diagram type) and
31
+ * a ran-vs-skipped summary.
32
+ */
33
+ export declare function runGlspConformance<TAction, TDriver extends GlspConformanceDriver<TAction>>(options: GlspConformanceOptions<TAction, TDriver>): void;
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jest/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAkBlF,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAmB,KAAK,qBAAqB,EAAE,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAI5G,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACtF,YAAY,EACT,4BAA4B,EAC5B,wBAAwB,EACxB,oBAAoB,EACpB,8BAA8B,EAC9B,qBAAqB,EACvB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAU5H;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,SAAS,eAAe,EAAE,WAAW,SAAS,kBAAkB,GAAG,kBAAkB,EAC9H,OAAO,EAAE,sBAAsB,CAAC,SAAS,EAAE,WAAW,CAAC,GACvD,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,SAAS,qBAAqB,CAAC,OAAO,CAAC,EACvF,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,GACjD,IAAI,CAEN"}
@@ -0,0 +1,59 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ /**
10
+ * The Jest adapter for `@hydranium/conformance` — one of the two runner
11
+ * adapters, which are the only parts of the kit that import a test runner. It
12
+ * binds Jest's `describe` / `it` / `it.skip` / `afterAll` to the
13
+ * runner-agnostic {@link ConformanceRunner} port and exposes the
14
+ * `run{Data,Lsp,Glsp}Conformance` entry points an adopter-on-Jest calls, each
15
+ * building its slice's pure check list and emitting it through the bound
16
+ * runner. The core (`.` / `/data` / `/lsp` / `/glsp`) imports no runner and
17
+ * asserts with `node:assert`; the `@hydranium/conformance/vitest` sibling is
18
+ * this same binding against Vitest's globals.
19
+ *
20
+ * Adopters import the `run*` functions AND the slice types from here, so a
21
+ * Jest-based suite needs a single import site.
22
+ */
23
+ import { afterAll, describe, it } from '@jest/globals';
24
+ import { emitConformanceSuite } from '../conformance-suite.js';
25
+ import { buildDataChecks } from '../data/index.js';
26
+ import { buildLspChecks } from '../lsp/index.js';
27
+ import { buildGlspChecks } from '../glsp/index.js';
28
+ /** Jest bound to the kit's runner-agnostic {@link ConformanceRunner} port. */
29
+ const jestRunner = {
30
+ describe: (name, register) => describe(name, register),
31
+ test: (name, body) => it(name, body),
32
+ skip: name => it.skip(name, () => undefined),
33
+ afterAll: fn => afterAll(fn)
34
+ };
35
+ /**
36
+ * Run the data-server conformance battery against an adopter's live server
37
+ * under Jest. Emits a `describe` with one `it` per check (server-level once,
38
+ * grammar-bearing per language) and a ran-vs-skipped summary.
39
+ */
40
+ export function runDataConformance(options) {
41
+ emitConformanceSuite(jestRunner, options.suiteTitle ?? 'conformance: data-server', buildDataChecks(options));
42
+ }
43
+ /**
44
+ * Run the LSP conformance battery against an adopter's live server under Jest.
45
+ * Emits a `describe` with one `it` per check (server-level once, grammar-bearing
46
+ * per language) and a ran-vs-skipped summary.
47
+ */
48
+ export function runLspConformance(options) {
49
+ emitConformanceSuite(jestRunner, options.suiteTitle ?? 'conformance: lsp', buildLspChecks(options));
50
+ }
51
+ /**
52
+ * Run the GLSP conformance battery against an adopter's live diagram server
53
+ * under Jest. Emits a `describe` with one `it` per check (per diagram type) and
54
+ * a ran-vs-skipped summary.
55
+ */
56
+ export function runGlspConformance(options) {
57
+ emitConformanceSuite(jestRunner, options.suiteTitle ?? 'conformance: glsp', buildGlspChecks(options));
58
+ }
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/jest/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAA0B,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,EAAE,eAAe,EAA+B,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,cAAc,EAA8B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAA2D,MAAM,kBAAkB,CAAC;AAc5G,8EAA8E;AAC9E,MAAM,UAAU,GAAsB;IACnC,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACtD,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;IACpC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC;IAC5C,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAC/B,OAAuD;IAEvD,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,0BAA0B,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AAChH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAA8B;IAC7D,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,kBAAkB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AACvG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAC/B,OAAiD;IAEjD,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,mBAAmB,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;AACzG,CAAC"}
@@ -0,0 +1,88 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2026 CrossBreeze, EclipseSource and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the MIT License which is available in the project root.
6
+ *
7
+ * SPDX-License-Identifier: MIT
8
+ ********************************************************************************/
9
+ import type { Harness } from '@hydranium/protocol/testing';
10
+ import type { ConformanceCheck } from '../conformance-suite.js';
11
+ import { type LanguageFixture } from '../model.js';
12
+ /** Structural minimum of an LSP `InitializeResult` — only the baseline capabilities the kit asserts. */
13
+ export interface LspConformanceInitializeResult {
14
+ readonly capabilities: {
15
+ readonly textDocumentSync?: unknown;
16
+ readonly completionProvider?: unknown;
17
+ };
18
+ }
19
+ /** Structural minimum of a `CompletionList` — the kit asserts only that `items` is an array. */
20
+ export interface LspConformanceCompletionList {
21
+ readonly items: readonly unknown[];
22
+ }
23
+ /**
24
+ * Structural minimum of a `Diagnostic` — the kit asserts only that each carries a
25
+ * `message`. LSP 3.18 widened `Diagnostic.message` to `string | MarkupContent`, so
26
+ * the minimum admits both shapes — spelled structurally (rather than importing
27
+ * `MarkupContent`) to keep the kit free of a `vscode-languageserver-types`
28
+ * dependency, and so a real `Diagnostic[]` stays assignable with no adapter.
29
+ */
30
+ export interface LspConformanceDiagnostic {
31
+ readonly message: string | {
32
+ readonly value: string;
33
+ };
34
+ }
35
+ /**
36
+ * The LSP driver port — a live, connected LSP server driven through the
37
+ * lifecycle + document-sync + completion + diagnostics-capture facades.
38
+ * `@hydranium/core/testing/node`'s `LspHarness` satisfies this structurally (its
39
+ * richer return types are assignable to these minima), so the adopter's
40
+ * `connect` returns a `makeLspHarness(...)` with no adapter. `extends Harness`
41
+ * gives the kit the universal `dispose()` teardown.
42
+ */
43
+ export interface LspConformanceDriver extends Harness {
44
+ /** Drive the `initialize` → `initialized` handshake; resolve with the (structurally-minimal) result. */
45
+ initialize(): Promise<LspConformanceInitializeResult>;
46
+ /** Send `didOpen` for `uri` with full `text` under `languageId`. */
47
+ openDocument(uri: string, text: string, languageId: string, version?: number): void;
48
+ /** Send `didChange` for `uri` as a single full-text replacement at `version`. */
49
+ changeDocument(uri: string, text: string, version: number): void;
50
+ /** Resolve with the diagnostics of the next `publishDiagnostics` matching `uri`; reject on timeout. */
51
+ nextDiagnostics(uri: string, timeoutMs?: number): Promise<readonly LspConformanceDiagnostic[]>;
52
+ /** Request completion at `position`, normalized to a list. */
53
+ completion(uri: string, position: {
54
+ line: number;
55
+ character: number;
56
+ }): Promise<LspConformanceCompletionList>;
57
+ /** Drive the graceful `shutdown` request. */
58
+ shutdown(): Promise<void>;
59
+ }
60
+ /** Options for `runLspConformance`. */
61
+ export interface LspConformanceOptions {
62
+ /**
63
+ * Establish a freshly-wired, connected LSP driver. Called once per check
64
+ * for isolation; the kit disposes it after the check. The kit drives the
65
+ * `initialize` handshake itself per check (it is once-only per connection),
66
+ * so `connect` must NOT pre-initialise.
67
+ */
68
+ readonly connect: () => LspConformanceDriver | Promise<LspConformanceDriver>;
69
+ /** Per-language fixtures; the grammar-bearing checks run once per language. */
70
+ readonly languages: ReadonlyArray<LanguageFixture>;
71
+ /** Suite title override. Default `'conformance: lsp'`. */
72
+ readonly suiteTitle?: string;
73
+ }
74
+ /**
75
+ * Build the LSP check battery: server-level checks once, then the
76
+ * grammar-bearing checks per language. Completion is an OPTIONAL LSP capability,
77
+ * so both completion checks are opt-in on the same `fixture.completionPosition`
78
+ * signal — the functional completion check and the `completionProvider` baseline
79
+ * advertisement each run only when at least one fixture supplies a position, and
80
+ * otherwise report skipped with a named reason rather than passing vacuously or
81
+ * mandating a capability of servers that do not offer completion.
82
+ * `textDocumentSync` stays mandatory: the document-sync and
83
+ * diagnostics checks depend on it. Each check connects a fresh driver, drives the
84
+ * `initialize` handshake, and disposes the driver. Exported for the kit's own
85
+ * unit tests; adopters call `runLspConformance`.
86
+ */
87
+ export declare function buildLspChecks(options: LspConformanceOptions): ConformanceCheck[];
88
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lsp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAkBlF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,KAAK,eAAe,EAAiC,MAAM,aAAa,CAAC;AAElF,wGAAwG;AACxG,MAAM,WAAW,8BAA8B;IAC5C,QAAQ,CAAC,YAAY,EAAE;QACpB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;QACpC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;KACxC,CAAC;CACJ;AAED,gGAAgG;AAChG,MAAM,WAAW,4BAA4B;IAC1C,QAAQ,CAAC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