@travetto/test 8.0.0-alpha.24 → 8.0.0-alpha.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/test",
3
- "version": "8.0.0-alpha.24",
3
+ "version": "8.0.0-alpha.25",
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": "^8.0.0-alpha.22",
32
- "@travetto/runtime": "^8.0.0-alpha.22",
33
- "@travetto/terminal": "^8.0.0-alpha.22",
34
- "@travetto/worker": "^8.0.0-alpha.23",
31
+ "@travetto/registry": "^8.0.0-alpha.23",
32
+ "@travetto/runtime": "^8.0.0-alpha.23",
33
+ "@travetto/terminal": "^8.0.0-alpha.23",
34
+ "@travetto/worker": "^8.0.0-alpha.24",
35
35
  "yaml": "^2.9.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@travetto/cli": "^8.0.0-alpha.31",
39
- "@travetto/transformer": "^8.0.0-alpha.17"
38
+ "@travetto/cli": "^8.0.0-alpha.32",
39
+ "@travetto/transformer": "^8.0.0-alpha.18"
40
40
  },
41
41
  "peerDependenciesMeta": {
42
42
  "@travetto/transformer": {
@@ -26,15 +26,15 @@ class $AssertCapture {
26
26
 
27
27
  // Emit and collect, every assertion as it occurs
28
28
  const handler = (a: CapturedAssertion): void => {
29
- const asrt: Assertion = {
29
+ const assertion: Assertion = {
30
30
  ...a,
31
31
  import: a.import ?? a.module!.join('/'),
32
32
  classId: test.classId,
33
33
  methodName: test.methodName
34
34
  };
35
- assertions.push(asrt);
35
+ assertions.push(assertion);
36
36
  if (listener) {
37
- listener(asrt);
37
+ listener(assertion);
38
38
  }
39
39
  };
40
40
 
@@ -80,29 +80,29 @@ export class TapEmitter implements TestConsumerShape {
80
80
  // Handle each assertion
81
81
  if (test.assertions.length) {
82
82
  let subCount = 0;
83
- for (const asrt of test.assertions) {
84
- const assertSourceFile = RuntimeIndex.getFromImport(asrt.import)!.sourceFile;
85
- const text = asrt.message ? `${asrt.text} (${this.#enhancer.failure(asrt.message)})` : asrt.text;
86
- const location = asrt.import ? `./${path.relative(process.cwd(), assertSourceFile)}` : '<unknown>';
83
+ for (const assertion of test.assertions) {
84
+ const assertSourceFile = RuntimeIndex.getFromImport(assertion.import)!.sourceFile;
85
+ const text = assertion.message ? `${assertion.text} (${this.#enhancer.failure(assertion.message)})` : assertion.text;
86
+ const location = assertion.import ? `./${path.relative(process.cwd(), assertSourceFile)}` : '<unknown>';
87
87
  let subMessage = [
88
88
  this.#enhancer.assertNumber((subCount += 1)),
89
89
  '-',
90
90
  this.#enhancer.assertDescription(text),
91
91
  StyleUtil.link(
92
- `${this.#enhancer.assertFile(location)}:${this.#enhancer.assertLine(asrt.line)}`,
93
- `file://${assertSourceFile}#${asrt.line}`
92
+ `${this.#enhancer.assertFile(location)}:${this.#enhancer.assertLine(assertion.line)}`,
93
+ `file://${assertSourceFile}#${assertion.line}`
94
94
  )
95
95
  ].join(' ');
96
96
 
97
- if (asrt.error) {
97
+ if (assertion.error) {
98
98
  subMessage = `${this.#enhancer.failure('not ok')} ${subMessage}`;
99
99
  } else {
100
100
  subMessage = `${this.#enhancer.success('ok')} ${subMessage}`;
101
101
  }
102
102
  this.log(` ${subMessage}`);
103
103
 
104
- if (asrt.message && asrt.message.length > 100) {
105
- this.logMeta({ message: asrt.message.replace(/\\n/g, '\n') });
104
+ if (assertion.message && assertion.message.length > 100) {
105
+ this.logMeta({ message: assertion.message.replace(/\\n/g, '\n') });
106
106
  }
107
107
  }
108
108
  this.log(` ${this.#enhancer.assertNumber(1)}..${this.#enhancer.assertNumber(subCount)}`);
@@ -8,8 +8,8 @@ import { describeFunction, Env, ExecUtil, JSONUtil, Runtime, RuntimeIndex, TimeU
8
8
  import { WorkPool } from '@travetto/worker';
9
9
 
10
10
  import { TestConsumerRegistryIndex } from '../consumer/registry-index.ts';
11
- import { RunnableTestConsumer } from '../consumer/types/runnable.ts';
12
11
  import type { TestConsumerShape } from '../consumer/types.ts';
12
+ import { RunnableTestConsumer } from '../consumer/types/runnable.ts';
13
13
  import type { TestRemoveEvent } from '../model/event.ts';
14
14
  import type { TestConfig, TestDiffInput, TestGlobInput, TestRun, TestRunInput } from '../model/test.ts';
15
15
  import { SuiteRegistryIndex } from '../registry/registry-index.ts';
package/src/model/util.ts CHANGED
@@ -88,7 +88,7 @@ export class TestModelUtil {
88
88
  status: 'errored',
89
89
  errored: 1,
90
90
  tests: {
91
- impport: asFull<TestResult>({
91
+ import: asFull<TestResult>({
92
92
  ...common,
93
93
  status: 'errored',
94
94
  assertions: [
@@ -18,9 +18,9 @@ export const DEEP_EQUALS_MAPPING: Record<string, string> = {
18
18
  };
19
19
 
20
20
  /**
21
- * Typescript optoken to assert methods
21
+ * Typescript op token to assert methods
22
22
  */
23
- export const OPTOKEN_ASSERT = {
23
+ export const OP_TOKEN_ASSERT = {
24
24
  InKeyword: 'in',
25
25
  EqualsEqualsToken: 'equal',
26
26
  ExclamationEqualsToken: 'notEqual',
@@ -46,7 +46,7 @@ const METHODS: Record<string, Function[]> = {
46
46
  test: [RegExp]
47
47
  };
48
48
 
49
- const OP_TOKEN_TO_NAME = new Map<number, keyof typeof OPTOKEN_ASSERT>();
49
+ const OP_TOKEN_TO_NAME = new Map<number, keyof typeof OP_TOKEN_ASSERT>();
50
50
 
51
51
  const AssertSymbol = Symbol();
52
52
  const IsTestSymbol = Symbol();
@@ -96,21 +96,21 @@ export class AssertTransformer {
96
96
  }
97
97
 
98
98
  /**
99
- * Resolves optoken to syntax kind. Relies on `ts`
99
+ * Resolves op token to syntax kind. Relies on `ts`
100
100
  */
101
101
  static lookupOpToken(key: number): string | undefined {
102
102
  if (OP_TOKEN_TO_NAME.size === 0) {
103
103
  Object.keys(ts.SyntaxKind)
104
104
  .filter(kind => !/^\d+$/.test(kind))
105
- .filter((kind): kind is keyof typeof OPTOKEN_ASSERT => !/^(Last|First)/.test(kind))
105
+ .filter((kind): kind is keyof typeof OP_TOKEN_ASSERT => !/^(Last|First)/.test(kind))
106
106
  .forEach(kind => {
107
107
  OP_TOKEN_TO_NAME.set(ts.SyntaxKind[kind], kind);
108
108
  });
109
109
  }
110
110
 
111
111
  const name = OP_TOKEN_TO_NAME.get(key)!;
112
- if (name in OPTOKEN_ASSERT) {
113
- return OPTOKEN_ASSERT[name];
112
+ if (name in OP_TOKEN_ASSERT) {
113
+ return OP_TOKEN_ASSERT[name];
114
114
  } else {
115
115
  return;
116
116
  }
@@ -142,12 +142,12 @@ export class AssertTransformer {
142
142
  */
143
143
  static initState(state: TransformerState & AssertState): void {
144
144
  if (!state[AssertSymbol]) {
145
- const asrt = state.importFile('@travetto/test/src/assert/check.ts').identifier;
145
+ const assertion = state.importFile('@travetto/test/src/assert/check.ts').identifier;
146
146
  state[AssertSymbol] = {
147
- assert: asrt,
148
- assertCheck: CoreUtil.createAccess(state.factory, asrt, ASSERT_UTIL, 'check'),
149
- checkThrow: CoreUtil.createAccess(state.factory, asrt, ASSERT_UTIL, 'checkThrow'),
150
- checkThrowAsync: CoreUtil.createAccess(state.factory, asrt, ASSERT_UTIL, 'checkThrowAsync')
147
+ assert: assertion,
148
+ assertCheck: CoreUtil.createAccess(state.factory, assertion, ASSERT_UTIL, 'check'),
149
+ checkThrow: CoreUtil.createAccess(state.factory, assertion, ASSERT_UTIL, 'checkThrow'),
150
+ checkThrowAsync: CoreUtil.createAccess(state.factory, assertion, ASSERT_UTIL, 'checkThrowAsync')
151
151
  };
152
152
  }
153
153
  }