velocious 1.0.666 → 1.0.668

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 (174) hide show
  1. package/README.md +40 -11
  2. package/build/background-jobs/adapter-client.js +22 -0
  3. package/build/background-jobs/adapter.js +15 -0
  4. package/build/background-jobs/client.js +147 -1
  5. package/build/background-jobs/job-semantics.js +30 -0
  6. package/build/background-jobs/job.js +26 -1
  7. package/build/background-jobs/local-adapter.js +36 -8
  8. package/build/background-jobs/local-store.js +410 -39
  9. package/build/background-jobs/main.js +69 -2
  10. package/build/background-jobs/platform-job.js +26 -1
  11. package/build/background-jobs/runtime.js +58 -0
  12. package/build/background-jobs/store.js +374 -6
  13. package/build/background-jobs/types.js +27 -2
  14. package/build/background-jobs/web/controller.js +1 -0
  15. package/build/configuration.js +30 -6
  16. package/build/database/drivers/mssql/column.js +2 -2
  17. package/build/database/drivers/mssql/table.js +19 -5
  18. package/build/database/pool/async-tracked-multi-connection.js +2 -1
  19. package/build/database/query/alter-table-base.js +8 -1
  20. package/build/database/record/attachments/store.js +2 -2
  21. package/build/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +2 -48
  22. package/build/environment-handlers/node/cli/commands/test.js +17 -69
  23. package/build/frontend-model-controller.js +22 -2
  24. package/build/frontend-models/websocket-channel.js +18 -0
  25. package/build/http-server/client/websocket-session.js +41 -4
  26. package/build/http-server/websocket-channel.js +14 -0
  27. package/build/http-server/websocket-event-log-store.js +85 -12
  28. package/build/http-server/websocket-events-host.js +17 -7
  29. package/build/src/background-jobs/adapter-client.d.ts +17 -0
  30. package/build/src/background-jobs/adapter-client.d.ts.map +1 -1
  31. package/build/src/background-jobs/adapter-client.js +19 -1
  32. package/build/src/background-jobs/adapter.d.ts +15 -0
  33. package/build/src/background-jobs/adapter.d.ts.map +1 -1
  34. package/build/src/background-jobs/adapter.js +14 -1
  35. package/build/src/background-jobs/client.d.ts +17 -0
  36. package/build/src/background-jobs/client.d.ts.map +1 -1
  37. package/build/src/background-jobs/client.js +129 -1
  38. package/build/src/background-jobs/job-semantics.d.ts +18 -0
  39. package/build/src/background-jobs/job-semantics.d.ts.map +1 -1
  40. package/build/src/background-jobs/job-semantics.js +28 -1
  41. package/build/src/background-jobs/job.d.ts +15 -0
  42. package/build/src/background-jobs/job.d.ts.map +1 -1
  43. package/build/src/background-jobs/job.js +21 -2
  44. package/build/src/background-jobs/local-adapter.d.ts +23 -8
  45. package/build/src/background-jobs/local-adapter.d.ts.map +1 -1
  46. package/build/src/background-jobs/local-adapter.js +35 -9
  47. package/build/src/background-jobs/local-store.d.ts +120 -5
  48. package/build/src/background-jobs/local-store.d.ts.map +1 -1
  49. package/build/src/background-jobs/local-store.js +366 -40
  50. package/build/src/background-jobs/main.d.ts +24 -2
  51. package/build/src/background-jobs/main.d.ts.map +1 -1
  52. package/build/src/background-jobs/main.js +68 -3
  53. package/build/src/background-jobs/platform-job.d.ts +15 -0
  54. package/build/src/background-jobs/platform-job.d.ts.map +1 -1
  55. package/build/src/background-jobs/platform-job.js +19 -2
  56. package/build/src/background-jobs/runtime.d.ts +39 -0
  57. package/build/src/background-jobs/runtime.d.ts.map +1 -1
  58. package/build/src/background-jobs/runtime.js +49 -1
  59. package/build/src/background-jobs/store.d.ts +100 -1
  60. package/build/src/background-jobs/store.d.ts.map +1 -1
  61. package/build/src/background-jobs/store.js +334 -8
  62. package/build/src/background-jobs/types.d.ts +97 -4
  63. package/build/src/background-jobs/types.d.ts.map +1 -1
  64. package/build/src/background-jobs/types.js +28 -3
  65. package/build/src/background-jobs/web/controller.d.ts.map +1 -1
  66. package/build/src/background-jobs/web/controller.js +2 -1
  67. package/build/src/configuration.d.ts +18 -1
  68. package/build/src/configuration.d.ts.map +1 -1
  69. package/build/src/configuration.js +28 -6
  70. package/build/src/database/drivers/mssql/column.d.ts.map +1 -1
  71. package/build/src/database/drivers/mssql/column.js +2 -2
  72. package/build/src/database/drivers/mssql/table.d.ts.map +1 -1
  73. package/build/src/database/drivers/mssql/table.js +19 -5
  74. package/build/src/database/pool/async-tracked-multi-connection.d.ts.map +1 -1
  75. package/build/src/database/pool/async-tracked-multi-connection.js +3 -2
  76. package/build/src/database/query/alter-table-base.d.ts.map +1 -1
  77. package/build/src/database/query/alter-table-base.js +9 -2
  78. package/build/src/database/record/attachments/store.js +3 -3
  79. package/build/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.d.ts.map +1 -1
  80. package/build/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +3 -47
  81. package/build/src/environment-handlers/node/cli/commands/test.d.ts +2 -28
  82. package/build/src/environment-handlers/node/cli/commands/test.d.ts.map +1 -1
  83. package/build/src/environment-handlers/node/cli/commands/test.js +10 -61
  84. package/build/src/frontend-model-controller.d.ts.map +1 -1
  85. package/build/src/frontend-model-controller.js +18 -3
  86. package/build/src/frontend-models/websocket-channel.d.ts +9 -0
  87. package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
  88. package/build/src/frontend-models/websocket-channel.js +16 -1
  89. package/build/src/http-server/client/websocket-session.d.ts +25 -2
  90. package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
  91. package/build/src/http-server/client/websocket-session.js +40 -5
  92. package/build/src/http-server/websocket-channel.d.ts +11 -0
  93. package/build/src/http-server/websocket-channel.d.ts.map +1 -1
  94. package/build/src/http-server/websocket-channel.js +14 -1
  95. package/build/src/http-server/websocket-event-log-store.d.ts +60 -41
  96. package/build/src/http-server/websocket-event-log-store.d.ts.map +1 -1
  97. package/build/src/http-server/websocket-event-log-store.js +79 -12
  98. package/build/src/http-server/websocket-events-host.d.ts +10 -3
  99. package/build/src/http-server/websocket-events-host.d.ts.map +1 -1
  100. package/build/src/http-server/websocket-events-host.js +17 -8
  101. package/build/src/testing/test-files-finder.d.ts +17 -117
  102. package/build/src/testing/test-files-finder.d.ts.map +1 -1
  103. package/build/src/testing/test-files-finder.js +29 -294
  104. package/build/src/testing/test-filter-parser.d.ts +32 -22
  105. package/build/src/testing/test-filter-parser.d.ts.map +1 -1
  106. package/build/src/testing/test-filter-parser.js +25 -217
  107. package/build/src/testing/test-profile-activity.d.ts +1 -6
  108. package/build/src/testing/test-profile-activity.d.ts.map +1 -1
  109. package/build/src/testing/test-profile-activity.js +2 -12
  110. package/build/src/testing/test-profile-output.d.ts +1 -40
  111. package/build/src/testing/test-profile-output.d.ts.map +1 -1
  112. package/build/src/testing/test-profile-output.js +2 -217
  113. package/build/src/testing/test-profiler.d.ts +15 -659
  114. package/build/src/testing/test-profiler.d.ts.map +1 -1
  115. package/build/src/testing/test-profiler.js +35 -833
  116. package/build/src/testing/test-runner.d.ts +10 -1
  117. package/build/src/testing/test-runner.d.ts.map +1 -1
  118. package/build/src/testing/test-runner.js +26 -4
  119. package/build/src/testing/test-suite-splitter.d.ts +1 -128
  120. package/build/src/testing/test-suite-splitter.d.ts.map +1 -1
  121. package/build/src/testing/test-suite-splitter.js +2 -259
  122. package/build/src/testing/timing-manifest.d.ts +5 -93
  123. package/build/src/testing/timing-manifest.d.ts.map +1 -1
  124. package/build/src/testing/timing-manifest.js +4 -283
  125. package/build/src/testing/velocious-attempt-executor.d.ts.map +1 -1
  126. package/build/src/testing/velocious-attempt-executor.js +8 -2
  127. package/build/testing/test-files-finder.js +32 -343
  128. package/build/testing/test-filter-parser.js +29 -248
  129. package/build/testing/test-profile-activity.js +1 -12
  130. package/build/testing/test-profile-output.js +8 -253
  131. package/build/testing/test-profiler.js +38 -895
  132. package/build/testing/test-runner.js +33 -9
  133. package/build/testing/test-suite-splitter.js +1 -301
  134. package/build/testing/timing-manifest.js +10 -344
  135. package/build/testing/velocious-attempt-executor.js +7 -1
  136. package/package.json +3 -3
  137. package/scripts/test-browser.js +30 -6
  138. package/scripts/verify-docker-dev-environment.js +13 -1
  139. package/src/background-jobs/adapter-client.js +22 -0
  140. package/src/background-jobs/adapter.js +15 -0
  141. package/src/background-jobs/client.js +147 -1
  142. package/src/background-jobs/job-semantics.js +30 -0
  143. package/src/background-jobs/job.js +26 -1
  144. package/src/background-jobs/local-adapter.js +36 -8
  145. package/src/background-jobs/local-store.js +410 -39
  146. package/src/background-jobs/main.js +69 -2
  147. package/src/background-jobs/platform-job.js +26 -1
  148. package/src/background-jobs/runtime.js +58 -0
  149. package/src/background-jobs/store.js +374 -6
  150. package/src/background-jobs/types.js +27 -2
  151. package/src/background-jobs/web/controller.js +1 -0
  152. package/src/configuration.js +30 -6
  153. package/src/database/drivers/mssql/column.js +2 -2
  154. package/src/database/drivers/mssql/table.js +19 -5
  155. package/src/database/pool/async-tracked-multi-connection.js +2 -1
  156. package/src/database/query/alter-table-base.js +8 -1
  157. package/src/database/record/attachments/store.js +2 -2
  158. package/src/environment-handlers/node/cli/commands/test/timing-manifest/merge.js +2 -48
  159. package/src/environment-handlers/node/cli/commands/test.js +17 -69
  160. package/src/frontend-model-controller.js +22 -2
  161. package/src/frontend-models/websocket-channel.js +18 -0
  162. package/src/http-server/client/websocket-session.js +41 -4
  163. package/src/http-server/websocket-channel.js +14 -0
  164. package/src/http-server/websocket-event-log-store.js +85 -12
  165. package/src/http-server/websocket-events-host.js +17 -7
  166. package/src/testing/test-files-finder.js +32 -343
  167. package/src/testing/test-filter-parser.js +29 -248
  168. package/src/testing/test-profile-activity.js +1 -12
  169. package/src/testing/test-profile-output.js +8 -253
  170. package/src/testing/test-profiler.js +38 -895
  171. package/src/testing/test-runner.js +33 -9
  172. package/src/testing/test-suite-splitter.js +1 -301
  173. package/src/testing/timing-manifest.js +10 -344
  174. package/src/testing/velocious-attempt-executor.js +7 -1
