@shivaedev/test-story 0.35.0 → 0.36.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 (134) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +2 -2
  3. package/dist/server/{internal → adapters}/callSite.d.ts.map +1 -1
  4. package/dist/server/{internal → adapters}/callSite.js.map +1 -1
  5. package/dist/server/adapters/declareGenre.d.ts +3 -0
  6. package/dist/server/adapters/declareGenre.d.ts.map +1 -0
  7. package/dist/server/adapters/declareGenre.js +20 -0
  8. package/dist/server/adapters/declareGenre.js.map +1 -0
  9. package/dist/server/{internal → adapters}/engineSnapshot.d.ts +1 -1
  10. package/dist/server/{internal → adapters}/engineSnapshot.d.ts.map +1 -1
  11. package/dist/server/{internal → adapters}/engineSnapshot.js.map +1 -1
  12. package/dist/server/{internal → adapters}/failureReport.d.ts.map +1 -1
  13. package/dist/server/{internal → adapters}/failureReport.js +2 -2
  14. package/dist/server/{internal → adapters}/failureReport.js.map +1 -1
  15. package/dist/server/{internal → adapters}/fakeHttpAnswer.d.ts.map +1 -1
  16. package/dist/server/{internal → adapters}/fakeHttpAnswer.js +1 -1
  17. package/dist/server/{internal → adapters}/fakeHttpAnswer.js.map +1 -1
  18. package/dist/server/{internal → adapters}/fakeHttpReceive.d.ts.map +1 -1
  19. package/dist/server/{internal → adapters}/fakeHttpReceive.js +2 -2
  20. package/dist/server/{internal → adapters}/fakeHttpReceive.js.map +1 -1
  21. package/dist/server/adapters/fakeHttpRuntime.d.ts +34 -0
  22. package/dist/server/adapters/fakeHttpRuntime.d.ts.map +1 -0
  23. package/dist/server/adapters/fakeHttpRuntime.js +19 -0
  24. package/dist/server/adapters/fakeHttpRuntime.js.map +1 -0
  25. package/dist/server/{internal → adapters}/fakeHttpSend.d.ts +1 -0
  26. package/dist/server/{internal → adapters}/fakeHttpSend.d.ts.map +1 -1
  27. package/dist/server/{internal → adapters}/fakeHttpSend.js +5 -0
  28. package/dist/server/{internal → adapters}/fakeHttpSend.js.map +1 -1
  29. package/dist/server/{internal → adapters}/loopback.d.ts.map +1 -1
  30. package/dist/server/{internal → adapters}/loopback.js.map +1 -1
  31. package/dist/server/adapters/makeForwardingProxy.d.ts +2 -0
  32. package/dist/server/adapters/makeForwardingProxy.d.ts.map +1 -1
  33. package/dist/server/adapters/makeForwardingProxy.js +5 -0
  34. package/dist/server/adapters/makeForwardingProxy.js.map +1 -1
  35. package/dist/server/adapters/otlpProtobuf.d.ts.map +1 -0
  36. package/dist/server/{internal → adapters}/otlpProtobuf.js +1 -1
  37. package/dist/server/{internal → adapters}/otlpProtobuf.js.map +1 -1
  38. package/dist/server/{internal → adapters}/otlpWire.d.ts.map +1 -1
  39. package/dist/server/{internal → adapters}/otlpWire.js.map +1 -1
  40. package/dist/server/adapters/receiveOtlp.d.ts +3 -1
  41. package/dist/server/adapters/receiveOtlp.d.ts.map +1 -1
  42. package/dist/server/adapters/receiveOtlp.js +5 -0
  43. package/dist/server/adapters/receiveOtlp.js.map +1 -1
  44. package/dist/server/adapters/recordLines.d.ts +9 -0
  45. package/dist/server/adapters/recordLines.d.ts.map +1 -0
  46. package/dist/server/adapters/recordLines.js +15 -0
  47. package/dist/server/adapters/recordLines.js.map +1 -0
  48. package/dist/server/adapters/screenAct.d.ts +2 -0
  49. package/dist/server/adapters/screenAct.d.ts.map +1 -1
  50. package/dist/server/adapters/screenAct.js +7 -0
  51. package/dist/server/adapters/screenAct.js.map +1 -1
  52. package/dist/server/adapters/screenMutations.js +1 -1
  53. package/dist/server/adapters/screenMutations.js.map +1 -1
  54. package/dist/server/adapters/storyFailure.d.ts +1 -1
  55. package/dist/server/adapters/writeSnapshot.d.ts +1 -1
  56. package/dist/server/fakeHttpService.d.ts +9 -3
  57. package/dist/server/fakeHttpService.d.ts.map +1 -1
  58. package/dist/server/fakeHttpService.js +12 -24
  59. package/dist/server/fakeHttpService.js.map +1 -1
  60. package/dist/server/forwardingProxy.d.ts.map +1 -1
  61. package/dist/server/forwardingProxy.js +3 -4
  62. package/dist/server/forwardingProxy.js.map +1 -1
  63. package/dist/server/internal/fakeHttpControls.d.ts +10 -4
  64. package/dist/server/internal/fakeHttpControls.d.ts.map +1 -1
  65. package/dist/server/internal/fakeHttpControls.js +9 -12
  66. package/dist/server/internal/fakeHttpControls.js.map +1 -1
  67. package/dist/server/internal/fakeHttpGates.d.ts +6 -2
  68. package/dist/server/internal/fakeHttpGates.d.ts.map +1 -1
  69. package/dist/server/internal/fakeHttpGates.js +3 -3
  70. package/dist/server/internal/fakeHttpGates.js.map +1 -1
  71. package/dist/server/internal/narration.d.ts.map +1 -1
  72. package/dist/server/internal/narration.js +2 -2
  73. package/dist/server/internal/narration.js.map +1 -1
  74. package/dist/server/internal/otlpReadout.js +1 -1
  75. package/dist/server/internal/start.d.ts.map +1 -1
  76. package/dist/server/internal/start.js +1 -1
  77. package/dist/server/internal/start.js.map +1 -1
  78. package/dist/server/internal/storyIt.d.ts.map +1 -1
  79. package/dist/server/internal/storyIt.js +2 -21
  80. package/dist/server/internal/storyIt.js.map +1 -1
  81. package/dist/server/internal/traits.js +1 -1
  82. package/dist/server/lineSignals.d.ts.map +1 -1
  83. package/dist/server/lineSignals.js +2 -10
  84. package/dist/server/lineSignals.js.map +1 -1
  85. package/dist/server/otlpReceiver.d.ts +1 -1
  86. package/dist/server/otlpReceiver.d.ts.map +1 -1
  87. package/dist/server/otlpReceiver.js +3 -4
  88. package/dist/server/otlpReceiver.js.map +1 -1
  89. package/dist/server/screenDriver.d.ts.map +1 -1
  90. package/dist/server/screenDriver.js +3 -8
  91. package/dist/server/screenDriver.js.map +1 -1
  92. package/package.json +5 -5
  93. package/src/server/adapters/declareGenre.ts +27 -0
  94. package/src/server/{internal → adapters}/engineSnapshot.ts +1 -1
  95. package/src/server/{internal → adapters}/failureReport.ts +2 -2
  96. package/src/server/{internal → adapters}/fakeHttpAnswer.ts +1 -1
  97. package/src/server/{internal → adapters}/fakeHttpReceive.ts +2 -2
  98. package/src/server/adapters/fakeHttpRuntime.ts +20 -0
  99. package/src/server/{internal → adapters}/fakeHttpSend.ts +6 -0
  100. package/src/server/adapters/makeForwardingProxy.ts +6 -0
  101. package/src/server/{internal → adapters}/otlpProtobuf.ts +1 -1
  102. package/src/server/adapters/receiveOtlp.ts +6 -1
  103. package/src/server/adapters/recordLines.ts +19 -0
  104. package/src/server/adapters/screenAct.ts +10 -0
  105. package/src/server/adapters/screenMutations.ts +1 -1
  106. package/src/server/adapters/storyFailure.ts +1 -1
  107. package/src/server/adapters/writeSnapshot.ts +1 -1
  108. package/src/server/fakeHttpService.ts +15 -26
  109. package/src/server/forwardingProxy.ts +3 -4
  110. package/src/server/internal/fakeHttpControls.ts +16 -15
  111. package/src/server/internal/fakeHttpGates.ts +6 -4
  112. package/src/server/internal/narration.ts +2 -2
  113. package/src/server/internal/otlpReadout.ts +1 -1
  114. package/src/server/internal/start.ts +1 -1
  115. package/src/server/internal/storyIt.ts +2 -21
  116. package/src/server/internal/traits.ts +1 -1
  117. package/src/server/lineSignals.ts +2 -13
  118. package/src/server/otlpReceiver.ts +4 -4
  119. package/src/server/screenDriver.ts +3 -17
  120. package/dist/server/internal/otlpProtobuf.d.ts.map +0 -1
  121. /package/dist/server/{internal → adapters}/callSite.d.ts +0 -0
  122. /package/dist/server/{internal → adapters}/callSite.js +0 -0
  123. /package/dist/server/{internal → adapters}/engineSnapshot.js +0 -0
  124. /package/dist/server/{internal → adapters}/failureReport.d.ts +0 -0
  125. /package/dist/server/{internal → adapters}/fakeHttpAnswer.d.ts +0 -0
  126. /package/dist/server/{internal → adapters}/fakeHttpReceive.d.ts +0 -0
  127. /package/dist/server/{internal → adapters}/loopback.d.ts +0 -0
  128. /package/dist/server/{internal → adapters}/loopback.js +0 -0
  129. /package/dist/server/{internal → adapters}/otlpProtobuf.d.ts +0 -0
  130. /package/dist/server/{internal → adapters}/otlpWire.d.ts +0 -0
  131. /package/dist/server/{internal → adapters}/otlpWire.js +0 -0
  132. /package/src/server/{internal → adapters}/callSite.ts +0 -0
  133. /package/src/server/{internal → adapters}/loopback.ts +0 -0
  134. /package/src/server/{internal → adapters}/otlpWire.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"screenDriver.d.ts","sourceRoot":"","sources":["../../src/server/screenDriver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAS7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE9F,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;IAClE,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;IAC3E,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,CAAC,MAAM,WAAW,CAAC,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CACpD;;;;AAED,qBAAa,oBAAq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wBAAgB,YAAY,CAC3B,OAAO,EAAE,mBAAmB,GAC3B,CAAC;IAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAA;CAAE,CAAC,GACvI,YAAY,CAAC;AAChB,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;AA8B/F,iBAAS,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAWrD,YAAY;sBAOZ,YAAY,SAAS,MAAM;;uBAQ1B,YAAY,SAAS,MAAM;wBAE1B;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;wBAEhC,YAAY;EAEhC"}
