@creative-introvert/tons-of-tests 2.1.0 → 3.0.0-rc.1

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 (120) hide show
  1. package/README.md +143 -37
  2. package/dist/cjs/Classify.js +1 -2
  3. package/dist/cjs/Classify.js.map +1 -1
  4. package/dist/cjs/RepositoryError.js +42 -33
  5. package/dist/cjs/RepositoryError.js.map +1 -1
  6. package/dist/cjs/Show.js +18 -0
  7. package/dist/cjs/Show.js.map +1 -1
  8. package/dist/cjs/Test.js +40 -2
  9. package/dist/cjs/Test.js.map +1 -1
  10. package/dist/cjs/Test.repository.js +25 -22
  11. package/dist/cjs/Test.repository.js.map +1 -1
  12. package/dist/cjs/TestRun.js +28 -0
  13. package/dist/cjs/TestRun.js.map +1 -0
  14. package/dist/cjs/TestValueError.js +23 -0
  15. package/dist/cjs/TestValueError.js.map +1 -0
  16. package/dist/cjs/index.js +0 -7
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/internal/Classify.js +1 -9
  19. package/dist/cjs/internal/Classify.js.map +1 -1
  20. package/dist/cjs/internal/Test.js +235 -95
  21. package/dist/cjs/internal/Test.js.map +1 -1
  22. package/dist/cjs/internal/Test.repository.sqlite.js +487 -356
  23. package/dist/cjs/internal/Test.repository.sqlite.js.map +1 -1
  24. package/dist/cjs/internal/Test.serialization.js +128 -0
  25. package/dist/cjs/internal/Test.serialization.js.map +1 -0
  26. package/dist/cjs/internal/common.js.map +1 -1
  27. package/dist/cjs/internal/stats.js +29 -1
  28. package/dist/cjs/internal/stats.js.map +1 -1
  29. package/dist/cjs/internal/summarize.js +143 -29
  30. package/dist/cjs/internal/summarize.js.map +1 -1
  31. package/dist/cjs/internal/test-repository-fixtures.js +31 -0
  32. package/dist/cjs/internal/test-repository-fixtures.js.map +1 -0
  33. package/dist/cjs/internal/test-repository-schema.js +98 -0
  34. package/dist/cjs/internal/test-repository-schema.js.map +1 -0
  35. package/dist/cjs/internal/test-result-stats.js +89 -0
  36. package/dist/cjs/internal/test-result-stats.js.map +1 -0
  37. package/dist/dts/Classify.d.ts +0 -1
  38. package/dist/dts/Classify.d.ts.map +1 -1
  39. package/dist/dts/RepositoryError.d.ts +47 -20
  40. package/dist/dts/RepositoryError.d.ts.map +1 -1
  41. package/dist/dts/Show.d.ts +5 -5
  42. package/dist/dts/Show.d.ts.map +1 -1
  43. package/dist/dts/Test.d.ts +136 -13
  44. package/dist/dts/Test.d.ts.map +1 -1
  45. package/dist/dts/Test.repository.d.ts +132 -9
  46. package/dist/dts/Test.repository.d.ts.map +1 -1
  47. package/dist/dts/TestRun.d.ts +22 -0
  48. package/dist/dts/TestRun.d.ts.map +1 -0
  49. package/dist/dts/TestValueError.d.ts +17 -0
  50. package/dist/dts/TestValueError.d.ts.map +1 -0
  51. package/dist/dts/index.d.ts +0 -1
  52. package/dist/dts/index.d.ts.map +1 -1
  53. package/dist/dts/internal/Classify.d.ts +0 -1
  54. package/dist/dts/internal/Classify.d.ts.map +1 -1
  55. package/dist/dts/internal/Test.d.ts +64 -30
  56. package/dist/dts/internal/Test.d.ts.map +1 -1
  57. package/dist/dts/internal/Test.repository.sqlite.d.ts +92 -11
  58. package/dist/dts/internal/Test.repository.sqlite.d.ts.map +1 -1
  59. package/dist/dts/internal/Test.serialization.d.ts +34 -0
  60. package/dist/dts/internal/Test.serialization.d.ts.map +1 -0
  61. package/dist/dts/internal/common.d.ts +1 -1
  62. package/dist/dts/internal/common.d.ts.map +1 -1
  63. package/dist/dts/internal/stats.d.ts +16 -1
  64. package/dist/dts/internal/stats.d.ts.map +1 -1
  65. package/dist/dts/internal/summarize.d.ts +39 -7
  66. package/dist/dts/internal/summarize.d.ts.map +1 -1
  67. package/dist/dts/internal/test-repository-fixtures.d.ts +33 -0
  68. package/dist/dts/internal/test-repository-fixtures.d.ts.map +1 -0
  69. package/dist/dts/internal/test-repository-schema.d.ts +16 -0
  70. package/dist/dts/internal/test-repository-schema.d.ts.map +1 -0
  71. package/dist/dts/internal/test-result-stats.d.ts +7 -0
  72. package/dist/dts/internal/test-result-stats.d.ts.map +1 -0
  73. package/dist/esm/Classify.js +0 -1
  74. package/dist/esm/Classify.js.map +1 -1
  75. package/dist/esm/RepositoryError.js +29 -29
  76. package/dist/esm/RepositoryError.js.map +1 -1
  77. package/dist/esm/Show.js +2 -2
  78. package/dist/esm/Show.js.map +1 -1
  79. package/dist/esm/Test.js +37 -1
  80. package/dist/esm/Test.js.map +1 -1
  81. package/dist/esm/Test.repository.js +26 -21
  82. package/dist/esm/Test.repository.js.map +1 -1
  83. package/dist/esm/TestRun.js +22 -0
  84. package/dist/esm/TestRun.js.map +1 -0
  85. package/dist/esm/TestValueError.js +16 -0
  86. package/dist/esm/TestValueError.js.map +1 -0
  87. package/dist/esm/index.js +0 -1
  88. package/dist/esm/index.js.map +1 -1
  89. package/dist/esm/internal/Classify.js +0 -7
  90. package/dist/esm/internal/Classify.js.map +1 -1
  91. package/dist/esm/internal/Test.js +231 -94
  92. package/dist/esm/internal/Test.js.map +1 -1
  93. package/dist/esm/internal/Test.repository.sqlite.js +486 -356
  94. package/dist/esm/internal/Test.repository.sqlite.js.map +1 -1
  95. package/dist/esm/internal/Test.serialization.js +119 -0
  96. package/dist/esm/internal/Test.serialization.js.map +1 -0
  97. package/dist/esm/internal/common.js.map +1 -1
  98. package/dist/esm/internal/stats.js +27 -0
  99. package/dist/esm/internal/stats.js.map +1 -1
  100. package/dist/esm/internal/summarize.js +143 -28
  101. package/dist/esm/internal/summarize.js.map +1 -1
  102. package/dist/esm/internal/test-repository-fixtures.js +25 -0
  103. package/dist/esm/internal/test-repository-fixtures.js.map +1 -0
  104. package/dist/esm/internal/test-repository-schema.js +92 -0
  105. package/dist/esm/internal/test-repository-schema.js.map +1 -0
  106. package/dist/esm/internal/test-result-stats.js +83 -0
  107. package/dist/esm/internal/test-result-stats.js.map +1 -0
  108. package/package.json +1 -1
  109. package/dist/cjs/Test.repository.types.js +0 -14
  110. package/dist/cjs/Test.repository.types.js.map +0 -1
  111. package/dist/cjs/internal/lib/Schema.js +0 -14
  112. package/dist/cjs/internal/lib/Schema.js.map +0 -1
  113. package/dist/dts/Test.repository.types.d.ts +0 -62
  114. package/dist/dts/Test.repository.types.d.ts.map +0 -1
  115. package/dist/dts/internal/lib/Schema.d.ts +0 -4
  116. package/dist/dts/internal/lib/Schema.d.ts.map +0 -1
  117. package/dist/esm/Test.repository.types.js +0 -7
  118. package/dist/esm/Test.repository.types.js.map +0 -1
  119. package/dist/esm/internal/lib/Schema.js +0 -7
  120. package/dist/esm/internal/lib/Schema.js.map +0 -1
