@travetto/test 2.0.1 → 2.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
@@ -88,12 +88,12 @@ let SimpleTest = class SimpleTest {
88
88
  ᚕ_check_1.AssertCheck.check({ file: ᚕsrc(__filename), line: 11, text: "{ size: 20, address: { state: 'VA' } } === {}", operator: "deepStrictEqual" }, true, { size: 20, address: { state: 'VA' } }, {});
89
89
  }
90
90
  };
91
- tslib_1.__decorate([
92
- test_1.Test({ lines: { start: 8, end: 12, codeStart: 11 } })
91
+ (0, tslib_1.__decorate)([
92
+ (0, test_1.Test)({ lines: { start: 8, end: 12, codeStart: 11 } })
93
93
  ], SimpleTest.prototype, "test", null);
94
- SimpleTest = tslib_1.__decorate([
94
+ SimpleTest = (0, tslib_1.__decorate)([
95
95
  ᚕ_decorator_1.Register(),
96
- test_1.Suite({ lines: { start: 5, end: 13 } })
96
+ (0, test_1.Suite)({ lines: { start: 5, end: 13 } })
97
97
  ], SimpleTest);
98
98
  Object.defineProperty(exports, 'ᚕtrv', { configurable: true, value: true });
99
99
  ```
package/bin/lib/run.ts CHANGED
@@ -5,7 +5,7 @@ import type { RunState } from '../../src/execute/types';
5
5
  * @param opts
6
6
  */
7
7
  export async function runTests(opts: RunState) {
8
- const { PhaseManager } = await import('@travetto/base');
8
+ const { PhaseManager, Util } = await import('@travetto/base');
9
9
  await PhaseManager.run('init', '*', ['@trv:registry/init']); // Delay registry
10
10
 
11
11
  const { RunnerUtil } = await import('../../src/execute/util');
@@ -13,6 +13,10 @@ export async function runTests(opts: RunState) {
13
13
 
14
14
  RunnerUtil.registerCleanup('runner');
15
15
 
16
+ if (process.env.TRV_TEST_DELAY) {
17
+ await Util.wait(process.env.TRV_TEST_DELAY as '2s');
18
+ }
19
+
16
20
  try {
17
21
  const res = await new Runner(opts).run();
18
22
  process.exit(res ? 0 : 1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@travetto/test",
3
3
  "displayName": "Testing",
4
- "version": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "description": "Declarative test framework",
6
6
  "keywords": [
7
7
  "unit-testing",
@@ -29,15 +29,15 @@
29
29
  "directory": "module/test"
30
30
  },
31
31
  "dependencies": {
32
- "@travetto/base": "^2.0.1",
33
- "@travetto/transformer": "^2.0.1",
34
- "@travetto/registry": "^2.0.1",
35
- "@travetto/watch": "^2.0.1",
36
- "@travetto/worker": "^2.0.1",
37
- "@travetto/yaml": "^2.0.1"
32
+ "@travetto/base": "^2.1.0",
33
+ "@travetto/transformer": "^2.1.0",
34
+ "@travetto/registry": "^2.1.0",
35
+ "@travetto/watch": "^2.1.0",
36
+ "@travetto/worker": "^2.1.0",
37
+ "@travetto/yaml": "^2.1.0"
38
38
  },
39
39
  "optionalPeerDependencies": {
40
- "@travetto/cli": "^2.0.1"
40
+ "@travetto/cli": "^2.1.0"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -43,8 +43,7 @@ export class AssertUtil {
43
43
  .replace(/[\\]/g, '/')
44
44
  .split('\n')
45
45
  // Exclude node_modules, target self
46
- .filter(x => x.includes(PathUtil.cwd) &&
47
- (!x.includes('node_modules') || /node_modules\/@travetto\/[^/]+\/test\//.test(x)));
46
+ .filter(x => x.includes(PathUtil.cwd) && (!x.includes('node_modules') || x.includes('/test-support/')));
48
47
 
49
48
  let best = lines.filter(x => x.includes(filename))[0];
50
49
 
@@ -17,6 +17,7 @@ import { ConsoleCapture } from './console';
17
17
  import { TestPhaseManager } from './phase';
18
18
  import { PromiseCapture } from './promise';
19
19
  import { AssertUtil } from '../assert/util';
20
+ import { TestEvent } from '../model/event';
20
21
 
21
22
  const TEST_TIMEOUT = Util.getEnvTime('TRV_TEST_TIMEOUT', '5s');
22
23
 
@@ -285,7 +286,7 @@ export class TestExecutor {
285
286
  TRV_CACHE: `.trv_cache_${SystemUtil.naiveHash(file)}`
286
287
  }
287
288
  });
288
- proc.process.on('message', e => consumer.onEvent(e));
289
+ proc.process.on('message', e => consumer.onEvent(e as TestEvent));
289
290
  await proc.result;
290
291
  }
291
292
  }