@metamesh/testkit 0.0.0-stage → 0.14.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +234 -0
  2. package/LICENSE +200 -0
  3. package/README.md +118 -2
  4. package/dist/assertions.d.ts +20 -0
  5. package/dist/assertions.d.ts.map +1 -0
  6. package/dist/assertions.js +103 -0
  7. package/dist/assertions.js.map +1 -0
  8. package/dist/docs/guides/package.md +119 -0
  9. package/dist/docs/manifest.json +259 -0
  10. package/dist/docs/reference/font-fixtures/LoadedFontFixtures.md +13 -0
  11. package/dist/docs/reference/font-fixtures/loadFontFixtureServices.md +10 -0
  12. package/dist/docs/reference/font-fixtures/loadFontFixtures.md +10 -0
  13. package/dist/docs/reference/fonts/FontTestFixture.md +17 -0
  14. package/dist/docs/reference/fonts/prepareFontTestServices.md +10 -0
  15. package/dist/docs/reference/index/GeneratorTestExecution.md +19 -0
  16. package/dist/docs/reference/index/GeneratorTestRunner.md +19 -0
  17. package/dist/docs/reference/index/GeneratorTestRunnerOptions.md +14 -0
  18. package/dist/docs/reference/index/MeshMeasurementExpectation.md +19 -0
  19. package/dist/docs/reference/index/MeshMeasurementTolerances.md +17 -0
  20. package/dist/docs/reference/index/createGeneratorTestRunner.md +12 -0
  21. package/dist/docs/reference/index/expectMeshMeasurements.md +14 -0
  22. package/dist/docs/reference/index/expectSerializableDefinition.md +10 -0
  23. package/dist/docs/reference/index/expectValidDefaults.md +10 -0
  24. package/dist/docs/reference/index/expectValidParts.md +19 -0
  25. package/dist/docs/reference/index/expectValidPresets.md +10 -0
  26. package/dist/docs/reference/index/getTestEngine.md +13 -0
  27. package/dist/engine.d.ts +7 -0
  28. package/dist/engine.d.ts.map +1 -0
  29. package/dist/engine.js +11 -0
  30. package/dist/engine.js.map +1 -0
  31. package/dist/font-fixtures.d.ts +11 -0
  32. package/dist/font-fixtures.d.ts.map +1 -0
  33. package/dist/font-fixtures.js +75 -0
  34. package/dist/font-fixtures.js.map +1 -0
  35. package/dist/fonts.d.ts +13 -0
  36. package/dist/fonts.d.ts.map +1 -0
  37. package/dist/fonts.js +34 -0
  38. package/dist/fonts.js.map +1 -0
  39. package/dist/index.d.ts +7 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +5 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/measurements.d.ts +28 -0
  44. package/dist/measurements.d.ts.map +1 -0
  45. package/dist/measurements.js +66 -0
  46. package/dist/measurements.js.map +1 -0
  47. package/dist/runner.d.ts +36 -0
  48. package/dist/runner.d.ts.map +1 -0
  49. package/dist/runner.js +118 -0
  50. package/dist/runner.js.map +1 -0
  51. package/package.json +55 -3