package/README.md CHANGED
@@ -26,8 +26,8 @@ A specialized test runner for predictive functions, focusing on scenarios where
26
26
 
27
27
  Use Node.js 24 or newer and Effect 4. The Effect packages in this repository
28
28
  use the same exact version. The SQLite driver uses Node's built-in SQLite.
29
- Existing database files are migrated when opened. Previously stored results
30
- receive the key `result`; their test case hashes stay the same.
29
+ This release requires a fresh database. Set `dbPath` to a new file and run the
30
+ suite again. Old database formats are not upgraded automatically.
31
31
 
32
32
  ### Installation
33
33
 
@@ -47,7 +47,7 @@ Define your test suite:
47
47
  // my-test-suite.ts
48
48
  import {Classify} from '@creative-introvert/tons-of-tests';
49
49
  import * as CLI from '@creative-introvert/tons-of-tests-cli';
50
- import {Effect} from 'effect';
50
+ import {Effect, Schema} from 'effect';
51
51
 
52
52
  const myFunction = (input: number) => Promise.resolve(input * 1.7);
53
53
  const classify = Classify.makeClassify<number, number>({
@@ -58,6 +58,10 @@ const classify = Classify.makeClassify<number, number>({
58
58
  CLI.run({
59
59
  testSuite: {
60
60
  name: 'with-cli-simple',
61
+ schemas: {
62
+ testCase: {input: Schema.Finite, expected: Schema.Finite},
63
+ evaluation: {result: Schema.Finite, expected: Schema.Finite},
64
+ },
61
65
  testCases: [
62
66
  {input: 0, expected: 0},
63
67
  {input: 1, expected: 2},
@@ -76,9 +80,17 @@ CLI.run({
76
80
  ```
77
81
 
78
82
  Omit `evaluate` to compare the whole output with the expected value using
79
- `Classify.defaultIsEqual`. The default evaluator returns one result with key
80
- `result`. `Classify.makeClassify` returns a label for one comparison; use it
81
- inside `evaluate` when you want to choose how values match.
83
+ `Schema.toEquivalence`. Reuse the same schema instance for
84
+ `schemas.evaluation.result` and `schemas.evaluation.expected`. The default
85
+ evaluator returns one result with key `result`. It treats `null` and `undefined`
86
+ as missing values for classification.
87
+
88
+ `Classify.makeClassify` returns a label for one comparison. Use it inside
89
+ `evaluate` to choose other matching rules or compare values of different types.
90
+
91
+ The runner keeps the first case for each input/expected-value hash. It warns
92
+ and skips later duplicates before calling `program`, then continues the suite.
93
+ Tags do not change a case's identity; the first case's tags are kept.
82
94
 
83
95
  `testCases` can also be an Effect `Stream`, which is useful for large or generated suites that are consumed lazily by the runner:
84
96
 
@@ -88,6 +100,10 @@ import {Stream} from 'effect';
88
100
  CLI.run({
89
101
  testSuite: {
90
102
  name: 'with-cli-stream',
103
+ schemas: {
104
+ testCase: {input: Schema.Finite, expected: Schema.Finite},
105
+ evaluation: {result: Schema.Finite, expected: Schema.Finite},
106
+ },
91
107
  testCases: Stream.fromIterable([
92
108
  {input: 0, expected: 0},
93
109
  {input: 1, expected: 2},
@@ -109,17 +125,19 @@ authority, need, and timeline:
109
125
 
110
126
  ```ts
111
127
  import {Classify, type Test} from '@creative-introvert/tons-of-tests';
112
- import {Array} from 'effect';
113
-
114
- type Bant = {
115
- readonly budget: string | null;
116
- readonly authority: string | null;
117
- readonly need: string | null;
118
- readonly timeline: string | null;
119
- };
128
+ import {Array, Schema} from 'effect';
129
+
130
+ const Field = Schema.NullOr(Schema.String);
131
+ const Bant = Schema.Struct({
132
+ budget: Field,
133
+ authority: Field,
134
+ need: Field,
135
+ timeline: Field,
136
+ });
137
+ type Bant = typeof Bant.Type;
120
138
 
121
139
  const fields = ['budget', 'authority', 'need', 'timeline'] as const;
122
- const classify = Classify.makeClassify({isEqual: Classify.defaultIsEqual});
140
+ const classify = Classify.makeClassify({isEqual: Schema.toEquivalence(Field)});
123
141
 
124
142
  const evaluate: Test.Evaluate<Bant, Bant, string | null, string | null> = (
125
143
  output,
@@ -168,32 +186,85 @@ The statistics count cases and results separately. Labels, precision, and recall
168
186
  count visible results. Timing statistics count each visible case once, even when
169
187
  it has several result rows.
170
188
 
171
- If you supply `testSuite.schemas`, `input` describes the original input.
172
- `result` and `expected` describe the values returned by `evaluate`. For this
173
- BANT example, both use `Schema.NullOr(Schema.String)` because each result is one
174
- field, even though the program returns a full BANT object.
189
+ This suite needs a schema for the whole BANT expectation and schemas for the
190
+ individual field values:
191
+
192
+ ```ts
193
+ const schemas = {
194
+ testCase: {input: Schema.String, expected: Bant},
195
+ evaluation: {result: Field, expected: Field},
196
+ };
197
+ ```
198
+
199
+ ### Value Schemas
200
+
201
+ Every suite requires `schemas`. The fields describe the values used at each
202
+ stage:
203
+
204
+ | Field | Value |
205
+ | --- | --- |
206
+ | `testCase.input` | Original input passed to `program` and saved with each result. |
207
+ | `testCase.expected` | Whole expected value passed to `evaluate` and used in the case hash. |
208
+ | `evaluation.result` | Result returned by `evaluate`. |
209
+ | `evaluation.expected` | Expected value returned by `evaluate`. |
210
+
211
+ The runner derives JSON codecs with Effect's `Schema.toCodecJson`. Built-in
212
+ schemas such as `Schema.BigInt` and `Schema.Date` provide JSON encodings.
213
+ Custom codecs can choose other encodings. Their encoded and decoded types may
214
+ differ. Schemas must not require Effect services.
215
+
216
+ `program`, `evaluate`, and fresh results keep the original values. Saved values
217
+ are encoded and loaded values are decoded with the same schemas. The whole
218
+ program output needs no storage schema when `evaluate` selects smaller values.
219
+
220
+ Encodings must be deterministic. The runner rejects undeclared object fields
221
+ and checks that decoding the JSON text restores an equivalent value according
222
+ to `Schema.toEquivalence`. These checks run before hashing or saving. For
223
+ example, an untagged bigint/string union can encode both `123n` and `"123"` as
224
+ the same JSON string. Use an encoding that records which type it contains.
225
+
226
+ Case hashes cover the encoded original input and whole expected value.
227
+ Result IDs also cover the evaluation key, label, and encoded result values.
228
+ Object keys are sorted; array order remains significant. Changing an encoding
229
+ can change hashes. Existing data is not migrated.
230
+
231
+ Tables and visual diffs display encoded JSON. Comparisons between runs use
232
+ schema equality on decoded values. Saved labels are not re-evaluated.
175
233
 
176
- #### Updating Suites That Use `classify`
234
+ Conversion failures use `Error.TestValueError`. It includes the suite,
235
+ one-based case number, evaluation key when available, field, operation, and
236
+ original `SchemaError` cause. A failed CLI execution stays incomplete and cannot
237
+ be committed or reused with `--cached`.
177
238
 
178
- Replace the suite's `classify` property with an `evaluate` callback. Keep the
179
- classifier and wrap its label in a result, as shown in the basic example:
239
+ Direct repository calls also require schemas:
180
240
 
181
241
  ```ts
182
- evaluate: (result, expected) => [
183
- {key: 'result', result, expected, label: classify(result, expected)},
184
- ],
242
+ yield* repository.withTestRun(
243
+ run,
244
+ repository.insertTestResults(results, run, schemas),
245
+ );
246
+ const saved = repository.getTestResultsStream(run, schemas);
185
247
  ```
186
248
 
187
- Suites that use the default comparison and omit `classify` need no changes.
188
- Cached results keep their saved values and labels. Run the suite again after
189
- changing `evaluate` to produce new results.
190
-
191
- The same `schemas` decode current and previous runs. If you change the stored
192
- result or expected-value shape and your schemas cannot read older values, use
193
- a new suite name for the new shape.
249
+ `Show.summarize({testRun, schemas})` returns an Effect containing the table text.
250
+ `Show.prepareSummary(results, {schemas, suite})` prepares table chunks inside
251
+ `Effect.scoped`. Both report conversion failures in the Effect error channel.
252
+ The schema-free `Classify.defaultIsEqual` and `Test.makeSha256` exports have
253
+ been removed.
194
254
 
195
255
  ### CLI Commands
196
256
 
257
+ The CLI reads and compares results in batches. It writes formatted rows to a
258
+ temporary file, then reads them back to print the table with the correct column
259
+ widths. Timing statistics use temporary SQLite tables, including the exact
260
+ median. Temporary files and tables are removed after use or failure.
261
+
262
+ This avoids keeping both full runs and the full table text in JavaScript memory.
263
+ The runner still keeps one hash per distinct case to detect duplicates. Arrays
264
+ you supply as `testCases` also stay in memory; use a stream to read cases as
265
+ needed. Temporary storage grows with the report size. The existing commands,
266
+ flags, table layout, and statistics stay the same.
267
+
197
268
  #### Summarize
198
269
 
199
270
  ```sh
@@ -231,16 +302,23 @@ or reduce the number of program calls. No matches produces an empty view;
231
302
 
232
303
  #### Summarize From Cache
233
304
 
234
- When results for the current run are already saved, `--cached` reads them
235
- without re-running the program or evaluator. If no cached results exist, it
236
- runs and saves the suite. After the first run, use it to inspect other keys
237
- without making another inference call:
305
+ After the whole suite finishes successfully, `--cached` reads its saved results
306
+ without re-running the program or evaluator. This also works for an empty
307
+ suite. If the previous attempt failed or was interrupted, the CLI clears its
308
+ partial results and runs the suite again.
309
+
310
+ Use the cache to inspect other keys without making another inference call:
238
311
 
239
312
  ```sh
240
313
  pnpx tsx bant-suite.ts summarize --cached --keys budget,need
241
314
  ```
242
315
 
243
316
  `diff --cached` behaves the same way for the current-run side of the diff.
317
+ The cache belongs to the suite name. It does not detect changes to the program
318
+ or test cases; omit `--cached` when you want to run them again.
319
+
320
+ After upgrading, use a fresh database and create a new baseline. See
321
+ [database setup](./MIGRATION_GUIDE_V1.md#database-setup).
244
322
 
245
323
  #### Write Test Results
246
324
 
@@ -248,6 +326,10 @@ pnpx tsx bant-suite.ts summarize --cached --keys budget,need
248
326
  pnpx tsx my-test-suite.ts commit
249
327
  ```
250
328
 
329
+ `commit` saves the current results as the baseline for later comparisons.
330
+ It rejects a tracked run that failed or is still running. Changing the
331
+ baseline and creating the next current run happen in one database transaction.
332
+
251
333
  #### Diff
252
334
 
253
335
  The diff command compares your current test results with previously committed results. This is useful when you've made changes to either:
@@ -334,6 +416,30 @@ CLI.effect(
334
416
  );
335
417
  ```
336
418
 
419
+ Each `CLI.effect` call opens and closes its own database connection. To share
420
+ one repository across several commands, use `CLI.effectNoDeps` and provide
421
+ the services once around the whole program. This also lets an in-memory
422
+ database keep its results between commands:
423
+
424
+ ```ts
425
+ import * as CLI from '@creative-introvert/tons-of-tests-cli';
426
+ import {NodeRuntime} from '@effect/platform-node';
427
+ import {Effect} from 'effect';
428
+
429
+ const config = {testSuite, dbPath: ':memory:'};
430
+
431
+ Effect.gen(function* () {
432
+ yield* CLI.effectNoDeps(config, ['node', 'script', 'summarize']);
433
+ yield* CLI.effectNoDeps(config, ['node', 'script', 'commit']);
434
+ }).pipe(
435
+ Effect.provide(CLI.buildLayer(config)),
436
+ NodeRuntime.runMain,
437
+ );
438
+ ```
439
+
440
+ `effectNoDeps` uses the supplied platform services and `TestRepository`.
441
+ Its `config.dbPath` is only used if you pass the config to `buildLayer`.
442
+
337
443
  If you need the last committed test-run hash from inside another script, use
338
444
  the dedicated helper:
339
445
 
@@ -347,7 +453,7 @@ const hash = await CLI.getLastTestRunHash({
347
453
  // hash: string | null
348
454
  ```
349
455
 
350
- When you use `CLI.effect`, `diff --exit-on-diff` fails with a typed
456
+ When you use `CLI.effect` or `CLI.effectNoDeps`, `diff --exit-on-diff` fails with a typed
351
457
  `DiffNonEmpty` error when the current run has visible diffs. Handle it with
352
458
  `Effect.catchTag('DiffNonEmpty', handler)`; `error.count` gives the number of
353
459
  visible changed results.
@@ -3,14 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.values = exports.makeClassify = exports.defaultIsNil = exports.defaultIsEqual = exports.Stats = exports.LabelSchema = void 0;
6
+ exports.values = exports.makeClassify = exports.defaultIsNil = exports.Stats = exports.LabelSchema = void 0;
7
7
  var _effect = /*#__PURE__*/require("effect");
8
8
  var internal = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./internal/Classify.js"));
9
9
  var cache;
10
10
  function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
11
11
  const LabelSchema = exports.LabelSchema = internal.LabelSchema;
12
12
  const values = exports.values = internal.values;
13
- const defaultIsEqual = exports.defaultIsEqual = internal.defaultIsEqual;
14
13
  const defaultIsNil = exports.defaultIsNil = internal.defaultIsNil;
15
14
  const makeClassify = exports.makeClassify = internal.makeClassify;
16
15
  /** Counts selected results; timing statistics count each selected case once. */
@@ -1 +1 @@
1
- {"version":3,"file":"Classify.js","names":["_effect","require","internal","_interopRequireWildcard","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","LabelSchema","exports","values","defaultIsEqual","defaultIsNil","makeClassify","Stats","Schema","Class","TP","Finite","TN","FP","FN","total","testCases","Int","precision","recall","timeMin","Option","timeMax","timeMedian","timeMean","empty","none"],"sources":["../../src/Classify.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,OAAA,gBAAAC,OAAA;AAEA,IAAAC,QAAA,gBAAAC,uBAAA,cAAAF,OAAA;AAAmD,IAAAG,KAAA;AAAA,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAE,UAAA,SAAAF,CAAA,MAAAG,CAAA,EAAAC,CAAA,EAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,QAAAM,MAAA,CAAAN,CAAA,MAAAA,CAAA,SAAAQ,CAAA,MAAAT,KAAA,yBAAAY,OAAA,KAAAZ,KAAA,OAAAY,OAAA,KAAAZ,KAAA,QAAAA,KAAA,CAAAa,GAAA,CAAAZ,CAAA,UAAAD,KAAA,CAAAc,GAAA,CAAAb,CAAA,GAAAD,KAAA,CAAAe,GAAA,CAAAd,CAAA,EAAAQ,CAAA,UAAAJ,CAAA,IAAAJ,CAAA,gBAAAI,CAAA,OAAAW,cAAA,CAAAC,IAAA,CA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AM,CAACb,cAAM,CAACG,MAAM,CAAC;EACxCa,QAAQ,eAAEhB,cAAM,CAACa,MAAM,CAACb,cAAM,CAACG,MAAM;CACxC,CAAC;EACE,OAAOc,KAAKA,CAAA;IACR,OAAO,IAAIlB,KAAK,CAAC;MACbG,EAAE,EAAE,CAAC;MACLE,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,KAAK,EAAE,CAAC;MACRC,SAAS,EAAE,CAAC;MACZE,SAAS,EAAE,CAAC;MACZC,MAAM,EAAE,CAAC;MACTC,OAAO,EAAEC,cAAM,CAACK,IAAI,EAAE;MACtBJ,OAAO,EAAED,cAAM,CAACK,IAAI,EAAE;MACtBH,UAAU,EAAEF,cAAM,CAACK,IAAI,EAAE;MACzBF,QAAQ,EAAEH,cAAM,CAACK,IAAI;KACxB,CAAC;EACN;;AACHxB,OAAA,CAAAK,KAAA,GAAAA,KAAA","ignoreList":[]}
1
+ {"version":3,"file":"Classify.js","names":["_effect","require","internal","_interopRequireWildcard","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","LabelSchema","exports","values","defaultIsNil","makeClassify","Stats","Schema","Class","TP","Finite","TN","FP","FN","total","testCases","Int","precision","recall","timeMin","Option","timeMax","timeMedian","timeMean","empty","none"],"sources":["../../src/Classify.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,OAAA,gBAAAC,OAAA;AAEA,IAAAC,QAAA,gBAAAC,uBAAA,cAAAF,OAAA;AAAmD,IAAAG,KAAA;AAAA,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAE,UAAA,SAAAF,CAAA,MAAAG,CAAA,EAAAC,CAAA,EAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAA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AG;EACrBC,SAAS,EAAEV,cAAM,CAACG,MAAM;EACxBQ,MAAM,EAAEX,cAAM,CAACG,MAAM;EACrBS,OAAO,eAAEZ,cAAM,CAACa,MAAM,CAACb,cAAM,CAACG,MAAM,CAAC;EACrCW,OAAO,eAAEd,cAAM,CAACa,MAAM,CAACb,cAAM,CAACG,MAAM,CAAC;EACrCY,UAAU,eAAEf,cAAM,CAACa,MAAM,CAACb,cAAM,CAACG,MAAM,CAAC;EACxCa,QAAQ,eAAEhB,cAAM,CAACa,MAAM,CAACb,cAAM,CAACG,MAAM;CACxC,CAAC;EACE,OAAOc,KAAKA,CAAA;IACR,OAAO,IAAIlB,KAAK,CAAC;MACbG,EAAE,EAAE,CAAC;MACLE,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,KAAK,EAAE,CAAC;MACRC,SAAS,EAAE,CAAC;MACZE,SAAS,EAAE,CAAC;MACZC,MAAM,EAAE,CAAC;MACTC,OAAO,EAAEC,cAAM,CAACK,IAAI,EAAE;MACtBJ,OAAO,EAAED,cAAM,CAACK,IAAI,EAAE;MACtBH,UAAU,EAAEF,cAAM,CAACK,IAAI,EAAE;MACzBF,QAAQ,EAAEH,cAAM,CAACK,IAAI;KACxB,CAAC;EACN;;AACHvB,OAAA,CAAAI,KAAA,GAAAA,KAAA","ignoreList":[]}
@@ -3,42 +3,51 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TestRunNotCreated = exports.RepositoryWriteError = exports.RepositoryQueryError = exports.RepositoryDecodeError = void 0;
7
- var _SqlError = /*#__PURE__*/require("effect/sql/SqlError");
6
+ exports.TestRunNotFound = exports.TestRunNotCreated = exports.TestRunIncomplete = exports.TestRunDuplicate = exports.TestBaselineNotFound = exports.RepositoryPathConflict = exports.RepositoryFormatError = void 0;
7
+ Object.defineProperty(exports, "TestValueError", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _TestValueError.TestValueError;
11
+ }
12
+ });
8
13
  var _effect = /*#__PURE__*/require("effect");
9
- const SqlCause = /*#__PURE__*/_effect.Schema.Union([/*#__PURE__*/_effect.Schema.instanceOf(_SqlError.SqlError), /*#__PURE__*/_effect.Schema.instanceOf(_SqlError.ResultLengthMismatch)]);
10
- class RepositoryQueryError extends /*#__PURE__*/_effect.Schema.TaggedError()('RepositoryQueryError', {
11
- operation: _effect.Schema.String,
12
- cause: /*#__PURE__*/_effect.Schema.instanceOf(_SqlError.SqlError)
13
- }) {
14
- static fromSql = operation => cause => new RepositoryQueryError({
15
- operation,
16
- cause
17
- });
18
- }
19
- exports.RepositoryQueryError = RepositoryQueryError;
20
- class RepositoryWriteError extends /*#__PURE__*/_effect.Schema.TaggedError()('RepositoryWriteError', {
21
- operation: _effect.Schema.String,
22
- cause: SqlCause
23
- }) {
24
- static from = operation => cause => new RepositoryWriteError({
25
- operation,
26
- cause
27
- });
28
- }
29
- exports.RepositoryWriteError = RepositoryWriteError;
30
- class RepositoryDecodeError extends /*#__PURE__*/_effect.Schema.TaggedError()('RepositoryDecodeError', {
31
- operation: _effect.Schema.String,
32
- cause: /*#__PURE__*/_effect.Schema.instanceOf(_effect.Schema.SchemaError)
33
- }) {
34
- static from = operation => cause => new RepositoryDecodeError({
35
- operation,
36
- cause
37
- });
38
- }
39
- exports.RepositoryDecodeError = RepositoryDecodeError;
14
+ var _TestValueError = /*#__PURE__*/require("./TestValueError.js");
40
15
  class TestRunNotCreated extends /*#__PURE__*/_effect.Schema.TaggedError()('TestRunNotCreated', {
41
16
  testSuiteName: _effect.Schema.String
42
17
  }) {}
18
+ /** This operation requires a complete cached attempt or committed snapshot. */
43
19
  exports.TestRunNotCreated = TestRunNotCreated;
20
+ class TestRunIncomplete extends /*#__PURE__*/_effect.Schema.TaggedError()('TestRunIncomplete', {
21
+ testSuiteName: _effect.Schema.String,
22
+ testRunId: _effect.Schema.Int,
23
+ variant: _effect.Schema.String
24
+ }) {}
25
+ exports.TestRunIncomplete = TestRunIncomplete;
26
+ class TestRunNotFound extends /*#__PURE__*/_effect.Schema.TaggedError()('TestRunNotFound', {
27
+ testRunId: _effect.Schema.Int
28
+ }) {}
29
+ exports.TestRunNotFound = TestRunNotFound;
30
+ class TestBaselineNotFound extends /*#__PURE__*/_effect.Schema.TaggedError()('TestBaselineNotFound', {
31
+ testSuiteName: _effect.Schema.String,
32
+ variant: _effect.Schema.String
33
+ }) {}
34
+ /** The store uses an unsupported format. Snapshot files are left unchanged. */
35
+ exports.TestBaselineNotFound = TestBaselineNotFound;
36
+ class RepositoryFormatError extends /*#__PURE__*/_effect.Schema.TaggedError()('RepositoryFormatError', {
37
+ store: /*#__PURE__*/_effect.Schema.Literals(['cache', 'snapshot']),
38
+ path: _effect.Schema.String
39
+ }) {}
40
+ /** A commit selects more than one run for the same suite and variant. */
41
+ exports.RepositoryFormatError = RepositoryFormatError;
42
+ class TestRunDuplicate extends /*#__PURE__*/_effect.Schema.TaggedError()('TestRunDuplicate', {
43
+ testSuiteName: _effect.Schema.String,
44
+ variant: _effect.Schema.String
45
+ }) {}
46
+ /** Cache and snapshot paths refer to the same file; no writer has been opened. */
47
+ exports.TestRunDuplicate = TestRunDuplicate;
48
+ class RepositoryPathConflict extends /*#__PURE__*/_effect.Schema.TaggedError()('RepositoryPathConflict', {
49
+ snapshotPath: _effect.Schema.String,
50
+ cachePath: _effect.Schema.String
51
+ }) {}
52
+ exports.RepositoryPathConflict = RepositoryPathConflict;
44
53
  //# sourceMappingURL=RepositoryError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RepositoryError.js","names":["_SqlError","require","_effect","SqlCause","Schema","Union","instanceOf","SqlError","ResultLengthMismatch","RepositoryQueryError","TaggedError","operation","String","cause","fromSql","exports","RepositoryWriteError","from","RepositoryDecodeError","SchemaError","TestRunNotCreated","testSuiteName"],"sources":["../../src/RepositoryError.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,SAAA,gBAAAC,OAAA;AACA,IAA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C,mBAAmB,EAAE;EAACW,aAAa,EAAEjB,cAAM,CAACQ;AAAM,CAAC,CAAC;AAAGG,OAAA,CAAAK,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"RepositoryError.js","names":["_effect","require","_TestValueError","TestRunNotCreated","Schema","TaggedError","testSuiteName","String","exports","TestRunIncomplete","testRunId","Int","variant","TestRunNotFound","TestBaselineNotFound","RepositoryFormatError","store","Literals","path","TestRunDuplicate","RepositoryPathConflict","snapshotPath","cachePath"],"sources":["../../src/RepositoryError.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;AAEA,IAAAA,OAAA,gBAAAC,OAAA;AAGA,IAAAC,eAAA,gBAAAD,OAAA;AAEM,MAAOE,iBAAkB,sBAAQC,cAAM,CAACC,WAAW,EAGtD,CAAC,mBAAmB,EAAE;EAACC,aAAa,EAAEF,cAAM,CAACG;AAAM,CAAC,CAAC;AAExD;AAAAC,OAAA,CAAAL,iBAAA,GAAAA,iBAAA;AACM,MAAOM,iBAAkB,sBAAQL,cAAM,CAACC,WAAW,EAGtD,CAAC,mBAAmB,EAAE;EACrBC,aAAa,EAAEF,cAAM,CAACG,MAAM;EAC5BG,SAAS,EAAEN,cAAM,CAACO,GAAG;EACrBC,OAAO,EAAER,cAAM,CAACG;CACnB,CAAC;AAAGC,OAAA,CAAAC,iBAAA,GAAAA,iBAAA;AAEC,MAAOI,eAAgB,sBAAQT,cAAM,CAACC,WAAW,EAGpD,CAAC,iBAAiB,EAAE;EAACK,SAAS,EAAEN,cAAM,CAACO;AAAG,CAAC,CAAC;AAAGH,OAAA,CAAAK,eAAA,GAAAA,eAAA;AAE5C,MAAOC,oBAAqB,sBAAQV,cAAM,CAACC,WAAW,EAGzD,CAAC,sBAAsB,EAAE;EACxBC,aAAa,EAAEF,cAAM,CAACG,MAAM;EAC5BK,OAAO,EAAER,cAAM,CAACG;CACnB,CAAC;AAEF;AAAAC,OAAA,CAAAM,oBAAA,GAAAA,oBAAA;AACM,MAAOC,qBAAsB,sBAAQX,cAAM,CAACC,WAAW,EAG1D,CAAC,uBAAuB,EAAE;EACzBW,KAAK,eAAEZ,cAAM,CAACa,QAAQ,CAAC,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;EAC7CC,IAAI,EAAEd,cAAM,CAACG;CAChB,CAAC;AAEF;AAAAC,OAAA,CAAAO,qBAAA,GAAAA,qBAAA;AACM,MAAOI,gBAAiB,sBAAQf,cAAM,CAACC,WAAW,EAGrD,CAAC,kBAAkB,EAAE;EACpBC,aAAa,EAAEF,cAAM,CAACG,MAAM;EAC5BK,OAAO,EAAER,cAAM,CAACG;CACnB,CAAC;AAEF;AAAAC,OAAA,CAAAW,gBAAA,GAAAA,gBAAA;AACM,MAAOC,sBAAuB,sBAAQhB,cAAM,CAACC,WAAW,EAG3D,CAAC,wBAAwB,EAAE;EAC1BgB,YAAY,EAAEjB,cAAM,CAACG,MAAM;EAC3Be,SAAS,EAAElB,cAAM,CAACG;CACrB,CAAC;AAAGC,OAAA,CAAAY,sBAAA,GAAAA,sBAAA","ignoreList":[]}
package/dist/cjs/Show.js CHANGED
@@ -9,6 +9,24 @@ Object.defineProperty(exports, "diff", {
9
9
  return _diff.showDiff;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "prepareComparison", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _summarize.prepareComparison;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "prepareSummary", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _summarize.prepareSummary;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "runSummaries", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _stats.showRunSummaries;
28
+ }
29
+ });
12
30
  Object.defineProperty(exports, "stats", {
13
31
  enumerable: true,
14
32
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"file":"Show.js","names":["_diff","require","_stats","_summarize"],"sources":["../../src/Show.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,KAAA,gBAAAC,OAAA;AACA,IAAAC,MAAA,gBAAAD,OAAA;AACA,IAAAE,UAAA,gBAAAF,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"Show.js","names":["_diff","require","_stats","_summarize"],"sources":["../../src/Show.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,KAAA,gBAAAC,OAAA;AACA,IAAAC,MAAA,gBAAAD,OAAA;AAIA,IAAAE,UAAA,gBAAAF,OAAA","ignoreList":[]}
package/dist/cjs/Test.js CHANGED
@@ -3,13 +3,51 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.runCollectRecord = exports.resultKey = exports.makeSha256 = exports.filterResults = exports.diff = exports.all = void 0;
6
+ exports.summarizeRun = exports.selectVariant = exports.runCollectRecord = exports.resultKey = exports.filterResults = exports.diff = exports.compareRuns = exports.all = exports.TestVariantRequired = exports.TestVariantNotFound = void 0;
7
+ var _effect = /*#__PURE__*/require("effect");
7
8
  var internal = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("./internal/Test.js"));
8
9
  var cache;
9
10
  function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
11
+ class TestVariantRequired extends /*#__PURE__*/_effect.Schema.TaggedError()('TestVariantRequired', {
12
+ testSuiteName: _effect.Schema.String
13
+ }) {}
14
+ exports.TestVariantRequired = TestVariantRequired;
15
+ class TestVariantNotFound extends /*#__PURE__*/_effect.Schema.TaggedError()('TestVariantNotFound', {
16
+ testSuiteName: _effect.Schema.String,
17
+ variant: _effect.Schema.String
18
+ }) {}
19
+ /** Selects a program without running it or requiring its services. */
20
+ exports.TestVariantNotFound = TestVariantNotFound;
21
+ const selectVariant = exports.selectVariant = internal.selectVariant;
22
+ /**
23
+ * Runs only the selected program. Named variants require an explicit selection;
24
+ * a single program uses `default`. Its error and service types include every
25
+ * configured program and the case stream, even when the variant ID is a literal.
26
+ */
10
27
  const all = exports.all = internal.all;
28
+ /**
29
+ * Compares complete cached runs or committed snapshots without evaluating again.
30
+ * The shared codecs must decode both runs and require no Effect services.
31
+ * Callers decide whether comparing different suites or program versions is meaningful.
32
+ *
33
+ * Results match by case hash and evaluation key. A match changes when its label
34
+ * or evaluated values change. Rows follow `to` order, followed by rows found only
35
+ * in `from`, in `from` order. Empty complete runs are valid comparison endpoints.
36
+ * Resolve missing baselines before calling. Both runs must still exist in their
37
+ * stores; a cached attempt replaced by another execution cannot be read.
38
+ * Incompatible codecs fail with `TestValueError`, which names the stored suite.
39
+ */
40
+ const compareRuns = exports.compareRuns = internal.compareRuns;
41
+ /**
42
+ * Summarizes all matching results in a complete cached run or snapshot, including
43
+ * unchanged results. Each case contributes its timing once. Empty complete runs
44
+ * have zero counts and no timing values.
45
+ * The shared codecs must still read that run. The caller decides whether the
46
+ * stored values still have the same meaning. Resolve a missing baseline before
47
+ * calling; it differs from an empty run.
48
+ */
49
+ const summarizeRun = exports.summarizeRun = internal.summarizeRun;
11
50
  const diff = exports.diff = internal.diff;
12
- const makeSha256 = exports.makeSha256 = internal.makeSha256;
13
51
  /** Builds the lookup key for one evaluation within its original test case. */
14
52
  const resultKey = exports.resultKey = internal.resultKey;
15
53
  const runCollectRecord = exports.runCollectRecord = internal.runCollectRecord;
@@ -1 +1 @@
1
- {"version":3,"file":"Test.js","names":["internal","_interopRequireWildcard","require","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","all","exports","diff","makeSha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AAAH,OAAA,CAAAG,SAAA,GAAG1B,QAAQ,CAAC0B,SAAS;AACpC,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAG3B,QAAQ,CAAC2B,gBAAgB;AACzD;AACO,MAAMC,aAAa,GAAAL,OAAA,CAAAK,aAAA,GAAG5B,QAAQ,CAAC4B,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"Test.js","names":["_effect","require","internal","_interopRequireWildcard","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","TestVariantRequired","Schema","TaggedError","testSuiteName","String","exports","TestVariantNotFound","variant","selectVariant","all","compareRuns","summarizeRun","diff","resultKey","runCollectRecord","filterResults"],"sources":["../../src/Test.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,OAAA,gBAAAC,OAAA;AASA,IAAAC,QAAA,gBAAAC,uBAAA,cAAAF,OAAA;AAA+C,IAAAG,KAAA;AAAA,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAE,UAAA,SAAAF,CAAA,MAAAG,CAAA,EAAAC,CAAA,EAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,QAAAM,MAAA,CAAAN,CAAA,MAAAA,CAAA,SAAAQ,CAAA,MAAAT,KAAA,yBAAAY,OAAA,KAAAZ,KAAA,OAAAY,OAAA,KAAAZ,KAAA,QAAAA,KAAA,CAAAa,GAAA,CAAAZ,CAAA,UAAAD,KAAA,CAAAc,GAAA,CAAAb,CAAA,GAAAD,KAAA,CAAAe,GAAA,CAAAd,CAAA,EAAAQ,CAAA,UAAAJ,CAAA,IAAAJ,CAAA,gBAAAI,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAI,CAAA,OAAAD,CAAA,GAAAE,CAAA,IA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CAAAU,aAAA,GAAGpC,QAAQ,CAACoC,aAAa","ignoreList":[]}
@@ -7,34 +7,37 @@ exports.TestRepository = void 0;
7
7
  Object.defineProperty(exports, "TestRun", {
8
8
  enumerable: true,
9
9
  get: function () {
10
- return _TestRepositoryTypes.TestRun;
10
+ return _TestRun.TestRun;
11
11
  }
12
12
  });
13
- var Sqlite = /*#__PURE__*/_interopRequireWildcard(/*#__PURE__*/require("@effect/sql-sqlite-node"));
13
+ var _platformNode = /*#__PURE__*/require("@effect/platform-node");
14
14
  var _effect = /*#__PURE__*/require("effect");
15
+ var _sql = /*#__PURE__*/require("effect/sql");
15
16
  var _TestRepositorySqlite = /*#__PURE__*/require("./internal/Test.repository.sqlite.js");
16
- var _TestRepositoryTypes = /*#__PURE__*/require("./Test.repository.types.js");
17
- var cache;
18
- function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var r, c, a = Object.defineProperty, n = { __proto__: null, default: e }; if (Object(e) !== e) return n; if (cache || "function" != typeof WeakMap || (cache = new WeakMap()), cache) { if (cache.has(e)) return cache.get(e); cache.set(e, n); } for (c in e) "default" !== c && {}.hasOwnProperty.call(e, c) && ((r = a && Object.getOwnPropertyDescriptor(e, c)) && (r.get || r.set) ? a(n, c, r) : n[c] = e[c]); return n; }
19
- const makeTestLayer = () => _effect.Layer.provideMerge(TestRepository.Live, Sqlite.SqliteClient.layer({
20
- filename: ':memory:'
21
- }));
22
- let testLayerCache;
23
- class TestRepository extends /*#__PURE__*/_effect.Context.Service()('TestRepository') {
24
- // Lazy getters: makeTestRepository lives in an internal module that has
25
- // its own import edge back here, so we evaluate these at access time
26
- // rather than at class definition time to avoid the circular init order.
27
- static get Live() {
28
- return _effect.Layer.effect(this, _TestRepositorySqlite.makeTestRepository);
17
+ var _TestRun = /*#__PURE__*/require("./TestRun.js");
18
+ class TestRepository extends /*#__PURE__*/_effect.Context.Service()('@creative-introvert/tons-of-tests/TestRepository') {
19
+ /**
20
+ * Keep cache rows separate by `snapshotIdentity`, even when repositories share a
21
+ * cache filename. Cache and snapshot paths must refer to different files.
22
+ * With `:memory:`, each store lasts for this layer's lifetime.
23
+ * The caller supplies platform services; `CLI.buildLayer` also resolves paths.
24
+ */
25
+ static layer(options) {
26
+ return _effect.Layer.effect(this, (0, _TestRepositorySqlite.makeTestRepository)(options).pipe(_effect.Effect.map(({
27
+ repository
28
+ }) => repository)));
29
29
  }
30
- static layer(dbPath) {
31
- return _effect.Layer.provide(this.Live, Sqlite.SqliteClient.layer({
32
- filename: dbPath
30
+ /** Use separate in-memory stores and platform services for isolated tests. */
31
+ static TestLayer = /*#__PURE__*/_effect.Layer.effectContext(_effect.Effect.gen(function* () {
32
+ const stores = yield* (0, _TestRepositorySqlite.makeTestRepository)({
33
+ dbPath: ':memory:',
34
+ cachePath: ':memory:',
35
+ snapshotIdentity: 'test'
36
+ });
37
+ return _effect.Context.make(TestRepository, stores.repository).pipe(_effect.Context.add(_sql.SqlClient.SqlClient, stores.cache), _effect.Context.add(_TestRepositorySqlite.TestRepositoryStorage, {
38
+ snapshot: stores.snapshot
33
39
  }));
34
- }
35
- static get TestLayer() {
36
- return testLayerCache ??= makeTestLayer();
37
- }
40
+ })).pipe(/*#__PURE__*/_effect.Layer.provide(_platformNode.NodeServices.layer));
38
41
  }
39
42
  exports.TestRepository = TestRepository;
40
43
  //# sourceMappingURL=Test.repository.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Test.repository.js","names":["Sqlite","_interopRequireWildcard","require","_effect","_TestRepositorySqlite","_TestRepositoryTypes","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","makeTestLayer","Layer","provideMerge","TestRepository","Live","SqliteClient","layer","filename","testLayerCache","Context","Service","effect","makeTestRepository","dbPath","provide","TestLayer","exports"],"sources":["../../src/Test.repository.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,gBAAAC,uBAAA,cAAA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,CAAC;EACjB;EACA;EACA;EACA,WAAWN,IAAIA,CAAA;IACX,OAAOH,aAAK,CAACU,MAAM,CAAC,IAAI,EAAEC,wCAAkB,CAAC;EACjD;EACA,OAAON,KAAKA,CAACO,MAAc;IACvB,OAAOZ,aAAK,CAACa,OAAO,CAChB,IAAI,CAACV,IAAI,EACT7B,MAAM,CAAC8B,YAAY,CAACC,KAAK,CAAC;MAACC,QAAQ,EAAEM;IAAM,CAAC,CAAC,CAChD;EACL;EAEA,WAAWE,SAASA,CAAA;IAChB,OAAQP,cAAc,KAAKR,aAAa,EAAE;EAC9C;;AACHgB,OAAA,CAAAb,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"file":"Test.repository.js","names":["_platformNode","require","_effect","_sql","_TestRepositorySqlite","_TestRun","TestRepository","Context","Service","layer","options","Layer","effect","makeTestRepository","pipe","Effect","map","repository","TestLayer","effectContext","gen","stores","dbPath","cachePath","snapshotIdentity","make","add","SqlClient","cache","TestRepositoryStorage","snapshot","provide","NodeServices","exports"],"sources":["../../src/Test.repository.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;AAAA,IAAAA,aAAA,gBAAAC,OAAA;AACA,IAAAC,OAAA,gBAAAD,OAAA;AAQA,IAAAE,IAAA,gBAAAF,OAAA;AAGA,IAAAG,qBAAA,gBAAAH,OAAA;AAQA,IAAAI,QAAA,gBAAAJ,OAAA;AAsIM,MAAOK,cAAe,sBAAQC,eAAO,CAACC,OAAO,EAGhD,CAAC,kDAAkD,CAAC;EACnD;;;;;;EAMA,OAAOC,KAAKA,CAACC,OAIZ;IACG,OAAOC,aAAK,CAACC,MAAM,CACf,IAAI,EACJ,IAAAC,wCAAkB,EAACH,OAAO,CAAC,CAACI,IAAI,CAC5BC,cAAM,CAACC,GAAG,CAAC,CAAC;MAACC;IAAU,CAAC,KAAKA,UAAU,CAAC,CAC3C,CACJ;EACL;EAEA;EACA,OAAgBC,SAAS,gBAAGP,aAAK,CAACQ,aAAa,CAC3CJ,cAAM,CAACK,GAAG,CAAC,aAAS;IAChB,MAAMC,MAAM,GAAG,OAAO,IAAAR,wCAAkB,EAAC;MACrCS,MAAM,EAAE,UAAU;MAClBC,SAAS,EAAE,UAAU;MACrBC,gBAAgB,EAAE;KACrB,CAAC;IACF,OAAOjB,eAAO,CAACkB,IAAI,CAACnB,cAAc,EAAEe,MAAM,CAACJ,UAAU,CAAC,CAACH,IAAI,CACvDP,eAAO,CAACmB,GAAG,CAACC,cAAS,CAACA,SAAS,EAAEN,MAAM,CAACO,KAAK,CAAC,EAC9CrB,eAAO,CAACmB,GAAG,CAACG,2CAAqB,EAAE;MAACC,QAAQ,EAAET,MAAM,CAACS;IAAQ,CAAC,CAAC,CAClE;EACL,CAAC,CAAC,CACL,CAAChB,IAAI,cAACH,aAAK,CAACoB,OAAO,CAACC,0BAAY,CAACvB,KAAK,CAAC,CAAC;;AAC5CwB,OAAA,CAAA3B,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TestRun = void 0;
7
+ var _effect = /*#__PURE__*/require("effect");
8
+ const fields = {
9
+ id: _effect.Schema.Int,
10
+ name: _effect.Schema.String,
11
+ variant: _effect.Schema.String
12
+ };
13
+ /**
14
+ * Identify a run by both `store` and `id`; the two stores can use the same ID.
15
+ * A new execution replaces the cached attempt for its snapshot identity, suite,
16
+ * and variant. Complete attempts, including empty ones, can be reused or committed.
17
+ * Committed snapshots stay unchanged after a program changes or is removed.
18
+ */
19
+ const TestRun = exports.TestRun = /*#__PURE__*/_effect.Schema.Union([/*#__PURE__*/_effect.Schema.Struct({
20
+ ...fields,
21
+ store: /*#__PURE__*/_effect.Schema.Literal('cache'),
22
+ state: /*#__PURE__*/_effect.Schema.Literals(['Running', 'Complete', 'Failed'])
23
+ }), /*#__PURE__*/_effect.Schema.Struct({
24
+ ...fields,
25
+ store: /*#__PURE__*/_effect.Schema.Literal('snapshot'),
26
+ state: /*#__PURE__*/_effect.Schema.Literal('Complete')
27
+ })]);
28
+ //# sourceMappingURL=TestRun.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestRun.js","names":["_effect","require","fields","id","Schema","Int","name","String","variant","TestRun","exports","Union","Struct","store","Literal","state","Literals"],"sources":["../../src/TestRun.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,OAAA,gBAAAC,OAAA;AAEA,MAAMC,MAAM,GAAG;EACXC,EAAE,EAAEC,cAAM,CAACC,GAAG;EACdC,IAAI,EAAEF,cAAM,CAACG,MAAM;EACnBC,OAAO,EAAEJ,cAAM,CAACG;CACnB;AAED;;;;;;AAMO,MAAME,OAAO,GAAAC,OAAA,CAAAD,OAAA,gBAAGL,cAAM,CAACO,KAAK,CAAC,cAChCP,cAAM,CAACQ,MAAM,CAAC;EACV,GAAGV,MAAM;EACTW,KAAK,eAAET,cAAM,CAACU,OAAO,CAAC,OAAO,CAAC;EAC9BC,KAAK,eAAEX,cAAM,CAACY,QAAQ,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC;CAC3D,CAAC,eACFZ,cAAM,CAACQ,MAAM,CAAC;EACV,GAAGV,MAAM;EACTW,KAAK,eAAET,cAAM,CAACU,OAAO,CAAC,UAAU,CAAC;EACjCC,KAAK,eAAEX,cAAM,CAACU,OAAO,CAAC,UAAU;CACnC,CAAC,CACL,CAAC","ignoreList":[]}