@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.16

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 (235) hide show
  1. package/README.md +111 -101
  2. package/app_meta.ts +56 -54
  3. package/config/config.ts +60 -57
  4. package/config/secrets.ts +45 -52
  5. package/config/value.ts +23 -26
  6. package/cron/mod.ts +28 -29
  7. package/dist/app_meta.d.ts +52 -50
  8. package/dist/app_meta.d.ts.map +1 -1
  9. package/dist/app_meta.js +2 -2
  10. package/dist/app_meta.js.map +1 -1
  11. package/dist/config/config.d.ts +58 -55
  12. package/dist/config/config.d.ts.map +1 -1
  13. package/dist/config/config.js +8 -9
  14. package/dist/config/config.js.map +1 -1
  15. package/dist/config/secrets.d.ts +45 -52
  16. package/dist/config/secrets.d.ts.map +1 -1
  17. package/dist/config/secrets.js +8 -9
  18. package/dist/config/secrets.js.map +1 -1
  19. package/dist/config/value.d.ts +20 -23
  20. package/dist/config/value.d.ts.map +1 -1
  21. package/dist/config/value.js +20 -23
  22. package/dist/config/value.js.map +1 -1
  23. package/dist/cron/mod.d.ts +26 -27
  24. package/dist/cron/mod.d.ts.map +1 -1
  25. package/dist/cron/mod.js +13 -14
  26. package/dist/cron/mod.js.map +1 -1
  27. package/dist/frontends/mod.d.ts +20 -19
  28. package/dist/frontends/mod.d.ts.map +1 -1
  29. package/dist/frontends/mod.js +20 -19
  30. package/dist/frontends/mod.js.map +1 -1
  31. package/dist/gateway/errors.d.ts +28 -30
  32. package/dist/gateway/errors.d.ts.map +1 -1
  33. package/dist/gateway/errors.js +29 -31
  34. package/dist/gateway/errors.js.map +1 -1
  35. package/dist/gateway/match.d.ts +54 -54
  36. package/dist/gateway/match.d.ts.map +1 -1
  37. package/dist/gateway/match.js +56 -56
  38. package/dist/gateway/match.js.map +1 -1
  39. package/dist/gateway/middleware.d.ts +62 -64
  40. package/dist/gateway/middleware.d.ts.map +1 -1
  41. package/dist/gateway/middleware.js +1 -1
  42. package/dist/gateway/middleware.js.map +1 -1
  43. package/dist/gateway/mod.d.ts +64 -67
  44. package/dist/gateway/mod.d.ts.map +1 -1
  45. package/dist/gateway/mod.js +72 -76
  46. package/dist/gateway/mod.js.map +1 -1
  47. package/dist/gateway/request.d.ts +138 -134
  48. package/dist/gateway/request.d.ts.map +1 -1
  49. package/dist/gateway/request.js +117 -108
  50. package/dist/gateway/request.js.map +1 -1
  51. package/dist/gateway/serve.d.ts +29 -34
  52. package/dist/gateway/serve.d.ts.map +1 -1
  53. package/dist/gateway/serve.js +51 -56
  54. package/dist/gateway/serve.js.map +1 -1
  55. package/dist/gateways/mod.d.ts +23 -21
  56. package/dist/gateways/mod.d.ts.map +1 -1
  57. package/dist/gateways/mod.js +25 -23
  58. package/dist/gateways/mod.js.map +1 -1
  59. package/dist/internal/runtime/napi/napi.cjs +1 -1
  60. package/dist/internal/runtime/napi/napi.d.cts +10 -3
  61. package/dist/internal/runtime/shutdown.d.ts +75 -57
  62. package/dist/internal/runtime/shutdown.d.ts.map +1 -1
  63. package/dist/internal/runtime/shutdown.js +88 -84
  64. package/dist/internal/runtime/shutdown.js.map +1 -1
  65. package/dist/log/logger.d.ts +43 -37
  66. package/dist/log/logger.d.ts.map +1 -1
  67. package/dist/log/logger.js +26 -25
  68. package/dist/log/logger.js.map +1 -1
  69. package/dist/metrics/mod.d.ts +133 -114
  70. package/dist/metrics/mod.d.ts.map +1 -1
  71. package/dist/metrics/mod.js +109 -101
  72. package/dist/metrics/mod.js.map +1 -1
  73. package/dist/otel.d.ts +6 -3
  74. package/dist/otel.d.ts.map +1 -1
  75. package/dist/otel.js +6 -3
  76. package/dist/otel.js.map +1 -1
  77. package/dist/pubsub/subscription.d.ts +88 -116
  78. package/dist/pubsub/subscription.d.ts.map +1 -1
  79. package/dist/pubsub/subscription.js +14 -17
  80. package/dist/pubsub/subscription.js.map +1 -1
  81. package/dist/pubsub/topic.d.ts +86 -113
  82. package/dist/pubsub/topic.d.ts.map +1 -1
  83. package/dist/pubsub/topic.js +68 -82
  84. package/dist/pubsub/topic.js.map +1 -1
  85. package/dist/reqctx/mod.d.ts +83 -86
  86. package/dist/reqctx/mod.d.ts.map +1 -1
  87. package/dist/reqctx/mod.js +39 -41
  88. package/dist/reqctx/mod.js.map +1 -1
  89. package/dist/services/index.d.ts +76 -75
  90. package/dist/services/index.d.ts.map +1 -1
  91. package/dist/services/index.js +73 -71
  92. package/dist/services/index.js.map +1 -1
  93. package/dist/shutdown/mod.d.ts +26 -25
  94. package/dist/shutdown/mod.d.ts.map +1 -1
  95. package/dist/shutdown/mod.js +26 -25
  96. package/dist/shutdown/mod.js.map +1 -1
  97. package/dist/storage/clickhouse/database.d.ts +113 -115
  98. package/dist/storage/clickhouse/database.d.ts.map +1 -1
  99. package/dist/storage/clickhouse/database.js +65 -79
  100. package/dist/storage/clickhouse/database.js.map +1 -1
  101. package/dist/storage/clickhouse/errors.d.ts +25 -26
  102. package/dist/storage/clickhouse/errors.d.ts.map +1 -1
  103. package/dist/storage/clickhouse/errors.js +15 -17
  104. package/dist/storage/clickhouse/errors.js.map +1 -1
  105. package/dist/storage/clickhouse/mod.d.ts +10 -10
  106. package/dist/storage/clickhouse/mod.js +10 -10
  107. package/dist/storage/objects/bucket.d.ts +196 -225
  108. package/dist/storage/objects/bucket.d.ts.map +1 -1
  109. package/dist/storage/objects/bucket.js +71 -84
  110. package/dist/storage/objects/bucket.js.map +1 -1
  111. package/dist/storage/objects/error.d.ts +4 -4
  112. package/dist/storage/objects/error.js +4 -4
  113. package/dist/storage/postgres/database.d.ts +124 -149
  114. package/dist/storage/postgres/database.d.ts.map +1 -1
  115. package/dist/storage/postgres/database.js +98 -135
  116. package/dist/storage/postgres/database.js.map +1 -1
  117. package/dist/storage/postgres/errors.d.ts +42 -48
  118. package/dist/storage/postgres/errors.d.ts.map +1 -1
  119. package/dist/storage/postgres/errors.js +44 -51
  120. package/dist/storage/postgres/errors.js.map +1 -1
  121. package/dist/storage/postgres/interval.d.ts +19 -19
  122. package/dist/storage/postgres/interval.d.ts.map +1 -1
  123. package/dist/storage/postgres/interval.js +21 -21
  124. package/dist/storage/postgres/interval.js.map +1 -1
  125. package/dist/storage/redis/bitfield.d.ts +48 -23
  126. package/dist/storage/redis/bitfield.d.ts.map +1 -1
  127. package/dist/storage/redis/bitfield.js +38 -19
  128. package/dist/storage/redis/bitfield.js.map +1 -1
  129. package/dist/storage/redis/command.d.ts +16 -12
  130. package/dist/storage/redis/command.d.ts.map +1 -1
  131. package/dist/storage/redis/command.js +16 -12
  132. package/dist/storage/redis/command.js.map +1 -1
  133. package/dist/storage/redis/commands.d.ts +99 -100
  134. package/dist/storage/redis/commands.d.ts.map +1 -1
  135. package/dist/storage/redis/commands.js +84 -85
  136. package/dist/storage/redis/commands.js.map +1 -1
  137. package/dist/storage/redis/database.d.ts +138 -122
  138. package/dist/storage/redis/database.d.ts.map +1 -1
  139. package/dist/storage/redis/database.js +120 -101
  140. package/dist/storage/redis/database.js.map +1 -1
  141. package/dist/storage/redis/mod.d.ts +52 -48
  142. package/dist/storage/redis/mod.d.ts.map +1 -1
  143. package/dist/storage/redis/mod.js +52 -48
  144. package/dist/storage/redis/mod.js.map +1 -1
  145. package/dist/storage/redis/options.d.ts +26 -24
  146. package/dist/storage/redis/options.d.ts.map +1 -1
  147. package/dist/storage/redis/options.js.map +1 -1
  148. package/dist/storage/redis/pubsub.d.ts +16 -16
  149. package/dist/storage/redis/pubsub.d.ts.map +1 -1
  150. package/dist/storage/redis/pubsub.js +14 -14
  151. package/dist/storage/redis/pubsub.js.map +1 -1
  152. package/dist/storage/redis/reply.d.ts +80 -72
  153. package/dist/storage/redis/reply.d.ts.map +1 -1
  154. package/dist/storage/redis/reply.js +53 -46
  155. package/dist/storage/redis/reply.js.map +1 -1
  156. package/dist/storage/redis/scan.d.ts +4 -4
  157. package/dist/storage/redis/scan.d.ts.map +1 -1
  158. package/dist/storage/redis/scan.js +6 -6
  159. package/dist/storage/redis/scan.js.map +1 -1
  160. package/dist/storage/redis/script.d.ts +28 -21
  161. package/dist/storage/redis/script.d.ts.map +1 -1
  162. package/dist/storage/redis/script.js +29 -22
  163. package/dist/storage/redis/script.js.map +1 -1
  164. package/dist/storage/redis/target.d.ts +17 -1
  165. package/dist/storage/redis/target.d.ts.map +1 -1
  166. package/dist/storage/redis/target.js +30 -1
  167. package/dist/storage/redis/target.js.map +1 -1
  168. package/dist/storage/redis/wire.d.ts +6 -6
  169. package/dist/storage/redis/wire.d.ts.map +1 -1
  170. package/dist/storage/redis/wire.js +6 -6
  171. package/dist/storage/redis/wire.js.map +1 -1
  172. package/dist/testing/mod.d.ts +83 -88
  173. package/dist/testing/mod.d.ts.map +1 -1
  174. package/dist/testing/mod.js +75 -81
  175. package/dist/testing/mod.js.map +1 -1
  176. package/dist/testing/playwright.d.ts +28 -32
  177. package/dist/testing/playwright.d.ts.map +1 -1
  178. package/dist/testing/playwright.js +22 -27
  179. package/dist/testing/playwright.js.map +1 -1
  180. package/dist/testing/puppeteer.d.ts +11 -12
  181. package/dist/testing/puppeteer.d.ts.map +1 -1
  182. package/dist/testing/puppeteer.js +17 -18
  183. package/dist/testing/puppeteer.js.map +1 -1
  184. package/dist/testing/system.d.ts +72 -90
  185. package/dist/testing/system.d.ts.map +1 -1
  186. package/dist/testing/system.js +90 -107
  187. package/dist/testing/system.js.map +1 -1
  188. package/dist/tsconfig.build.tsbuildinfo +1 -1
  189. package/frontends/mod.test.ts +6 -2
  190. package/frontends/mod.ts +20 -19
  191. package/gateway/errors.ts +30 -32
  192. package/gateway/match.ts +61 -57
  193. package/gateway/middleware.ts +62 -64
  194. package/gateway/mod.ts +73 -76
  195. package/gateway/request.ts +143 -140
  196. package/gateway/serve.ts +58 -63
  197. package/gateways/mod.ts +25 -23
  198. package/internal/runtime/napi/napi.cjs +1 -1
  199. package/internal/runtime/napi/napi.d.cts +10 -3
  200. package/internal/runtime/shutdown.ts +113 -101
  201. package/log/logger.test.ts +8 -0
  202. package/log/logger.ts +48 -45
  203. package/metrics/mod.ts +138 -122
  204. package/otel.ts +6 -3
  205. package/package.json +1 -1
  206. package/pubsub/subscription.ts +93 -123
  207. package/pubsub/topic.ts +96 -130
  208. package/reqctx/mod.ts +83 -86
  209. package/services/index.ts +78 -78
  210. package/shutdown/mod.ts +26 -25
  211. package/storage/clickhouse/database.ts +115 -129
  212. package/storage/clickhouse/errors.ts +27 -29
  213. package/storage/clickhouse/mod.ts +10 -10
  214. package/storage/objects/bucket.ts +209 -239
  215. package/storage/objects/error.ts +4 -4
  216. package/storage/postgres/database.ts +131 -164
  217. package/storage/postgres/errors.ts +45 -52
  218. package/storage/postgres/interval.ts +21 -21
  219. package/storage/redis/bitfield.ts +51 -26
  220. package/storage/redis/command.ts +16 -12
  221. package/storage/redis/commands.ts +99 -100
  222. package/storage/redis/database.ts +145 -123
  223. package/storage/redis/mod.ts +52 -48
  224. package/storage/redis/options.ts +26 -24
  225. package/storage/redis/pubsub.ts +14 -14
  226. package/storage/redis/redis.test.ts +17 -2
  227. package/storage/redis/reply.ts +85 -77
  228. package/storage/redis/scan.ts +6 -6
  229. package/storage/redis/script.ts +29 -22
  230. package/storage/redis/target.ts +34 -1
  231. package/storage/redis/wire.ts +8 -8
  232. package/testing/mod.ts +99 -105
  233. package/testing/playwright.ts +32 -37
  234. package/testing/puppeteer.ts +22 -23
  235. package/testing/system.ts +117 -133
