@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 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
- var Δm_1 = ["@travetto/test", "doc/assert-example.ts"];
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.5",
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.5",
32
- "@travetto/runtime": "^7.0.4",
33
- "@travetto/terminal": "^7.0.4",
34
- "@travetto/worker": "^7.0.4",
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.6",
39
- "@travetto/transformer": "^7.0.4"
38
+ "@travetto/cli": "^7.1.0",
39
+ "@travetto/transformer": "^7.1.0"
40
40
  },
41
41
  "peerDependenciesMeta": {
42
42
  "@travetto/transformer": {
@@ -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, ShutdownManager, Util, RuntimeIndex, Runtime, TimeUtil, JSONUtil } from '@travetto/runtime';
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],
@@ -42,8 +42,6 @@ export class TestChildWorker extends IpcChannel<TestRun> {
42
42
  ConsoleManager.set({ log: () => { } });
43
43
  }
44
44
 
45
- RunUtil.registerCleanup('worker');
46
-
47
45
  // Listen for inbound requests
48
46
  this.on('*', event => this.onCommand(event));
49
47
 
@@ -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']
@@ -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;
@@ -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> {
@@ -24,7 +24,6 @@ export class TestDiffCommand {
24
24
 
25
25
  preMain(): void {
26
26
  Env.TRV_ROLE.set('test');
27
- Env.TRV_ENV.set('test');
28
27
  Env.TRV_LOG_PLAIN.set(true);
29
28
  Env.TRV_LOG_TIME.clear();
30
29
  }
@@ -23,7 +23,6 @@ export class TestDirectCommand {
23
23
 
24
24
  preMain(): void {
25
25
  Env.TRV_ROLE.set('test');
26
- Env.TRV_ENV.set('test');
27
26
  Env.TRV_LOG_PLAIN.set(true);
28
27
  Env.TRV_LOG_TIME.clear();
29
28
  }