@travetto/test 7.0.5 → 7.1.0
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 +7 -7
- package/src/execute/run.ts +3 -9
- package/src/registry/registry-adapter.ts +4 -0
- package/src/worker/child.ts +0 -2
- package/src/worker/standard.ts +0 -4
- package/support/bin/run.ts +0 -2
- package/support/cli.test.ts +1 -1
- package/support/cli.test_child.ts +1 -1
- package/support/cli.test_diff.ts +0 -1
- package/support/cli.test_direct.ts +0 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ import * as Δdebug from "@travetto/runtime/src/debug.js";
|
|
|
82
82
|
import * as Δcheck from "@travetto/test/src/assert/check.js";
|
|
83
83
|
import * as Δfunction from "@travetto/runtime/src/function.js";
|
|
84
84
|
import * as Δschema from "@travetto/schema/src/decorator/schema.js";
|
|
85
|
-
|
|
85
|
+
const Δm_1 = ["@travetto/test", "doc/assert-example.ts"];
|
|
86
86
|
import assert from 'node:assert';
|
|
87
87
|
import { Suite, Test } from '@travetto/test';
|
|
88
88
|
let SimpleTest = class SimpleTest {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/test",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
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": "^7.0
|
|
32
|
-
"@travetto/runtime": "^7.0
|
|
33
|
-
"@travetto/terminal": "^7.0
|
|
34
|
-
"@travetto/worker": "^7.0
|
|
31
|
+
"@travetto/registry": "^7.1.0",
|
|
32
|
+
"@travetto/runtime": "^7.1.0",
|
|
33
|
+
"@travetto/terminal": "^7.1.0",
|
|
34
|
+
"@travetto/worker": "^7.1.0",
|
|
35
35
|
"yaml": "^2.8.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@travetto/cli": "^7.0
|
|
39
|
-
"@travetto/transformer": "^7.0
|
|
38
|
+
"@travetto/cli": "^7.1.0",
|
|
39
|
+
"@travetto/transformer": "^7.1.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@travetto/transformer": {
|
package/src/execute/run.ts
CHANGED
|
@@ -4,7 +4,7 @@ import readline from 'node:readline/promises';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { spawn } from 'node:child_process';
|
|
6
6
|
|
|
7
|
-
import { Env, ExecUtil,
|
|
7
|
+
import { Env, ExecUtil, Util, RuntimeIndex, Runtime, TimeUtil, JSONUtil } from '@travetto/runtime';
|
|
8
8
|
import { WorkPool } from '@travetto/worker';
|
|
9
9
|
import { Registry } from '@travetto/registry';
|
|
10
10
|
|
|
@@ -27,12 +27,6 @@ type RunState = {
|
|
|
27
27
|
* Test Utilities for Running
|
|
28
28
|
*/
|
|
29
29
|
export class RunUtil {
|
|
30
|
-
/**
|
|
31
|
-
* Add 50 ms to the shutdown to allow for buffers to output properly
|
|
32
|
-
*/
|
|
33
|
-
static registerCleanup(scope: string): void {
|
|
34
|
-
ShutdownManager.onGracefulShutdown(() => Util.blockingTimeout(50), `test.${scope}.bufferOutput`);
|
|
35
|
-
}
|
|
36
30
|
|
|
37
31
|
/**
|
|
38
32
|
* Determine if a given file path is a valid test file
|
|
@@ -220,11 +214,11 @@ export class RunUtil {
|
|
|
220
214
|
static async runTests(consumerConfig: TestConsumerConfig, input: TestRunInput): Promise<boolean | undefined> {
|
|
221
215
|
const { runs, removes } = await this.resolveInput(input);
|
|
222
216
|
|
|
223
|
-
await this.reinitManifestIfNeeded(runs);
|
|
224
|
-
|
|
225
217
|
const targetConsumer = await TestConsumerRegistryIndex.getInstance(consumerConfig);
|
|
226
218
|
const consumer = await this.getRunnableConsumer(targetConsumer, runs);
|
|
227
219
|
|
|
220
|
+
await this.reinitManifestIfNeeded(runs);
|
|
221
|
+
|
|
228
222
|
for (const item of removes ?? []) {
|
|
229
223
|
consumer.onRemoveEvent(item);
|
|
230
224
|
}
|
|
@@ -22,6 +22,8 @@ function combineClasses(baseConfig: SuiteConfig, ...subConfig: Partial<SuiteConf
|
|
|
22
22
|
if (config.tags) {
|
|
23
23
|
baseConfig.tags = [...baseConfig.tags ?? [], ...config.tags];
|
|
24
24
|
}
|
|
25
|
+
baseConfig.skip = config.skip ?? baseConfig.skip;
|
|
26
|
+
|
|
25
27
|
if (config.tests) {
|
|
26
28
|
for (const [key, test] of Object.entries(config.tests ?? {})) {
|
|
27
29
|
baseConfig.tests[key] = {
|
|
@@ -66,6 +68,7 @@ export class SuiteRegistryAdapter implements RegistryAdapter<SuiteConfig> {
|
|
|
66
68
|
class: this.#cls,
|
|
67
69
|
classId: this.#cls.Ⲑid,
|
|
68
70
|
tags: [],
|
|
71
|
+
skip: false,
|
|
69
72
|
import: Runtime.getImport(this.#cls),
|
|
70
73
|
lineStart: lines?.[0],
|
|
71
74
|
lineEnd: lines?.[1],
|
|
@@ -89,6 +92,7 @@ export class SuiteRegistryAdapter implements RegistryAdapter<SuiteConfig> {
|
|
|
89
92
|
const config = asFull<TestConfig>({
|
|
90
93
|
class: this.#cls,
|
|
91
94
|
tags: [],
|
|
95
|
+
skip: false,
|
|
92
96
|
import: Runtime.getImport(this.#cls),
|
|
93
97
|
lineStart: lines?.[0],
|
|
94
98
|
lineEnd: lines?.[1],
|
package/src/worker/child.ts
CHANGED
package/src/worker/standard.ts
CHANGED
|
@@ -20,16 +20,12 @@ const log = (message: string | TestLogEvent): void => {
|
|
|
20
20
|
export async function buildStandardTestManager(consumer: TestConsumerShape, run: TestRun | TestDiffInput): Promise<void> {
|
|
21
21
|
log(`Worker Input ${JSON.stringify(run)}`);
|
|
22
22
|
|
|
23
|
-
const suiteMod = RuntimeIndex.findModuleForArbitraryImport(run.import)!;
|
|
24
|
-
|
|
25
23
|
const channel = new IpcChannel<TestEvent & { error?: Error }>(
|
|
26
24
|
fork(
|
|
27
25
|
RuntimeIndex.resolveFileImport('@travetto/cli/support/entry.trv.ts'), ['test:child'],
|
|
28
26
|
{
|
|
29
|
-
cwd: suiteMod.sourcePath,
|
|
30
27
|
env: {
|
|
31
28
|
...process.env,
|
|
32
|
-
...Env.TRV_MANIFEST.export(suiteMod.outputPath),
|
|
33
29
|
...Env.TRV_QUIET.export(true)
|
|
34
30
|
},
|
|
35
31
|
stdio: ['ignore', 'ignore', 2, 'ipc']
|
package/support/bin/run.ts
CHANGED
|
@@ -12,8 +12,6 @@ import type { TestRunInput } from '../../src/model/test.ts';
|
|
|
12
12
|
export async function runTests(state: TestConsumerConfig, input: TestRunInput): Promise<void> {
|
|
13
13
|
const { RunUtil } = await import('../../src/execute/run.ts');
|
|
14
14
|
|
|
15
|
-
RunUtil.registerCleanup('runner');
|
|
16
|
-
|
|
17
15
|
try {
|
|
18
16
|
const result = await RunUtil.runTests(state, input);
|
|
19
17
|
process.exitCode = result ? 0 : 1;
|
package/support/cli.test.ts
CHANGED
|
@@ -33,10 +33,10 @@ export class TestCommand implements CliCommandShape {
|
|
|
33
33
|
preMain(): void {
|
|
34
34
|
EventEmitter.defaultMaxListeners = 1000;
|
|
35
35
|
Env.TRV_ROLE.set('test');
|
|
36
|
-
Env.TRV_ENV.set('test');
|
|
37
36
|
Env.DEBUG.set(false);
|
|
38
37
|
Env.TRV_LOG_PLAIN.set(true);
|
|
39
38
|
Env.TRV_LOG_TIME.clear();
|
|
39
|
+
Env.TRV_SHUTDOWN_STDOUT_WAIT.set(50);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
async preValidate(): Promise<void> {
|
|
@@ -11,11 +11,11 @@ export class TestChildWorkerCommand {
|
|
|
11
11
|
preMain(): void {
|
|
12
12
|
EventEmitter.defaultMaxListeners = 1000;
|
|
13
13
|
Env.TRV_ROLE.set('test');
|
|
14
|
-
Env.TRV_ENV.set('test');
|
|
15
14
|
Env.DEBUG.set(false);
|
|
16
15
|
Env.FORCE_COLOR.set(false);
|
|
17
16
|
Env.TRV_LOG_PLAIN.set(true);
|
|
18
17
|
Env.TRV_LOG_TIME.clear();
|
|
18
|
+
Env.TRV_SHUTDOWN_STDOUT_WAIT.set(50);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async main(): Promise<void> {
|
package/support/cli.test_diff.ts
CHANGED