@@ -1,22 +1,22 @@
1
1
  /**
2
- * A system test's browser, driven with Puppeteer.
2
+ * Puppeteer adapter for driving Encore's managed system-test browser.
3
3
  *
4
- * {@link connect} connects Puppeteer to the browser Encore runs for the
5
- * current test (see `system.browser` in `@encore.dev/sdk/testing`): a page
6
- * reaches the app where `encore run` has it, in the test session; its
7
- * requests are the test's; and what it shows is recorded.
4
+ * {@link connect} attaches Puppeteer to the Chromium instance Encore starts
5
+ * for the current test (see `system.browser` in `@encore.dev/sdk/testing`).
6
+ * Requests from pages route to the test session under your test's isolated
7
+ * data, and page sessions are recorded.
8
8
  *
9
- * Each call the test makes on a page is reported as it is written, with
10
- * where it is, so that the recording and the test's telemetry say which
11
- * statement had the browser do what, and which requests came of it:
9
+ * Every page call is automatically tracked with its call site so test
10
+ * telemetry and recordings link each test statement to the browser actions and
11
+ * backend requests it triggered:
12
12
  *
13
13
  * page.locator("#pay").click() checkout.test.ts:14
14
14
  * click button "Pay"
15
15
  * POST http://localhost:4000/orders 500
16
16
  * POST orders /orders 500
17
17
  *
18
- * Puppeteer is the test's own, passed in: `puppeteer` or `puppeteer-core`.
19
- * Neither downloads a browser for this, as Encore runs its own.
18
+ * Pass your own `puppeteer` or `puppeteer-core` module; no separate browser
19
+ * download is needed because Encore manages Chromium.
20
20
  *
21
21
  * @example
22
22
  * import puppeteer from "puppeteer-core";
@@ -37,12 +37,12 @@
37
37
  import { Steps, wrap } from '../internal/testing/steps.js';
38
38
  import { browser as testBrowser } from './system.js';
39
39
  /**
40
- * Connects `puppeteer` to the current test's browser, starting it if the
41
- * test has none yet, and returns Puppeteer's `Browser`. The browser ends
42
- * with the test: there is nothing to close.
40
+ * Connects `puppeteer` to the current test's Encore browser (starting it if
41
+ * needed) and returns the Puppeteer `Browser`. The browser is automatically
42
+ * closed when the test ends.
43
43
  *
44
- * Its pages' viewport is the browser's window (`options.window`), unless
45
- * `options.connect.defaultViewport` says otherwise.
44
+ * Page viewports match `options.window` (defaulting to 1280×800) unless
45
+ * overridden via `options.connect.defaultViewport`.
46
46
  */
