@overkill-dev/test 0.0.11 → 0.0.13
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 +11 -11
- package/packages/test/authoring-metadata.d.ts +32 -0
- package/packages/test/authoring-metadata.d.ts.map +1 -0
- package/packages/test/authoring-metadata.js +98 -0
- package/packages/test/authoring-metadata.js.map +1 -0
- package/packages/test/authoring-source-locations.js +55 -0
- package/packages/test/authoring-source-locations.js.map +1 -0
- package/packages/test/test.entry-point.d.ts +32 -10
- package/packages/test/test.entry-point.d.ts.map +1 -1
- package/packages/test/test.entry-point.js +44 -79
- package/packages/test/test.entry-point.js.map +1 -1
- package/readme.md +24 -3
- package/sbom.cdx.json +44 -44
package/package.json
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
"url": "https://github.com/enormora/overkill/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@overkill-dev/assert": "0.0.
|
|
11
|
-
"@overkill-dev/doubles": "0.0.
|
|
12
|
-
"@overkill-dev/engine": "0.0.
|
|
13
|
-
"@overkill-dev/output-renderer-github-actions": "0.0.
|
|
14
|
-
"@overkill-dev/reporter-brief": "0.0.
|
|
15
|
-
"@overkill-dev/reporter-dot": "0.0.
|
|
16
|
-
"@overkill-dev/reporter-line": "0.0.
|
|
17
|
-
"@overkill-dev/run": "0.0.
|
|
10
|
+
"@overkill-dev/assert": "0.0.29",
|
|
11
|
+
"@overkill-dev/doubles": "0.0.27",
|
|
12
|
+
"@overkill-dev/engine": "0.0.28",
|
|
13
|
+
"@overkill-dev/output-renderer-github-actions": "0.0.18",
|
|
14
|
+
"@overkill-dev/reporter-brief": "0.0.18",
|
|
15
|
+
"@overkill-dev/reporter-dot": "0.0.29",
|
|
16
|
+
"@overkill-dev/reporter-line": "0.0.29",
|
|
17
|
+
"@overkill-dev/run": "0.0.33",
|
|
18
18
|
"cmd-ts": "0.15.0"
|
|
19
19
|
},
|
|
20
20
|
"description": "Standard Overkill distribution and command-line binary.",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
"url": "git+https://github.com/enormora/overkill.git"
|
|
65
65
|
},
|
|
66
66
|
"sideEffects": [
|
|
67
|
+
"./packages/test/authoring-metadata.js",
|
|
67
68
|
"./packages/test/baselines.entry-point.js",
|
|
68
69
|
"./packages/test/bench.entry-point.js",
|
|
69
70
|
"./packages/test/command-line-runner.js",
|
|
70
71
|
"./packages/test/overkill.entry-point.js",
|
|
71
|
-
"./packages/test/resources.entry-point.js"
|
|
72
|
-
"./packages/test/test.entry-point.js"
|
|
72
|
+
"./packages/test/resources.entry-point.js"
|
|
73
73
|
],
|
|
74
74
|
"type": "module",
|
|
75
|
-
"version": "0.0.
|
|
75
|
+
"version": "0.0.13"
|
|
76
76
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Metadata, TestFamily } from '@overkill-dev/engine';
|
|
2
|
+
export type AuthoringMetadata = {
|
|
3
|
+
readonly baselines?: never;
|
|
4
|
+
readonly capabilities?: never;
|
|
5
|
+
readonly capture?: never;
|
|
6
|
+
readonly debug?: never;
|
|
7
|
+
readonly extra?: Readonly<Record<string, unknown>>;
|
|
8
|
+
readonly kind?: never;
|
|
9
|
+
readonly ownership?: never;
|
|
10
|
+
readonly priority?: never;
|
|
11
|
+
readonly runtimes?: never;
|
|
12
|
+
readonly stability?: never;
|
|
13
|
+
readonly tags?: readonly string[];
|
|
14
|
+
readonly timeoutMilliseconds?: never;
|
|
15
|
+
};
|
|
16
|
+
type TestFacadeMetadata = {
|
|
17
|
+
readonly metadata: AuthoringMetadata;
|
|
18
|
+
readonly testFamily: TestFamily;
|
|
19
|
+
};
|
|
20
|
+
type TestFacadeWithoutMetadata = {
|
|
21
|
+
readonly testFamily: TestFamily;
|
|
22
|
+
};
|
|
23
|
+
export type TestFacadeDefinition = TestFacadeMetadata | TestFacadeWithoutMetadata;
|
|
24
|
+
export type ReadTestFacadeDefinitionResult = {
|
|
25
|
+
readonly metadata: Metadata;
|
|
26
|
+
readonly testFamily: TestFamily;
|
|
27
|
+
};
|
|
28
|
+
export declare function readAuthoringMetadata(value: unknown): Metadata;
|
|
29
|
+
export declare function createAuthoringMetadata(testFamily: TestFamily, facadeMetadata: Metadata, nodeMetadata: Metadata): Metadata;
|
|
30
|
+
export declare function readTestFacadeDefinition(definition: TestFacadeDefinition): ReadTestFacadeDefinitionResult;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=authoring-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-metadata.d.ts","sourceRoot":"","sources":["../../../../../source/packages/test/authoring-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,sBAAiC,CAAC;AAE5E,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC;CACxC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACtB,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACnC,CAAC;AACF,KAAK,yBAAyB,GAAG;IAC7B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG,yBAAyB,CAAC;AAElF,MAAM,MAAM,8BAA8B,GAAG;IACzC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACnC,CAAC;AAsEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAO9D;AA+BD,wBAAgB,uBAAuB,CACnC,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,QAAQ,EACxB,YAAY,EAAE,QAAQ,GACvB,QAAQ,CASV;AAED,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,oBAAoB,GAAG,8BAA8B,CAUzG"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const createTestFacadeArgumentsError = 'createTestFacade() requires ({ testFamily, metadata? }).';
|
|
2
|
+
const testFamilyValues = [
|
|
3
|
+
'benchmark',
|
|
4
|
+
'integration',
|
|
5
|
+
'microtest',
|
|
6
|
+
'property',
|
|
7
|
+
'type-test'
|
|
8
|
+
];
|
|
9
|
+
const knownTestFamilies = new Set(testFamilyValues);
|
|
10
|
+
function isRecord(value) {
|
|
11
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
function readRecord(value, message) {
|
|
14
|
+
if (!isRecord(value)) {
|
|
15
|
+
throw new TypeError(message);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function isTestFamily(value) {
|
|
20
|
+
return typeof value === 'string' && knownTestFamilies.has(value);
|
|
21
|
+
}
|
|
22
|
+
function readTestFamily(value) {
|
|
23
|
+
if (!isTestFamily(value)) {
|
|
24
|
+
throw new TypeError(createTestFacadeArgumentsError);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
function readStringArray(value, field) {
|
|
29
|
+
if (!Array.isArray(value)) {
|
|
30
|
+
throw new TypeError(`Metadata field "${field}" must be an array.`);
|
|
31
|
+
}
|
|
32
|
+
const items = [];
|
|
33
|
+
for (const item of value) {
|
|
34
|
+
if (typeof item !== 'string' || item.trim().length === 0) {
|
|
35
|
+
throw new TypeError(`Metadata field "${field}" must contain non-empty strings.`);
|
|
36
|
+
}
|
|
37
|
+
items.push(item);
|
|
38
|
+
}
|
|
39
|
+
return items;
|
|
40
|
+
}
|
|
41
|
+
function readExtra(value) {
|
|
42
|
+
if (!isRecord(value)) {
|
|
43
|
+
throw new TypeError('Metadata field "extra" must be an object.');
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function readTagsMetadata(value) {
|
|
48
|
+
return Object.hasOwn(value, 'tags') ? { tags: readStringArray(value.tags, 'tags') } : {};
|
|
49
|
+
}
|
|
50
|
+
function readExtraMetadata(value) {
|
|
51
|
+
return Object.hasOwn(value, 'extra') ? { extra: readExtra(value.extra) } : {};
|
|
52
|
+
}
|
|
53
|
+
export function readAuthoringMetadata(value) {
|
|
54
|
+
const metadata = readRecord(value, 'Test node metadata must be an object.');
|
|
55
|
+
return {
|
|
56
|
+
...readTagsMetadata(metadata),
|
|
57
|
+
...readExtraMetadata(metadata)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function metadataField(metadata, field) {
|
|
61
|
+
return Object.hasOwn(metadata, field) ? metadata[field] : undefined;
|
|
62
|
+
}
|
|
63
|
+
function mergedTags(facadeMetadata, nodeMetadata) {
|
|
64
|
+
const facadeTags = metadataField(facadeMetadata, 'tags');
|
|
65
|
+
const nodeTags = metadataField(nodeMetadata, 'tags');
|
|
66
|
+
if (facadeTags !== undefined && nodeTags !== undefined) {
|
|
67
|
+
return Array.from(new Set([...facadeTags, ...nodeTags]));
|
|
68
|
+
}
|
|
69
|
+
return nodeTags ?? facadeTags;
|
|
70
|
+
}
|
|
71
|
+
function mergedExtra(facadeMetadata, nodeMetadata) {
|
|
72
|
+
const facadeExtra = metadataField(facadeMetadata, 'extra');
|
|
73
|
+
const nodeExtra = metadataField(nodeMetadata, 'extra');
|
|
74
|
+
if (facadeExtra !== undefined && nodeExtra !== undefined) {
|
|
75
|
+
return { ...facadeExtra, ...nodeExtra };
|
|
76
|
+
}
|
|
77
|
+
return nodeExtra ?? facadeExtra;
|
|
78
|
+
}
|
|
79
|
+
export function createAuthoringMetadata(testFamily, facadeMetadata, nodeMetadata) {
|
|
80
|
+
const tags = mergedTags(facadeMetadata, nodeMetadata);
|
|
81
|
+
const extra = mergedExtra(facadeMetadata, nodeMetadata);
|
|
82
|
+
return {
|
|
83
|
+
kind: testFamily,
|
|
84
|
+
...tags === undefined ? {} : { tags },
|
|
85
|
+
...extra === undefined ? {} : { extra }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function readTestFacadeDefinition(definition) {
|
|
89
|
+
const facadeDefinition = readRecord(definition, createTestFacadeArgumentsError);
|
|
90
|
+
const metadata = Object.hasOwn(facadeDefinition, 'metadata')
|
|
91
|
+
? readAuthoringMetadata(facadeDefinition.metadata)
|
|
92
|
+
: {};
|
|
93
|
+
return {
|
|
94
|
+
metadata,
|
|
95
|
+
testFamily: readTestFamily(facadeDefinition.testFamily)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=authoring-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-metadata.js","sourceRoot":"","sources":["../../../../../source/packages/test/authoring-metadata.ts"],"names":[],"mappings":"AAgCA,MAAM,8BAA8B,GAAG,0DAA0D,CAAC;AAClG,MAAM,gBAAgB,GAA0B;IAC5C,WAAW;IACX,aAAa;IACb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Q,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC;QACxD,CAAC,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;QAClD,CAAC,CAAC,EAAE,CAAC;IAET,OAAO;QACH,QAAQ;QACR,UAAU,EAAE,cAAc,CAAC,gBAAgB,CAAC,UAAU,CAAC;KAC1D,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { captureSourceLocation, forwardAssertionSourceLocations } from "@overkill-dev/engine";
|
|
2
|
+
const activeMacroDefinitionLocations = [];
|
|
3
|
+
function captureAuthoringLocation() {
|
|
4
|
+
return captureSourceLocation()();
|
|
5
|
+
}
|
|
6
|
+
export function activeMacroSourceLocations() {
|
|
7
|
+
return activeMacroDefinitionLocations.at(-1) ?? [];
|
|
8
|
+
}
|
|
9
|
+
function sourceLocationsWithTrailingLocation(sourceLocations, location) {
|
|
10
|
+
const firstLocation = sourceLocations[0];
|
|
11
|
+
return firstLocation === undefined
|
|
12
|
+
? [location]
|
|
13
|
+
: [firstLocation, ...sourceLocations.slice(1), location];
|
|
14
|
+
}
|
|
15
|
+
export function runWithForwardedSourceLocations(sourceLocations, body) {
|
|
16
|
+
const firstLocation = sourceLocations[0];
|
|
17
|
+
return firstLocation === undefined
|
|
18
|
+
? body()
|
|
19
|
+
: forwardAssertionSourceLocations([firstLocation, ...sourceLocations.slice(1)], body);
|
|
20
|
+
}
|
|
21
|
+
export function definitionLocationsForAuthoringCall() {
|
|
22
|
+
return sourceLocationsWithTrailingLocation(activeMacroSourceLocations(), captureAuthoringLocation());
|
|
23
|
+
}
|
|
24
|
+
export function assertionBodyForActiveMacro(body) {
|
|
25
|
+
const sourceLocations = activeMacroSourceLocations();
|
|
26
|
+
if (sourceLocations.length === 0) {
|
|
27
|
+
return body;
|
|
28
|
+
}
|
|
29
|
+
return async function runMacroGeneratedTestBody(scope) {
|
|
30
|
+
return await runWithForwardedSourceLocations(sourceLocations, async function runBody() {
|
|
31
|
+
return await body(scope);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function runMacroWithDefinitionLocations(body) {
|
|
36
|
+
const definitionLocations = definitionLocationsForAuthoringCall();
|
|
37
|
+
activeMacroDefinitionLocations.push(definitionLocations);
|
|
38
|
+
try {
|
|
39
|
+
return body();
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
activeMacroDefinitionLocations.pop();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function defineParameterizedTestBodyFactory(body) {
|
|
46
|
+
return function createParameterizedTestBody(data) {
|
|
47
|
+
const sourceLocations = [captureAuthoringLocation()];
|
|
48
|
+
return async function runParameterizedTestBody(scope) {
|
|
49
|
+
return forwardAssertionSourceLocations(sourceLocations, async function runBody() {
|
|
50
|
+
return body(scope, data);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=authoring-source-locations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-source-locations.js","sourceRoot":"","sources":["../../../../../source/packages/test/authoring-source-locations.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,+BAA+B,EAMlC,MAAM,sBAAiC,CAAC;AAOzC,MAAM,8BAA8B,GAA4C,EAAE,CAAC;AAEnF,SAAS,wBAAwB;IAC7B,OAAO,qBAAqB,EAAE,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,0BAA0B;IACtC,OAAO,8BAA8B,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,mCAAmC,CACxC,eAAoC,EACpC,QAAkB;IAElB,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;IAEzC,OAAO,aAAa,KAAK,SAAS;QAC9B,CAAC,CAAC,CAAE,QAAQ,CAAE;QACd,CAAC,C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2B,CAAC,IAAI;QAC5C,MAAM,eAAe,GAAoD,CAAE,wBAAwB,EAAE,CAAE,CAAC;QAExG,OAAO,KAAK,UAAU,wBAAwB,CAAC,KAAK;YAChD,OAAO,+BAA+B,CAAC,eAAe,EAAE,KAAK,UAAU,OAAO;gBAC1E,OAAO,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type DefinedOutputRenderer, type DefinedReporter, type Suite, type Table, type TestBody, type TestCase, type TestNode, type TestScope } from '@overkill-dev/engine';
|
|
2
|
+
import { type AuthoringMetadata, type TestFacadeDefinition } from './authoring-metadata.ts';
|
|
2
3
|
export { doubleUsage, rule, testAsyncDisposable, testAsyncIterable, testAsyncIterator, testDisposable, testDouble, testIterable, testIterator } from '@overkill-dev/doubles';
|
|
3
4
|
export type { AsyncDisposableConfiguration, AsyncIterableConfiguration, AsyncIteratorConfiguration, AsyncIteratorSource, DisposableConfiguration, DoubleCall, DoubleConstruction, DoubleHistory, DoubleInteraction, DoubleInvocation, DoubleIteratorEvent, DoubleIteratorReturnEvent, DoubleIteratorThrowEvent, DoubleIteratorYieldEvent, DoubleResult, DoubleReturnedResult, DoubleThrownResult, DoubleUsageAssertions, ProtocolMethodConfiguration, RuleFactory, SyncIterableConfiguration, SyncIteratorConfiguration, SyncIteratorSource, TestAsyncDisposable, TestAsyncDisposableFactory, TestAsyncIterable, TestAsyncIterableFactory, TestAsyncIterator, TestAsyncIteratorFactory, TestDisposable, TestDisposableFactory, TestDouble, TestDoubleFactory, TestIterable, TestIterableFactory, TestIterator, TestIteratorFactory } from '@overkill-dev/doubles';
|
|
4
|
-
type
|
|
5
|
+
export type { AuthoringMetadata, TestFacadeDefinition } from './authoring-metadata.ts';
|
|
5
6
|
export type RunIfMainRootOptions = {
|
|
6
|
-
readonly metadata:
|
|
7
|
+
readonly metadata: AuthoringMetadata;
|
|
7
8
|
readonly title: string;
|
|
8
9
|
};
|
|
9
10
|
export type RunIfMainOptions = {
|
|
10
|
-
readonly outputRenderer?:
|
|
11
|
-
readonly reporters?: readonly
|
|
11
|
+
readonly outputRenderer?: DefinedOutputRenderer;
|
|
12
|
+
readonly reporters?: readonly DefinedReporter[];
|
|
12
13
|
readonly root?: RunIfMainRootOptions;
|
|
13
14
|
};
|
|
14
15
|
export type RunIfMain = (meta: Readonly<ImportMeta>, testNode: TestNode, options?: RunIfMainOptions) => Promise<void>;
|
|
16
|
+
type TestDefinition = {
|
|
17
|
+
readonly body: TestBody;
|
|
18
|
+
readonly metadata: AuthoringMetadata;
|
|
19
|
+
readonly title: string;
|
|
20
|
+
};
|
|
21
|
+
type SuiteDefinition = {
|
|
22
|
+
readonly children: readonly TestNode[];
|
|
23
|
+
readonly metadata: AuthoringMetadata;
|
|
24
|
+
readonly title: string;
|
|
25
|
+
};
|
|
15
26
|
export type ParameterizedTestScope<Row> = TestScope & {
|
|
16
27
|
readonly parameters: Row;
|
|
17
28
|
};
|
|
@@ -19,20 +30,31 @@ export type TableTestBody<Row> = (scope: ParameterizedTestScope<Row>) => ReturnT
|
|
|
19
30
|
export type TableDefinition<Row> = {
|
|
20
31
|
readonly caseTitle?: (parameters: Row, index: number) => string;
|
|
21
32
|
readonly cases: readonly Row[];
|
|
22
|
-
readonly metadata?:
|
|
33
|
+
readonly metadata?: AuthoringMetadata;
|
|
23
34
|
readonly test: TableTestBody<Row>;
|
|
24
35
|
readonly title: string;
|
|
25
36
|
};
|
|
26
37
|
type MacroFactory<MacroParameters extends readonly unknown[], Node extends TestNode> = (...parameters: MacroParameters) => Node;
|
|
27
38
|
type ParameterizedTestBody<Data> = (scope: TestScope, data: Data) => ReturnType<TestBody>;
|
|
28
|
-
|
|
39
|
+
type TestAuthor = (...input: readonly [definition: Readonly<TestDefinition>] | readonly [title: string, body: TestBody]) => TestCase;
|
|
40
|
+
type SuiteAuthor = (...input: readonly [definition: Readonly<SuiteDefinition>] | readonly [title: string, children: readonly TestNode[]]) => Suite;
|
|
41
|
+
type TableAuthor = <Row>(definition: TableDefinition<Row>) => Table;
|
|
42
|
+
export type TestFacade = {
|
|
43
|
+
readonly defineMacro: typeof defineMacro;
|
|
44
|
+
readonly defineParameterizedTestBody: typeof defineParameterizedTestBody;
|
|
45
|
+
readonly runIfMain: RunIfMain;
|
|
46
|
+
readonly suite: SuiteAuthor;
|
|
47
|
+
readonly table: TableAuthor;
|
|
48
|
+
readonly test: TestAuthor;
|
|
49
|
+
};
|
|
50
|
+
export declare function test(...input: readonly [definition: Readonly<TestDefinition>]): TestCase;
|
|
29
51
|
export declare function test(...input: readonly [title: string, body: TestBody]): TestCase;
|
|
30
|
-
export declare function suite(...input: readonly [definition: Readonly<
|
|
52
|
+
export declare function suite(...input: readonly [definition: Readonly<SuiteDefinition>]): Suite;
|
|
31
53
|
export declare function suite(...input: readonly [title: string, children: readonly TestNode[]]): Suite;
|
|
32
54
|
export declare function table<Row>(definition: TableDefinition<Row>): Table;
|
|
33
|
-
export declare const createTestFacade: UnavailableAuthoringApi;
|
|
34
55
|
export declare function defineMacro<const MacroParameters extends readonly unknown[], Node extends TestNode>(factory: MacroFactory<MacroParameters, Node>): MacroFactory<MacroParameters, Node>;
|
|
35
56
|
export declare function defineParameterizedTestBody<Data>(body: ParameterizedTestBody<Data>): (data: Data) => TestBody;
|
|
36
57
|
export declare function runIfMain(meta: Readonly<ImportMeta>, testNode: TestNode, options?: RunIfMainOptions): Promise<void>;
|
|
37
|
-
export
|
|
58
|
+
export declare function createTestFacade(definition: TestFacadeDefinition): TestFacade;
|
|
59
|
+
export type { OutputRenderer, Reporter, Suite, Table, TestBody, TestCase, TestFamily, TestNode, TestScope, TestScopeAssertContext } from '@overkill-dev/engine';
|
|
38
60
|
//# sourceMappingURL=test.entry-point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/test/test.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"test.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/test/test.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EAIpB,KAAK,KAAK,EACV,KAAK,KAAK,EAEV,KAAK,QAAQ,EACb,KAAK,QAAQ,EAEb,KAAK,QAAQ,EACb,KAAK,SAAS,EACjB,MAAM,sBAAiC,CAAC;AASzC,OAAO,EAIH,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACH,WAAW,EACX,IAAI,EACJ,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,EACf,MAAM,uBAAmC,CAAC;AAC3C,YAAY,EACR,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,2BAA2B,EAC3B,WAAW,EACX,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACtB,MAAM,uBAAmC,CAAC;AAE3C,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEvF,MAAM,M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iB7E;AAED,YAAY,EACR,cAAc,EACd,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,sBAAsB,EACzB,MAAM,sBAAiC,CAAC"}
|
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createSuite, createTable, createTestCase, ownsTestNode } from "@overkill-dev/engine";
|
|
2
|
+
import { activeMacroSourceLocations, assertionBodyForActiveMacro, defineParameterizedTestBodyFactory, definitionLocationsForAuthoringCall, runWithForwardedSourceLocations, runMacroWithDefinitionLocations } from "./authoring-source-locations.js";
|
|
3
|
+
import { createAuthoringMetadata, readAuthoringMetadata, readTestFacadeDefinition } from "./authoring-metadata.js";
|
|
2
4
|
export { doubleUsage, rule, testAsyncDisposable, testAsyncIterable, testAsyncIterator, testDisposable, testDouble, testIterable, testIterator } from "@overkill-dev/doubles";
|
|
3
5
|
const singleArgumentCount = 1;
|
|
4
6
|
const positionalArgumentCount = 2;
|
|
5
7
|
const testArgumentsError = 'test() requires (title, body) or ({ title, metadata, body }).';
|
|
6
8
|
const suiteArgumentsError = 'suite() requires (title, children) or ({ title, metadata, children }).';
|
|
7
9
|
const tableArgumentsError = 'table() requires ({ title, cases, metadata?, caseTitle?, test }).';
|
|
8
|
-
const activeMacroDefinitionLocations = [];
|
|
9
|
-
function createUnavailableAuthoringApi(name) {
|
|
10
|
-
return function unavailableAuthoringApi() {
|
|
11
|
-
throw new Error(`The @overkill-dev/test ${name}() authoring API is not implemented yet.`);
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
10
|
function isRecord(value) {
|
|
15
11
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
16
12
|
}
|
|
17
|
-
function assertMetadataObject(value) {
|
|
18
|
-
if (!isRecord(value)) {
|
|
19
|
-
throw new TypeError('Test node metadata must be an object.');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
13
|
function readRecord(value, message) {
|
|
23
14
|
if (!isRecord(value)) {
|
|
24
15
|
throw new TypeError(message);
|
|
@@ -40,13 +31,6 @@ function readBody(value) {
|
|
|
40
31
|
}
|
|
41
32
|
return value;
|
|
42
33
|
}
|
|
43
|
-
function createMicrotestMetadata(value) {
|
|
44
|
-
const metadata = isRecord(value) && !Object.hasOwn(value, 'kind')
|
|
45
|
-
? { ...value, kind: 'microtest' }
|
|
46
|
-
: value;
|
|
47
|
-
assertMetadataObject(metadata);
|
|
48
|
-
return metadata;
|
|
49
|
-
}
|
|
50
34
|
function readChildren(value, message) {
|
|
51
35
|
if (!Array.isArray(value)) {
|
|
52
36
|
throw new TypeError(message);
|
|
@@ -61,7 +45,7 @@ function readTestDefinition(value) {
|
|
|
61
45
|
const definition = readRecord(value, testArgumentsError);
|
|
62
46
|
return {
|
|
63
47
|
body: readBody(definition.body),
|
|
64
|
-
metadata:
|
|
48
|
+
metadata: readAuthoringMetadata(definition.metadata),
|
|
65
49
|
title: readTitle(definition.title, testArgumentsError)
|
|
66
50
|
};
|
|
67
51
|
}
|
|
@@ -69,45 +53,13 @@ function readSuiteDefinition(value) {
|
|
|
69
53
|
const definition = readRecord(value, suiteArgumentsError);
|
|
70
54
|
return {
|
|
71
55
|
children: readChildren(definition.children, suiteArgumentsError),
|
|
72
|
-
metadata:
|
|
56
|
+
metadata: readAuthoringMetadata(definition.metadata),
|
|
73
57
|
title: readTitle(definition.title, suiteArgumentsError)
|
|
74
58
|
};
|
|
75
59
|
}
|
|
76
60
|
function defaultCaseTitle(index) {
|
|
77
61
|
return `case ${index + 1}`;
|
|
78
62
|
}
|
|
79
|
-
function captureAuthoringLocation() {
|
|
80
|
-
return captureSourceLocation()();
|
|
81
|
-
}
|
|
82
|
-
function currentMacroDefinitionLocations() {
|
|
83
|
-
return activeMacroDefinitionLocations.at(-1) ?? [];
|
|
84
|
-
}
|
|
85
|
-
function sourceLocationsWithTrailingLocation(sourceLocations, location) {
|
|
86
|
-
const firstLocation = sourceLocations[0];
|
|
87
|
-
return firstLocation === undefined
|
|
88
|
-
? [location]
|
|
89
|
-
: [firstLocation, ...sourceLocations.slice(1), location];
|
|
90
|
-
}
|
|
91
|
-
function definitionLocationsForAuthoringCall() {
|
|
92
|
-
return sourceLocationsWithTrailingLocation(currentMacroDefinitionLocations(), captureAuthoringLocation());
|
|
93
|
-
}
|
|
94
|
-
function runWithForwardedSourceLocations(sourceLocations, body) {
|
|
95
|
-
const firstLocation = sourceLocations[0];
|
|
96
|
-
return firstLocation === undefined
|
|
97
|
-
? body()
|
|
98
|
-
: forwardAssertionSourceLocations([firstLocation, ...sourceLocations.slice(1)], body);
|
|
99
|
-
}
|
|
100
|
-
function assertionBodyForActiveMacro(body) {
|
|
101
|
-
const sourceLocations = currentMacroDefinitionLocations();
|
|
102
|
-
if (sourceLocations.length === 0) {
|
|
103
|
-
return body;
|
|
104
|
-
}
|
|
105
|
-
return async function runMacroGeneratedTestBody(scope) {
|
|
106
|
-
return await runWithForwardedSourceLocations(sourceLocations, async function runBody() {
|
|
107
|
-
return await body(scope);
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
63
|
function tableCaseTitle(caseTitle, parameters, index) {
|
|
112
64
|
const title = caseTitle === null ? defaultCaseTitle(index) : caseTitle(parameters, index);
|
|
113
65
|
if (typeof title !== 'string') {
|
|
@@ -139,13 +91,13 @@ function readTableDefinition(definition) {
|
|
|
139
91
|
return {
|
|
140
92
|
caseTitle: definition.caseTitle ?? null,
|
|
141
93
|
cases: definition.cases,
|
|
142
|
-
metadata:
|
|
94
|
+
metadata: readAuthoringMetadata(runtimeDefinition.metadata ?? {}),
|
|
143
95
|
test: definition.test,
|
|
144
96
|
title: readTitle(runtimeDefinition.title, tableArgumentsError)
|
|
145
97
|
};
|
|
146
98
|
}
|
|
147
99
|
function tableCases(definition) {
|
|
148
|
-
const sourceLocations =
|
|
100
|
+
const sourceLocations = activeMacroSourceLocations();
|
|
149
101
|
return definition.cases.map(function createTableCase(parameters, index) {
|
|
150
102
|
return {
|
|
151
103
|
body: tableCaseBody(definition, parameters, sourceLocations),
|
|
@@ -155,13 +107,13 @@ function tableCases(definition) {
|
|
|
155
107
|
};
|
|
156
108
|
});
|
|
157
109
|
}
|
|
158
|
-
|
|
110
|
+
function createAuthoredTest(testFamily, facadeMetadata, ...input) {
|
|
159
111
|
if (input.length === singleArgumentCount) {
|
|
160
112
|
const definition = readTestDefinition(input[0]);
|
|
161
113
|
return createTestCase({
|
|
162
114
|
body: assertionBodyForActiveMacro(definition.body),
|
|
163
115
|
definitionLocations: definitionLocationsForAuthoringCall(),
|
|
164
|
-
metadata: definition.metadata,
|
|
116
|
+
metadata: createAuthoringMetadata(testFamily, facadeMetadata, definition.metadata),
|
|
165
117
|
title: definition.title
|
|
166
118
|
});
|
|
167
119
|
}
|
|
@@ -170,19 +122,22 @@ export function test(...input) {
|
|
|
170
122
|
return createTestCase({
|
|
171
123
|
body: assertionBodyForActiveMacro(readBody(body)),
|
|
172
124
|
definitionLocations: definitionLocationsForAuthoringCall(),
|
|
173
|
-
metadata:
|
|
125
|
+
metadata: createAuthoringMetadata(testFamily, facadeMetadata, {}),
|
|
174
126
|
title: readTitle(name, testArgumentsError)
|
|
175
127
|
});
|
|
176
128
|
}
|
|
177
129
|
throw new TypeError(testArgumentsError);
|
|
178
130
|
}
|
|
179
|
-
export function
|
|
131
|
+
export function test(...input) {
|
|
132
|
+
return createAuthoredTest('microtest', {}, ...input);
|
|
133
|
+
}
|
|
134
|
+
function createAuthoredSuite(testFamily, facadeMetadata, ...input) {
|
|
180
135
|
if (input.length === singleArgumentCount) {
|
|
181
136
|
const definition = readSuiteDefinition(input[0]);
|
|
182
137
|
return createSuite({
|
|
183
138
|
children: definition.children,
|
|
184
139
|
definitionLocations: definitionLocationsForAuthoringCall(),
|
|
185
|
-
metadata: definition.metadata,
|
|
140
|
+
metadata: createAuthoringMetadata(testFamily, facadeMetadata, definition.metadata),
|
|
186
141
|
title: definition.title
|
|
187
142
|
});
|
|
188
143
|
}
|
|
@@ -191,22 +146,27 @@ export function suite(...input) {
|
|
|
191
146
|
return createSuite({
|
|
192
147
|
children: readChildren(children, suiteArgumentsError),
|
|
193
148
|
definitionLocations: definitionLocationsForAuthoringCall(),
|
|
194
|
-
metadata:
|
|
149
|
+
metadata: createAuthoringMetadata(testFamily, facadeMetadata, {}),
|
|
195
150
|
title: readTitle(name, suiteArgumentsError)
|
|
196
151
|
});
|
|
197
152
|
}
|
|
198
153
|
throw new TypeError(suiteArgumentsError);
|
|
199
154
|
}
|
|
200
|
-
export function
|
|
155
|
+
export function suite(...input) {
|
|
156
|
+
return createAuthoredSuite('microtest', {}, ...input);
|
|
157
|
+
}
|
|
158
|
+
function createAuthoredTable(testFamily, facadeMetadata, definition) {
|
|
201
159
|
const tableDefinition = readTableDefinition(definition);
|
|
202
160
|
return createTable({
|
|
203
161
|
cases: tableCases(tableDefinition),
|
|
204
162
|
definitionLocations: definitionLocationsForAuthoringCall(),
|
|
205
|
-
metadata: tableDefinition.metadata,
|
|
163
|
+
metadata: createAuthoringMetadata(testFamily, facadeMetadata, tableDefinition.metadata),
|
|
206
164
|
title: tableDefinition.title
|
|
207
165
|
});
|
|
208
166
|
}
|
|
209
|
-
export
|
|
167
|
+
export function table(definition) {
|
|
168
|
+
return createAuthoredTable('microtest', {}, definition);
|
|
169
|
+
}
|
|
210
170
|
function createMacroNode(factory, parameters) {
|
|
211
171
|
const node = factory(...parameters);
|
|
212
172
|
if (!ownsTestNode(node)) {
|
|
@@ -219,28 +179,16 @@ export function defineMacro(factory) {
|
|
|
219
179
|
throw new TypeError('defineMacro() requires a factory function.');
|
|
220
180
|
}
|
|
221
181
|
return function runMacro(...parameters) {
|
|
222
|
-
|
|
223
|
-
activeMacroDefinitionLocations.push(definitionLocations);
|
|
224
|
-
try {
|
|
182
|
+
return runMacroWithDefinitionLocations(function createNode() {
|
|
225
183
|
return createMacroNode(factory, parameters);
|
|
226
|
-
}
|
|
227
|
-
finally {
|
|
228
|
-
activeMacroDefinitionLocations.pop();
|
|
229
|
-
}
|
|
184
|
+
});
|
|
230
185
|
};
|
|
231
186
|
}
|
|
232
187
|
export function defineParameterizedTestBody(body) {
|
|
233
188
|
if (typeof body !== 'function') {
|
|
234
189
|
throw new TypeError('defineParameterizedTestBody() requires a body function.');
|
|
235
190
|
}
|
|
236
|
-
return
|
|
237
|
-
const sourceLocations = [captureAuthoringLocation()];
|
|
238
|
-
return async function runParameterizedTestBody(scope) {
|
|
239
|
-
return forwardAssertionSourceLocations(sourceLocations, async function runBody() {
|
|
240
|
-
return body(scope, data);
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
};
|
|
191
|
+
return defineParameterizedTestBodyFactory(body);
|
|
244
192
|
}
|
|
245
193
|
export async function runIfMain(meta, testNode, options) {
|
|
246
194
|
if (!meta.main) {
|
|
@@ -249,4 +197,21 @@ export async function runIfMain(meta, testNode, options) {
|
|
|
249
197
|
const runModule = await import("@overkill-dev/run");
|
|
250
198
|
await runModule.runIfMain(meta, testNode, options);
|
|
251
199
|
}
|
|
200
|
+
export function createTestFacade(definition) {
|
|
201
|
+
const facadeDefinition = readTestFacadeDefinition(definition);
|
|
202
|
+
return {
|
|
203
|
+
defineMacro,
|
|
204
|
+
defineParameterizedTestBody,
|
|
205
|
+
runIfMain,
|
|
206
|
+
suite(...input) {
|
|
207
|
+
return createAuthoredSuite(facadeDefinition.testFamily, facadeDefinition.metadata, ...input);
|
|
208
|
+
},
|
|
209
|
+
table(tableDefinition) {
|
|
210
|
+
return createAuthoredTable(facadeDefinition.testFamily, facadeDefinition.metadata, tableDefinition);
|
|
211
|
+
},
|
|
212
|
+
test(...input) {
|
|
213
|
+
return createAuthoredTest(facadeDefinition.testFamily, facadeDefinition.metadata, ...input);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
}
|
|
252
217
|
//# sourceMappingURL=test.entry-point.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/test/test.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"test.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/test/test.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,WAAW,EACX,cAAc,EAKd,YAAY,EASf,MAAM,sBAAiC,CAAC;AACzC,OAAO,EACH,0BAA0B,EAC1B,2BAA2B,EAC3B,kCAAkC,EAClC,mCAAmC,EACnC,+BAA+B,EAC/B,+BAA+B,EAClC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EAG3B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACH,WAAW,EACX,IAAI,EACJ,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,YAAY,EACZ,YAAY,EACf,MAAM,uBAAmC,CAAC;AAkI3C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,MAAM,kBAAkB,GAAG,+DAA+D,CAAC;AAC3F,MAAM,mBAAmB,GAAG,wEAAwE,CAAC;AACrG,MAAM,mBAAmB,GAAG,mEAAmE,CAAC;AAEhG,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,UAAU,CAAC,KAAc,EAAE,OAAe;IAC/C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,EAAE,OAAe;IAC9C,IAAI,OAAO,KAAK,KAAK,QAA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KAAK,CAAC,CAAC;QACjG,CAAC;QACD,KAAK,CAAM,eAAqC;YAC5C,OAAO,mBAAmB,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACxG,CAAC;QACD,IAAI,CAAC,GAAG,KAAK;YACT,OAAO,kBAAkB,CAAC,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC;QAChG,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/readme.md
CHANGED
|
@@ -69,8 +69,9 @@ The root doubles exports are the current lightweight public surface from
|
|
|
69
69
|
`@overkill-dev/doubles`. Import the leaf package directly when documenting or
|
|
70
70
|
testing doubles package ownership.
|
|
71
71
|
|
|
72
|
-
Nodes created through this root facade
|
|
73
|
-
|
|
72
|
+
Nodes created through this root facade derive `metadata.kind: 'microtest'`.
|
|
73
|
+
High-level authoring metadata accepts `tags` and `extra`; engine-owned fields
|
|
74
|
+
such as `kind`, `runtimes`, and `ownership` stay outside the root facade.
|
|
74
75
|
|
|
75
76
|
Use the object form when attaching node metadata. Metadata on the exported
|
|
76
77
|
top-level `testNode` applies to the whole module's test tree.
|
|
@@ -128,7 +129,27 @@ export const testNode = suite('users', [
|
|
|
128
129
|
]);
|
|
129
130
|
```
|
|
130
131
|
|
|
131
|
-
`createTestFacade`
|
|
132
|
+
`createTestFacade` creates another narrow authoring surface for one test
|
|
133
|
+
family:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
import { createTestFacade } from '@overkill-dev/test';
|
|
137
|
+
|
|
138
|
+
export const {
|
|
139
|
+
defineMacro,
|
|
140
|
+
defineParameterizedTestBody,
|
|
141
|
+
runIfMain,
|
|
142
|
+
suite,
|
|
143
|
+
table,
|
|
144
|
+
test
|
|
145
|
+
} = createTestFacade({
|
|
146
|
+
metadata: { tags: [ 'integration' ] },
|
|
147
|
+
testFamily: 'integration'
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The returned facade contains authoring helpers only. Assertions and doubles
|
|
152
|
+
are imported alongside it instead of being registered into the facade.
|
|
132
153
|
|
|
133
154
|
Direct Node execution:
|
|
134
155
|
|
package/sbom.cdx.json
CHANGED
|
@@ -16,115 +16,115 @@
|
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "library",
|
|
18
18
|
"name": "@overkill-dev/test",
|
|
19
|
-
"version": "0.0.
|
|
20
|
-
"bom-ref": "pkg:npm/@overkill-dev/test@0.0.
|
|
21
|
-
"purl": "pkg:npm/@overkill-dev/test@0.0.
|
|
19
|
+
"version": "0.0.13",
|
|
20
|
+
"bom-ref": "pkg:npm/@overkill-dev/test@0.0.13",
|
|
21
|
+
"purl": "pkg:npm/@overkill-dev/test@0.0.13"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
25
25
|
{
|
|
26
26
|
"type": "library",
|
|
27
27
|
"name": "@overkill-dev/assert",
|
|
28
|
-
"version": "0.0.
|
|
29
|
-
"bom-ref": "pkg:npm/@overkill-dev/assert@0.0.
|
|
28
|
+
"version": "0.0.29",
|
|
29
|
+
"bom-ref": "pkg:npm/@overkill-dev/assert@0.0.29",
|
|
30
30
|
"scope": "required",
|
|
31
31
|
"licenses": [
|
|
32
32
|
{
|
|
33
33
|
"expression": "MIT"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
|
-
"purl": "pkg:npm/@overkill-dev/assert@0.0.
|
|
36
|
+
"purl": "pkg:npm/@overkill-dev/assert@0.0.29"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"type": "library",
|
|
40
40
|
"name": "@overkill-dev/doubles",
|
|
41
|
-
"version": "0.0.
|
|
42
|
-
"bom-ref": "pkg:npm/@overkill-dev/doubles@0.0.
|
|
41
|
+
"version": "0.0.27",
|
|
42
|
+
"bom-ref": "pkg:npm/@overkill-dev/doubles@0.0.27",
|
|
43
43
|
"scope": "required",
|
|
44
44
|
"licenses": [
|
|
45
45
|
{
|
|
46
46
|
"expression": "MIT"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
|
-
"purl": "pkg:npm/@overkill-dev/doubles@0.0.
|
|
49
|
+
"purl": "pkg:npm/@overkill-dev/doubles@0.0.27"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"type": "library",
|
|
53
53
|
"name": "@overkill-dev/engine",
|
|
54
|
-
"version": "0.0.
|
|
55
|
-
"bom-ref": "pkg:npm/@overkill-dev/engine@0.0.
|
|
54
|
+
"version": "0.0.28",
|
|
55
|
+
"bom-ref": "pkg:npm/@overkill-dev/engine@0.0.28",
|
|
56
56
|
"scope": "required",
|
|
57
57
|
"licenses": [
|
|
58
58
|
{
|
|
59
59
|
"expression": "MIT"
|
|
60
60
|
}
|
|
61
61
|
],
|
|
62
|
-
"purl": "pkg:npm/@overkill-dev/engine@0.0.
|
|
62
|
+
"purl": "pkg:npm/@overkill-dev/engine@0.0.28"
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
"type": "library",
|
|
66
66
|
"name": "@overkill-dev/output-renderer-github-actions",
|
|
67
|
-
"version": "0.0.
|
|
68
|
-
"bom-ref": "pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.
|
|
67
|
+
"version": "0.0.18",
|
|
68
|
+
"bom-ref": "pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.18",
|
|
69
69
|
"scope": "required",
|
|
70
70
|
"licenses": [
|
|
71
71
|
{
|
|
72
72
|
"expression": "MIT"
|
|
73
73
|
}
|
|
74
74
|
],
|
|
75
|
-
"purl": "pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.
|
|
75
|
+
"purl": "pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.18"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"type": "library",
|
|
79
79
|
"name": "@overkill-dev/reporter-brief",
|
|
80
|
-
"version": "0.0.
|
|
81
|
-
"bom-ref": "pkg:npm/@overkill-dev/reporter-brief@0.0.
|
|
80
|
+
"version": "0.0.18",
|
|
81
|
+
"bom-ref": "pkg:npm/@overkill-dev/reporter-brief@0.0.18",
|
|
82
82
|
"scope": "required",
|
|
83
83
|
"licenses": [
|
|
84
84
|
{
|
|
85
85
|
"expression": "MIT"
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
|
-
"purl": "pkg:npm/@overkill-dev/reporter-brief@0.0.
|
|
88
|
+
"purl": "pkg:npm/@overkill-dev/reporter-brief@0.0.18"
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"type": "library",
|
|
92
92
|
"name": "@overkill-dev/reporter-dot",
|
|
93
|
-
"version": "0.0.
|
|
94
|
-
"bom-ref": "pkg:npm/@overkill-dev/reporter-dot@0.0.
|
|
93
|
+
"version": "0.0.29",
|
|
94
|
+
"bom-ref": "pkg:npm/@overkill-dev/reporter-dot@0.0.29",
|
|
95
95
|
"scope": "required",
|
|
96
96
|
"licenses": [
|
|
97
97
|
{
|
|
98
98
|
"expression": "MIT"
|
|
99
99
|
}
|
|
100
100
|
],
|
|
101
|
-
"purl": "pkg:npm/@overkill-dev/reporter-dot@0.0.
|
|
101
|
+
"purl": "pkg:npm/@overkill-dev/reporter-dot@0.0.29"
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
"type": "library",
|
|
105
105
|
"name": "@overkill-dev/reporter-line",
|
|
106
|
-
"version": "0.0.
|
|
107
|
-
"bom-ref": "pkg:npm/@overkill-dev/reporter-line@0.0.
|
|
106
|
+
"version": "0.0.29",
|
|
107
|
+
"bom-ref": "pkg:npm/@overkill-dev/reporter-line@0.0.29",
|
|
108
108
|
"scope": "required",
|
|
109
109
|
"licenses": [
|
|
110
110
|
{
|
|
111
111
|
"expression": "MIT"
|
|
112
112
|
}
|
|
113
113
|
],
|
|
114
|
-
"purl": "pkg:npm/@overkill-dev/reporter-line@0.0.
|
|
114
|
+
"purl": "pkg:npm/@overkill-dev/reporter-line@0.0.29"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"type": "library",
|
|
118
118
|
"name": "@overkill-dev/run",
|
|
119
|
-
"version": "0.0.
|
|
120
|
-
"bom-ref": "pkg:npm/@overkill-dev/run@0.0.
|
|
119
|
+
"version": "0.0.33",
|
|
120
|
+
"bom-ref": "pkg:npm/@overkill-dev/run@0.0.33",
|
|
121
121
|
"scope": "required",
|
|
122
122
|
"licenses": [
|
|
123
123
|
{
|
|
124
124
|
"expression": "MIT"
|
|
125
125
|
}
|
|
126
126
|
],
|
|
127
|
-
"purl": "pkg:npm/@overkill-dev/run@0.0.
|
|
127
|
+
"purl": "pkg:npm/@overkill-dev/run@0.0.33"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
"type": "library",
|
|
@@ -142,40 +142,40 @@
|
|
|
142
142
|
],
|
|
143
143
|
"dependencies": [
|
|
144
144
|
{
|
|
145
|
-
"ref": "pkg:npm/@overkill-dev/assert@0.0.
|
|
145
|
+
"ref": "pkg:npm/@overkill-dev/assert@0.0.29"
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
|
-
"ref": "pkg:npm/@overkill-dev/doubles@0.0.
|
|
148
|
+
"ref": "pkg:npm/@overkill-dev/doubles@0.0.27"
|
|
149
149
|
},
|
|
150
150
|
{
|
|
151
|
-
"ref": "pkg:npm/@overkill-dev/engine@0.0.
|
|
151
|
+
"ref": "pkg:npm/@overkill-dev/engine@0.0.28"
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
|
-
"ref": "pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.
|
|
154
|
+
"ref": "pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.18"
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
|
-
"ref": "pkg:npm/@overkill-dev/reporter-brief@0.0.
|
|
157
|
+
"ref": "pkg:npm/@overkill-dev/reporter-brief@0.0.18"
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
|
-
"ref": "pkg:npm/@overkill-dev/reporter-dot@0.0.
|
|
160
|
+
"ref": "pkg:npm/@overkill-dev/reporter-dot@0.0.29"
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
|
-
"ref": "pkg:npm/@overkill-dev/reporter-line@0.0.
|
|
163
|
+
"ref": "pkg:npm/@overkill-dev/reporter-line@0.0.29"
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
|
-
"ref": "pkg:npm/@overkill-dev/run@0.0.
|
|
166
|
+
"ref": "pkg:npm/@overkill-dev/run@0.0.33"
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
|
-
"ref": "pkg:npm/@overkill-dev/test@0.0.
|
|
169
|
+
"ref": "pkg:npm/@overkill-dev/test@0.0.13",
|
|
170
170
|
"dependsOn": [
|
|
171
|
-
"pkg:npm/@overkill-dev/assert@0.0.
|
|
172
|
-
"pkg:npm/@overkill-dev/doubles@0.0.
|
|
173
|
-
"pkg:npm/@overkill-dev/engine@0.0.
|
|
174
|
-
"pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.
|
|
175
|
-
"pkg:npm/@overkill-dev/reporter-brief@0.0.
|
|
176
|
-
"pkg:npm/@overkill-dev/reporter-dot@0.0.
|
|
177
|
-
"pkg:npm/@overkill-dev/reporter-line@0.0.
|
|
178
|
-
"pkg:npm/@overkill-dev/run@0.0.
|
|
171
|
+
"pkg:npm/@overkill-dev/assert@0.0.29",
|
|
172
|
+
"pkg:npm/@overkill-dev/doubles@0.0.27",
|
|
173
|
+
"pkg:npm/@overkill-dev/engine@0.0.28",
|
|
174
|
+
"pkg:npm/@overkill-dev/output-renderer-github-actions@0.0.18",
|
|
175
|
+
"pkg:npm/@overkill-dev/reporter-brief@0.0.18",
|
|
176
|
+
"pkg:npm/@overkill-dev/reporter-dot@0.0.29",
|
|
177
|
+
"pkg:npm/@overkill-dev/reporter-line@0.0.29",
|
|
178
|
+
"pkg:npm/@overkill-dev/run@0.0.33",
|
|
179
179
|
"pkg:npm/cmd-ts@0.15.0"
|
|
180
180
|
]
|
|
181
181
|
},
|