package/CHANGELOG.md ADDED
@@ -0,0 +1,234 @@
1
+ # @metamesh/testkit
2
+
3
+ ## 0.14.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [be565ad]
8
+ - Updated dependencies [bd33fb0]
9
+ - @metamesh/modeling@0.14.0
10
+ - @metamesh/generator-sdk@0.14.0
11
+
12
+ ## 0.13.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 2ebe03f: Ship exact-version offline documentation and a development-only authoring CLI for semantic
17
+ checking, generation, captured geometry inspection, and explicit Chromium previews. Use exact
18
+ package versions in documentation metadata and reject unsupported authoring artifact formats.
19
+ Provide generated command help and strict per-command argument validation, and enforce semantic
20
+ checking even when the consumer's TypeScript configuration disables it.
21
+
22
+ Publish lightweight model and Generator testing helpers as `@metamesh/testkit`. Move the
23
+ `metamesh` executable and Node authoring API into `@metamesh/cli`, which owns compiler, bundler,
24
+ renderer, and browser dependencies. Remove the former package name and authoring entry from
25
+ Testkit without compatibility aliases.
26
+
27
+ - 7e1b75d: Simplify modeling authoring with `polygon` construction, shared bounds and vector text fitting,
28
+ Section patterns, pure pattern transforms, and explicit profile closure and part layout helpers.
29
+ Zero-sized round, chamfer, and smooth treatments preserve untreated geometry.
30
+
31
+ Replace the public geometry vocabulary with `Vector2`, `Vector3`, `Contour`, `Polygon`, and
32
+ `Region`, and use canonical `Bounds2` and `Bounds3` throughout. Remove retired constructor and
33
+ type names. Bundles require runtime major 5 and the generation realm uses protocol 5; older
34
+ runtime packages reject before execution. The package envelope remains format 4.
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [2ebe03f]
39
+ - Updated dependencies [7e1b75d]
40
+ - Updated dependencies [3139981]
41
+ - @metamesh/modeling@0.13.0
42
+ - @metamesh/generator-sdk@0.13.0
43
+
44
+ ## 0.12.0
45
+
46
+ ### Patch Changes
47
+
48
+ - Updated dependencies [45d2617]
49
+ - @metamesh/modeling@0.12.0
50
+ - @metamesh/generator-sdk@0.12.0
51
+
52
+ ## 0.11.0
53
+
54
+ ### Minor Changes
55
+
56
+ - b5da778: Replace prepare/build with typed generation programs, optional computed values and authoritative
57
+ part placement. Add isolated session caches and deferred geometry with explicit snapshot ownership.
58
+ Expose immutable fluent Solid and Section methods for transforms, subtraction, finishing, and
59
+ Section-to-Solid construction, replacing the corresponding standalone operations and public
60
+ context facade. Generator packages require format 4 and runtime 4; previous executable contracts are unsupported.
61
+
62
+ ### Patch Changes
63
+
64
+ - 88f5336: Correct immutable cache comparisons, recapture mutable mesh inputs on every run, and preserve
65
+ session ownership during concurrent Testkit operations. Reject unsupported hidden data fields
66
+ instead of silently dropping them, and reuse native operation contexts during recipe evaluation.
67
+ - Updated dependencies [88f5336]
68
+ - Updated dependencies [6c90e9d]
69
+ - Updated dependencies [b5da778]
70
+ - Updated dependencies [60c458f]
71
+ - Updated dependencies [d69836c]
72
+ - Updated dependencies [bfb7a63]
73
+ - Updated dependencies [a1f5aba]
74
+ - Updated dependencies [d4ffce7]
75
+ - @metamesh/modeling@0.11.0
76
+ - @metamesh/generator-sdk@0.11.0
77
+
78
+ ## 0.10.0
79
+
80
+ ### Minor Changes
81
+
82
+ - 9d7052c: Separate parameter values from local UI metadata, add strict parameter-document diagnostics and a generated JSON Schema, and rename the side-profile and contour APIs. Generator packages and modules now require format 3 and runtime 3.0.0.
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [0eea1b4]
87
+ - Updated dependencies [9d7052c]
88
+ - Updated dependencies [cf597bd]
89
+ - @metamesh/generator-sdk@0.10.0
90
+ - @metamesh/modeling@0.10.0
91
+
92
+ ## 0.9.0
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [e405876]
97
+ - Updated dependencies [e405876]
98
+ - @metamesh/generator-sdk@0.9.0
99
+ - @metamesh/modeling@0.9.0
100
+
101
+ ## 0.8.0
102
+
103
+ ### Minor Changes
104
+
105
+ - bf1abe4: Add circular baselines to prepared vector text and Generator text services. Shaped glyphs and attached marks rotate rigidly around a millimetre radius, preserving kerning, ligatures, exact curve bounds and logical advances. Circular text is limited to one line, baseline vertical alignment, less than one revolution, and outlines that stay clear of the circle's center axis.
106
+ - bf1abe4: Complete solid splitting, plane clipping, Section hull/component/simplification operations, minimum-distance
107
+ queries and inspection facts. Add optional bounded geometric solid
108
+ validation at build/export boundaries and a pure uniform-density volume centroid helper.
109
+ Reuse immutable native inspection facts within a build and fresh owned topology analysis during
110
+ solid validation; share checks for identical buffer ranges without trusting mutable external facts.
111
+
112
+ Unify SVG default/preset limits and strict preset metadata checks. Preserve structured validation
113
+ codes and nested paths, add physical mesh assertions, and require runtime 2.1 for the current host
114
+ surface and issue metadata.
115
+
116
+ ### Patch Changes
117
+
118
+ - Updated dependencies [bf1abe4]
119
+ - Updated dependencies [bf1abe4]
120
+ - Updated dependencies [bf1abe4]
121
+ - Updated dependencies [bf1abe4]
122
+ - Updated dependencies [bf1abe4]
123
+ - @metamesh/modeling@0.8.0
124
+ - @metamesh/generator-sdk@0.8.0
125
+
126
+ ## 0.7.0
127
+
128
+ ### Patch Changes
129
+
130
+ - Updated dependencies [b1b97b9]
131
+ - Updated dependencies [b1b97b9]
132
+ - @metamesh/modeling@0.7.0
133
+ - @metamesh/generator-sdk@0.7.0
134
+
135
+ ## 0.6.0
136
+
137
+ ### Minor Changes
138
+
139
+ - Run prepare/build through the shared Modeling engine. Remove direct native-kernel and generate bypass APIs; add direct preparation probes, finalized-model execution, and synchronous mesh assertions for an explicit engine.
140
+
141
+ ## 0.5.2
142
+
143
+ ### Patch Changes
144
+
145
+ - Updated dependencies [02a1692]
146
+ - @metamesh/generator-sdk@0.5.2
147
+ - @metamesh/geometry@0.5.2
148
+
149
+ ## 0.5.1
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies
154
+ - @metamesh/generator-sdk@0.5.1
155
+ - @metamesh/geometry@0.5.1
156
+
157
+ ## 0.5.0
158
+
159
+ ### Minor Changes
160
+
161
+ - 0dc29c2: Add the portable numeric `curve-resolution` parameter role for model-owned physical curve
162
+ tolerance, with strict millimetre units, positive bounds, and one role per definition. Require
163
+ runtime 1.3.0 or later for packages declaring the role. Geometry and
164
+ Testkit follow the coordinated fixed Preview package release.
165
+
166
+ ### Patch Changes
167
+
168
+ - Updated dependencies [0dc29c2]
169
+ - Updated dependencies [0dc29c2]
170
+ - @metamesh/generator-sdk@0.5.0
171
+ - @metamesh/geometry@0.5.0
172
+
173
+ ## 0.4.0
174
+
175
+ ### Minor Changes
176
+
177
+ - ad3bb49: Strengthen generator geometry with correct concave sweep caps, bounded region aggregation,
178
+ consistent finite input checks, protected copied-mesh scope exits, and shared primitive/extrusion
179
+ sampling. Add scoped hull, Minkowski sum, projection, slicing, and region revolution.
180
+
181
+ Compiled `MeshPart` now exposes `{ id, positions, indices, color? }`, directly compatible with SDK
182
+ `GeneratedPart`. Pass explicit `{ degrees }` or `{ radians }` to `rotationTransform3`, and rounded
183
+ rectangle sampling options as `{ segmentsPerCorner }` or `{ resolution }`.
184
+
185
+ Add `definePreparedGeneratorModule` for bounded, one-use validation/generation preparation while
186
+ preserving the five format-1 module exports. Authored `/v1` keeps its existing signatures and shares
187
+ the pure validation and sampling implementation with compiled modeling.
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies [ad3bb49]
192
+ - @metamesh/geometry@0.4.0
193
+ - @metamesh/generator-sdk@0.4.0
194
+
195
+ ## 0.3.0
196
+
197
+ ### Minor Changes
198
+
199
+ - e87357e: Add direct catalog-font text geometry and matching metrics through prepared synchronous font
200
+ scopes. Share vector layout with SVG outlining, use natural font line spacing by default, and
201
+ make whitespace measurable. Nonzero tracking disables optional ligatures to match browser text.
202
+ Compiled Generators can receive font services during validation as well as generation; packages
203
+ declaring font parameters require runtime 1.2.0. Text geometry requires an exact font selection;
204
+ host text services expose shared vector layout. Browser editing uses prepared vector measurements.
205
+ Compiled module calls require explicit execution services for validation and generation.
206
+
207
+ Use the shared transform functions for both 2D sections and 3D solids. Reuse core-validated immutable
208
+ loops, polygons, and regions when winding and tolerance policies match, avoiding repeated topology
209
+ validation without changing tessellation or accepting unvalidated caller geometry.
210
+
211
+ ### Patch Changes
212
+
213
+ - Updated dependencies [e87357e]
214
+ - @metamesh/geometry@0.3.0
215
+ - @metamesh/generator-sdk@0.3.0
216
+
217
+ ## 0.2.0
218
+
219
+ ### Minor Changes
220
+
221
+ - 8b4e918: Add immutable font selections, font parameters and prepared text services, the optional Geometry
222
+ text engine, and reproducible font test services.
223
+
224
+ ### Patch Changes
225
+
226
+ - Updated dependencies [8b4e918]
227
+ - @metamesh/generator-sdk@0.2.0
228
+ - @metamesh/geometry@0.2.0
229
+
230
+ ## 0.1.0
231
+
232
+ ### Minor Changes
233
+
234
+ - Initial public Preview release of the Generator contract assertions.
package/LICENSE ADDED
@@ -0,0 +1,200 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice.
187
+
188
+ Copyright 2026 MetaMesh
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,119 @@
1
- # Temporary Holding Version
1
+ # `@metamesh/testkit`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Test MetaMesh models and Generators with the same generation engine used by their hosts. Check definitions,
4
+ presets, mesh validity, and physical measurements with any test runner.
5
+
6
+ > **Preview:** `0.x` minor releases may break compatibility. Patches remain compatible within the
7
+ > same minor line.
8
+
9
+ ## Installation
10
+
11
+ Install the same exact SDK, Modeling, and Testkit release. Testkit is a development dependency:
12
+
13
+ ```bash
14
+ pnpm add @metamesh/generator-sdk @metamesh/modeling
15
+ pnpm add -D @metamesh/testkit
16
+ ```
17
+
18
+ ## Execute models in tests
19
+
20
+ Given a Generator module exporting its `definition` and default runtime, such as the
21
+ [SDK example](https://github.com/JasonKoolman/metamesh/blob/main/packages/generator-sdk/README.md#define-controls):
22
+
23
+ ```ts
24
+ import { getDefaultParameters } from "@metamesh/generator-sdk/parameters";
25
+ import { createGeneratorTestRunner, expectValidParts } from "@metamesh/testkit";
26
+
27
+ import runtime, { definition } from "./generator.js";
28
+
29
+ const runner = createGeneratorTestRunner(definition, runtime);
30
+ try {
31
+ const result = await runner.execute(getDefaultParameters(definition));
32
+ if (result.type !== "generated") throw new Error("Expected valid Generator output.");
33
+ try {
34
+ await expectValidParts(result.model.parts);
35
+ } finally {
36
+ result.model.dispose();
37
+ }
38
+ } finally {
39
+ runner.dispose();
40
+ }
41
+ ```
42
+
43
+ `execute` normalizes values, prepares services, and runs a persistent session. Schema and assertion
44
+ errors return `invalid`; unexpected execution or malformed-output errors reject. Dispose returned
45
+ snapshots separately from the runner; captured snapshots remain valid after runner disposal.
46
+
47
+ Use `runner.validate(parameters, { normalize: false })` to probe deliberately invalid typed values
48
+ without finalizing parts. It checks declarations and reached assertions; observing geometry can
49
+ still initialize the engine. Creating a runner alone loads no engine or assets. Pass `options.engine`
50
+ to reuse a test-owned engine and `options.limits` to lower host ceilings.
51
+
52
+ ## Assertions
53
+
54
+ Helpers throw on failure without depending on your test framework:
55
+
56
+ | Helper | Checks |
57
+ | ------------------------------ | ------------------------------------------------------------------ |
58
+ | `expectSerializableDefinition` | Strict parsing and a canonical JSON round trip |
59
+ | `expectValidDefaults` | Strict parameter decoding and agreement with definition defaults |
60
+ | `expectValidPresets` | Serializable preset metadata; use the runner for domain assertions |
61
+ | `expectValidParts` | Strict part metadata, closed topology, and native reconstruction |
62
+ | `expectMeshMeasurements` | Bounds, area, signed volume, and connected-component count |
63
+
64
+ `expectValidParts(parts, engine)` is synchronous and uses that engine's limits. Without an engine,
65
+ it returns a promise using the shared test engine and default limits. It also accepts finalized
66
+ parts, stripping measurement facts before strict validation; other unknown fields reject.
67
+
68
+ Compare physical measurements with explicit tolerances. For a 30 × 20 × 4 mm box mesh:
69
+
70
+ ```ts
71
+ import { expectMeshMeasurements } from "@metamesh/testkit";
72
+
73
+ expectMeshMeasurements(
74
+ mesh,
75
+ { signedVolume: 30 * 20 * 4, connectedComponentCount: 1 },
76
+ { signedVolume: 0.05 }
77
+ );
78
+ ```
79
+
80
+ Bounds use mm, area mm², and volume mm³. Tolerances are absolute and default to zero; component
81
+ counts are exact. Measurements check closed oriented topology without a native engine. Matching
82
+ measurements alone do not establish geometric equivalence or exclude self-intersections; use
83
+ `expectValidParts` for native reconstruction.
84
+
85
+ ## Font fixtures
86
+
87
+ Supply `prepareServices` in runner options for models with fonts. It receives the definition and
88
+ current parameters, and can return services synchronously or asynchronously. Missing fixtures or
89
+ service failures reject before generation.
90
+
91
+ `prepareFontTestServices` from `/fonts` checks immutable font revisions and prepares services from
92
+ checked-in bytes. Install Modeling's optional `fontkit` peer, plus `woff2-encoder` for WOFF2 fixtures.
93
+ Tests need no font downloads or browser cache; retain the fixtures' licenses.
94
+
95
+ For local JSON fixture descriptors, `loadFontFixtureServices` from
96
+ `@metamesh/testkit/font-fixtures` returns the runner's `prepareServices` adapter. Descriptor paths
97
+ resolve beside the JSON file, and every file's SHA-256 must match its declared selection revision.
98
+ `loadFontFixtures` additionally returns the verified selections. These loaders are Node-only;
99
+ use `/fonts` when the host already supplies the bytes.
100
+
101
+ ## Documentation
102
+
103
+ Resolve `@metamesh/testkit/docs/manifest.json` for this installed version's Markdown
104
+ reference and testing guidance. Testkit has no compiler, bundler, renderer, or browser dependencies.
105
+ It shares the Modeling engine and Generator SDK contracts rather than duplicating runtime rules.
106
+
107
+ For source checking, captured runs, documentation lookup, and images, install
108
+ [`@metamesh/cli`](https://github.com/JasonKoolman/metamesh/blob/main/packages/cli/README.md).
109
+ Its executable is `metamesh`; reusable Node authoring functions live in `@metamesh/cli/authoring`.
110
+
111
+ - [Generator SDK](https://github.com/JasonKoolman/metamesh/blob/main/packages/generator-sdk/README.md) — definitions, parameter values, and module authoring.
112
+ - [Modeling](https://github.com/JasonKoolman/metamesh/blob/main/packages/modeling/README.md) — geometry, sessions, and snapshots.
113
+ - [API source](https://github.com/JasonKoolman/metamesh/blob/main/packages/testkit/src/index.ts) — runner and assertion exports; [font helpers](https://github.com/JasonKoolman/metamesh/blob/main/packages/testkit/src/fonts.ts) live in `/fonts`.
114
+
115
+ For package development, see [Contributing](https://github.com/JasonKoolman/metamesh/blob/main/CONTRIBUTING.md).
116
+
117
+ ## License
118
+
119
+ [Apache-2.0](https://github.com/JasonKoolman/metamesh/blob/main/packages/testkit/LICENSE).
@@ -0,0 +1,20 @@
1
+ import type { GeneratorDefinition, GeneratorParams, GeneratorPreset } from "@metamesh/generator-sdk";
2
+ import { type GeneratedPart } from "@metamesh/generator-sdk/runtime";
3
+ import { type FinalizedPart } from "@metamesh/modeling";
4
+ import type { ModelEngine } from "@metamesh/modeling/engine";
5
+ /** Throws unless a definition already has the canonical package-serializable representation. */
6
+ export declare function expectSerializableDefinition(definition: GeneratorDefinition): void;
7
+ /** Throws unless defaults strictly decode and equal the defaults derived from the definition. */
8
+ export declare function expectValidDefaults<const D extends GeneratorDefinition>(definition: D, defaults: GeneratorParams<D>): void;
9
+ /** Checks preset metadata. Validate domain assertions through the generation test runner. */
10
+ export declare function expectValidPresets<const D extends GeneratorDefinition>(definition: D, presets: readonly GeneratorPreset<D>[]): void;
11
+ /**
12
+ * Checks finalized engine parts after omitting measurement facts from their strict wire DTOs.
13
+ * Runs mesh reconstruction/finalization synchronously using the supplied engine.
14
+ */
15
+ export declare function expectValidParts(value: readonly FinalizedPart[], engine: ModelEngine): readonly GeneratedPart[];
16
+ /** Strictly checks unknown wire data and reconstructs its meshes using the supplied engine. */
17
+ export declare function expectValidParts(value: unknown, engine: ModelEngine): readonly GeneratedPart[];
18
+ /** Initializes the shared test engine lazily, then applies the same wire and mesh checks. */
19
+ export declare function expectValidParts(value: unknown): Promise<readonly GeneratedPart[]>;
20
+ //# sourceMappingURL=assertions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../src/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC1F,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AA4B7D,gGAAgG;AAChG,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI,CAUlF;AAED,iGAAiG;AACjG,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EACrE,UAAU,EAAE,CAAC,EACb,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,GAC3B,IAAI,CAQN;AAED,6FAA6F;AAC7F,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,CAAC,SAAS,mBAAmB,EACpE,UAAU,EAAE,CAAC,EACb,OAAO,EAAE,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,GACrC,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,MAAM,EAAE,WAAW,GAClB,SAAS,aAAa,EAAE,CAAC;AAE5B,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,aAAa,EAAE,CAAC;AAEhG,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAAC"}