47
47
  export async function connect(puppeteer, options) {
48
48
  const info = await testBrowser(options);
@@ -60,9 +60,8 @@ export async function connect(puppeteer, options) {
60
60
  return wrap(browser, 'browser', steps);
61
61
  }
62
62
  /**
63
- * The URL a page of the current test's browser reaches the gateway or
64
- * frontend `name` at: the one `encore run` has it at, which the frontend is
65
- * written against.
63
+ * Returns the URL a page in the current test's browser uses to reach gateway
64
+ * or frontend `name` (matching the local `encore run` origin).
66
65
  */
67
66
  export async function url(name) {
68
67
  return (await testBrowser()).url(name);
@@ -1 +1 @@
1
- {"version":3,"file":"puppeteer.js","sourceRoot":"","sources":["../../testing/puppeteer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAsB,MAAM,UAAU,CAAC;AA6BrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,SAAuB,EACvB,OAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;QACtC,eAAe,EAAE,OAAO,EAAE,MAAM,IAAI,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAC;QAC9D,GAAG,OAAO,EAAE,OAAO;QACnB,iBAAiB,EAAE,IAAI,CAAC,UAAU;KACnC,CAAC,CAAC;IACH,+DAA+D;IAC/D,oEAAoE;IACpE,MAAM,OAAO,GAAG,MAAO,OAAgC;SACpD,MAAM,EAAE;SACR,gBAAgB,EAAE,CAAC;IACtB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC,OAAiB,EAAE,SAAS,EAAE,KAAK,CAAM,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAY;IACpC,OAAO,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC"}
1
+ {"version":3,"file":"puppeteer.js","sourceRoot":"","sources":["../../testing/puppeteer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAC,OAAO,IAAI,WAAW,EAAsB,MAAM,UAAU,CAAC;AA6BrE;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,SAAuB,EACvB,OAAwB;IAExB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC;QACtC,eAAe,EAAE,OAAO,EAAE,MAAM,IAAI,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAC;QAC9D,GAAG,OAAO,EAAE,OAAO;QACnB,iBAAiB,EAAE,IAAI,CAAC,UAAU;KACnC,CAAC,CAAC;IACH,+DAA+D;IAC/D,oEAAoE;IACpE,MAAM,OAAO,GAAG,MAAO,OAAgC;SACpD,MAAM,EAAE;SACR,gBAAgB,EAAE,CAAC;IACtB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1E,OAAO,IAAI,CAAC,OAAiB,EAAE,SAAS,EAAE,KAAK,CAAM,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAY;IACpC,OAAO,CAAC,MAAM,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC"}
@@ -2,31 +2,26 @@ import { Telemetry } from '../internal/testing/telemetry.js';
2
2
  export { Telemetry } from '../internal/testing/telemetry.js';
3
3
  export type { LostContext } from '../internal/testing/telemetry.js';
4
4
  export type { DeliveryWhat, Filter, HopWhat, Log, OtherWhat, PublishWhat, QueryWhat, RequestWhat, Span, SpanEvent, SpanKind, SpanLink, SpanStatus, TestWhat, What, } from '../internal/testing/telemetry.js';
5
- /** The options of {@link settled}. */
5
+ /** Options for {@link settled}. */
6
6
  export interface SettledOptions {
7
- /** How long to wait at most, in milliseconds: 30 seconds when not given. */
7
+ /** Maximum wait time in milliseconds. Defaults to 30,000 ms (30 seconds). */
8
8
  timeout?: number;
9
9
  }
10
10
  /**
11
- * Waits until nothing the test set in motion is still running or queued: no
12
- * request in flight to a service or through a gateway, and no message
13
- * waiting, being handled or due a retry on a subscription. For at most 30
14
- * seconds, or `options.timeout`: it rejects when the app has not settled by
15
- * then, with an error saying what was still under way.
11
+ * Waits until all asynchronous work triggered by the current test has finished
12
+ * — no requests are in flight to services or gateways, and no Pub/Sub messages
13
+ * are queued, in progress, or awaiting retry. Rejects after 30 seconds (or
14
+ * `options.timeout`) with details of what is still pending.
16
15
  *
17
- * It is the current test's work that is waited for, which is told by the
18
- * test's id travelling with it, and nothing else: not what another test set
19
- * in motion, so tests running side by side do not wait for each other, and
20
- * not what the app does for no test. The work of a service that did not
21
- * pass its request's context on has lost the test's id: it is not waited
22
- * for, and is done on data the test does not see. The test's telemetry says
23
- * which call lost it.
16
+ * Only work tagged with the current test's propagated ID is tracked, so
17
+ * parallel tests do not block one another and unrelated background activity is
18
+ * ignored. If a service fails to propagate request context on an outgoing call,
19
+ * that work loses the test ID, runs outside the test's isolated data, and is
20
+ * flagged in {@link telemetry}.
24
21
  *
25
- * In a suite whose tests share the session's data (`"data": "shared"`),
26
- * everything the app has under way is waited for instead.
27
- *
28
- * What a service does that is neither — work that goes on after its request
29
- * was answered — is not waited for.
22
+ * In suites configured with `"data": "shared"`, `settled()` waits for all
23
+ * in-flight work across the app. Fire-and-forget work that continues after a
24
+ * handler has already responded is not tracked.
30
25
  *
31
26
  * @example
32
27
  * await orders.fetch("/orders", {method: "POST", body}); // publishes `order-placed`
@@ -34,14 +29,13 @@ export interface SettledOptions {
34
29
  */
35
30
  export declare function settled(options?: SettledOptions): Promise<void>;
36
31
  /**
37
- * The URL of the gateway or frontend `name` in the test session, for a
38
- * client of the test's own, such as a WebSocket client. A frontend starts
39
- * when something first connects to it.
32
+ * Returns the URL of gateway or frontend `name` in the current test session,
33
+ * for use with custom clients (such as WebSockets). Frontends start lazily on
34
+ * first connection.
40
35
  *
41
- * A request made with the SDK's clients, or the suite's generated ones,
42
- * carries the test already: a generated Gateway Client made with no options
43
- * calls the gateway here, for the test making the request. One made with
44
- * another client carries the test with {@link headers}.
36
+ * Encore SDK clients and generated gateway clients automatically attach the
37
+ * current test context. For custom HTTP clients, pass {@link headers} on each
38
+ * request.
45
39
  *
46
40
  * @example
47
41
  * import {Client} from "./encore_gen/gateway/api";
@@ -49,9 +43,9 @@ export declare function settled(options?: SettledOptions): Promise<void>;
49
43
  */
50
44
  export declare function url(name: string): string;
51
45
  /**
52
- * The headers that make a request part of the current test, for a client of
53
- * the test's own: the test's id, as the Request Context field Encore carries
54
- * it in, and the test's span for the request to continue. By lowercase name.
46
+ * Returns lowercase HTTP headers that bind a custom client's request to the
47
+ * current test (carrying the test ID Request Context field and active trace
48
+ * span).
55
49
  *
56
50
  * @example
57
51
  * const res = await fetch(`${system.url("api")}/health`, {
@@ -59,29 +53,26 @@ export declare function url(name: string): string;
59
53
  * });
60
54
  */
61
55
  export declare function headers(): Record<string, string>;
62
- /** The options of {@link telemetry}. */
56
+ /** Options for {@link telemetry}. */
63
57
  export interface TelemetryOptions {
64
58
  /**
65
- * Whether to wait for the app to settle first, as {@link settled} does,
66
- * which is when all of what the test caused is recorded. `false` reads
67
- * what has been recorded by now. Defaults to `true`.
59
+ * Wait for the app to settle (as in {@link settled}) before reading recorded
60
+ * telemetry so all triggered work is captured. Set to `false` to read a
61
+ * snapshot immediately. Defaults to `true`.
68
62
  */
69
63
  settle?: boolean;
70
- /** How long to wait for the app to settle at most, in milliseconds: 30
71
- * seconds when not given. */
64
+ /** Maximum time to wait for settling, in milliseconds. Defaults to 30,000 ms. */
72
65
  timeout?: number;
73
66
  }
74
67
  /**
75
- * What the app recorded for the current test, once it has {@link settled}:
76
- * every span of what the test caused — in the services it reached, in the
77
- * requests between them, in the deliveries of what was published for it —
78
- * and the lines logged in them.
68
+ * Returns all telemetry recorded by the app for the current test (waiting for
69
+ * {@link settled} by default): every span triggered across services,
70
+ * inter-service requests, and Pub/Sub deliveries, along with their logs.
79
71
  *
80
- * Each span says what it is of ({@link Span.what}): a request a service was
81
- * handed, a query, a message published or delivered, for a test to assert
82
- * on. As a string it is the tree of it a failed test prints, and
83
- * {@link Telemetry.shape} the same without what differs between runs, to
84
- * keep as a snapshot of which services a flow touches.
72
+ * Inspect typed span details via {@link Span.what} (requests, queries,
73
+ * publishes, deliveries). Converting the result to a string renders the same
74
+ * trace tree printed on test failure, and {@link Telemetry.shape} strips
75
+ * run-specific values for snapshot testing.
85
76
  *
86
77
  * @example
87
78
  * const recorded = await system.telemetry();
@@ -90,50 +81,49 @@ export interface TelemetryOptions {
90
81
  * expect(recorded.errors()).toEqual([]);
91
82
  */
92
83
  export declare function telemetry(options?: TelemetryOptions): Promise<Telemetry>;
93
- /** The options of {@link browser}. */
84
+ /** Options for {@link browser}. */
94
85
  export interface BrowserOptions {
95
86
  /**
96
- * When what the browser recorded is kept: for a test that `'failed'`, or
97
- * whose runner does not say how it ended; for `'all'` tests; or `'off'`.
98
- * Defaults to what `ENCORE_TEST_RECORD` says, else `'failed'`.
87
+ * Controls when browser recordings are saved: `'failed'` (failed tests or
88
+ * runners that do not report outcomes), `'all'`, or `'off'`. Defaults to
89
+ * `ENCORE_TEST_RECORD` if set, otherwise `'failed'`.
99
90
  */
100
91
  record?: 'failed' | 'all' | 'off';
101
- /** More command-line arguments for the browser. */
92
+ /** Additional command-line flags passed to Chromium. */
102
93
  args?: string[];
103
- /** The size of the browser's window, in CSS pixels: 1280×800 by default. */
94
+ /** Browser viewport/window size in CSS pixels. Defaults to 1280×800. */
104
95
  window?: {
105
96
  width: number;
106
97
  height: number;
107
98
  };
108
99
  }
109
- /** The current test's browser: see {@link browser}. */
100
+ /** Handle to the current test's managed Chromium instance (see {@link browser}). */
110
101
  export interface Browser {
111
102
  /**
112
- * What a DevTools Protocol client connects to: the address of a WebSocket,
113
- * as a browser gives for itself. Puppeteer's `connect`, Playwright's
114
- * `connectOverCDP`.
103
+ * Chrome DevTools Protocol WebSocket endpoint for connecting tools such as
104
+ * Puppeteer (`connect`) or Playwright (`connectOverCDP`).
115
105
  */
116
106
  readonly wsEndpoint: string;
117
107
  /**
118
- * The file the recording is written to when the test ends, if it is kept:
119
- * one HTML file that plays the pages back beside what the test and the app
120
- * did. `null` when nothing is recorded.
108
+ * Path to the self-contained HTML recording file written when the test ends,
109
+ * replaying page frames alongside test steps and backend telemetry, or `null`
110
+ * if recording is disabled.
121
111
  */
122
112
  readonly recording: string | null;
123
113
  /**
124
- * The URL a page reaches the gateway or frontend `name` at: the one
125
- * `encore run` has it at, which the frontend is written against. The
126
- * browser's requests there go to the test session.
114
+ * Returns the URL a browser page uses to reach gateway or frontend `name`
115
+ * (matching the local `encore run` origin, transparently routed to the test
116
+ * session).
127
117
  */
128
118
  url(name: string): string;
129
119
  /**
130
- * Runs `fn` as one statement of the test, called `name`: what `fn` has the
131
- * browser do, and the requests that come of it, are recorded under it, in
132
- * the test's telemetry and in its recording, with where `step` was called.
133
- * It resolves to what `fn` returns, and a `fn` that throws fails the step.
120
+ * Groups the actions and network requests inside `fn` under a named step in
121
+ * test telemetry and browser recordings (including the call site). Returns
122
+ * the result of `fn`, marking the step failed if `fn` throws.
134
123
  *
135
- * An adapter reports each call a test makes on its tool by itself: this is
136
- * for a tool that has none, and for naming several calls as one.
124
+ * Browser adapters (`@encore.dev/sdk/testing/playwright` and `puppeteer`)
125
+ * record individual page calls automatically; use `step` for custom CDP tools
126
+ * or to group multiple calls under a higher-level label.
137
127
  *
138
128
  * @example
139
129
  * await browser.step("pay with a saved card", async () => {
@@ -144,32 +134,24 @@ export interface Browser {
144
134
  step<R>(name: string, fn: () => R | Promise<R>): Promise<R>;
145
135
  }
146
136
  /**
147
- * The current test's browser: a headless Chromium Encore runs for the test,
148
- * for a tool of the test's own to drive. It is started the first time the
149
- * test asks, and ends with the test.
150
- *
151
- * It is the test's in every way a call the test makes is:
152
- *
153
- * - It reaches the app where `encore run` has it. A frontend says itself
154
- * where its API is, as `http://localhost:4000`: a page's requests there,
155
- * and to the frontends' own addresses, go to the test session.
156
- * - Each request a page makes to the app carries the test, so what the app
157
- * does for a click is done on the test's data, and {@link settled} waits
158
- * for it.
159
- * - What the test has the browser do, and each request a page makes, is in
160
- * the test's {@link telemetry}, with what the app did for a request
161
- * under it. So is what a page says went wrong: an error on its console,
162
- * an exception nothing caught, a request that failed.
163
- * - Its pages are recorded. A test that fails is left a file that plays
164
- * them back beside all of that ({@link Browser.recording}).
137
+ * Starts (or returns) a headless Chromium instance managed by Encore for the
138
+ * current system test, automatically closed when the test ends.
165
139
  *
166
- * The adapters connect a tool to it and say which statement of the test
167
- * is running: `@encore.dev/sdk/testing/puppeteer`,
168
- * `@encore.dev/sdk/testing/playwright`. This is for any other tool that
169
- * speaks the DevTools Protocol.
140
+ * The managed browser integrates directly with the test session:
141
+ * - Pages reach frontends and APIs at their usual `encore run` URLs (such as
142
+ * `http://localhost:4000`), transparently routed to the test session.
143
+ * - Every app request from a page carries the test ID, so backend work uses the
144
+ * test's isolated data and is waited on by {@link settled}.
145
+ * - Browser actions, page requests, console errors, uncaught page exceptions,
146
+ * and failed requests are captured in {@link telemetry} alongside backend
147
+ * spans.
148
+ * - Page sessions are recorded to an HTML file on failure (see
149
+ * {@link Browser.recording}).
170
150
  *
171
- * The browser is the `browser/chromium` component, which Encore downloads
172
- * the first time a test asks for one.
151
+ * Prefer the Playwright (`@encore.dev/sdk/testing/playwright`) or Puppeteer
152
+ * (`@encore.dev/sdk/testing/puppeteer`) adapters when using those libraries;
153
+ * use this function directly for other Chrome DevTools Protocol clients.
154
+ * Encore downloads the `browser/chromium` component automatically on first use.
173
155
  *
174
156
  * @example
175
157
  * const {wsEndpoint, url} = await system.browser();
@@ -1 +1 @@
1
- {"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../testing/system.ts"],"names":[],"mappings":"AAuEA,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AAExD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,YAAY,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC/D,YAAY,EACV,YAAY,EACZ,MAAM,EACN,OAAO,EACP,GAAG,EACH,SAAS,EACT,WAAW,EACX,SAAS,EACT,WAAW,EACX,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,IAAI,GACL,MAAM,+BAA+B,CAAC;AAmBvC,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAErE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWxC;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEhD;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;iCAC6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,SAAS,CAC7B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,SAAS,CAAC,CAMpB;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,CA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