@travetto/test 3.3.6 → 3.4.0-rc.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
@@ -224,7 +224,7 @@ Usage: test [options] [first:string] [regexes...:string]
224
224
 
225
225
  Options:
226
226
  -f, --format <string> Output format for test results (default: "tap")
227
- -c, --concurrency <number> Number of tests to run concurrently (default: 7)
227
+ -c, --concurrency <number> Number of tests to run concurrently (default: 4)
228
228
  -m, --mode <single|standard> Test run mode (default: "standard")
229
229
  -h, --help display help for command
230
230
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/test",
3
- "version": "3.3.6",
3
+ "version": "3.4.0-rc.0",
4
4
  "description": "Declarative test framework",
5
5
  "keywords": [
6
6
  "unit-testing",
@@ -27,15 +27,15 @@
27
27
  "directory": "module/test"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/base": "^3.3.4",
31
- "@travetto/registry": "^3.3.4",
32
- "@travetto/terminal": "^3.3.1",
33
- "@travetto/worker": "^3.3.4",
34
- "@travetto/yaml": "^3.3.4"
30
+ "@travetto/base": "^3.4.0-rc.0",
31
+ "@travetto/registry": "^3.4.0-rc.0",
32
+ "@travetto/terminal": "^3.4.0-rc.0",
33
+ "@travetto/worker": "^3.4.0-rc.0",
34
+ "@travetto/yaml": "^3.4.0-rc.0"
35
35
  },
36
36
  "peerDependencies": {
37
- "@travetto/cli": "^3.3.6",
38
- "@travetto/transformer": "^3.3.2"
37
+ "@travetto/cli": "^3.4.0-rc.0",
38
+ "@travetto/transformer": "^3.4.0-rc.0"
39
39
  },
40
40
  "peerDependenciesMeta": {
41
41
  "@travetto/transformer": {
@@ -1,4 +1,4 @@
1
- import fs from 'fs';
1
+ import { existsSync } from 'fs';
2
2
 
3
3
  import { Class } from '@travetto/base';
4
4
 
@@ -28,7 +28,7 @@ export class CumulativeSummaryConsumer implements TestConsumer {
28
28
  */
29
29
  summarizeSuite(test: TestResult): SuiteResult {
30
30
  // Was only loading to verify existence (TODO: double-check)
31
- if (fs.existsSync(test.file)) {
31
+ if (existsSync(test.file)) {
32
32
  this.#state[test.classId] = this.#state[test.classId] ?? {};
33
33
  this.#state[test.classId][test.methodName] = test.status;
34
34
  const SuiteCls = SuiteRegistry.getClasses().find(x =>
@@ -1,6 +1,6 @@
1
- import fs from 'fs/promises';
1
+ import { createWriteStream } from 'fs';
2
2
 
3
- import { path } from '@travetto/manifest';
3
+ import { ManifestFileUtil, RootIndex } from '@travetto/manifest';
4
4
  import { ConsoleManager, ErrorUtil, TimeUtil } from '@travetto/base';
5
5
  import { ChildCommChannel } from '@travetto/worker';
6
6
 
@@ -32,9 +32,7 @@ export class TestChildWorker extends ChildCommChannel<RunEvent> {
32
32
  */
33
33
  async activate(): Promise<void> {
34
34
  if (/\b@travetto[/]test\b/.test(process.env.DEBUG ?? '')) {
35
- const handle = await fs.open(path.resolve(`.trv-test-worker.${process.pid}.log`), 'a');
36
- const stdout = handle.createWriteStream();
37
-
35
+ const stdout = createWriteStream(ManifestFileUtil.toolPath(RootIndex, `test-worker.${process.pid}.log`), { flags: 'a' });
38
36
  const c = new console.Console({ stdout, inspectOptions: { depth: 4, colors: false } });
39
37
  ConsoleManager.set({ onLog: (ev) => c[ev.level](process.pid, ...ev.args) });
40
38
  } else {
@@ -61,7 +59,6 @@ export class TestChildWorker extends ChildCommChannel<RunEvent> {
61
59
  if (event.type === Events.INIT) { // On request to init, start initialization
62
60
  await this.#exec(() => this.onInitCommand(), Events.INIT_COMPLETE);
63
61
  } else if (event.type === Events.RUN) { // On request to run, start running
64
- console.log!(process.stdout.isTTY && process.stdout.getColorDepth());
65
62
  await this.#exec(() => this.onRunCommand(event), Events.RUN_COMPLETE);
66
63
  }
67
64
 
@@ -39,7 +39,7 @@ export function buildStandardTestManager(consumer: TestConsumer): () => Worker<s
39
39
 
40
40
  const channel = new ParentCommChannel<TestEvent & { error?: Error }>(
41
41
  ExecUtil.fork(
42
- RootIndex.resolveFileImport('@travetto/cli/support/entry.cli'),
42
+ RootIndex.resolveFileImport('@travetto/cli/support/entry.trv'),
43
43
  ['test:child'],
44
44
  {
45
45
  cwd,
@@ -18,7 +18,7 @@ export class TestCommand implements CliCommandShape {
18
18
  format: TestFormat = 'tap';
19
19
  /** Number of tests to run concurrently */
20
20
  @Min(1) @Max(WorkPool.MAX_SIZE)
21
- concurrency: number = WorkPool.MAX_SIZE;
21
+ concurrency: number = WorkPool.DEFAULT_SIZE;
22
22
  /** Test run mode */
23
23
  mode: TestMode = 'standard';
24
24
 
@@ -1,5 +1,5 @@
1
1
  import { GlobalEnvConfig } from '@travetto/base';
2
- import { CliCommand } from '@travetto/cli';
2
+ import { CliCommand, CliUtil } from '@travetto/cli';
3
3
 
4
4
  import { TestFormat } from './bin/types';
5
5
 
@@ -17,6 +17,10 @@ export class TestWatcherCommand {
17
17
  }
18
18
 
19
19
  async main(): Promise<void> {
20
+ if (await CliUtil.runWithRestart(this)) {
21
+ return;
22
+ }
23
+
20
24
  // Quit on parent disconnect
21
25
  if (process.send) {
22
26
  process.on('disconnect', () => process.exit(0));
@@ -24,9 +28,7 @@ export class TestWatcherCommand {
24
28
 
25
29
  try {
26
30
  const { TestWatcher } = await import('../src/execute/watcher.js');
27
- console.log('Starting');
28
31
  await TestWatcher.watch(this.format, this.mode === 'all');
29
- console.log('Done');
30
32
  } catch (err) {
31
33
  console.error(err);
32
34
  }