@travetto/test 8.0.0-alpha.0 → 8.0.0-alpha.10
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 +1 -1
- package/package.json +8 -8
- package/src/assert/check.ts +3 -7
- package/src/assert/util.ts +19 -80
- package/src/consumer/types/cumulative.ts +6 -18
- package/src/consumer/types/delegating.ts +6 -0
- package/src/consumer/types/runnable.ts +2 -1
- package/src/consumer/types/summarizer.ts +4 -16
- package/src/consumer/types/tap-summary.ts +13 -7
- package/src/consumer/types/tap.ts +25 -45
- package/src/consumer/types/util.ts +28 -0
- package/src/consumer/types/xunit.ts +3 -2
- package/src/consumer/types.ts +6 -10
- package/src/decorator/suite.ts +1 -3
- package/src/execute/executor.ts +97 -143
- package/src/execute/phase.ts +12 -22
- package/src/execute/run.ts +3 -2
- package/src/model/suite.ts +13 -11
- package/src/model/test.ts +3 -3
- package/src/model/util.ts +90 -7
- package/src/registry/registry-adapter.ts +20 -5
- package/src/worker/child.ts +1 -3
- package/support/bin/run.ts +1 -18
- package/support/cli.test.ts +4 -7
- package/support/cli.test_diff.ts +3 -6
- package/support/cli.test_direct.ts +3 -6
- package/support/cli.test_watch.ts +4 -6
package/support/bin/run.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { getClass, Runtime } from '@travetto/runtime';
|
|
2
|
-
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
3
|
-
|
|
4
|
-
import { TestConsumerRegistryIndex } from '../../src/consumer/registry-index.ts';
|
|
5
1
|
import type { TestConsumerConfig } from '../../src/execute/types.ts';
|
|
6
2
|
import type { TestRunInput } from '../../src/model/test.ts';
|
|
7
3
|
|
|
@@ -21,17 +17,4 @@ export async function runTests(state: TestConsumerConfig, input: TestRunInput):
|
|
|
21
17
|
}
|
|
22
18
|
}
|
|
23
19
|
|
|
24
|
-
export
|
|
25
|
-
if (instance.format?.includes('/')) {
|
|
26
|
-
await Runtime.importFrom(instance.format);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const types = await TestConsumerRegistryIndex.getTypes();
|
|
30
|
-
|
|
31
|
-
SchemaRegistryIndex.getForRegister(getClass(instance), true).registerField('format', {
|
|
32
|
-
enum: {
|
|
33
|
-
message: `{path} is only allowed to be "${types.join('" or "')}"`,
|
|
34
|
-
values: types
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
20
|
+
export type TestConsumerType = 'tap' | 'tap-summary' | 'json' | 'exec' | 'event' | 'xunit' | 'custom';
|
package/support/cli.test.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { type CliCommandShape, CliCommand, CliUtil } from '@travetto/cli';
|
|
|
5
5
|
import { WorkPool } from '@travetto/worker';
|
|
6
6
|
import { Max, Min } from '@travetto/schema';
|
|
7
7
|
|
|
8
|
+
import type { TestConsumerType } from './bin/run.ts';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* Launch test framework and execute tests
|
|
10
12
|
*/
|
|
@@ -12,7 +14,7 @@ import { Max, Min } from '@travetto/schema';
|
|
|
12
14
|
export class TestCommand implements CliCommandShape {
|
|
13
15
|
|
|
14
16
|
/** Output format for test results */
|
|
15
|
-
format:
|
|
17
|
+
format: TestConsumerType = 'tap';
|
|
16
18
|
|
|
17
19
|
/** Number of tests to run concurrently */
|
|
18
20
|
@Min(1) @Max(WorkPool.MAX_SIZE)
|
|
@@ -30,7 +32,7 @@ export class TestCommand implements CliCommandShape {
|
|
|
30
32
|
*/
|
|
31
33
|
formatOptions?: string[];
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
finalize(): void {
|
|
34
36
|
EventEmitter.defaultMaxListeners = 1000;
|
|
35
37
|
Env.TRV_ROLE.set('test');
|
|
36
38
|
Env.DEBUG.set(false);
|
|
@@ -38,11 +40,6 @@ export class TestCommand implements CliCommandShape {
|
|
|
38
40
|
Env.TRV_LOG_TIME.clear();
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
async preValidate(): Promise<void> {
|
|
42
|
-
const { selectConsumer } = await import('./bin/run.ts');
|
|
43
|
-
await selectConsumer(this);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
43
|
async main(first: string = '**/*', globs: string[] = []): Promise<void> {
|
|
47
44
|
const { runTests } = await import('./bin/run.ts');
|
|
48
45
|
|
package/support/cli.test_diff.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Env, JSONUtil, RuntimeIndex } from '@travetto/runtime';
|
|
|
4
4
|
import { CliCommand, CliUtil } from '@travetto/cli';
|
|
5
5
|
import { IsPrivate } from '@travetto/schema';
|
|
6
6
|
|
|
7
|
-
import { runTests,
|
|
7
|
+
import { runTests, type TestConsumerType } from './bin/run.ts';
|
|
8
8
|
import type { TestDiffSource } from '../src/model/test.ts';
|
|
9
9
|
|
|
10
10
|
/** Direct test invocation */
|
|
@@ -12,7 +12,8 @@ import type { TestDiffSource } from '../src/model/test.ts';
|
|
|
12
12
|
@IsPrivate()
|
|
13
13
|
export class TestDiffCommand {
|
|
14
14
|
|
|
15
|
-
format
|
|
15
|
+
/** Output format for test results */
|
|
16
|
+
format: TestConsumerType = 'tap';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Format options
|
|
@@ -20,10 +21,6 @@ export class TestDiffCommand {
|
|
|
20
21
|
*/
|
|
21
22
|
formatOptions?: string[];
|
|
22
23
|
|
|
23
|
-
async preValidate(): Promise<void> {
|
|
24
|
-
await selectConsumer(this);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
24
|
preMain(): void {
|
|
28
25
|
Env.TRV_ROLE.set('test');
|
|
29
26
|
Env.TRV_LOG_PLAIN.set(true);
|
|
@@ -2,14 +2,15 @@ import { Env, RuntimeIndex } from '@travetto/runtime';
|
|
|
2
2
|
import { CliCommand, CliUtil } from '@travetto/cli';
|
|
3
3
|
import { IsPrivate } from '@travetto/schema';
|
|
4
4
|
|
|
5
|
-
import { runTests,
|
|
5
|
+
import { runTests, type TestConsumerType } from './bin/run.ts';
|
|
6
6
|
|
|
7
7
|
/** Direct test invocation */
|
|
8
8
|
@CliCommand()
|
|
9
9
|
@IsPrivate()
|
|
10
10
|
export class TestDirectCommand {
|
|
11
11
|
|
|
12
|
-
format
|
|
12
|
+
/** Output format for test results */
|
|
13
|
+
format: TestConsumerType = 'tap';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Format options
|
|
@@ -17,10 +18,6 @@ export class TestDirectCommand {
|
|
|
17
18
|
*/
|
|
18
19
|
formatOptions?: string[];
|
|
19
20
|
|
|
20
|
-
async preValidate(): Promise<void> {
|
|
21
|
-
await selectConsumer(this);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
21
|
preMain(): void {
|
|
25
22
|
Env.TRV_ROLE.set('test');
|
|
26
23
|
Env.TRV_LOG_PLAIN.set(true);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Env } from '@travetto/runtime';
|
|
2
2
|
import { CliCommand } from '@travetto/cli';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { TestConsumerType } from './bin/run.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Invoke the test watcher
|
|
@@ -9,12 +9,10 @@ import { selectConsumer } from './bin/run.ts';
|
|
|
9
9
|
@CliCommand()
|
|
10
10
|
export class TestWatcherCommand {
|
|
11
11
|
|
|
12
|
-
format
|
|
13
|
-
|
|
12
|
+
/** Output format for test results */
|
|
13
|
+
format: TestConsumerType = 'tap';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
await selectConsumer(this);
|
|
17
|
-
}
|
|
15
|
+
mode: 'all' | 'change' = 'all';
|
|
18
16
|
|
|
19
17
|
preMain(): void {
|
|
20
18
|
Env.TRV_ROLE.set('test');
|