@travetto/test 8.0.0-alpha.14 → 8.0.0-alpha.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.
- package/README.md +8 -1
- package/package.json +8 -8
- package/src/consumer/types/tap-summary.ts +13 -5
- package/support/cli.test.ts +4 -1
- package/support/cli.test_child.ts +6 -1
- package/support/cli.test_diff.ts +6 -1
- package/support/cli.test_digest.ts +7 -0
- package/support/cli.test_direct.ts +6 -1
- package/support/cli.test_watch.ts +4 -1
package/README.md
CHANGED
|
@@ -220,12 +220,19 @@ class SimpleTest {
|
|
|
220
220
|
## Running Tests
|
|
221
221
|
To run the tests you can either call the [Command Line Interface](https://github.com/travetto/travetto/tree/main/module/cli#readme "CLI infrastructure for Travetto framework") by invoking
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
## CLI - test
|
|
224
|
+
|
|
225
|
+
**Terminal: Help for test**
|
|
224
226
|
```bash
|
|
225
227
|
$ trv test --help
|
|
226
228
|
|
|
227
229
|
Usage: test [options] [first:string] [globs...:string]
|
|
228
230
|
|
|
231
|
+
Execute the test framework for targeted files, suites, or methods.
|
|
232
|
+
|
|
233
|
+
Supports glob-based discovery, import-based targeting, tag filtering, and
|
|
234
|
+
configurable output consumers for local and CI workflows.
|
|
235
|
+
|
|
229
236
|
Options:
|
|
230
237
|
-f, --format <string> Output format for test results (default: "tap")
|
|
231
238
|
-c, --concurrency <number> Number of tests to run concurrently (default: 9)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/test",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Declarative test framework",
|
|
6
6
|
"keywords": [
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"directory": "module/test"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@travetto/registry": "^8.0.0-alpha.
|
|
32
|
-
"@travetto/runtime": "^8.0.0-alpha.
|
|
33
|
-
"@travetto/terminal": "^8.0.0-alpha.
|
|
34
|
-
"@travetto/worker": "^8.0.0-alpha.
|
|
35
|
-
"yaml": "^2.
|
|
31
|
+
"@travetto/registry": "^8.0.0-alpha.16",
|
|
32
|
+
"@travetto/runtime": "^8.0.0-alpha.16",
|
|
33
|
+
"@travetto/terminal": "^8.0.0-alpha.16",
|
|
34
|
+
"@travetto/worker": "^8.0.0-alpha.16",
|
|
35
|
+
"yaml": "^2.9.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@travetto/cli": "^8.0.0-alpha.
|
|
39
|
-
"@travetto/transformer": "^8.0.0-alpha.
|
|
38
|
+
"@travetto/cli": "^8.0.0-alpha.22",
|
|
39
|
+
"@travetto/transformer": "^8.0.0-alpha.11"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@travetto/transformer": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Util, AsyncQueue } from '@travetto/runtime';
|
|
2
|
-
import {
|
|
2
|
+
import { Terminal, TerminalUtil } from '@travetto/terminal';
|
|
3
3
|
|
|
4
4
|
import type { TestEvent } from '../../model/event.ts';
|
|
5
5
|
import type { TestResult } from '../../model/test.ts';
|
|
@@ -98,17 +98,25 @@ export class TapSummaryEmitter implements TestConsumerShape {
|
|
|
98
98
|
this.onTestRunState(state);
|
|
99
99
|
|
|
100
100
|
const total = TestModelUtil.buildSummary();
|
|
101
|
-
const success = StyleUtil.getStyle({ text: '#e5e5e5', background: '#026020' }); // White on dark green
|
|
102
|
-
const fail = StyleUtil.getStyle({ text: '#e5e5e5', background: '#8b0000' }); // White on dark red
|
|
103
101
|
this.#progress = this.#terminal.streamToBottom(
|
|
104
102
|
Util.mapAsyncIterable(
|
|
105
103
|
this.#results,
|
|
106
104
|
(value) => {
|
|
107
105
|
TestModelUtil.countTestResult(total, [value]);
|
|
108
106
|
const statusLine = `${total.failed} failed, ${total.errored} errored, ${total.skipped} skipped`;
|
|
109
|
-
return {
|
|
107
|
+
return {
|
|
108
|
+
value: `Tests %completed/%total [${statusLine}] -- ${value.classId}`,
|
|
109
|
+
total: this.#state.testCount,
|
|
110
|
+
completed: total.passed,
|
|
111
|
+
failed: total.failed + total.errored
|
|
112
|
+
};
|
|
110
113
|
},
|
|
111
|
-
TerminalUtil.progressBarUpdater(this.#terminal, {
|
|
114
|
+
TerminalUtil.progressBarUpdater(this.#terminal, {
|
|
115
|
+
style: {
|
|
116
|
+
complete: { text: '#e5e5e5', background: '#026020' },
|
|
117
|
+
failed: { text: '#e5e5e5', background: '#8b0000' }
|
|
118
|
+
}
|
|
119
|
+
})
|
|
112
120
|
),
|
|
113
121
|
{ minDelay: 100 }
|
|
114
122
|
);
|
package/support/cli.test.ts
CHANGED
|
@@ -8,7 +8,10 @@ import { Max, Min } from '@travetto/schema';
|
|
|
8
8
|
import type { TestConsumerType } from './bin/run.ts';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
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
|
-
/**
|
|
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 {
|
package/support/cli.test_diff.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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 {
|
|
@@ -4,7 +4,12 @@ import { IsPrivate } from '@travetto/schema';
|
|
|
4
4
|
|
|
5
5
|
import { runTests, type TestConsumerType } from './bin/run.ts';
|
|
6
6
|
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Run tests directly from an import or source file with optional class/method filtering.
|
|
9
|
+
*
|
|
10
|
+
* This internal command bypasses discovery by targeting a specific test import
|
|
11
|
+
* and optional class or method names.
|
|
12
|
+
*/
|
|
8
13
|
@CliCommand()
|
|
9
14
|
@IsPrivate()
|
|
10
15
|
export class TestDirectCommand {
|
|
@@ -4,7 +4,10 @@ import { CliCommand } from '@travetto/cli';
|
|
|
4
4
|
import type { TestConsumerType } from './bin/run.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Start the test watcher for continuous test execution.
|
|
8
|
+
*
|
|
9
|
+
* Watches project changes and reruns either all tests or changed subsets,
|
|
10
|
+
* using the configured output format.
|
|
8
11
|
*/
|
|
9
12
|
@CliCommand()
|
|
10
13
|
export class TestWatcherCommand {
|