@travetto/test 8.0.0-alpha.2 → 8.0.0-alpha.20

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.
@@ -26,38 +26,18 @@ export class TestExecutor {
26
26
  this.#consumer = consumer;
27
27
  }
28
28
 
29
- #onSuiteTestError(result: TestResult, test: TestConfig): void {
30
- this.#consumer.onEvent({ type: 'test', phase: 'before', test });
31
- for (const assertion of result.assertions) {
32
- this.#consumer.onEvent({ type: 'assertion', phase: 'after', assertion });
33
- }
34
- this.#consumer.onEvent({ type: 'test', phase: 'after', test: result });
35
- }
36
-
37
- #recordSuiteErrors(suiteConfig: SuiteConfig, suiteResult: SuiteResult, errors: TestResult[]): void {
38
- for (const test of errors) {
39
- if (!suiteResult.tests[test.methodName]) {
40
- this.#onSuiteTestError(test, suiteConfig.tests[test.methodName]);
41
- suiteResult.errored += 1;
42
- suiteResult.total += 1;
43
- }
44
- }
45
- }
46
-
47
29
  /**
48
30
  * Raw execution, runs the method and then returns any thrown errors as the result.
49
31
  *
50
32
  * This method should never throw under any circumstances.
51
33
  */
52
- async #executeTestMethod(test: TestConfig): Promise<Error | undefined> {
53
- const suite = SuiteRegistryIndex.getConfig(test.class);
54
-
34
+ async #executeTestMethod(instance: unknown, test: TestConfig): Promise<Error | undefined> {
55
35
  // Ensure all the criteria below are satisfied before moving forward
56
36
  return Barrier.awaitOperation(test.timeout || TEST_TIMEOUT, async () => {
57
37
  const env = process.env;
58
38
  process.env = { ...env }; // Created an isolated environment
59
39
  try {
60
- await castTo<Record<string, Function>>(suite.instance)[test.methodName]();
40
+ await castTo<Record<string, Function>>(instance)[test.methodName]();
61
41
  } finally {
62
42
  process.env = env; // Restore
63
43
  }
@@ -73,96 +53,43 @@ export class TestExecutor {
73
53
  }
74
54
  }
75
55
 
76
- #skipTest(test: TestConfig, result: SuiteResult): void {
77
- // Mark test start
78
- this.#consumer.onEvent({ type: 'test', phase: 'before', test });
79
- result.skipped += 1;
80
- result.total += 1;
81
- this.#consumer.onEvent({
82
- type: 'test',
83
- phase: 'after',
84
- test: {
85
- ...test,
86
- suiteLineStart: result.lineStart,
87
- assertions: [], duration: 0, durationTotal: 0, output: [], status: 'skipped'
88
- }
89
- });
90
- }
91
-
92
- /**
93
- * An empty suite result based on a suite config
94
- */
95
- createSuiteResult(suite: SuiteConfig, override?: Partial<SuiteResult>): SuiteResult {
96
- return {
97
- passed: 0,
98
- failed: 0,
99
- errored: 0,
100
- skipped: 0,
101
- unknown: 0,
102
- total: 0,
103
- status: 'unknown',
104
- lineStart: suite.lineStart,
105
- lineEnd: suite.lineEnd,
106
- import: suite.import,
107
- classId: suite.classId,
108
- sourceHash: suite.sourceHash,
109
- duration: 0,
110
- tests: {},
111
- ...override
112
- };
113
- }
114
-
115
56
  /**
116
57
  * Execute the test, capture output, assertions and promises
117
58
  */