@@ -1,7 +1,7 @@
1
1
  import * as Data from "effect/Data";
2
2
  import * as Effect from "effect/Effect";
3
3
  import { withLive } from "@shivaedev/test/withLive.ts";
4
- import { screenAct } from "#server/adapters/screenAct.ts";
4
+ import { directScreenAct, screenAct, screenPerform } from "#server/adapters/screenAct.ts";
5
5
  import { screenElements } from "#server/adapters/screenElements.ts";
6
6
  import { nextScreenHint } from "#server/internal/nextScreenHint.ts";
7
7
  import { screenInteractions } from "#server/internal/screenInteractions.ts";
@@ -42,16 +42,11 @@ function makeDriver(options, dialogs, dialogOwner) {
42
42
  };
43
43
  }
44
44
  function makeScreenActions(options, dialogs) {
45
- const { root, pending, activity, transport, tell, act = (action) => action(), timeoutMs = 3000, loadingTimeoutMs = 10_000, } = options;
45
+ const { root, pending, activity, transport, tell, act = directScreenAct, timeoutMs = 3000, loadingTimeoutMs = 10_000 } = options;
46
46
  const currentRoot = typeof root === "function" ? root : () => root;
47
47
  const elements = screenElements(currentRoot, dialogs);
48
48
  const waits = screenWaits({ ...options, act, loadingTimeoutMs, pending, root: currentRoot, timeoutMs }, elements, dialogs);
49
- function perform(line, action) {
50
- return Effect.promise(async () => {
51
- tell(line);
52
- await act(async () => action());
53
- });
54
- }
49
+ const perform = screenPerform(act, tell);
55
50
  return {
56
51
  ...screenReadouts(currentRoot, tell, dialogs),
57
52
  ...screenInteractions(elements, perform),
@@ -1 +1 @@
1
- {"version":3,"file":"screenDriver.js","sourceRoot":"","sources":["../../src/server/screenDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAiB5D,MAAM,OAAO,oBAAqB,SAAQ,IAAI,CAAC,WAAW,CAAC,sBAAsB,CAAC;IAC/D,OAAO,GACxB,wKAAwK,CAAC;CAC1K;AAED,MAAM,OAAO,qBAAsB,SAAQ,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAAC;IACjE,OAAO,GACxB,uJAAuJ,CAAC;CACzJ;AAoBD,MAAM,UAAU,YAAY,CAAC,OAA4B;IACxD,OAAO,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAC,OAA4B,EAAE,OAAgB,EAAE,WAA+B;IAClG,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I,MAAM,CAAC,EAAE,CAAC;gBACpF,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,qBAAqB,EAAE,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtI,CAAC;QACD,MAAM,EAAE,CAAC,QAAsB,EAAE,KAAa,EAAE,EAAE,CACjD,OAAO,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC9G,MAAM,EAAE,CAAC,QAA0C,EAAE,EAAE,CACtD,OAAO,KAAK,SAAS,IAAI,QAAQ,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC9I,MAAM,EAAE,CAAC,QAAQ,GAAiB,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,EAAE,CAAC;KACrI,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/test-story",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Tests that read like stories over the real engine: a story kit per engine with its own it, traits per feature, and a failure that prints the story, where it stopped and the engine's state",
5
5
  "homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/test-story#readme",
6
6
  "bugs": {
@@ -42,9 +42,9 @@
42
42
  "README.md"
43
43
  ],
44
44
  "dependencies": {
45
- "@shivaedev/contract": "0.32.0",
45
+ "@shivaedev/contract": "0.33.0",
46
46
  "@shivaedev/test": "0.14.0",
47
- "@shivaedev/test-sql": "0.17.0",
47
+ "@shivaedev/test-sql": "0.18.0",
48
48
  "dom-accessibility-api": "0.7.1"
49
49
  },
50
50
  "devDependencies": {
@@ -52,8 +52,8 @@
52
52
  "@effect/platform-node": "4.0.6",
53
53
  "@effect/sql-pg": "4.0.6",
54
54
  "@effect/vitest": "4.0.6",
55
- "@shivaedev/quality": "0.57.0",
56
- "@shivaedev/react": "0.35.0",
55
+ "@shivaedev/quality": "0.57.1",
56
+ "@shivaedev/react": "0.36.0",
57
57
  "@types/node": "24.19.2",
58
58
  "@types/react": "19.3.0",
59
59
  "@types/react-dom": "19.3.0",
@@ -0,0 +1,27 @@
1
+ import type { EffectTest, EffectTestOptions } from "@shivaedev/test/types.ts";
2
+
3
+ function withTags(options: number | EffectTestOptions | undefined, tags: readonly string[]): EffectTestOptions {
4
+ if (typeof options === "number") {
5
+ return { tags: [...tags], timeout: options };
6
+ }
7
+ const own = options?.tags ?? [];
8
+ return { ...options, tags: [...tags, ...(typeof own === "string" ? [own] : own)] };
9
+ }
10
+
11
+ // Vitest refuses a tag its config does not declare, so a genre the config leaves out names the test without tagging it.
12
+ export function declareGenre(
13
+ declare: EffectTest<unknown, unknown>,
14
+ title: string,
15
+ story: Parameters<EffectTest<unknown, unknown>>[1],
16
+ options: number | EffectTestOptions | undefined,
17
+ tag: string,
18
+ ) {
19
+ try {
20
+ declare(title, story, withTags(options, [tag]));
21
+ } catch (error) {
22
+ if (!(error instanceof Error && error.message.includes(`"${tag}"`))) {
23
+ throw error;
24
+ }
25
+ declare(title, story, withTags(options, []));
26
+ }
27
+ }
@@ -1,5 +1,5 @@
1
+ import type { FailedTest } from "#server/adapters/failureReport.ts";
1
2
  import { writeSnapshot } from "#server/adapters/writeSnapshot.ts";
2
- import type { FailedTest } from "#server/internal/failureReport.ts";
3
3
  import type { Subject } from "#server/internal/narration.ts";
4
4
  import { describeValue, toJson } from "#server/internal/render.ts";
5
5
  import { WIDTH, wrap, wrapJson } from "#server/internal/wrap.ts";
@@ -1,7 +1,7 @@
1
1
  import { relative } from "node:path";
2
2
  import process from "node:process";
3
- import { locate } from "#server/internal/callSite.ts";
4
- import { engineSnapshot } from "#server/internal/engineSnapshot.ts";
3
+ import { locate } from "#server/adapters/callSite.ts";
4
+ import { engineSnapshot } from "#server/adapters/engineSnapshot.ts";
5
5
  import type { Narration, Subject } from "#server/internal/narration.ts";
6
6
  import { describeValue } from "#server/internal/render.ts";
7
7
  import { explained, WIDTH, wrap } from "#server/internal/wrap.ts";
@@ -1,8 +1,8 @@
1
1
  import type { ServerResponse } from "node:http";
2
2
  import * as HttpStatus from "effect/http/HttpStatus";
3
+ import { fakeHttpSend, fakeHttpStrike } from "#server/adapters/fakeHttpSend.ts";
3
4
  import type { FakeHttpReply, FakeHttpRequest, FakeHttpRoute } from "#server/fakeHttpService.ts";
4
5
  import type { fakeHttpControls } from "#server/internal/fakeHttpControls.ts";
5
- import { fakeHttpSend, fakeHttpStrike } from "#server/internal/fakeHttpSend.ts";
6
6
 
7
7
  function pageReply(route: FakeHttpRoute, request: FakeHttpRequest): FakeHttpReply {
8
8
  if (route.reply) {
@@ -1,9 +1,9 @@
1
1
  import type { IncomingMessage, ServerResponse } from "node:http";
2
2
  import * as HttpStatus from "effect/http/HttpStatus";
3
+ import { fakeHttpAnswer } from "#server/adapters/fakeHttpAnswer.ts";
4
+ import { fakeHttpSend } from "#server/adapters/fakeHttpSend.ts";
3
5
  import type { FakeHttpRequestRecord, FakeHttpRoute, FakeHttpServiceOptions } from "#server/fakeHttpService.ts";
4
- import { fakeHttpAnswer } from "#server/internal/fakeHttpAnswer.ts";
5
6
  import type { fakeHttpControls } from "#server/internal/fakeHttpControls.ts";
6
- import { fakeHttpSend } from "#server/internal/fakeHttpSend.ts";
7
7
 
8
8
  function match(route: FakeHttpRoute, method: string, pathname: string) {
9
9
  if ((route.method ?? "GET").toUpperCase() !== method) {
@@ -0,0 +1,20 @@
1
+ import { createServer } from "node:http";
2
+ import * as Clock from "effect/Clock";
3
+ import * as Effect from "effect/Effect";
4
+ import type { FakeHttpRequestRecord, FakeHttpServiceOptions } from "#server/fakeHttpService.ts";
5
+ import { fakeHttpControls } from "#server/internal/fakeHttpControls.ts";
6
+ import { fakeHttpSignals } from "#server/internal/fakeHttpSignals.ts";
7
+ import { fakeHttpReceive } from "./fakeHttpReceive.ts";
8
+ import { loopbackServer } from "./loopback.ts";
9
+
10
+ export const fakeHttpRuntime = Effect.fnUntraced(function* (options: FakeHttpServiceOptions, tell: (line: string) => void) {
11
+ const clock = yield* Clock.Clock;
12
+ const requests: FakeHttpRequestRecord[] = [];
13
+ const controls = fakeHttpControls(tell, () => clock.currentTimeMillisUnsafe());
14
+ const signals = fakeHttpSignals();
15
+ const server = createServer((request, response) => fakeHttpReceive(request, response, options, requests, controls, tell, signals.record));
16
+ const url = yield* loopbackServer(server);
17
+ yield* Effect.addFinalizer(() => Effect.sync(signals.close));
18
+ yield* Effect.addFinalizer(controls.close);
19
+ return { controls, requests, signals, url };
20
+ });
@@ -63,3 +63,9 @@ export async function fakeHttpStrike(response: ServerResponse, fault: Exclude<Fa
63
63
  }
64
64
  response.destroy();
65
65
  }
66
+
67
+ export async function fakeHttpPause(response: ServerResponse, pending: () => Promise<void> | undefined) {
68
+ const connection = fakeHttpConnection(response);
69
+ await connection.pause(pending());
70
+ return !(response.destroyed || response.writableEnded || response.headersSent);
71
+ }
@@ -1,7 +1,9 @@
1
1
  import { createServer, type IncomingMessage, request } from "node:http";
2
2
  import { isIP } from "node:net";
3
+ import * as Effect from "effect/Effect";
3
4
  import * as HttpStatus from "effect/http/HttpStatus";
4
5
  import type { ForwardingProxyOptions } from "#server/forwardingProxy.ts";
6
+ import { loopbackServer } from "./loopback.ts";
5
7
  import { proxyConnections } from "./proxyConnections.ts";
6
8
 
7
9
  export function makeForwardingProxy(upstream: string, options: ForwardingProxyOptions) {
@@ -57,3 +59,7 @@ export function makeForwardingProxy(upstream: string, options: ForwardingProxyOp
57
59
  });
58
60
  return { ...connections, server };
59
61
  }
62
+
63
+ export function checkLocalAddress(host: string) {
64
+ return Effect.scoped(loopbackServer(createServer(), { host }));
65
+ }
@@ -1,4 +1,4 @@
1
- import { type WireValue, wireFields } from "#server/internal/otlpWire.ts";
1
+ import { type WireValue, wireFields } from "#server/adapters/otlpWire.ts";
2
2
 
3
3
  type Scalar = "string" | "hex" | "base64" | "number" | "integer" | "boolean" | "double" | "fixed64";
4
4
  type Field = readonly [name: string, type: Scalar | (() => Descriptor), repeated?: boolean];
@@ -1,4 +1,5 @@
1
- import type { IncomingMessage, ServerResponse } from "node:http";
1
+ import { createServer, type IncomingMessage, type ServerResponse } from "node:http";
2
+ import * as Effect from "effect/Effect";
2
3
  import * as HttpStatus from "effect/http/HttpStatus";
3
4
  import type { OtlpExport, OtlpReceiverOptions, OtlpSpan } from "#server/otlpReceiver.ts";
4
5
 
@@ -43,3 +44,7 @@ export async function receiveOtlp(
43
44
  response.writeHead(HttpStatus.fromLiteral("BadRequest")).end();
44
45
  }
45
46
  }
47
+
48
+ export function otlpServer(requests: OtlpExport[], record: (span: OtlpSpan) => void, options: OtlpReceiverOptions) {
49
+ return Effect.sync(() => createServer((request, response) => receiveOtlp(request, response, requests, record, options)));
50
+ }
@@ -0,0 +1,19 @@
1
+ import { createInterface } from "node:readline";
2
+ import type { Readable } from "node:stream";
3
+ import * as Effect from "effect/Effect";
4
+ import { recordedSignals } from "#server/internal/recordedSignals.ts";
5
+
6
+ export const recordLines = Effect.fnUntraced(function* (output: Readable) {
7
+ const signals = recordedSignals<string, Error>();
8
+ yield* Effect.acquireRelease(
9
+ Effect.sync(() => {
10
+ const reader = createInterface({ crlfDelay: Number.POSITIVE_INFINITY, input: output });
11
+ reader.on("line", signals.push);
12
+ reader.once("close", () => signals.end());
13
+ reader.on("error", signals.end);
14
+ return reader;
15
+ }),
16
+ (reader) => Effect.sync(() => reader.close()),
17
+ );
18
+ return signals;
19
+ });
@@ -18,3 +18,13 @@ export function screenAct<E>(act: NonNullable<ScreenDriverOptions["act"]>, actio
18
18
  return Effect.promise(() => completed);
19
19
  });
20
20
  }
21
+
22
+ export const directScreenAct: NonNullable<ScreenDriverOptions["act"]> = (action) => action();
23
+
24
+ export function screenPerform(act: NonNullable<ScreenDriverOptions["act"]>, tell: (line: string) => void) {
25
+ return (line: string, action: () => void) =>
26
+ Effect.promise(async () => {
27
+ tell(line);
28
+ await act(async () => action());
29
+ });
30
+ }
@@ -3,7 +3,7 @@ import * as Effect from "effect/Effect";
3
3
  export function screenMutations(root: HTMLElement, changed: () => void) {
4
4
  return Effect.acquireRelease(
5
5
  Effect.sync(() => {
6
- const observer = new MutationObserver(changed);
6
+ const observer = new (root.ownerDocument.defaultView ?? globalThis).MutationObserver(changed);
7
7
  // Root getters can follow navigation, and visibility can change on an ancestor.
8
8
  observer.observe(root.ownerDocument, { attributes: true, characterData: true, childList: true, subtree: true });
9
9
  observer.observe(root, { attributes: true, characterData: true, childList: true, subtree: true });
@@ -1,6 +1,6 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import type { TestContext } from "vitest";
3
- import type { FailedTest } from "#server/internal/failureReport.ts";
3
+ import type { FailedTest } from "#server/adapters/failureReport.ts";
4
4
  import { describeFailure } from "#server/internal/render.ts";
5
5
 
6
6
  export type FailureContext = Pick<TestContext, "onTestFailed" | "task">;
@@ -1,7 +1,7 @@
1
1
  import { mkdirSync, writeFileSync } from "node:fs";
2
2
  import { basename, dirname, join, relative } from "node:path";
3
3
  import process from "node:process";
4
- import type { FailedTest } from "#server/internal/failureReport.ts";
4
+ import type { FailedTest } from "#server/adapters/failureReport.ts";
5
5
  import { describeValue, toJson } from "#server/internal/render.ts";
6
6
  import { wrap } from "#server/internal/wrap.ts";
7
7
 
@@ -1,10 +1,6 @@
1
- import { createServer, type IncomingHttpHeaders } from "node:http";
2
- import * as Clock from "effect/Clock";
1
+ import type { IncomingHttpHeaders } from "node:http";
3
2
  import * as Effect from "effect/Effect";
4
- import { fakeHttpControls } from "#server/internal/fakeHttpControls.ts";
5
- import { fakeHttpReceive } from "#server/internal/fakeHttpReceive.ts";
6
- import { fakeHttpSignals } from "#server/internal/fakeHttpSignals.ts";
7
- import { loopbackServer } from "#server/internal/loopback.ts";
3
+ import { fakeHttpRuntime } from "#server/adapters/fakeHttpRuntime.ts";
8
4
  import { type UntilOptions, until } from "#server/until.ts";
9
5
 
10
6
  export interface FakeHttpRequest {
@@ -69,45 +65,38 @@ export interface FakeHttpHold {
69
65
  }
70
66
 
71
67
  export const fakeHttpService = Effect.fnUntraced(function* (options: FakeHttpServiceOptions) {
72
- const clock = yield* Clock.Clock;
73
- const requests: FakeHttpRequestRecord[] = [];
74
68
  let narrate = options.tell;
75
69
  function tell(line: string) {
76
70
  narrate?.(line);
77
71
  }
78
- const controls = fakeHttpControls(tell, () => clock.currentTimeMillisUnsafe());
79
- const signals = fakeHttpSignals();
80
- const server = createServer((request, response) => fakeHttpReceive(request, response, options, requests, controls, tell, signals.record));
81
- const url = yield* loopbackServer(server);
82
-
83
- yield* Effect.addFinalizer(() => Effect.sync(signals.close));
84
- yield* Effect.addFinalizer(controls.close);
85
- function checkRoute(route: string) {
72
+ const { controls, signals, requests, url } = yield* fakeHttpRuntime(options, tell);
73
+ const checkRoute = Effect.fnUntraced(function* (route: string) {
86
74
  if (!Object.hasOwn(options.routes, route)) {
87
- throw new Error(`Unknown fake HTTP route "${route}".\nhelp: Use a name from fakeHttpService's routes when scripting a reply or hold.`);
75
+ return yield* Effect.die(
76
+ new Error(`Unknown fake HTTP route "${route}".\nhelp: Use a name from fakeHttpService's routes when scripting a reply or hold.`),
77
+ );
88
78
  }
89
- }
79
+ });
90
80
  return {
91
81
  completed: signals.completed,
92
82
  fault: (route: string, fault: FakeHttpFault, scope?: FakeHttpScope) =>
93
- Effect.sync(() => checkRoute(route)).pipe(Effect.andThen(controls.fault(route, fault, scope))),
94
- hold: (route: string, holdOptions?: FakeHttpHoldOptions) =>
95
- Effect.sync(() => checkRoute(route)).pipe(Effect.andThen(controls.hold(route, holdOptions))),
83
+ checkRoute(route).pipe(Effect.andThen(controls.fault(route, fault, scope))),
84
+ hold: (route: string, holdOptions?: FakeHttpHoldOptions) => checkRoute(route).pipe(Effect.andThen(controls.hold(route, holdOptions))),
96
85
  narrate: (sink: (line: string) => void) => {
97
86
  narrate = sink;
98
87
  },
99
88
  received: signals.received,
100
89
  releaseOnArrival: (route: string, arrival: string, scope?: FakeHttpScope) =>
101
- Effect.sync(() => {
102
- checkRoute(route);
103
- checkRoute(arrival);
90
+ Effect.gen(function* () {
91
+ yield* checkRoute(route);
92
+ yield* checkRoute(arrival);
104
93
  }).pipe(Effect.andThen(controls.releaseOnArrival(route, arrival, scope))),
105
94
  get requests(): readonly FakeHttpRequestRecord[] {
106
95
  return requests.slice();
107
96
  },
108
97
  scriptFault: (route: string, fault: FakeHttpFault, scriptOptions?: FakeHttpScriptOptions) =>
109
- Effect.sync(() => checkRoute(route)).pipe(Effect.andThen(controls.scriptFault(route, fault, scriptOptions))),
110
- stall: (route: string, scope?: FakeHttpScope) => Effect.sync(() => checkRoute(route)).pipe(Effect.andThen(controls.stall(route, scope))),
98
+ checkRoute(route).pipe(Effect.andThen(controls.scriptFault(route, fault, scriptOptions))),
99
+ stall: (route: string, scope?: FakeHttpScope) => checkRoute(route).pipe(Effect.andThen(controls.stall(route, scope))),
111
100
  untilAbandoned: (matches: (request: FakeHttpRequestRecord) => boolean, wait: UntilOptions) => until(signals.abandoned, matches, wait),
112
101
  url,
113
102
  };
@@ -1,7 +1,6 @@
1
- import { createServer } from "node:http";
2
1
  import * as Effect from "effect/Effect";
3
- import { makeForwardingProxy } from "#server/adapters/makeForwardingProxy.ts";
4
- import { loopbackServer } from "#server/internal/loopback.ts";
2
+ import { loopbackServer } from "#server/adapters/loopback.ts";
3
+ import { checkLocalAddress, makeForwardingProxy } from "#server/adapters/makeForwardingProxy.ts";
5
4
 
6
5
  export interface ForwardingProxyOptions {
7
6
  readonly forwardedHops?: readonly string[];
@@ -11,7 +10,7 @@ export interface ForwardingProxyOptions {
11
10
 
12
11
  export const forwardingProxy = Effect.fnUntraced(function* (upstream: string, options: ForwardingProxyOptions = {}) {
13
12
  if (options.localAddress !== undefined) {
14
- yield* Effect.scoped(loopbackServer(createServer(), { host: options.localAddress })).pipe(
13
+ yield* checkLocalAddress(options.localAddress).pipe(
15
14
  Effect.mapError((cause) => new Error(`Cannot acquire forwarding proxy with local address ${options.localAddress}`, { cause })),
16
15
  );
17
16
  }
@@ -1,5 +1,6 @@
1
1
  import type { ServerResponse } from "node:http";
2
2
  import * as Effect from "effect/Effect";
3
+ import { fakeHttpPause, fakeHttpSend } from "#server/adapters/fakeHttpSend.ts";
3
4
  import type {
4
5
  FakeHttpFault,
5
6
  FakeHttpHoldOptions,
@@ -11,7 +12,6 @@ import type {
11
12
  import { fakeHttpGates } from "#server/internal/fakeHttpGates.ts";
12
13
  import { fakeHttpScripts } from "#server/internal/fakeHttpScripts.ts";
13
14
  import { fakeHttpSelection } from "#server/internal/fakeHttpSelection.ts";
14
- import { fakeHttpConnection, fakeHttpSend } from "#server/internal/fakeHttpSend.ts";
15
15
  import { describeValue } from "#server/internal/render.ts";
16
16
  import { explained } from "#server/internal/wrap.ts";
17
17
 
@@ -50,8 +50,8 @@ export function fakeHttpControls(tell: (line: string) => void, now: () => number
50
50
  cause,
51
51
  });
52
52
  },
53
- fault: (route: string, fault: FakeHttpFault, scope?: FakeHttpScope) =>
54
- Effect.promise(async () => {
53
+ fault: (route: string, fault: FakeHttpFault, scope?: FakeHttpScope): Effect.Effect<void> =>
54
+ Effect.gen(function* () {
55
55
  const selection = fakeHttpSelection(route, scope);
56
56
  const found = [...active].find(
57
57
  ([candidate, entry]) =>
@@ -60,28 +60,29 @@ export function fakeHttpControls(tell: (line: string) => void, now: () => number
60
60
  && candidate.headersSent === (fault.kind === "reset"),
61
61
  );
62
62
  if (!found) {
63
- throw new Error(
64
- `Fake HTTP route "${route}" has no request ready for a ${fault.kind} fault.\nhelp: Wait for a hold before a status or drop fault, or for response headers before a reset fault.`,
63
+ return yield* Effect.die(
64
+ new Error(
65
+ `Fake HTTP route "${route}" has no request ready for a ${fault.kind} fault.\nhelp: Wait for a hold before a status or drop fault, or for response headers before a reset fault.`,
66
+ ),
65
67
  );
66
68
  }
67
69
  const [response, { request }] = found;
68
70
  tell(`fake HTTP ${selection.label} fault ${fault.kind}`);
69
71
  if (fault.kind === "status") {
70
- await fakeHttpSend(response, typeof fault.reply === "function" ? fault.reply(request, now()) : fault.reply);
72
+ yield* Effect.promise(() => fakeHttpSend(response, typeof fault.reply === "function" ? fault.reply(request, now()) : fault.reply));
71
73
  } else {
72
74
  response.destroy();
73
75
  }
74
76
  }),
75
- hold: (route: string, options?: FakeHttpHoldOptions) => Effect.sync(() => holds.make(route, options, options?.once)),
76
- pause: async (route: string, request: FakeHttpRequest, response: ServerResponse) => {
77
- await fakeHttpConnection(response).pause(holds.get(route, request)?.enter());
78
- return !(response.destroyed || response.writableEnded || response.headersSent);
79
- },
80
- releaseOnArrival: (route: string, arrival: string, scope?: FakeHttpScope) =>
81
- Effect.sync(() => {
77
+ hold: (route: string, options?: FakeHttpHoldOptions) => holds.make(route, options, options?.once),
78
+ pause: (route: string, request: FakeHttpRequest, response: ServerResponse) => fakeHttpPause(response, () => holds.get(route, request)?.enter()),
79
+ releaseOnArrival: (route: string, arrival: string, scope?: FakeHttpScope): Effect.Effect<void> =>
80
+ Effect.gen(function* () {
82
81
  const hold = holds.at(route, scope);
83
82
  if (!hold) {
84
- throw new Error(`Fake HTTP route "${route}" has no hold.\nhelp: Hold the route before scripting its release on arrival.`);
83
+ return yield* Effect.die(
84
+ new Error(`Fake HTTP route "${route}" has no hold.\nhelp: Hold the route before scripting its release on arrival.`),
85
+ );
85
86
  }
86
87
  const releases = arrivals.get(arrival) ?? new Set<() => void>();
87
88
  releases.add(hold.release);
@@ -90,7 +91,7 @@ export function fakeHttpControls(tell: (line: string) => void, now: () => number
90
91
  }),
91
92
  reply: (source: FakeHttpReplySource, request: FakeHttpRequest) => (typeof source === "function" ? source(request, now()) : source),
92
93
  scriptFault: (route: string, fault: FakeHttpFault, options?: FakeHttpScriptOptions) => Effect.sync(() => scripts.make(route, fault, options)),
93
- stall: (route: string, scope?: FakeHttpScope) => Effect.sync(() => stalls.make(route, scope)),
94
+ stall: (route: string, scope?: FakeHttpScope) => stalls.make(route, scope),
94
95
  stallBody: (route: string, request: FakeHttpRequest) => {
95
96
  const stall = stalls.get(route, request);
96
97
  return stall ? () => stall.enter() : undefined;
@@ -13,11 +13,13 @@ export function fakeHttpGates(tell: (line: string) => void, kind: "hold" | "stal
13
13
  }
14
14
  },
15
15
  get: (route: string, request: FakeHttpRequest) => [...gates.values()].find((gate) => gate.matches(route, request)),
16
- make: (route: string, scope?: FakeHttpScope, once = false): FakeHttpHold => {
16
+ make: Effect.fnUntraced(function* (route: string, scope?: FakeHttpScope, once = false) {
17
17
  const selection = fakeHttpSelection(route, scope);
18
18
  const label = selection.label;
19
19
  if (gates.has(label)) {
20
- throw new Error(`Fake HTTP route "${route}" already has a ${kind}.\nhelp: Release its current ${kind} before scripting another.`);
20
+ return yield* Effect.die(
21
+ new Error(`Fake HTTP route "${route}" already has a ${kind}.\nhelp: Release its current ${kind} before scripting another.`),
22
+ );
21
23
  }
22
24
  const waiting = Deferred.makeUnsafe<void>();
23
25
  const released = Promise.withResolvers<void>();
@@ -41,7 +43,7 @@ export function fakeHttpGates(tell: (line: string) => void, kind: "hold" | "stal
41
43
  };
42
44
  gates.set(label, gate);
43
45
  tell(kind === "hold" ? `fake HTTP ${label} held` : `fake HTTP ${label} body will stall`);
44
- return { release: Effect.sync(gate.release), waiting: Deferred.await(waiting) };
45
- },
46
+ return { release: Effect.sync(gate.release), waiting: Deferred.await(waiting) } satisfies FakeHttpHold;
47
+ }),
46
48
  };
47
49
  }
@@ -1,8 +1,8 @@
1
1
  import * as Cause from "effect/Cause";
2
2
  import * as Effect from "effect/Effect";
3
+ import { callSite } from "#server/adapters/callSite.ts";
4
+ import { creationReport, failureReport } from "#server/adapters/failureReport.ts";
3
5
  import { type FailureContext, reportOnFailure } from "#server/adapters/storyFailure.ts";
4
- import { callSite } from "#server/internal/callSite.ts";
5
- import { creationReport, failureReport } from "#server/internal/failureReport.ts";
6
6
  import { hooked } from "#server/internal/hooked.ts";
7
7
 
8
8
  export interface Refusal {
@@ -1,5 +1,5 @@
1
1
  import * as Schema from "effect/Schema";
2
- import { otlpProtobuf } from "#server/internal/otlpProtobuf.ts";
2
+ import { otlpProtobuf } from "#server/adapters/otlpProtobuf.ts";
3
3
  import { Attribute } from "#server/internal/otlpValue.ts";
4
4
 
5
5
  const Attributes = Schema.optionalKey(Schema.Array(Attribute));
@@ -2,8 +2,8 @@ import * as Cause from "effect/Cause";
2
2
  import * as Context from "effect/Context";
3
3
  import * as Effect from "effect/Effect";
4
4
  import * as Tracer from "effect/Tracer";
5
+ import { callSite } from "#server/adapters/callSite.ts";
5
6
  import type { FailureContext } from "#server/adapters/storyFailure.ts";
6
- import { callSite } from "#server/internal/callSite.ts";
7
7
  import { hooked } from "#server/internal/hooked.ts";
8
8
  import { narrate, narrateCreation } from "#server/internal/narration.ts";
9
9
  import { runUntil } from "#server/internal/runUntil.ts";
@@ -5,6 +5,7 @@ import * as Layer from "effect/Layer";
5
5
  import * as TestCrypto from "effect/testing/TestCrypto";
6
6
  import { makeEffectIt } from "@shivaedev/test/adapters/makeEffectIt.ts";
7
7
  import type { EffectTest, EffectTestOptions } from "@shivaedev/test/types.ts";
8
+ import { declareGenre } from "#server/adapters/declareGenre.ts";
8
9
  import { freshDocument, inDom } from "#server/internal/domDocument.ts";
9
10
  import { type Genre, genreOf } from "#server/internal/genre.ts";
10
11
  import { type AnyEffect, hooked } from "#server/internal/hooked.ts";
@@ -25,34 +26,14 @@ export interface LooseIt extends LooseTest {
25
26
  readonly skipIf: (condition: unknown) => LooseTest;
26
27
  }
27
28
 
28
- function withTags(options: number | EffectTestOptions | undefined, tags: readonly string[]): EffectTestOptions {
29
- if (typeof options === "number") {
30
- return { tags: [...tags], timeout: options };
31
- }
32
- const own = options?.tags ?? [];
33
- return { ...options, tags: [...tags, ...(typeof own === "string" ? [own] : own)] };
34
- }
35
-
36
29
  function storyOf(definition: LooseDefinition, given: readonly LooseTrait[], body: LooseBody | undefined) {
37
30
  return function* story(_harness: unknown, context: TestContext) {
38
31
  return yield* start(definition, given, context, (told) => hooked(() => body?.(told, context)));
39
32
  };
40
33
  }
41
34
 
42
- // Vitest refuses a tag its config does not declare, so a genre the config leaves out names the test without tagging it.
43
35
  function declaring(definition: LooseDefinition, genre: Genre, declare: EffectTest<unknown, unknown>): LooseTest {
44
- return (name, given, body, options) => {
45
- const title = `${genre.title}: ${name}`;
46
- const story = storyOf(definition, given, body);
47
- try {
48
- declare(title, story, withTags(options, [genre.tag.name]));
49
- } catch (error) {
50
- if (!(error instanceof Error && error.message.includes(`"${genre.tag.name}"`))) {
51
- throw error;
52
- }
53
- declare(title, story, withTags(options, []));
54
- }
55
- };
36
+ return (name, given, body, options) => declareGenre(declare, `${genre.title}: ${name}`, storyOf(definition, given, body), options, genre.tag.name);
56
37
  }
57
38
 
58
39
  export function storyIt(definition: LooseDefinition): LooseIt {
@@ -1,4 +1,4 @@
1
- import { callSite } from "#server/internal/callSite.ts";
1
+ import { callSite } from "#server/adapters/callSite.ts";
2
2
 
3
3
  export interface TraitPart<TStage extends string, TApply> {
4
4
  readonly apply: TApply;
@@ -1,21 +1,10 @@
1
- import { createInterface } from "node:readline";
2
1
  import type { Readable } from "node:stream";
3
2
  import * as Effect from "effect/Effect";
4
- import { recordedSignals } from "#server/internal/recordedSignals.ts";
3
+ import { recordLines } from "#server/adapters/recordLines.ts";
5
4
  import { type UntilOptions, until } from "#server/until.ts";
6
5
 
7
6
  export const lineSignals = Effect.fnUntraced(function* (output: Readable) {
8
- const signals = recordedSignals<string, Error>();
9
- yield* Effect.acquireRelease(
10
- Effect.sync(() => {
11
- const reader = createInterface({ crlfDelay: Number.POSITIVE_INFINITY, input: output });
12
- reader.on("line", signals.push);
13
- reader.once("close", () => signals.end());
14
- reader.on("error", signals.end);
15
- return reader;
16
- }),
17
- (reader) => Effect.sync(() => reader.close()),
18
- );
7
+ const signals = yield* recordLines(output);
19
8
  return {
20
9
  get lines(): readonly string[] {
21
10
  return signals.values.slice();