@travetto/test 7.0.4 → 7.0.5
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 +3 -3
- package/package.json +7 -7
- package/src/assert/capture.ts +4 -4
- package/src/assert/check.ts +7 -7
- package/src/assert/util.ts +3 -3
- package/src/consumer/decorator.ts +3 -3
- package/src/consumer/enhancer.ts +18 -16
- package/src/consumer/registry-adapter.ts +1 -1
- package/src/consumer/registry-index.ts +2 -2
- package/src/consumer/types/cumulative.ts +1 -1
- package/src/consumer/types/event.ts +1 -1
- package/src/consumer/types/tap-summary.ts +1 -1
- package/src/consumer/types/tap.ts +1 -1
- package/src/consumer/types.ts +1 -1
- package/src/decorator/suite.ts +2 -2
- package/src/decorator/test.ts +2 -2
- package/src/execute/barrier.ts +1 -1
- package/src/execute/console.ts +2 -2
- package/src/execute/executor.ts +3 -3
- package/src/execute/phase.ts +1 -1
- package/src/execute/run.ts +1 -1
- package/src/fixture.ts +1 -1
- package/src/model/event.ts +2 -2
- package/src/model/suite.ts +2 -2
- package/src/model/test.ts +1 -1
- package/src/model/util.ts +2 -2
- package/src/registry/registry-adapter.ts +4 -4
- package/src/registry/registry-index.ts +4 -4
- package/src/worker/child.ts +1 -1
- package/src/worker/types.ts +1 -1
- package/support/cli.test.ts +1 -1
- package/support/transformer.assert.ts +7 -4
package/README.md
CHANGED
|
@@ -82,15 +82,15 @@ 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
|
|
85
|
+
var Δ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 {
|
|
89
|
-
static { Δfunction.registerFunction(SimpleTest,
|
|
89
|
+
static { Δfunction.registerFunction(SimpleTest, Δm_1, { hash: 1887908328, lines: [5, 12] }, { test: { hash: 102834457, lines: [8, 11, 10] } }, false); }
|
|
90
90
|
async test() {
|
|
91
91
|
if (Δdebug.tryDebugger)
|
|
92
92
|
debugger;
|
|
93
|
-
Δcheck.AssertCheck.check({ module:
|
|
93
|
+
Δcheck.AssertCheck.check({ module: Δm_1, line: 10, text: "{ size: 20, address: { state: 'VA' } }", operator: "deepStrictEqual" }, true, { size: 20, address: { state: 'VA' } }, {});
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/test",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.5",
|
|
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.
|
|
32
|
-
"@travetto/runtime": "^7.0.
|
|
33
|
-
"@travetto/terminal": "^7.0.
|
|
34
|
-
"@travetto/worker": "^7.0.
|
|
31
|
+
"@travetto/registry": "^7.0.5",
|
|
32
|
+
"@travetto/runtime": "^7.0.4",
|
|
33
|
+
"@travetto/terminal": "^7.0.4",
|
|
34
|
+
"@travetto/worker": "^7.0.4",
|
|
35
35
|
"yaml": "^2.8.2"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@travetto/cli": "^7.0.
|
|
39
|
-
"@travetto/transformer": "^7.0.
|
|
38
|
+
"@travetto/cli": "^7.0.6",
|
|
39
|
+
"@travetto/transformer": "^7.0.4"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"@travetto/transformer": {
|
package/src/assert/capture.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
|
|
3
|
-
import { Assertion, TestConfig } from '../model/test.ts';
|
|
3
|
+
import type { Assertion, TestConfig } from '../model/test.ts';
|
|
4
4
|
|
|
5
|
-
export interface
|
|
5
|
+
export interface CapturedAssertion extends Partial<Assertion> {
|
|
6
6
|
module?: [string, string];
|
|
7
7
|
line: number;
|
|
8
8
|
text: string;
|
|
@@ -25,7 +25,7 @@ class $AssertCapture {
|
|
|
25
25
|
const assertions: Assertion[] = [];
|
|
26
26
|
|
|
27
27
|
// Emit and collect, every assertion as it occurs
|
|
28
|
-
const handler = (a:
|
|
28
|
+
const handler = (a: CapturedAssertion): void => {
|
|
29
29
|
const asrt: Assertion = {
|
|
30
30
|
...a,
|
|
31
31
|
import: a.import ?? a.module!.join('/'),
|
|
@@ -46,7 +46,7 @@ class $AssertCapture {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
add(a:
|
|
49
|
+
add(a: CapturedAssertion): void {
|
|
50
50
|
this.#emitter.emit('assert', a);
|
|
51
51
|
}
|
|
52
52
|
}
|
package/src/assert/check.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import { isPromise } from 'node:util/types';
|
|
3
3
|
|
|
4
|
-
import { AppError, Class, castTo, castKey, asConstructable } from '@travetto/runtime';
|
|
4
|
+
import { AppError, type Class, castTo, castKey, asConstructable } from '@travetto/runtime';
|
|
5
5
|
|
|
6
|
-
import { ThrowableError, TestConfig, Assertion } from '../model/test.ts';
|
|
7
|
-
import { AssertCapture,
|
|
6
|
+
import type { ThrowableError, TestConfig, Assertion } from '../model/test.ts';
|
|
7
|
+
import { AssertCapture, type CapturedAssertion } from './capture.ts';
|
|
8
8
|
import { AssertUtil } from './util.ts';
|
|
9
9
|
import { ASSERT_FN_OPERATOR, OP_MAPPING } from './types.ts';
|
|
10
10
|
|
|
@@ -25,7 +25,7 @@ export class AssertCheck {
|
|
|
25
25
|
* @param positive Is the check positive or negative
|
|
26
26
|
* @param args The arguments passed in
|
|
27
27
|
*/
|
|
28
|
-
static check(assertion:
|
|
28
|
+
static check(assertion: CapturedAssertion, positive: boolean, ...args: unknown[]): void {
|
|
29
29
|
let fn = assertion.operator;
|
|
30
30
|
assertion.operator = ASSERT_FN_OPERATOR[fn];
|
|
31
31
|
|
|
@@ -180,7 +180,7 @@ export class AssertCheck {
|
|
|
180
180
|
error: unknown,
|
|
181
181
|
missed: Error | undefined,
|
|
182
182
|
shouldThrow: ThrowableError | undefined,
|
|
183
|
-
assertion:
|
|
183
|
+
assertion: CapturedAssertion
|
|
184
184
|
): void {
|
|
185
185
|
if (!(error instanceof Error)) {
|
|
186
186
|
error = new Error(`${error}`);
|
|
@@ -209,7 +209,7 @@ export class AssertCheck {
|
|
|
209
209
|
* @param message Message to share on failure
|
|
210
210
|
*/
|
|
211
211
|
static checkThrow(
|
|
212
|
-
assertion:
|
|
212
|
+
assertion: CapturedAssertion,
|
|
213
213
|
positive: boolean,
|
|
214
214
|
action: Function,
|
|
215
215
|
shouldThrow?: ThrowableError,
|
|
@@ -241,7 +241,7 @@ export class AssertCheck {
|
|
|
241
241
|
* @param message Message to share on failure
|
|
242
242
|
*/
|
|
243
243
|
static async checkThrowAsync(
|
|
244
|
-
assertion:
|
|
244
|
+
assertion: CapturedAssertion,
|
|
245
245
|
positive: boolean,
|
|
246
246
|
action: Function | Promise<unknown>,
|
|
247
247
|
shouldThrow?: ThrowableError,
|
package/src/assert/util.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import util from 'node:util';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import { asFull, Class, hasFunction, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
4
|
+
import { asFull, type Class, hasFunction, Runtime, RuntimeIndex } from '@travetto/runtime';
|
|
5
5
|
|
|
6
|
-
import { TestConfig, Assertion, TestResult } from '../model/test.ts';
|
|
7
|
-
import { SuiteConfig, SuiteFailure, SuiteResult } from '../model/suite.ts';
|
|
6
|
+
import type { TestConfig, Assertion, TestResult } from '../model/test.ts';
|
|
7
|
+
import type { SuiteConfig, SuiteFailure, SuiteResult } from '../model/suite.ts';
|
|
8
8
|
|
|
9
9
|
const isCleanable = hasFunction<{ toClean(): unknown }>('toClean');
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Class } from '@travetto/runtime';
|
|
1
|
+
import type { Class } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { TestConsumerShape } from './types';
|
|
4
|
-
import { TestConsumerRegistryIndex } from './registry-index';
|
|
3
|
+
import type { TestConsumerShape } from './types.ts';
|
|
4
|
+
import { TestConsumerRegistryIndex } from './registry-index.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Registers a class a valid test consumer
|
package/src/consumer/enhancer.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { StyleUtil } from '@travetto/terminal';
|
|
1
|
+
import { StyleUtil, type TermStyleFn } from '@travetto/terminal';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
assertDescription: '#d3d3d3', // light gray
|
|
5
|
-
testDescription: '#e5e5e5', // White
|
|
6
|
-
success: '#00cd00', // Green
|
|
7
|
-
failure: '#cd0000', // Red
|
|
8
|
-
assertNumber: '#00ffff', // Bright cyan
|
|
9
|
-
testNumber: '#1e90ff', // dodger blue
|
|
10
|
-
assertFile: '#
|
|
11
|
-
assertLine: '#ffffe0', // light yellow
|
|
12
|
-
objectInspect: '#cd00cd', // Magenta
|
|
13
|
-
suiteName: '#cdcd00', // Yellow
|
|
14
|
-
testName: '#00cdcd', // Cyan
|
|
15
|
-
total: '#e5e5e5', // White
|
|
16
|
-
}
|
|
3
|
+
const input = {
|
|
4
|
+
assertDescription: ['#d3d3d3'], // light gray
|
|
5
|
+
testDescription: ['#e5e5e5'], // White
|
|
6
|
+
success: ['#00cd00'], // Green
|
|
7
|
+
failure: ['#cd0000'], // Red
|
|
8
|
+
assertNumber: ['#00ffff'], // Bright cyan
|
|
9
|
+
testNumber: ['#1e90ff'], // dodger blue
|
|
10
|
+
assertFile: ['#90ee90'], // lightGreen
|
|
11
|
+
assertLine: ['#ffffe0'], // light yellow
|
|
12
|
+
objectInspect: ['#cd00cd'], // Magenta
|
|
13
|
+
suiteName: ['#cdcd00'], // Yellow
|
|
14
|
+
testName: ['#00cdcd'], // Cyan
|
|
15
|
+
total: ['#e5e5e5'], // White
|
|
16
|
+
} as const;
|
|
17
17
|
|
|
18
|
-
export
|
|
18
|
+
export const CONSOLE_ENHANCER = StyleUtil.getPalette(input);
|
|
19
|
+
|
|
20
|
+
export type TestResultsEnhancer = Record<keyof typeof input, TermStyleFn>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
|
|
3
3
|
import { classConstruct, describeFunction, type Class } from '@travetto/runtime';
|
|
4
|
-
import { RegistryAdapter } from '@travetto/registry';
|
|
4
|
+
import type { RegistryAdapter } from '@travetto/registry';
|
|
5
5
|
|
|
6
6
|
import type { TestConsumerShape, TestConsumerConfig } from './types.ts';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RuntimeIndex, type Class } from '@travetto/runtime';
|
|
2
|
-
import { Registry, RegistryIndex, RegistryIndexStore } from '@travetto/registry';
|
|
2
|
+
import { Registry, type RegistryIndex, RegistryIndexStore } from '@travetto/registry';
|
|
3
3
|
|
|
4
4
|
import type { TestConsumerShape } from './types.ts';
|
|
5
5
|
import type { TestConsumerConfig } from '../execute/types.ts';
|
|
@@ -41,7 +41,7 @@ export class TestConsumerRegistryIndex implements RegistryIndex {
|
|
|
41
41
|
*/
|
|
42
42
|
async #init(): Promise<void> {
|
|
43
43
|
const allFiles = RuntimeIndex.find({
|
|
44
|
-
module:
|
|
44
|
+
module: module => module.name === '@travetto/test',
|
|
45
45
|
file: file => file.relativeFile.startsWith('src/consumer/types/')
|
|
46
46
|
});
|
|
47
47
|
for (const file of allFiles) {
|
|
@@ -3,7 +3,7 @@ import type { TestEvent, TestRemoveEvent } from '../../model/event.ts';
|
|
|
3
3
|
import type { TestConfig, TestDiffSource, TestResult } from '../../model/test.ts';
|
|
4
4
|
import type { Counts, SuiteConfig, SuiteResult } from '../../model/suite.ts';
|
|
5
5
|
import { DelegatingConsumer } from './delegating.ts';
|
|
6
|
-
import { SuiteCore } from '../../model/common.ts';
|
|
6
|
+
import type { SuiteCore } from '../../model/common.ts';
|
|
7
7
|
import { TestModelUtil } from '../../model/util.ts';
|
|
8
8
|
|
|
9
9
|
type ClassId = string;
|
|
@@ -8,7 +8,7 @@ import type { SuitesSummary, TestConsumerShape, TestRunState } from '../types.ts
|
|
|
8
8
|
import { TestConsumer } from '../decorator.ts';
|
|
9
9
|
|
|
10
10
|
import { TapEmitter } from './tap.ts';
|
|
11
|
-
import { CONSOLE_ENHANCER, TestResultsEnhancer } from '../enhancer.ts';
|
|
11
|
+
import { CONSOLE_ENHANCER, type TestResultsEnhancer } from '../enhancer.ts';
|
|
12
12
|
|
|
13
13
|
type Result = {
|
|
14
14
|
key: string;
|
|
@@ -7,7 +7,7 @@ import { TimeUtil, RuntimeIndex, hasToJSON } from '@travetto/runtime';
|
|
|
7
7
|
import type { TestEvent } from '../../model/event.ts';
|
|
8
8
|
import type { SuitesSummary, TestConsumerShape } from '../types.ts';
|
|
9
9
|
import { TestConsumer } from '../decorator.ts';
|
|
10
|
-
import { TestResultsEnhancer, CONSOLE_ENHANCER } from '../enhancer.ts';
|
|
10
|
+
import { type TestResultsEnhancer, CONSOLE_ENHANCER } from '../enhancer.ts';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* TAP Format consumer
|
package/src/consumer/types.ts
CHANGED
package/src/decorator/suite.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { castTo, Class, ClassInstance, describeFunction, getClass } from '@travetto/runtime';
|
|
1
|
+
import { castTo, type Class, type ClassInstance, describeFunction, getClass } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { SuiteConfig } from '../model/suite.ts';
|
|
3
|
+
import type { SuiteConfig } from '../model/suite.ts';
|
|
4
4
|
import { SuiteRegistryIndex } from '../registry/registry-index.ts';
|
|
5
5
|
|
|
6
6
|
export type SuitePhase = 'beforeAll' | 'beforeEach' | 'afterAll' | 'afterEach';
|
package/src/decorator/test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ClassInstance, getClass } from '@travetto/runtime';
|
|
1
|
+
import { type ClassInstance, getClass } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { TestConfig, ThrowableError } from '../model/test.ts';
|
|
3
|
+
import type { TestConfig, ThrowableError } from '../model/test.ts';
|
|
4
4
|
import { SuiteRegistryIndex } from '../registry/registry-index.ts';
|
|
5
5
|
|
|
6
6
|
type MethodDecorator = (instance: ClassInstance, property: string, descriptor: PropertyDescriptor) => PropertyDescriptor | void;
|
package/src/execute/barrier.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isPromise } from 'node:util/types';
|
|
2
2
|
import { createHook, executionAsyncId } from 'node:async_hooks';
|
|
3
3
|
|
|
4
|
-
import { TimeSpan, TimeUtil, Util } from '@travetto/runtime';
|
|
4
|
+
import { type TimeSpan, TimeUtil, Util } from '@travetto/runtime';
|
|
5
5
|
|
|
6
6
|
import { ExecutionError, TimeoutError } from './error.ts';
|
|
7
7
|
|
package/src/execute/console.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import util from 'node:util';
|
|
2
2
|
|
|
3
|
-
import { ConsoleEvent, ConsoleListener, ConsoleManager } from '@travetto/runtime';
|
|
4
|
-
import { TestLog } from '../model/test';
|
|
3
|
+
import { type ConsoleEvent, type ConsoleListener, ConsoleManager } from '@travetto/runtime';
|
|
4
|
+
import type { TestLog } from '../model/test.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Console capturer. Hooks into the Console manager, and collects the
|
package/src/execute/executor.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { AssertionError } from 'node:assert';
|
|
|
3
3
|
import { Env, TimeUtil, Runtime, castTo, classConstruct } from '@travetto/runtime';
|
|
4
4
|
import { Registry } from '@travetto/registry';
|
|
5
5
|
|
|
6
|
-
import { TestConfig, TestResult,
|
|
7
|
-
import { SuiteConfig, SuiteFailure, SuiteResult } from '../model/suite.ts';
|
|
8
|
-
import { TestConsumerShape } from '../consumer/types.ts';
|
|
6
|
+
import type { TestConfig, TestResult, TestRun } from '../model/test.ts';
|
|
7
|
+
import type { SuiteConfig, SuiteFailure, SuiteResult } from '../model/suite.ts';
|
|
8
|
+
import type { TestConsumerShape } from '../consumer/types.ts';
|
|
9
9
|
import { AssertCheck } from '../assert/check.ts';
|
|
10
10
|
import { AssertCapture } from '../assert/capture.ts';
|
|
11
11
|
import { ConsoleCapture } from './console.ts';
|
package/src/execute/phase.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Env, TimeUtil } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { SuiteConfig, SuiteFailure, SuiteResult } from '../model/suite.ts';
|
|
3
|
+
import type { SuiteConfig, SuiteFailure, SuiteResult } from '../model/suite.ts';
|
|
4
4
|
import { AssertUtil } from '../assert/util.ts';
|
|
5
5
|
import { Barrier } from './barrier.ts';
|
|
6
6
|
|
package/src/execute/run.ts
CHANGED
|
@@ -56,7 +56,7 @@ export class RunUtil {
|
|
|
56
56
|
*/
|
|
57
57
|
static async* getTestImports(globs?: string[]): AsyncIterable<string> {
|
|
58
58
|
const all = RuntimeIndex.find({
|
|
59
|
-
module:
|
|
59
|
+
module: module => module.roles.includes('test') || module.roles.includes('std'),
|
|
60
60
|
folder: folder => folder === 'test',
|
|
61
61
|
file: file => file.role === 'test'
|
|
62
62
|
});
|
package/src/fixture.ts
CHANGED
|
@@ -5,7 +5,7 @@ export class TestFixtures extends FileLoader {
|
|
|
5
5
|
super([
|
|
6
6
|
'@#test/fixtures',
|
|
7
7
|
'@#support/fixtures',
|
|
8
|
-
...modules.flat().map(
|
|
8
|
+
...modules.flat().map(module => `${module}#support/fixtures`),
|
|
9
9
|
'@@#support/fixtures'
|
|
10
10
|
].map(value => Runtime.modulePath(value)));
|
|
11
11
|
}
|
package/src/model/event.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Assertion, TestConfig, TestResult } from './test.ts';
|
|
2
|
-
import { SuiteConfig, SuiteResult } from './suite.ts';
|
|
1
|
+
import type { Assertion, TestConfig, TestResult } from './test.ts';
|
|
2
|
+
import type { SuiteConfig, SuiteResult } from './suite.ts';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Targets
|
package/src/model/suite.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Class } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { Assertion, TestConfig, TestResult,
|
|
4
|
-
import { Skip, SuiteCore } from './common.ts';
|
|
3
|
+
import type { Assertion, TestConfig, TestResult, TestStatus } from './test.ts';
|
|
4
|
+
import type { Skip, SuiteCore } from './common.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Suite configuration
|
package/src/model/test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Class, ConsoleEvent, TimeSpan } from '@travetto/runtime';
|
|
2
2
|
|
|
3
|
-
import { Skip, TestCore } from './common.ts';
|
|
3
|
+
import type { Skip, TestCore } from './common.ts';
|
|
4
4
|
|
|
5
5
|
export type ThrowableError = string | RegExp | Class<Error> | ((error: Error | string) => boolean | void | undefined);
|
|
6
6
|
export type TestLog = Omit<ConsoleEvent, 'args' | 'scope'> & { message: string };
|
package/src/model/util.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RegistryAdapter } from '@travetto/registry';
|
|
2
|
-
import { AppError, asFull, Class, describeFunction, Runtime, safeAssign } from '@travetto/runtime';
|
|
1
|
+
import type { RegistryAdapter } from '@travetto/registry';
|
|
2
|
+
import { AppError, asFull, type Class, describeFunction, Runtime, safeAssign } from '@travetto/runtime';
|
|
3
3
|
import { SchemaRegistryIndex } from '@travetto/schema';
|
|
4
4
|
|
|
5
|
-
import { SuiteConfig } from '../model/suite';
|
|
6
|
-
import { TestConfig } from '../model/test';
|
|
5
|
+
import type { SuiteConfig } from '../model/suite.ts';
|
|
6
|
+
import type { TestConfig } from '../model/test.ts';
|
|
7
7
|
|
|
8
8
|
function combineClasses(baseConfig: SuiteConfig, ...subConfig: Partial<SuiteConfig>[]): SuiteConfig {
|
|
9
9
|
for (const config of subConfig) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AppError, Class, Runtime, describeFunction } from '@travetto/runtime';
|
|
2
|
-
import { RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
|
|
1
|
+
import { AppError, type Class, Runtime, describeFunction } from '@travetto/runtime';
|
|
2
|
+
import { type RegistryIndex, RegistryIndexStore, Registry } from '@travetto/registry';
|
|
3
3
|
|
|
4
|
-
import { SuiteConfig } from '../model/suite.ts';
|
|
5
|
-
import { TestConfig, TestRun } from '../model/test.ts';
|
|
4
|
+
import type { SuiteConfig } from '../model/suite.ts';
|
|
5
|
+
import type { TestConfig, TestRun } from '../model/test.ts';
|
|
6
6
|
import { SuiteRegistryAdapter } from './registry-adapter.ts';
|
|
7
7
|
|
|
8
8
|
const sortedTests = (config: SuiteConfig): TestConfig[] =>
|
package/src/worker/child.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { IpcChannel } from '@travetto/worker';
|
|
|
5
5
|
|
|
6
6
|
import { RunUtil } from '../execute/run.ts';
|
|
7
7
|
import { TestWorkerEvents } from './types.ts';
|
|
8
|
-
import { TestRun } from '../model/test.ts';
|
|
8
|
+
import type { TestRun } from '../model/test.ts';
|
|
9
9
|
import { CommunicationUtil } from '../communication.ts';
|
|
10
10
|
|
|
11
11
|
/**
|
package/src/worker/types.ts
CHANGED
package/support/cli.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
2
|
|
|
3
3
|
import { Env, RuntimeIndex } from '@travetto/runtime';
|
|
4
|
-
import { CliCommandShape, CliCommand, CliUtil } from '@travetto/cli';
|
|
4
|
+
import { type CliCommandShape, CliCommand, CliUtil } from '@travetto/cli';
|
|
5
5
|
import { WorkPool } from '@travetto/worker';
|
|
6
6
|
import { Max, Min } from '@travetto/schema';
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
|
|
3
|
-
import { TransformerState,
|
|
3
|
+
import { type TransformerState, DeclarationUtil, CoreUtil, TransformerHandler } from '@travetto/transformer';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Which types are candidates for deep literal checking
|
|
@@ -90,6 +90,12 @@ interface Command {
|
|
|
90
90
|
*/
|
|
91
91
|
export class AssertTransformer {
|
|
92
92
|
|
|
93
|
+
static {
|
|
94
|
+
TransformerHandler(this, this.onAssertCheck, 'before', 'method', ['AssertCheck']);
|
|
95
|
+
TransformerHandler(this, this.afterAssertCheck, 'after', 'method', ['AssertCheck']);
|
|
96
|
+
TransformerHandler(this, this.onAssertCall, 'before', 'call');
|
|
97
|
+
}
|
|
98
|
+
|
|
93
99
|
/**
|
|
94
100
|
* Resolves optoken to syntax kind. Relies on `ts`
|
|
95
101
|
*/
|
|
@@ -266,13 +272,11 @@ export class AssertTransformer {
|
|
|
266
272
|
}
|
|
267
273
|
}
|
|
268
274
|
|
|
269
|
-
@OnMethod('AssertCheck')
|
|
270
275
|
static onAssertCheck(state: TransformerState & AssertState, node: ts.MethodDeclaration): ts.MethodDeclaration {
|
|
271
276
|
state[IsTestSymbol] = true;
|
|
272
277
|
return node;
|
|
273
278
|
}
|
|
274
279
|
|
|
275
|
-
@AfterMethod('AssertCheck')
|
|
276
280
|
static afterAssertCheck(state: TransformerState & AssertState, node: ts.MethodDeclaration): ts.MethodDeclaration {
|
|
277
281
|
state[IsTestSymbol] = false;
|
|
278
282
|
return node;
|
|
@@ -281,7 +285,6 @@ export class AssertTransformer {
|
|
|
281
285
|
/**
|
|
282
286
|
* Listen for all call expression
|
|
283
287
|
*/
|
|
284
|
-
@OnCall()
|
|
285
288
|
static onAssertCall(state: TransformerState & AssertState, node: ts.CallExpression): ts.CallExpression {
|
|
286
289
|
// Only check in test mode
|
|
287
290
|
if (!state[IsTestSymbol]) {
|