118
- async executeTest(test: TestConfig, suite: SuiteConfig): Promise<TestResult> {
59
+ async executeTest(instance: unknown, test: TestConfig, suite: SuiteConfig, override?: Partial<TestResult>): Promise<TestResult> {
60
+
61
+ const result = TestModelUtil.createTestResult(suite, test, override);
119
62
 
120
63
  // Mark test start
121
64
  this.#consumer.onEvent({ type: 'test', phase: 'before', test });
122
65
 
123
- const startTime = Date.now();
124
-
125
- const result: TestResult = {
126
- methodName: test.methodName,
127
- description: test.description,
128
- classId: test.classId,
129
- tags: test.tags,
130
- suiteLineStart: suite.lineStart,
131
- lineStart: test.lineStart,
132
- lineEnd: test.lineEnd,
133
- lineBodyStart: test.lineBodyStart,
134
- import: test.import,
135
- declarationImport: test.declarationImport,
136
- sourceHash: test.sourceHash,
137
- status: 'unknown',
138
- assertions: [],
139
- duration: 0,
140
- durationTotal: 0,
141
- output: [],
142
- };
143
66
 
144
67
  // Emit every assertion as it occurs
145
- const getAssertions = AssertCapture.collector(test, asrt =>
146
- this.#consumer.onEvent({
147
- type: 'assertion',
148
- phase: 'after',
149
- assertion: asrt
150
- })
151
- );
68
+ const getAssertions = AssertCapture.collector(test, item =>
69
+ this.#consumer.onEvent({ type: 'assertion', phase: 'after', assertion: item }));
152
70
 
153
71
  const consoleCapture = new ConsoleCapture().start(); // Capture all output from transpiled code
154
72
 
155
- // Run method and get result
156
- const error = await this.#executeTestMethod(test);
157
- const [status, finalError] = AssertCheck.validateTestResultError(test, error);
73
+ // Already finished
74
+ if (result.status !== 'unknown') {
75
+ if (result.error) {
76
+ result.assertions.push(AssertUtil.generateAssertion({ suite, test, error: result.error }));
77
+ }
78
+ for (const item of result.assertions ?? []) { AssertCapture.add(item); }
79
+ } else {
80
+ // Run method and get result
81
+ const startTime = Date.now();
82
+ const error = await this.#executeTestMethod(instance, test);
83
+ const [status, finalError] = AssertCheck.validateTestResultError(test, error);
84
+ result.status = status;
85
+ result.selfDuration = Date.now() - startTime;
86
+ if (finalError) {
87
+ result.error = finalError;
88
+ }
89
+ }
158
90
 
159
- Object.assign(result, {
160
- status,
161
- output: consoleCapture.end(),
162
- assertions: getAssertions(),
163
- duration: Date.now() - startTime,
164
- ...(finalError ? { error: finalError } : {})
165
- });
91
+ result.output = consoleCapture.end();
92
+ result.assertions = getAssertions();
166
93
 
167
94
  // Mark completion
168
95
  this.#consumer.onEvent({ type: 'test', phase: 'after', test: result });
@@ -175,18 +102,21 @@ export class TestExecutor {
175
102
  */
176
103
  async executeSuite(suite: SuiteConfig, tests: TestConfig[]): Promise<void> {
177
104
 
178
- suite.instance = classConstruct(suite.class);
105
+ const instance = classConstruct(suite.class);
179
106
 
180
- const shouldSkip = await this.#shouldSkip(suite, suite.instance);
107
+ const shouldSkip = await this.#shouldSkip(suite, instance);
108
+
109
+ const result: SuiteResult = TestModelUtil.createSuiteResult(suite);
181
110
 
182
111
  if (shouldSkip) {
183
112
  this.#consumer.onEvent({
184
113
  phase: 'after', type: 'suite',
185
- suite: this.createSuiteResult(suite, {
114
+ suite: {
115
+ ...result,
186
116
  status: 'skipped',
187
117
  skipped: tests.length,
188
118
  total: tests.length
189
- })
119
+ }
190
120
  });
191
121
  }
192
122
 
@@ -194,69 +124,80 @@ export class TestExecutor {
194
124
  return;
195
125
  }
196
126
 
197
- const result: SuiteResult = this.createSuiteResult(suite);
127
+ const manager = new TestPhaseManager(suite, instance);
128
+ const originalEnv = { ...process.env };
129
+ const startTime = Date.now();
130
+ const testResultOverrides: Record<string, Partial<TestResult>> = {};
131
+
198
132
  const validTestMethodNames = new Set(tests.map(t => t.methodName));
199
133
  const testConfigs = Object.fromEntries(
200
134
  Object.entries(suite.tests).filter(([key]) => validTestMethodNames.has(key))
201
135
  );
202
136
 
203
- const startTime = Date.now();
204
-
205
137
  // Mark suite start
206
138
  this.#consumer.onEvent({ phase: 'before', type: 'suite', suite: { ...suite, tests: testConfigs } });
207
139
 
208
- const manager = new TestPhaseManager(suite);
209
-
210
- const originalEnv = { ...process.env };
211
-
212
140
  try {
213
141
  // Handle the BeforeAll calls
214
142
  await manager.startPhase('all');
143
+ } catch (someError) {
144
+ const suiteError = await manager.onError('all', someError);
145
+ for (const method of validTestMethodNames) {
146
+ testResultOverrides[method] ??= { status: 'errored', error: suiteError };
147
+ }
148
+ }
215
149
 
216
- const suiteEnv = { ...process.env };
150
+ const suiteEnv = { ...process.env };
217
151
 
218
- for (const test of tests ?? suite.tests) {
219
- if (await this.#shouldSkip(test, suite.instance)) {
220
- this.#skipTest(test, result);
221
- continue;
222
- }
152
+ for (const test of tests) {
153
+ // Reset env before each test
154
+ process.env = { ...suiteEnv };
223
155
 
224
- // Reset env before each test
225
- process.env = { ...suiteEnv };
156
+ const testStart = Date.now();
157
+ const testResultOverride = (testResultOverrides[test.methodName] ??= {});
226
158
 
227
- const testStart = Date.now();
228
- try {
159
+ if (await this.#shouldSkip(test, instance)) {
160
+ testResultOverride.status = 'skipped';
161
+ }
229
162
 
230
- // Handle BeforeEach
231
- await manager.startPhase('each');
163
+ try {
164
+ // Handle BeforeEach
165
+ testResultOverride.status || await manager.startPhase('each');
166
+ } catch (someError) {
167
+ const testError = await manager.onError('each', someError);
168
+ testResultOverride.error = testError;
169
+ testResultOverride.status = 'errored';
170
+ }
232
171
 
233
- // Run test
234
- const testResult = await this.executeTest(test, suite);
235
- result.tests[testResult.methodName] = testResult;
236
- result[testResult.status]++;
237
- result.total += 1;
172
+ // Run test
173
+ const testResult = await this.executeTest(instance, test, suite, testResultOverride);
238
174
 
239
- // Handle after each
240
- await manager.endPhase('each');
241
- testResult.durationTotal = Date.now() - testStart;
242
- } catch (testError) {
243
- const errors = await manager.errorPhase('each', testError, suite, test);
244
- this.#recordSuiteErrors(suite, result, errors);
245
- }
175
+ // Handle after each
176
+ try {
177
+ testResultOverride.status || await manager.endPhase('each');
178
+ } catch (testError) {
179
+ if (!(testError instanceof Error)) { throw testError; };
180
+ console.error('Failed to properly shutdown test', testError.message);
246
181
  }
247
182
 
183
+ result.tests[testResult.methodName] = testResult;
184
+ testResult.duration = Date.now() - testStart;
185
+ TestModelUtil.countTestResult(result, [testResult]);
186
+ }
187
+
188
+ try {
248
189
  // Handle after all
249
190
  await manager.endPhase('all');
250
191
  } catch (suiteError) {
251
- const errors = await manager.errorPhase('all', suiteError, suite);
252
- this.#recordSuiteErrors(suite, result, errors);
192
+ if (!(suiteError instanceof Error)) { throw suiteError; };
193
+ console.error('Failed to properly shutdown test', suiteError.message);
253
194
  }
254
195
 
255
196
  // Restore env
256
197
  process.env = { ...originalEnv };
257
198
 
258
199
  result.duration = Date.now() - startTime;
259
- result.status = TestModelUtil.countsToTestStatus(result);
200
+ result.status = TestModelUtil.computeTestStatus(result);
260
201
 
261
202
  // Mark suite complete
262
203
  this.#consumer.onEvent({ phase: 'after', type: 'suite', suite: result });
@@ -265,19 +206,13 @@ export class TestExecutor {
265
206
  /**
266
207
  * Handle executing a suite's test/tests based on command line inputs
267
208
  */
268
- async execute(run: TestRun): Promise<void> {
209
+ async execute(run: TestRun, singleFile?: boolean): Promise<void> {
269
210
  try {
270
211
  await Runtime.importFrom(run.import);
271
212
  } catch (error) {
272
- if (!(error instanceof Error)) {
273
- throw error;
274
- }
213
+ if (!(error instanceof Error)) { throw error; }
214
+ const suite = TestModelUtil.createImportErrorSuiteResult(run);
275
215
  console.error(error);
276
-
277
- // Fire import failure as a test failure for each test in the suite
278
- const { result, test, suite } = AssertUtil.gernerateImportFailure(run.import, error);
279
- this.#consumer.onEvent({ type: 'suite', phase: 'before', suite });
280
- this.#onSuiteTestError(result, test);
281
216
  this.#consumer.onEvent({ type: 'suite', phase: 'after', suite });
282
217
  return;
283
218
  }
@@ -291,6 +226,11 @@ export class TestExecutor {
291
226
  console.warn('Unable to find suites for ', run);
292
227
  }
293
228
 
229
+ if (singleFile) {
230
+ const testCount = suites.reduce((acc, suite) => acc + suite.tests.length, 0);
231
+ this.#consumer.onTestRunState?.({ testCount });
232
+ }
233
+
294
234
  for (const { suite, tests } of suites) {
295
235
  await this.executeSuite(suite, tests);
296
236
  }
@@ -1,9 +1,7 @@
1
- import { describeFunction, Env, TimeUtil } from '@travetto/runtime';
1
+ import { Env, TimeUtil } from '@travetto/runtime';
2
2
 
3
3
  import type { SuiteConfig, SuitePhase } from '../model/suite.ts';
4
- import { AssertUtil } from '../assert/util.ts';
5
4
  import { Barrier } from './barrier.ts';
6
- import type { TestConfig, TestResult } from '../model/test.ts';
7
5
 
8
6
  const TEST_PHASE_TIMEOUT = TimeUtil.duration(Env.TRV_TEST_PHASE_TIMEOUT.value ?? 15000, 'ms');
9
7
 
@@ -15,9 +13,11 @@ const TEST_PHASE_TIMEOUT = TimeUtil.duration(Env.TRV_TEST_PHASE_TIMEOUT.value ??
15
13
  export class TestPhaseManager {
16
14
  #progress: ('all' | 'each')[] = [];
17
15
  #suite: SuiteConfig;
16
+ #instance: unknown;
18
17
 
19
- constructor(suite: SuiteConfig) {
18
+ constructor(suite: SuiteConfig, instance: unknown) {
20
19
  this.#suite = suite;
20
+ this.#instance = instance;
21
21
  }
22
22
 
23
23
  /**
@@ -31,12 +31,10 @@ export class TestPhaseManager {
31
31
  }
32
32
 
33
33
  // Ensure all the criteria below are satisfied before moving forward
34
- error = await Barrier.awaitOperation(TEST_PHASE_TIMEOUT, async () => handler[phase]?.(this.#suite.instance));
34
+ error = await Barrier.awaitOperation(TEST_PHASE_TIMEOUT, async () => handler[phase]?.(this.#instance));
35
35
 
36
36
  if (error) {
37
- const toThrow = new Error(phase, { cause: error });
38
- Object.assign(toThrow, { import: describeFunction(handler.constructor) ?? undefined });
39
- throw toThrow;
37
+ throw error;
40
38
  }
41
39
  }
42
40
  }
@@ -58,21 +56,13 @@ export class TestPhaseManager {
58
56
  }
59
57
 
60
58
  /**
61
- * Handles if an error occurs during a phase, ensuring that we attempt to end the phase and then return the appropriate test results for the failure
59
+ * Handle an error during phase operation
62
60
  */
63
- async errorPhase(phase: 'all' | 'each', error: unknown, suite: SuiteConfig, test?: TestConfig): Promise<TestResult[]> {
64
- try { await this.endPhase(phase); } catch { }
65
- if (!(error instanceof Error)) { throw error; }
66
-
67
- // Don't propagate our own errors
68
- if (error.message === 'afterAll' || error.message === 'afterEach') {
69
- return [];
70
- }
71
-
72
- if (test) {
73
- return [AssertUtil.generateSuiteTestFailure({ suite, error, test })];
74
- } else {
75
- return AssertUtil.generateSuiteTestFailures(suite, error);
61
+ async onError(phase: 'all' | 'each', error: unknown): Promise<Error> {
62
+ if (!(error instanceof Error)) {
63
+ await this.endPhase(phase).catch(() => { });
64
+ throw error;
76
65
  }
66
+ return error;
77
67
  }
78
68
  }
@@ -3,7 +3,7 @@ import fs from 'node:fs/promises';
3
3
  import readline from 'node:readline/promises';
4
4
  import path from 'node:path';
5
5
 
6
- import { Env, ExecUtil, Util, RuntimeIndex, Runtime, TimeUtil, JSONUtil } from '@travetto/runtime';
6
+ import { Env, ExecUtil, Util, RuntimeIndex, Runtime, TimeUtil, JSONUtil, describeFunction } from '@travetto/runtime';
7
7
  import { WorkPool } from '@travetto/worker';
8
8
  import { Registry } from '@travetto/registry';
9
9
 
@@ -126,6 +126,7 @@ export class RunUtil {
126
126
  const imported = await Registry.manualInit([importPath]);
127
127
  const classes = Object.fromEntries(
128
128
  imported
129
+ .filter(cls => !describeFunction(cls).abstract)
129
130
  .filter(cls => SuiteRegistryIndex.hasConfig(cls))
130
131
  .map(cls => [cls.Ⲑid, SuiteRegistryIndex.getConfig(cls)])
131
132
  );
@@ -222,7 +223,7 @@ export class RunUtil {
222
223
  }
223
224
 
224
225
  if (runs.length === 1) {
225
- await new TestExecutor(consumer).execute(runs[0]);
226
+ await new TestExecutor(consumer).execute(runs[0], true);
226
227
  } else {
227
228
  await WorkPool.run(
228
229
  run => buildStandardTestManager(consumer, run),
@@ -19,10 +19,6 @@ export interface SuiteConfig extends SuiteCore {
19
19
  * Should this be skipped
20
20
  */
21
21
  skip: Skip;
22
- /**
23
- * Actual class instance
24
- */
25
- instance?: unknown;
26
22
  /**
27
23
  * Tests to run
28
24
  */
@@ -34,29 +30,35 @@ export interface SuiteConfig extends SuiteCore {
34
30
  }
35
31
 
36
32
  /**
37
- * All counts for the suite summary
33
+ * Test Counts
38
34
  */
39
- export interface Counts {
35
+ export interface ResultsSummary {
36
+ /** Passing Test Count */
40
37
  passed: number;
38
+ /** Skipped Test Count */
41
39
  skipped: number;
40
+ /** Failed Test Count */
42
41
  failed: number;
42
+ /** Errored Test Count */
43
43
  errored: number;
44
+ /** Unknown Test Count */
44
45
  unknown: number;
46
+ /** Total Test Count */
45
47
  total: number;
48
+ /** Test Self Execution Duration */
49
+ selfDuration: number;
50
+ /** Total Duration */
51
+ duration: number;
46
52
  }
47
53
 
48
54
  /**
49
55
  * Results of a suite run
50
56
  */
51
- export interface SuiteResult extends Counts, SuiteCore {
57
+ export interface SuiteResult extends ResultsSummary, SuiteCore {
52
58
  /**
53
59
  * All test results
54
60
  */
55
61
  tests: Record<string, TestResult>;
56
- /**
57
- * Suite duration
58
- */
59
- duration: number;
60
62
  /**
61
63
  * Overall status
62
64
  */
package/src/model/test.ts CHANGED
@@ -105,13 +105,13 @@ export interface TestResult extends TestCore {
105
105
  */
106
106
  assertions: Assertion[];
107
107
  /**
108
- * Duration for the test
108
+ * Self Execution Duration
109
109
  */
110
- duration: number;
110
+ selfDuration: number;
111
111
  /**
112
112
  * Total duration including before/after
113
113
  */
114
- durationTotal: number;
114
+ duration: number;
115
115
  /**
116
116
  * Logging output
117
117
  */
package/src/model/util.ts CHANGED
@@ -1,14 +1,97 @@
1
- import type { Counts } from './suite.ts';
2
- import type { TestStatus } from './test.ts';
1
+ import path from 'node:path';
2
+
3
+ import { asFull, RuntimeIndex } from '@travetto/runtime';
4
+
5
+ import type { ResultsSummary, SuiteConfig, SuiteResult } from './suite.ts';
6
+ import type { TestConfig, TestResult, TestRun, TestStatus } from './test.ts';
3
7
 
4
8
  export class TestModelUtil {
5
- static countsToTestStatus(counts: Counts): TestStatus {
9
+ static computeTestStatus(summary: ResultsSummary): TestStatus {
6
10
  switch (true) {
7
- case counts.errored > 0: return 'errored';
8
- case counts.failed > 0: return 'failed';
9
- case counts.skipped > 0: return 'skipped';
10
- case counts.unknown > 0: return 'unknown';
11
+ case summary.errored > 0: return 'errored';
12
+ case summary.failed > 0: return 'failed';
13
+ case summary.skipped > 0: return 'skipped';
14
+ case summary.unknown > 0: return 'unknown';
11
15
  default: return 'passed';
12
16
  }
13
17
  }
18
+
19
+ static buildSummary(): ResultsSummary {
20
+ return { passed: 0, failed: 0, skipped: 0, errored: 0, unknown: 0, total: 0, duration: 0, selfDuration: 0 };
21
+ }
22
+
23
+ static countTestResult<T extends ResultsSummary>(summary: T, tests: Pick<TestResult, 'status' | 'selfDuration' | 'duration'>[]): T {
24
+ for (const test of tests) {
25
+ summary[test.status] += 1;
26
+ summary.total += 1;
27
+ summary.selfDuration += (test.selfDuration ?? 0);
28
+ summary.duration += (test.duration ?? 0);
29
+ }
30
+ return summary;
31
+ }
32
+
33
+
34
+ /**
35
+ * An empty suite result based on a suite config
36
+ */
37
+ static createSuiteResult(suite: SuiteConfig, override?: Partial<SuiteResult>): SuiteResult {
38
+ return {
39
+ ...TestModelUtil.buildSummary(),
40
+ status: 'unknown',
41
+ lineStart: suite.lineStart,
42
+ lineEnd: suite.lineEnd,
43
+ import: suite.import,
44
+ classId: suite.classId,
45
+ sourceHash: suite.sourceHash,
46
+ tests: {},
47
+ duration: 0,
48
+ selfDuration: 0,
49
+ ...override
50
+ };
51
+ }
52
+
53
+ /**
54
+ * An empty test result based on a suite and test config
55
+ */
56
+ static createTestResult(suite: SuiteConfig, test: TestConfig, override?: Partial<TestResult>): TestResult {
57
+ return {
58
+ methodName: test.methodName,
59
+ description: test.description,
60
+ classId: test.classId,
61
+ tags: test.tags,
62
+ suiteLineStart: suite.lineStart,
63
+ lineStart: test.lineStart,
64
+ lineEnd: test.lineEnd,
65
+ lineBodyStart: test.lineBodyStart,
66
+ import: test.import,
67
+ declarationImport: test.declarationImport,
68
+ sourceHash: test.sourceHash,
69
+ status: 'unknown',
70
+ assertions: [],
71
+ duration: 0,
72
+ selfDuration: 0,
73
+ output: [],
74
+ ...override
75
+ };
76
+ }
77
+
78
+ static createImportErrorSuiteResult(run: TestRun): SuiteResult {
79
+ const name = path.basename(run.import);
80
+ const classId = `${RuntimeIndex.getFromImport(run.import)?.id}#${name}`;
81
+ const common = { classId, duration: 0, lineStart: 1, lineEnd: 1, import: run.import } as const;
82
+ return asFull<SuiteResult>({
83
+ ...common,
84
+ status: 'errored', errored: 1,
85
+ tests: {
86
+ impport: asFull<TestResult>({
87
+ ...common,
88
+ status: 'errored',
89
+ assertions: [{
90
+ ...common, line: common.lineStart,
91
+ methodName: 'import', operator: 'import', text: `Failed to import ${run.import}`,
92
+ }]
93
+ })
94
+ }
95
+ });
96
+ }
14
97
  }
@@ -20,9 +20,7 @@ export class TestChildWorker extends IpcChannel<TestRun> {
20
20
  await operation();
21
21
  this.send(type); // Respond
22
22
  } catch (error) {
23
- if (!(error instanceof Error)) {
24
- throw error;
25
- }
23
+ if (!(error instanceof Error)) { throw error; }
26
24
  // Mark as errored out
27
25
  this.send(type, JSONUtil.cloneForTransmit(error));
28
26
  }
@@ -8,7 +8,10 @@ import { Max, Min } from '@travetto/schema';
8
8
  import type { TestConsumerType } from './bin/run.ts';
9
9
 
10
10
  /**
11
- * Launch test framework and execute tests
11
+ * Execute the test framework for targeted files, suites, or methods.
12
+ *
13
+ * Supports glob-based discovery, import-based targeting, tag filtering, and
14
+ * configurable output consumers for local and CI workflows.
12
15
  */
13
16
  @CliCommand()
14
17
  export class TestCommand implements CliCommandShape {
@@ -4,7 +4,12 @@ import { Env } from '@travetto/runtime';
4
4
  import { CliCommand } from '@travetto/cli';
5
5
  import { IsPrivate } from '@travetto/schema';
6
6
 
7
- /** Test child worker target */
7
+ /**
8
+ * Internal command target for test child workers.
9
+ *
10
+ * Used by the test runner to bootstrap isolated worker processes with test-
11
+ * oriented runtime configuration.
12
+ */
8
13
  @CliCommand()
9
14
  @IsPrivate()
10
15
  export class TestChildWorkerCommand {
@@ -7,7 +7,12 @@ import { IsPrivate } from '@travetto/schema';
7
7
  import { runTests, type TestConsumerType } from './bin/run.ts';
8
8
  import type { TestDiffSource } from '../src/model/test.ts';
9
9
 
10
- /** Direct test invocation */
10
+ /**
11
+ * Run tests scoped by a precomputed diff source file.
12
+ *
13
+ * The first argument resolves the test import root, and the second argument is
14
+ * a JSON diff payload consumed by test-selection logic.
15
+ */
11
16
  @CliCommand()
12
17
  @IsPrivate()
13
18
  export class TestDiffCommand {
@@ -8,8 +8,15 @@ import { RunUtil } from '../src/execute/run.ts';
8
8
 
9
9
  @CliCommand()
10
10
  @IsPrivate()
11
+ /**
12
+ * Produce a deterministic digest of discovered test identifiers.
13
+ *
14
+ * This is an internal command used by tooling to enumerate tests in a stable
15
+ * order for planning, sharding, or change detection workflows.
16
+ */
11
17
  export class TestDigestCommand {
12
18
 
19
+ /** Output mode for digest emission. */
13
20
  output: 'json' | 'text' = 'text';
14
21
 
15
22
  preMain(): void {