@travetto/test 5.0.0-rc.8 → 5.0.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 +2 -1
- package/package.json +8 -8
- package/src/assert/capture.ts +3 -3
- package/src/assert/check.ts +23 -25
- package/src/assert/util.ts +21 -9
- package/src/consumer/registry.ts +2 -3
- package/src/consumer/{error.ts → serialize.ts} +12 -21
- package/src/consumer/types/cumulative.ts +9 -17
- package/src/consumer/types/delegating.ts +58 -0
- package/src/consumer/types/event.ts +2 -4
- package/src/consumer/types/execution.ts +2 -4
- package/src/consumer/types/runnable.ts +12 -41
- package/src/consumer/types/tap-streamed.ts +9 -6
- package/src/consumer/types/tap.ts +2 -2
- package/src/decorator/suite.ts +4 -5
- package/src/execute/executor.ts +82 -95
- package/src/execute/phase.ts +19 -29
- package/src/execute/promise.ts +3 -3
- package/src/execute/runner.ts +29 -20
- package/src/execute/types.ts +12 -10
- package/src/execute/util.ts +30 -5
- package/src/execute/watcher.ts +32 -36
- package/src/model/common.ts +9 -1
- package/src/model/event.ts +9 -5
- package/src/model/suite.ts +11 -1
- package/src/model/test.ts +27 -1
- package/src/registry/suite.ts +28 -24
- package/src/trv.d.ts +4 -0
- package/src/worker/child.ts +9 -15
- package/src/worker/standard.ts +17 -22
- package/src/worker/types.ts +13 -23
- package/support/cli.test.ts +18 -4
- package/support/{cli.test_count.ts → cli.test_digest.ts} +14 -6
- package/support/cli.test_direct.ts +10 -3
- package/support/transformer.assert.ts +10 -10
|
@@ -93,7 +93,7 @@ export class AssertTransformer {
|
|
|
93
93
|
/**
|
|
94
94
|
* Resolves optoken to syntax kind. Relies on `ts`
|
|
95
95
|
*/
|
|
96
|
-
static lookupOpToken(key: number): string {
|
|
96
|
+
static lookupOpToken(key: number): string | undefined {
|
|
97
97
|
if (OP_TOKEN_TO_NAME.size === 0) {
|
|
98
98
|
Object.keys(ts.SyntaxKind)
|
|
99
99
|
.filter(x => !/^\d+$/.test(x))
|
|
@@ -106,7 +106,7 @@ export class AssertTransformer {
|
|
|
106
106
|
if (name in OPTOKEN_ASSERT) {
|
|
107
107
|
return OPTOKEN_ASSERT[name];
|
|
108
108
|
} else {
|
|
109
|
-
|
|
109
|
+
return;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -137,12 +137,12 @@ export class AssertTransformer {
|
|
|
137
137
|
*/
|
|
138
138
|
static initState(state: TransformerState & AssertState): void {
|
|
139
139
|
if (!state[AssertⲐ]) {
|
|
140
|
-
const
|
|
140
|
+
const asrt = state.importFile('@travetto/test/src/assert/check').ident;
|
|
141
141
|
state[AssertⲐ] = {
|
|
142
|
-
assert:
|
|
143
|
-
assertCheck: CoreUtil.createAccess(state.factory,
|
|
144
|
-
checkThrow: CoreUtil.createAccess(state.factory,
|
|
145
|
-
checkThrowAsync: CoreUtil.createAccess(state.factory,
|
|
142
|
+
assert: asrt,
|
|
143
|
+
assertCheck: CoreUtil.createAccess(state.factory, asrt, ASSERT_UTIL, 'check'),
|
|
144
|
+
checkThrow: CoreUtil.createAccess(state.factory, asrt, ASSERT_UTIL, 'checkThrow'),
|
|
145
|
+
checkThrowAsync: CoreUtil.createAccess(state.factory, asrt, ASSERT_UTIL, 'checkThrowAsync'),
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -153,7 +153,7 @@ export class AssertTransformer {
|
|
|
153
153
|
static doAssert(state: TransformerState & AssertState, node: ts.CallExpression, cmd: Command): ts.CallExpression {
|
|
154
154
|
this.initState(state);
|
|
155
155
|
|
|
156
|
-
const first = CoreUtil.
|
|
156
|
+
const first = CoreUtil.firstArgument(node);
|
|
157
157
|
const firstText = first!.getText();
|
|
158
158
|
|
|
159
159
|
cmd.args = cmd.args.filter(x => x !== undefined && x !== null);
|
|
@@ -175,8 +175,8 @@ export class AssertTransformer {
|
|
|
175
175
|
* Convert `assert.(throws|rejects|doesNotThrow|doesNotReject)` to the appropriate structure
|
|
176
176
|
*/
|
|
177
177
|
static doThrows(state: TransformerState & AssertState, node: ts.CallExpression, key: string, args: ts.Expression[]): ts.CallExpression {
|
|
178
|
-
const first = CoreUtil.
|
|
179
|
-
const firstText = first
|
|
178
|
+
const first = CoreUtil.firstArgument(node)!;
|
|
179
|
+
const firstText = first.getText();
|
|
180
180
|
|
|
181
181
|
this.initState(state);
|
|
182
182
|
return state.factory.createCallExpression(
|