@@ -1,668 +1,24 @@
1
- export type TestProfileAttemptStatus = "passed" | "failed" | "interrupted" | "timed-out";
2
- export type ProcessCpuUsage = {
3
- user: number;
4
- system: number;
5
- };
6
- export type ProfileDatabaseAggregate = {
7
- queryCount: number;
8
- failedQueryCount: number;
9
- totalMs: number;
10
- maxMs: number;
11
- };
12
- export type ProfileActionAggregate = {
13
- count: number;
14
- failedCount: number;
15
- totalMs: number;
16
- maxMs: number;
17
- };
18
- export type ProfilePoolAggregate = {
19
- identifier: string;
20
- connectionCreation: ProfileActionAggregate;
21
- checkoutWait: {
22
- count: number;
23
- totalMs: number;
24
- maxMs: number;
25
- };
26
- checkoutTimeoutCount: number;
27
- idleReap: ProfileActionAggregate & {
28
- disposalCount: number;
29
- };
30
- peakLiveConnections: number;
31
- };
32
- export type TestProfileAsyncContext = {
33
- /**
34
- * - Owning profiler.
35
- */
36
- profiler: TestProfiler;
37
- /**
38
- * - Active test attempt.
39
- */
40
- attempt: TestProfileAttemptRecord | undefined;
41
- /**
42
- * - Whether attribution is still open.
43
- */
44
- active: boolean;
45
- /**
46
- * - Contexts sharing one attempt lifetime.
47
- */
48
- attemptContexts?: Set<TestProfileAsyncContext> | undefined;
49
- /**
50
- * - Project-relative owning test file.
51
- */
52
- filePath: string | undefined;
53
- /**
54
- * - Innermost active profile span.
55
- */
56
- span?: TestProfileSpan | undefined;
57
- /**
58
- * - Span monotonic start time.
59
- */
60
- spanStartedAt?: number;
61
- /**
62
- * - Span CPU start time.
63
- */
64
- spanCpuStartedAt?: ProcessCpuUsage;
65
- };
66
- export type TestProfileSpan = {
67
- /**
68
- * - Profile phase.
69
- */
70
- phase: string;
71
- /**
72
- * - Monotonic span start order.
73
- */
74
- executionOrder: number;
75
- /**
76
- * - Real duration.
77
- */
78
- durationMs: number;
79
- /**
80
- * - Process CPU duration.
81
- */
82
- cpuMs: {
83
- user: number;
84
- system: number;
85
- total: number;
86
- };
87
- /**
88
- * - Validated custom activity name.
89
- */
90
- activity?: string;
91
- /**
92
- * - Hook index within its declaration scope.
93
- */
94
- declarationIndex?: number;
95
- /**
96
- * - Opaque declaration scope identifier.
97
- */
98
- declarationScopeId?: string;
99
- /**
100
- * - Project-relative source path.
101
- */
102
- file?: string;
103
- /**
104
- * - Span database aggregate.
105
- */
106
- database?: ProfileDatabaseAggregate;
107
- /**
108
- * - Span pool aggregates.
109
- */
110
- pools?: ProfilePoolAggregate[];
111
- };
112
- export type TestProfileAttemptRecord = {
113
- /**
114
- * - One-indexed attempt number.
115
- */
116
- number: number;
117
- /**
118
- * - Attempt result.
119
- */
120
- status: TestProfileAttemptStatus | "running";
121
- /**
122
- * - Real duration.
123
- */
124
- durationMs: number;
125
- /**
126
- * - Process CPU duration.
127
- */
128
- cpuMs: {
129
- user: number;
130
- system: number;
131
- total: number;
132
- };
133
- /**
134
- * - Attempt-owned spans.
135
- */
136
- spans: TestProfileSpan[];
137
- };
138
- export type TestProfileAttemptHandle = {
139
- /**
140
- * - Async attribution context.
141
- */
142
- context: TestProfileAsyncContext;
143
- /**
144
- * - Output attempt record.
145
- */
146
- attempt: TestProfileAttemptRecord;
147
- /**
148
- * - Real start time.
149
- */
150
- startedAt: number;
151
- /**
152
- * - CPU start time.
153
- */
154
- cpuStartedAt: ProcessCpuUsage;
155
- };
156
- export type InternalPhaseAggregate = {
157
- /**
158
- * - Invocation count.
159
- */
160
- count: number;
161
- /**
162
- * - Total real duration.
163
- */
164
- totalMs: number;
165
- /**
166
- * - Maximum real duration.
167
- */
168
- maxMs: number;
169
- /**
170
- * - Total user CPU time.
171
- */
172
- cpuUserMs: number;
173
- /**
174
- * - Total system CPU time.
175
- */
176
- cpuSystemMs: number;
177
- };
178
- export type InternalFileAggregate = {
179
- /**
180
- * - Project-relative path.
181
- */
182
- path: string;
183
- /**
184
- * - Import duration.
185
- */
186
- importMs: number;
187
- /**
188
- * - Hook duration.
189
- */
190
- hooksMs: number;
191
- /**
192
- * - Test body duration.
193
- */
194
- testsMs: number;
195
- /**
196
- * - Complete test-attempt duration.
197
- */
198
- attemptsMs: number;
199
- /**
200
- * - Total file weight duration.
201
- */
202
- totalMs: number;
203
- };
204
- export type InternalTestRecord = {
205
- /**
206
- * - Opaque stable test identifier.
207
- */
208
- id: string;
209
- /**
210
- * - Project-relative source path.
211
- */
212
- file: string;
213
- /**
214
- * - Declaration line.
215
- */
216
- line: number | undefined;
217
- /**
218
- * - Attempt records.
219
- */
220
- attempts: TestProfileAttemptRecord[];
221
- };
222
- /**
223
- * Rounds and bounds duration values for public output.
224
- * @param {number} durationMs - Raw duration.
225
- * @returns {number} - Safe duration.
226
- */
227
- export declare function roundProfileDuration(durationMs: number): number;
228
- /**
229
- * Collects opt-in test-run timing without retaining application payloads.
230
- */
231
- export default class TestProfiler {
232
- _configuration: import("../configuration.js").default;
233
- _projectDirectory: string;
234
- _selection: Record<string, any>;
235
- _startedAt: number;
236
- _cpuStartedAt: NodeJS.CpuUsage;
237
- _executionOrder: number;
238
- _unattributedLateEventCount: number;
239
- /** @type {Map<string, InternalPhaseAggregate>} */
240
- _phases: Map<string, InternalPhaseAggregate>;
241
- /** @type {Map<string, InternalFileAggregate>} */
242
- _files: Map<string, InternalFileAggregate>;
243
- /** @type {InternalTestRecord[]} */
244
- _tests: InternalTestRecord[];
245
- /** @type {Map<string, InternalTestRecord>} */
246
- _testsById: Map<string, InternalTestRecord>;
247
- /** @type {Set<TestProfileAttemptHandle>} */
248
- _activeAttempts: Set<TestProfileAttemptHandle>;
249
- /** @type {Set<TestProfileAsyncContext>} */
250
- _activeSpanContexts: Set<TestProfileAsyncContext>;
251
- /** @type {TestProfileSpan[]} */
252
- _spans: TestProfileSpan[];
253
- /** @type {Array<{id: string, parentId: string | undefined, file: string, line: number | undefined}>} */
254
- _scopes: Array<{
255
- id: string;
256
- parentId: string | undefined;
257
- file: string;
258
- line: number | undefined;
259
- }>;
260
- /** @type {WeakMap<import("./test-runner.js").TestsArgument | import("@velocious/testing/runner").SuiteDeclaration, string>} */
261
- _scopeIds: WeakMap<import("./test-runner.js").TestsArgument | import("@velocious/testing/runner").SuiteDeclaration, string>;
262
- /** @type {Set<string>} */
263
- _customActivityNames: Set<string>;
264
- _database: ProfileDatabaseAggregate;
265
- /** @type {Map<string, {hash: string, operation: string, count: number, failedCount: number, totalMs: number, maxMs: number}>} */
266
- _queryFingerprints: Map<string, {
267
- hash: string;
268
- operation: string;
269
- count: number;
270
- failedCount: number;
271
- totalMs: number;
272
- maxMs: number;
273
- }>;
274
- _transactions: {
275
- start: ProfileActionAggregate;
276
- commit: ProfileActionAggregate;
277
- rollback: ProfileActionAggregate;
278
- };
279
- /** @type {Map<string, ProfilePoolAggregate>} */
280
- _pools: Map<string, ProfilePoolAggregate>;
281
- _finishedProfile: {
282
- schema: string;
283
- schemaVersion: number;
284
- status: string;
285
- selection: {
286
- focused: boolean;
287
- };
288
- counts: {
289
- discovered: number;
290
- executed: number;
291
- failed: number;
292
- passed: number;
293
- attempts: number;
294
- };
295
- durationMs: number;
296
- cpuMs: {
297
- user: number;
298
- system: number;
299
- total: number;
300
- };
301
- phases: {
302
- [k: string]: {
303
- count: number;
304
- totalMs: number;
305
- maxMs: number;
306
- cpuMs: {
307
- user: number;
308
- system: number;
309
- total: number;
310
- };
311
- };
312
- };
313
- files: {
314
- path: string;
315
- importMs: number;
316
- hooksMs: number;
317
- testsMs: number;
318
- attemptsMs: number;
319
- totalMs: number;
320
- }[];
321
- scopes: {
322
- id: string;
323
- parentId: string | undefined;
324
- file: string;
325
- line: number | undefined;
326
- }[];
327
- tests: {
328
- id: string;
329
- file: string;
330
- line: number | undefined;
331
- durationMs: number;
332
- attempts: TestProfileAttemptRecord[];
333
- }[];
334
- spans: TestProfileSpan[];
335
- database: {
336
- queryCount: number;
337
- failedQueryCount: number;
338
- totalMs: number;
339
- maxMs: number;
340
- fingerprints: {
341
- hash: string;
342
- operation: string;
343
- count: number;
344
- failedCount: number;
345
- totalMs: number;
346
- maxMs: number;
347
- }[];
348
- transactions: {
349
- start: ProfileActionAggregate;
350
- commit: ProfileActionAggregate;
351
- rollback: ProfileActionAggregate;
352
- };
353
- };
354
- pools: ProfilePoolAggregate[];
355
- unattributedLateEventCount: number;
356
- timingManifest: {
357
- [k: string]: number;
358
- };
359
- } | undefined;
360
- /**
361
- * Creates an opt-in test profile collector.
1
+ import { TestProfiler as PackageTestProfiler, roundProfileDuration } from "@velocious/testing/node";
2
+ export type TestProfileAsyncContext = import("@velocious/testing/node").TestProfileAsyncContext;
3
+ export type TestProfileAttemptHandle = import("@velocious/testing/node").TestProfileAttemptHandle;
4
+ export type TestProfileAttemptStatus = import("@velocious/testing/node").TestProfileAttemptStatus;
5
+ /** @typedef {import("@velocious/testing/node").TestProfileAsyncContext} TestProfileAsyncContext */
6
+ /** @typedef {import("@velocious/testing/node").TestProfileAttemptHandle} TestProfileAttemptHandle */
7
+ /** @typedef {import("@velocious/testing/node").TestProfileAttemptStatus} TestProfileAttemptStatus */
8
+ export { roundProfileDuration };
9
+ /** Velocious compatibility facade around the package-owned profiler. */
10
+ export default class TestProfiler extends PackageTestProfiler {
11
+ /**
12
+ * Creates the package profiler with Velocious environment context.
362
13
  * @param {object} args - Profiler options.
363
14
  * @param {import("../configuration.js").default} args.configuration - Test configuration.
364
15
  * @param {string} args.projectDirectory - Project root used for portable paths.
365
- * @param {Record<string, ReturnType<typeof JSON.parse>>} [args.selection] - Sanitized selection metadata.
16
+ * @param {Partial<import("@velocious/testing/node").TestProfileSelection>} [args.selection] - Selection metadata.
366
17
  */
367
- constructor({ configuration, projectDirectory, selection }: {
18
+ constructor({ configuration, projectDirectory, selection, ...restArgs }: {
368
19
  configuration: import("../configuration.js").default;
369
20
  projectDirectory: string;
370
- selection?: Record<string, ReturnType<typeof JSON.parse>>;
21
+ selection?: Partial<import("@velocious/testing/node").TestProfileSelection>;
371
22
  });
372
- /**
373
- * Returns the profiler's monotonic clock.
374
- * @returns {number} - Monotonic milliseconds.
375
- */
376
- now(): number;
377
- /**
378
- * Converts a source path to a project-relative path or an opaque hash.
379
- * @param {string | undefined} filePath - Source path.
380
- * @returns {string} - Safe source identifier.
381
- */
382
- safeSourcePath(filePath: string | undefined): string;
383
- /**
384
- * Returns a bounded opaque SHA-256 identifier.
385
- * @param {string} value - Value to hash.
386
- * @returns {string} - Opaque hash.
387
- */
388
- hash(value: string): string;
389
- /**
390
- * Adds aggregate-only selection metadata as discovery progresses.
391
- * @param {Record<string, ReturnType<typeof JSON.parse>>} selection - Safe selection metadata.
392
- * @returns {void}
393
- */
394
- setSelection(selection: Record<string, ReturnType<typeof JSON.parse>>): void;
395
- /**
396
- * Registers and returns a deterministic scope identifier.
397
- * @param {import("./test-runner.js").TestsArgument | import("@velocious/testing/runner").SuiteDeclaration} scope - Scope object.
398
- * @param {object} args - Scope metadata.
399
- * @param {string[]} args.descriptions - Scope description path.
400
- * @param {string | undefined} args.filePath - Scope source path.
401
- * @param {number | undefined} [args.line] - Scope source line.
402
- * @param {string | undefined} [args.parentId] - Parent scope identifier.
403
- * @returns {string} - Opaque scope identifier.
404
- */
405
- scopeId(scope: import("./test-runner.js").TestsArgument | import("@velocious/testing/runner").SuiteDeclaration, { descriptions, filePath, line, parentId }: {
406
- descriptions: string[];
407
- filePath: string | undefined;
408
- line?: number | undefined;
409
- parentId?: string | undefined;
410
- }): string;
411
- /**
412
- * Starts an attempt and its async attribution context.
413
- * @param {object} args - Attempt metadata.
414
- * @param {string[]} args.descriptions - Parent descriptions.
415
- * @param {number} args.attemptNumber - Attempt number.
416
- * @param {import("./test-runner.js").TestData} args.testData - Test declaration.
417
- * @param {string} args.testDescription - Test description.
418
- * @returns {TestProfileAttemptHandle} - Active attempt handle.
419
- */
420
- startAttempt({ descriptions, attemptNumber, testData, testDescription }: {
421
- descriptions: string[];
422
- attemptNumber: number;
423
- testData: import("./test-runner.js").TestData;
424
- testDescription: string;
425
- }): TestProfileAttemptHandle;
426
- /**
427
- * Runs work inside an attempt's async context.
428
- * @template T
429
- * @param {TestProfileAttemptHandle} handle - Attempt handle.
430
- * @param {() => Promise<T>} callback - Attempt lifecycle.
431
- * @returns {Promise<T>} - Callback result.
432
- */
433
- runAttempt<T>(handle: TestProfileAttemptHandle, callback: () => Promise<T>): Promise<T>;
434
- /**
435
- * Completes an attempt and prevents descendant late work from retaining attribution.
436
- * @param {TestProfileAttemptHandle} handle - Attempt handle.
437
- * @param {TestProfileAttemptStatus} status - Attempt result.
438
- * @returns {void}
439
- */
440
- finishAttempt(handle: TestProfileAttemptHandle, status: TestProfileAttemptStatus): void;
441
- /**
442
- * Closes every active attempt and nested span at the current interruption boundary.
443
- * @returns {void}
444
- */
445
- interrupt(): void;
446
- /**
447
- * Runs a runner-owned phase span.
448
- * @template T
449
- * @param {object} args - Span metadata.
450
- * @param {string} args.phase - Phase name.
451
- * @param {string} [args.activity] - Custom activity label.
452
- * @param {number} [args.declarationIndex] - Hook declaration index.
453
- * @param {string} [args.declarationScopeId] - Hook declaration scope.
454
- * @param {string} [args.filePath] - Source or owning test file.
455
- * @param {() => (T | Promise<T>)} callback - Timed work.
456
- * @returns {Promise<T>} - Callback result.
457
- */
458
- runSpan<T>({ phase, activity, declarationIndex, declarationScopeId, filePath }: {
459
- phase: string;
460
- activity?: string;
461
- declarationIndex?: number;
462
- declarationScopeId?: string;
463
- filePath?: string;
464
- }, callback: () => (T | Promise<T>)): Promise<T>;
465
- /**
466
- * Finalizes an open span, including partial work closed by a timeout.
467
- * @param {TestProfileAsyncContext} context - Span context.
468
- * @returns {void}
469
- */
470
- finishSpanContext(context: TestProfileAsyncContext): void;
471
- /**
472
- * Checks both a nested span boundary and its owning attempt boundary.
473
- * @param {TestProfileAsyncContext} context - Candidate profile context.
474
- * @returns {boolean} - Whether events may still be attributed.
475
- */
476
- contextIsActive(context: TestProfileAsyncContext): boolean;
477
- /**
478
- * Runs a validated application-defined activity.
479
- * @template T
480
- * @param {TestProfileAsyncContext} context - Captured async context.
481
- * @param {string} name - Validated activity name.
482
- * @param {() => (T | Promise<T>)} callback - Activity callback.
483
- * @returns {Promise<T>} - Callback result.
484
- */
485
- profileActivity<T>(context: TestProfileAsyncContext, name: string, callback: () => (T | Promise<T>)): Promise<T>;
486
- /**
487
- * Measures a command-level phase outside an attempt.
488
- * @template T
489
- * @param {string} phase - Phase name.
490
- * @param {() => (T | Promise<T>)} callback - Timed work.
491
- * @param {{filePath?: string}} [metadata] - Optional source ownership.
492
- * @returns {Promise<T>} - Callback result.
493
- */
494
- measurePhase<T>(phase: string, callback: () => (T | Promise<T>), metadata?: {
495
- filePath?: string;
496
- }): Promise<T>;
497
- /**
498
- * Records one successful or failed physical database query attempt.
499
- * @param {TestProfileAsyncContext} context - Context captured when the query began.
500
- * @param {{durationMs: number, failed: boolean, sqlFingerprint: string, sqlOperation: string}} args - Query aggregate values.
501
- * @returns {void}
502
- */
503
- recordDatabaseQuery(context: TestProfileAsyncContext, { durationMs, failed, sqlFingerprint, sqlOperation }: {
504
- durationMs: number;
505
- failed: boolean;
506
- sqlFingerprint: string;
507
- sqlOperation: string;
508
- }): void;
509
- /**
510
- * Records a physical transaction action.
511
- * @param {TestProfileAsyncContext} context - Context captured when the action began.
512
- * @param {{action: "start" | "commit" | "rollback", durationMs: number, failed: boolean}} args - Transaction aggregate values.
513
- * @returns {void}
514
- */
515
- recordDatabaseTransaction(context: TestProfileAsyncContext, { action, durationMs, failed }: {
516
- action: "start" | "commit" | "rollback";
517
- durationMs: number;
518
- failed: boolean;
519
- }): void;
520
- /**
521
- * Records one low-cardinality pool lifecycle delta.
522
- * @param {TestProfileAsyncContext} context - Context captured when the operation began.
523
- * @param {string} identifier - Logical pool identifier.
524
- * @param {"connectionCreation" | "checkoutWait" | "checkoutTimeout" | "idleReap" | "idleReapDisposal" | "peakLiveConnections"} metric - Metric name.
525
- * @param {{durationMs?: number, failed?: boolean, value?: number}} [values] - Aggregate values.
526
- * @returns {void}
527
- */
528
- recordPoolMetric(context: TestProfileAsyncContext, identifier: string, metric: "connectionCreation" | "checkoutWait" | "checkoutTimeout" | "idleReap" | "idleReapDisposal" | "peakLiveConnections", values?: {
529
- durationMs?: number;
530
- failed?: boolean;
531
- value?: number;
532
- }): void;
533
- /**
534
- * Builds the final privacy-safe profile document.
535
- * @param {object} args - Run result.
536
- * @param {{discovered: number, executed: number, failed: number, passed: number}} args.counts - Run counts.
537
- * @param {boolean} args.focused - Whether focused tests were selected.
538
- * @param {string} args.status - Run status.
539
- * @returns {ReturnType<typeof JSON.parse>} - Rich profile document.
540
- */
541
- finish({ counts, focused, status }: {
542
- counts: {
543
- discovered: number;
544
- executed: number;
545
- failed: number;
546
- passed: number;
547
- };
548
- focused: boolean;
549
- status: string;
550
- }): ReturnType<typeof JSON.parse>;
551
- /**
552
- * Returns an internal phase aggregate.
553
- * @param {string} phase - Phase name.
554
- * @returns {InternalPhaseAggregate} - Aggregate.
555
- */
556
- phaseAggregate(phase: string): InternalPhaseAggregate;
557
- /**
558
- * Adds a completed span to its aggregate phase.
559
- * @param {string} phase - Phase name.
560
- * @param {number} durationMs - Real duration.
561
- * @param {{user: number, system: number, total: number}} cpuMs - CPU duration.
562
- * @returns {void}
563
- */
564
- addPhaseDuration(phase: string, durationMs: number, cpuMs: {
565
- user: number;
566
- system: number;
567
- total: number;
568
- }): void;
569
- /**
570
- * Adds an exclusive file-owned phase to timing-manifest weight.
571
- * @param {string | undefined} filePath - Safe project-relative path.
572
- * @param {string} phase - Phase name.
573
- * @param {number} durationMs - Real duration.
574
- * @param {boolean} [insideAttempt] - Whether the phase is already covered by complete attempt time.
575
- * @returns {void}
576
- */
577
- addFileDuration(filePath: string | undefined, phase: string, durationMs: number, insideAttempt?: boolean): void;
578
- /**
579
- * Adds the complete cost of an attempt to its owning file weight.
580
- * @param {string | undefined} filePath - Safe project-relative path.
581
- * @param {number} durationMs - Attempt duration.
582
- * @returns {void}
583
- */
584
- addFileAttemptDuration(filePath: string | undefined, durationMs: number): void;
585
- /**
586
- * Calculates process CPU time since a start sample.
587
- * @param {ProcessCpuUsage} start - CPU start sample.
588
- * @returns {{user: number, system: number, total: number}} - Millisecond CPU duration.
589
- */
590
- cpuDuration(start: ProcessCpuUsage): {
591
- user: number;
592
- system: number;
593
- total: number;
594
- };
595
- /**
596
- * Converts an internal aggregate to public rounded values.
597
- * @param {InternalPhaseAggregate} [aggregate] - Internal aggregate.
598
- * @returns {{count: number, totalMs: number, maxMs: number, cpuMs: {user: number, system: number, total: number}}} - Public aggregate.
599
- */
600
- publicAggregate(aggregate?: InternalPhaseAggregate): {
601
- count: number;
602
- totalMs: number;
603
- maxMs: number;
604
- cpuMs: {
605
- user: number;
606
- system: number;
607
- total: number;
608
- };
609
- };
610
- /**
611
- * Returns an empty query aggregate.
612
- * @returns {ProfileDatabaseAggregate} - Empty aggregate.
613
- */
614
- emptyDatabaseAggregate(): ProfileDatabaseAggregate;
615
- /**
616
- * Adds a query attempt to a database aggregate.
617
- * @param {ProfileDatabaseAggregate} aggregate - Aggregate to update.
618
- * @param {{durationMs: number, failed: boolean}} args - Attempt values.
619
- * @returns {void}
620
- */
621
- addDatabaseQueryAggregate(aggregate: ProfileDatabaseAggregate, { durationMs, failed }: {
622
- durationMs: number;
623
- failed: boolean;
624
- }): void;
625
- /**
626
- * Returns an empty action aggregate.
627
- * @returns {ProfileActionAggregate} - Empty aggregate.
628
- */
629
- phaseAggregateShape(): ProfileActionAggregate;
630
- /**
631
- * Rounds a transaction or pool action aggregate.
632
- * @param {ProfileActionAggregate} aggregate - Internal aggregate.
633
- * @returns {ProfileActionAggregate} - Public aggregate.
634
- */
635
- publicActionAggregate(aggregate: ProfileActionAggregate): ProfileActionAggregate;
636
- /**
637
- * Returns an empty pool aggregate.
638
- * @param {string} [identifier] - Logical pool identifier.
639
- * @returns {ProfilePoolAggregate} - Empty aggregate.
640
- */
641
- emptyPoolAggregate(identifier?: string): ProfilePoolAggregate;
642
- /**
643
- * Gets or creates a pool aggregate in a map.
644
- * @param {Map<string, ProfilePoolAggregate>} pools - Pool map.
645
- * @param {string} identifier - Logical pool identifier.
646
- * @returns {ProfilePoolAggregate} - Pool aggregate.
647
- */
648
- poolAggregate(pools: Map<string, ProfilePoolAggregate>, identifier: string): ProfilePoolAggregate;
649
- /**
650
- * Applies one pool metric delta.
651
- * @param {ProfilePoolAggregate} aggregate - Pool aggregate.
652
- * @param {"connectionCreation" | "checkoutWait" | "checkoutTimeout" | "idleReap" | "idleReapDisposal" | "peakLiveConnections"} metric - Metric name.
653
- * @param {{durationMs?: number, failed?: boolean, value?: number}} values - Metric values.
654
- * @returns {void}
655
- */
656
- addPoolMetric(aggregate: ProfilePoolAggregate, metric: "connectionCreation" | "checkoutWait" | "checkoutTimeout" | "idleReap" | "idleReapDisposal" | "peakLiveConnections", values: {
657
- durationMs?: number;
658
- failed?: boolean;
659
- value?: number;
660
- }): void;
661
- /**
662
- * Rounds a pool aggregate for output.
663
- * @param {ProfilePoolAggregate} aggregate - Internal aggregate.
664
- * @returns {ProfilePoolAggregate} - Public aggregate.
665
- */
666
- publicPoolAggregate(aggregate: ProfilePoolAggregate): ProfilePoolAggregate;
667
23
  }
668
24
  //# sourceMappingURL=test-profiler.d.ts.map