@autometa/coordinator 0.3.33 → 1.0.0-rc.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 +1 -1
- package/dist/index.cjs +82 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +31 -48
- package/dist/index.js +67 -121
- package/dist/index.js.map +1 -1
- package/package.json +31 -29
- package/.eslintignore +0 -3
- package/.eslintrc.cjs +0 -4
- package/.turbo/turbo-coverage.log +0 -19
- package/.turbo/turbo-lint$colon$fix.log +0 -4
- package/.turbo/turbo-prettify.log +0 -0
- package/.turbo/turbo-test.log +0 -12
- package/CHANGELOG.md +0 -827
- package/dist/esm/index.js +0 -105
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.cts +0 -49
- package/tsup.config.ts +0 -14
package/README.md
CHANGED
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var errors = require('@autometa/errors');
|
|
6
|
+
var executor = require('@autometa/executor');
|
|
7
|
+
var scopes = require('@autometa/scopes');
|
|
8
|
+
var testBuilder = require('@autometa/test-builder');
|
|
9
|
+
|
|
10
|
+
// src/index.ts
|
|
11
|
+
function coordinateFeature(options) {
|
|
12
|
+
const { feature, scopePlan, config } = options;
|
|
13
|
+
assertFeature(feature);
|
|
14
|
+
assertScopePlan(scopePlan);
|
|
15
|
+
assertConfig(config);
|
|
16
|
+
const createAdapter = options.adapterFactory ?? defaultAdapterFactory;
|
|
17
|
+
const buildPlan = options.planBuilder ?? defaultPlanBuilder;
|
|
18
|
+
const register = options.registerPlan ?? defaultRegistrationHandler;
|
|
19
|
+
const adapter = createAdapter(scopePlan);
|
|
20
|
+
const planOptions = {
|
|
21
|
+
feature,
|
|
22
|
+
adapter,
|
|
23
|
+
...options.featureScope !== void 0 ? { featureScope: options.featureScope } : {}
|
|
24
|
+
};
|
|
25
|
+
const plan = buildPlan(planOptions);
|
|
26
|
+
return {
|
|
27
|
+
feature,
|
|
28
|
+
adapter,
|
|
29
|
+
plan,
|
|
30
|
+
config,
|
|
31
|
+
register(runtime) {
|
|
32
|
+
const executorRuntime = runtime ?? options.runtime;
|
|
33
|
+
if (!executorRuntime) {
|
|
34
|
+
throw new errors.AutomationError(
|
|
35
|
+
"An executor runtime is required to register the feature plan"
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
register({
|
|
39
|
+
plan,
|
|
40
|
+
adapter,
|
|
41
|
+
runtime: executorRuntime,
|
|
42
|
+
config,
|
|
43
|
+
...options.hookLogger ? { hookLogger: options.hookLogger } : {}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function defaultAdapterFactory(plan) {
|
|
49
|
+
return scopes.createExecutionAdapter(plan);
|
|
50
|
+
}
|
|
51
|
+
function defaultPlanBuilder(options) {
|
|
52
|
+
return testBuilder.buildTestPlan(options);
|
|
53
|
+
}
|
|
54
|
+
function defaultRegistrationHandler(options) {
|
|
55
|
+
executor.registerFeaturePlan(options);
|
|
56
|
+
}
|
|
57
|
+
function assertFeature(feature) {
|
|
58
|
+
if (!feature) {
|
|
59
|
+
throw new errors.AutomationError("A Gherkin feature is required to coordinate execution");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function assertScopePlan(plan) {
|
|
63
|
+
if (!plan) {
|
|
64
|
+
throw new errors.AutomationError("A scope plan is required to coordinate execution");
|
|
65
|
+
}
|
|
66
|
+
if (!plan.root || plan.root.children.length === 0) {
|
|
67
|
+
throw new errors.AutomationError("The provided scope plan does not contain any feature scopes");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function assertConfig(config) {
|
|
71
|
+
if (!config) {
|
|
72
|
+
throw new errors.AutomationError("An executor configuration is required to coordinate execution");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
var src_default = {
|
|
76
|
+
coordinateFeature
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
exports.coordinateFeature = coordinateFeature;
|
|
80
|
+
exports.default = src_default;
|
|
81
|
+
//# sourceMappingURL=out.js.map
|
|
82
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AACA,SAAS,uBAAuB;AAEhC,SAAS,2BAAiD;AAK1D,SAAS,8BAA8B;AAEvC,SAAS,qBAAqB;AA8BvB,SAAS,kBACf,SACiC;AACjC,QAAM,EAAE,SAAS,WAAW,OAAO,IAAI;AAEvC,gBAAc,OAAO;AACrB,kBAAgB,SAAS;AACzB,eAAa,MAAM;AAEnB,QAAM,gBAAgB,QAAQ,kBAAkB;AAChD,QAAM,YAAY,QAAQ,eAAe;AACzC,QAAM,WAAW,QAAQ,gBAAgB;AAEzC,QAAM,UAAU,cAAc,SAAS;AACvC,QAAM,cAA2C;AAAA,IAChD;AAAA,IACA;AAAA,IACA,GAAI,QAAQ,iBAAiB,SAC1B,EAAE,cAAc,QAAQ,aAAa,IACrC,CAAC;AAAA,EACL;AAEA,QAAM,OAAO,UAAU,WAAW;AAElC,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,SAAS;AACjB,YAAM,kBAAkB,WAAW,QAAQ;AAC3C,UAAI,CAAC,iBAAiB;AACrB,cAAM,IAAI;AAAA,UACT;AAAA,QACD;AAAA,MACD;AACA,eAAS;AAAA,QACR;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,GAAI,QAAQ,aAAa,EAAE,YAAY,QAAQ,WAAW,IAAI,CAAC;AAAA,MAChE,CAAC;AAAA,IACF;AAAA,EACD;AACD;AAEA,SAAS,sBAA6B,MAAsD;AAC3F,SAAO,uBAAuB,IAAI;AACnC;AAEA,SAAS,mBAA0B,SAAuD;AACzF,SAAO,cAAc,OAAO;AAC7B;AAEA,SAAS,2BAAkC,SAA6C;AACvF,sBAAoB,OAAO;AAC5B;AAEA,SAAS,cAAc,SAAsE;AAC5F,MAAI,CAAC,SAAS;AACb,UAAM,IAAI,gBAAgB,uDAAuD;AAAA,EAClF;AACD;AAEA,SAAS,gBAAuB,MAAsE;AACrG,MAAI,CAAC,MAAM;AACV,UAAM,IAAI,gBAAgB,kDAAkD;AAAA,EAC7E;AACA,MAAI,CAAC,KAAK,QAAQ,KAAK,KAAK,SAAS,WAAW,GAAG;AAClD,UAAM,IAAI,gBAAgB,6DAA6D;AAAA,EACxF;AACD;AAEA,SAAS,aAAa,QAAsE;AAC3F,MAAI,CAAC,QAAQ;AACZ,UAAM,IAAI,gBAAgB,+DAA+D;AAAA,EAC1F;AACD;AAEA,IAAO,cAAQ;AAAA,EACd;AACD","sourcesContent":["import type { ExecutorConfig } from \"@autometa/config\";\nimport { AutomationError } from \"@autometa/errors\";\nimport type { ExecuteFeatureOptions, ExecutorRuntime } from \"@autometa/executor\";\nimport { registerFeaturePlan, type HookLogListener } from \"@autometa/executor\";\nimport type {\n\tScopeExecutionAdapter,\n\tScopePlan,\n} from \"@autometa/scopes\";\nimport { createExecutionAdapter } from \"@autometa/scopes\";\nimport type { SimpleFeature } from \"@autometa/gherkin\";\nimport { buildTestPlan } from \"@autometa/test-builder\";\nimport type {\n\tBuildTestPlanOptions,\n\tTestPlan,\n} from \"@autometa/test-builder\";\n\ntype AdapterFactory<World> = (plan: ScopePlan<World>) => ScopeExecutionAdapter<World>;\ntype PlanBuilder<World> = (options: BuildTestPlanOptions<World>) => TestPlan<World>;\ntype RegistrationHandler<World> = (options: ExecuteFeatureOptions<World>) => void;\n\nexport interface CoordinateFeatureOptions<World> {\n\treadonly feature: SimpleFeature;\n\treadonly scopePlan: ScopePlan<World>;\n\treadonly config: ExecutorConfig;\n\treadonly runtime?: ExecutorRuntime;\n\treadonly planBuilder?: PlanBuilder<World>;\n\treadonly adapterFactory?: AdapterFactory<World>;\n\treadonly registerPlan?: RegistrationHandler<World>;\n\treadonly featureScope?: BuildTestPlanOptions<World>[\"featureScope\"];\n\treadonly hookLogger?: HookLogListener;\n}\n\nexport interface CoordinateFeatureResult<World> {\n\treadonly feature: SimpleFeature;\n\treadonly adapter: ScopeExecutionAdapter<World>;\n\treadonly plan: TestPlan<World>;\n\treadonly config: ExecutorConfig;\n\tregister(runtime?: ExecutorRuntime): void;\n}\n\nexport function coordinateFeature<World>(\n\toptions: CoordinateFeatureOptions<World>\n): CoordinateFeatureResult<World> {\n\tconst { feature, scopePlan, config } = options;\n\n\tassertFeature(feature);\n\tassertScopePlan(scopePlan);\n\tassertConfig(config);\n\n\tconst createAdapter = options.adapterFactory ?? defaultAdapterFactory;\n\tconst buildPlan = options.planBuilder ?? defaultPlanBuilder;\n\tconst register = options.registerPlan ?? defaultRegistrationHandler;\n\n\tconst adapter = createAdapter(scopePlan);\n\tconst planOptions: BuildTestPlanOptions<World> = {\n\t\tfeature,\n\t\tadapter,\n\t\t...(options.featureScope !== undefined\n\t\t\t? { featureScope: options.featureScope }\n\t\t\t: {}),\n\t};\n\n\tconst plan = buildPlan(planOptions);\n\n\treturn {\n\t\tfeature,\n\t\tadapter,\n\t\tplan,\n\t\tconfig,\n\t\tregister(runtime) {\n\t\t\tconst executorRuntime = runtime ?? options.runtime;\n\t\t\tif (!executorRuntime) {\n\t\t\t\tthrow new AutomationError(\n\t\t\t\t\t\"An executor runtime is required to register the feature plan\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tregister({\n\t\t\t\tplan,\n\t\t\t\tadapter,\n\t\t\t\truntime: executorRuntime,\n\t\t\t\tconfig,\n\t\t\t\t...(options.hookLogger ? { hookLogger: options.hookLogger } : {}),\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction defaultAdapterFactory<World>(plan: ScopePlan<World>): ScopeExecutionAdapter<World> {\n\treturn createExecutionAdapter(plan);\n}\n\nfunction defaultPlanBuilder<World>(options: BuildTestPlanOptions<World>): TestPlan<World> {\n\treturn buildTestPlan(options);\n}\n\nfunction defaultRegistrationHandler<World>(options: ExecuteFeatureOptions<World>): void {\n\tregisterFeaturePlan(options);\n}\n\nfunction assertFeature(feature: SimpleFeature | undefined): asserts feature is SimpleFeature {\n\tif (!feature) {\n\t\tthrow new AutomationError(\"A Gherkin feature is required to coordinate execution\");\n\t}\n}\n\nfunction assertScopePlan<World>(plan: ScopePlan<World> | undefined): asserts plan is ScopePlan<World> {\n\tif (!plan) {\n\t\tthrow new AutomationError(\"A scope plan is required to coordinate execution\");\n\t}\n\tif (!plan.root || plan.root.children.length === 0) {\n\t\tthrow new AutomationError(\"The provided scope plan does not contain any feature scopes\");\n\t}\n}\n\nfunction assertConfig(config: ExecutorConfig | undefined): asserts config is ExecutorConfig {\n\tif (!config) {\n\t\tthrow new AutomationError(\"An executor configuration is required to coordinate execution\");\n\t}\n}\n\nexport default {\n\tcoordinateFeature,\n};"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,49 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
roots: {
|
|
28
|
-
features: string[];
|
|
29
|
-
steps: string[];
|
|
30
|
-
app: string[];
|
|
31
|
-
parameterTypes?: string[] | undefined;
|
|
32
|
-
};
|
|
33
|
-
environment?: string | undefined;
|
|
34
|
-
test?: {
|
|
35
|
-
timeout?: number | [number, "ms" | "s" | "m" | "h"] | undefined;
|
|
36
|
-
tagFilter?: string | undefined;
|
|
37
|
-
groupLogging?: boolean | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
shim?: {
|
|
40
|
-
errorCause?: boolean | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
events?: string[] | undefined;
|
|
43
|
-
};
|
|
44
|
-
fileSystem(caller: string): Files;
|
|
45
|
-
loadSteps(): void;
|
|
46
|
-
loadParameterTypes(): void;
|
|
1
|
+
import type { ExecutorConfig } from "@autometa/config";
|
|
2
|
+
import type { ExecuteFeatureOptions, ExecutorRuntime } from "@autometa/executor";
|
|
3
|
+
import { type HookLogListener } from "@autometa/executor";
|
|
4
|
+
import type { ScopeExecutionAdapter, ScopePlan } from "@autometa/scopes";
|
|
5
|
+
import type { SimpleFeature } from "@autometa/gherkin";
|
|
6
|
+
import type { BuildTestPlanOptions, TestPlan } from "@autometa/test-builder";
|
|
7
|
+
type AdapterFactory<World> = (plan: ScopePlan<World>) => ScopeExecutionAdapter<World>;
|
|
8
|
+
type PlanBuilder<World> = (options: BuildTestPlanOptions<World>) => TestPlan<World>;
|
|
9
|
+
type RegistrationHandler<World> = (options: ExecuteFeatureOptions<World>) => void;
|
|
10
|
+
export interface CoordinateFeatureOptions<World> {
|
|
11
|
+
readonly feature: SimpleFeature;
|
|
12
|
+
readonly scopePlan: ScopePlan<World>;
|
|
13
|
+
readonly config: ExecutorConfig;
|
|
14
|
+
readonly runtime?: ExecutorRuntime;
|
|
15
|
+
readonly planBuilder?: PlanBuilder<World>;
|
|
16
|
+
readonly adapterFactory?: AdapterFactory<World>;
|
|
17
|
+
readonly registerPlan?: RegistrationHandler<World>;
|
|
18
|
+
readonly featureScope?: BuildTestPlanOptions<World>["featureScope"];
|
|
19
|
+
readonly hookLogger?: HookLogListener;
|
|
20
|
+
}
|
|
21
|
+
export interface CoordinateFeatureResult<World> {
|
|
22
|
+
readonly feature: SimpleFeature;
|
|
23
|
+
readonly adapter: ScopeExecutionAdapter<World>;
|
|
24
|
+
readonly plan: TestPlan<World>;
|
|
25
|
+
readonly config: ExecutorConfig;
|
|
26
|
+
register(runtime?: ExecutorRuntime): void;
|
|
47
27
|
}
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
export declare function coordinateFeature<World>(options: CoordinateFeatureOptions<World>): CoordinateFeatureResult<World>;
|
|
29
|
+
declare const _default: {
|
|
30
|
+
coordinateFeature: typeof coordinateFeature;
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1,131 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __accessCheck = (obj, member, msg) => {
|
|
20
|
-
if (!member.has(obj))
|
|
21
|
-
throw TypeError("Cannot " + msg);
|
|
22
|
-
};
|
|
23
|
-
var __privateGet = (obj, member, getter) => {
|
|
24
|
-
__accessCheck(obj, member, "read from private field");
|
|
25
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
26
|
-
};
|
|
27
|
-
var __privateAdd = (obj, member, value) => {
|
|
28
|
-
if (member.has(obj))
|
|
29
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
30
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
31
|
-
};
|
|
32
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
33
|
-
__accessCheck(obj, member, "write to private field");
|
|
34
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
35
|
-
return value;
|
|
36
|
-
};
|
|
1
|
+
import { AutomationError } from '@autometa/errors';
|
|
2
|
+
import { registerFeaturePlan } from '@autometa/executor';
|
|
3
|
+
import { createExecutionAdapter } from '@autometa/scopes';
|
|
4
|
+
import { buildTestPlan } from '@autometa/test-builder';
|
|
37
5
|
|
|
38
6
|
// src/index.ts
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
path.loadApps();
|
|
66
|
-
const gherkin = path.getFeatureFile();
|
|
67
|
-
if (!Array.isArray(gherkin)) {
|
|
68
|
-
this.start(gherkin, feature, events, executor);
|
|
69
|
-
} else {
|
|
70
|
-
for (const featGherkin of gherkin) {
|
|
71
|
-
this.start(featGherkin, feature, events, executor);
|
|
7
|
+
function coordinateFeature(options) {
|
|
8
|
+
const { feature, scopePlan, config } = options;
|
|
9
|
+
assertFeature(feature);
|
|
10
|
+
assertScopePlan(scopePlan);
|
|
11
|
+
assertConfig(config);
|
|
12
|
+
const createAdapter = options.adapterFactory ?? defaultAdapterFactory;
|
|
13
|
+
const buildPlan = options.planBuilder ?? defaultPlanBuilder;
|
|
14
|
+
const register = options.registerPlan ?? defaultRegistrationHandler;
|
|
15
|
+
const adapter = createAdapter(scopePlan);
|
|
16
|
+
const planOptions = {
|
|
17
|
+
feature,
|
|
18
|
+
adapter,
|
|
19
|
+
...options.featureScope !== void 0 ? { featureScope: options.featureScope } : {}
|
|
20
|
+
};
|
|
21
|
+
const plan = buildPlan(planOptions);
|
|
22
|
+
return {
|
|
23
|
+
feature,
|
|
24
|
+
adapter,
|
|
25
|
+
plan,
|
|
26
|
+
config,
|
|
27
|
+
register(runtime) {
|
|
28
|
+
const executorRuntime = runtime ?? options.runtime;
|
|
29
|
+
if (!executorRuntime) {
|
|
30
|
+
throw new AutomationError(
|
|
31
|
+
"An executor runtime is required to register the feature plan"
|
|
32
|
+
);
|
|
72
33
|
}
|
|
34
|
+
register({
|
|
35
|
+
plan,
|
|
36
|
+
adapter,
|
|
37
|
+
runtime: executorRuntime,
|
|
38
|
+
config,
|
|
39
|
+
...options.hookLogger ? { hookLogger: options.hookLogger } : {}
|
|
40
|
+
});
|
|
73
41
|
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function defaultAdapterFactory(plan) {
|
|
45
|
+
return createExecutionAdapter(plan);
|
|
46
|
+
}
|
|
47
|
+
function defaultPlanBuilder(options) {
|
|
48
|
+
return buildTestPlan(options);
|
|
49
|
+
}
|
|
50
|
+
function defaultRegistrationHandler(options) {
|
|
51
|
+
registerFeaturePlan(options);
|
|
52
|
+
}
|
|
53
|
+
function assertFeature(feature) {
|
|
54
|
+
if (!feature) {
|
|
55
|
+
throw new AutomationError("A Gherkin feature is required to coordinate execution");
|
|
74
56
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
this.global.lock();
|
|
80
|
-
__privateSet(this, _builder, new import_test_builder.TestBuilder(gherkin));
|
|
81
|
-
__privateSet(this, _bridge, __privateGet(this, _builder).onFeatureExecuted(feature));
|
|
82
|
-
const { app, world } = this.opts[this.config.environment ?? "default"];
|
|
83
|
-
executor({ app, world }, this.global, __privateGet(this, _bridge), events, this.configs);
|
|
57
|
+
}
|
|
58
|
+
function assertScopePlan(plan) {
|
|
59
|
+
if (!plan) {
|
|
60
|
+
throw new AutomationError("A scope plan is required to coordinate execution");
|
|
84
61
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
throw new import_errors.AutomationError("File System not initialized");
|
|
88
|
-
}
|
|
89
|
-
return __privateGet(this, _fs);
|
|
62
|
+
if (!plan.root || plan.root.children.length === 0) {
|
|
63
|
+
throw new AutomationError("The provided scope plan does not contain any feature scopes");
|
|
90
64
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const { roots } = this.config;
|
|
96
|
-
const { steps, features, app, parameterTypes } = roots;
|
|
97
|
-
__privateSet(this, _fs, new import_scopes.Files().withFeatureRoot(features).withCallerFile(caller).withStepsRoot(steps).withParameterTypes(parameterTypes).withAppRoot(app));
|
|
98
|
-
return this.fs;
|
|
99
|
-
}
|
|
100
|
-
loadSteps() {
|
|
101
|
-
const { steps } = this.config.roots;
|
|
102
|
-
if (typeof steps === "string") {
|
|
103
|
-
this.fs.fromUrlPattern(steps).loadStepDefinitions();
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
for (const stepRoot of steps) {
|
|
107
|
-
this.fs.fromUrlPattern(stepRoot).loadStepDefinitions();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
loadParameterTypes() {
|
|
111
|
-
const { parameterTypes } = this.config.roots;
|
|
112
|
-
if (parameterTypes === void 0) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (typeof parameterTypes === "string") {
|
|
116
|
-
this.fs.fromUrlPattern(parameterTypes).loadParameterTypes();
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
for (const paramTypeRoot of parameterTypes) {
|
|
120
|
-
this.fs.fromUrlPattern(paramTypeRoot).loadParameterTypes();
|
|
121
|
-
}
|
|
65
|
+
}
|
|
66
|
+
function assertConfig(config) {
|
|
67
|
+
if (!config) {
|
|
68
|
+
throw new AutomationError("An executor configuration is required to coordinate execution");
|
|
122
69
|
}
|
|
70
|
+
}
|
|
71
|
+
var src_default = {
|
|
72
|
+
coordinateFeature
|
|
123
73
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
-
0 && (module.exports = {
|
|
129
|
-
Coordinator
|
|
130
|
-
});
|
|
74
|
+
|
|
75
|
+
export { coordinateFeature, src_default as default };
|
|
76
|
+
//# sourceMappingURL=out.js.map
|
|
131
77
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AACA,SAAS,uBAAuB;AAEhC,SAAS,2BAAiD;AAK1D,SAAS,8BAA8B;AAEvC,SAAS,qBAAqB;AA8BvB,SAAS,kBACf,SACiC;AACjC,QAAM,EAAE,SAAS,WAAW,OAAO,IAAI;AAEvC,gBAAc,OAAO;AACrB,kBAAgB,SAAS;AACzB,eAAa,MAAM;AAEnB,QAAM,gBAAgB,QAAQ,kBAAkB;AAChD,QAAM,YAAY,QAAQ,eAAe;AACzC,QAAM,WAAW,QAAQ,gBAAgB;AAEzC,QAAM,UAAU,cAAc,SAAS;AACvC,QAAM,cAA2C;AAAA,IAChD;AAAA,IACA;AAAA,IACA,GAAI,QAAQ,iBAAiB,SAC1B,EAAE,cAAc,QAAQ,aAAa,IACrC,CAAC;AAAA,EACL;AAEA,QAAM,OAAO,UAAU,WAAW;AAElC,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS,SAAS;AACjB,YAAM,kBAAkB,WAAW,QAAQ;AAC3C,UAAI,CAAC,iBAAiB;AACrB,cAAM,IAAI;AAAA,UACT;AAAA,QACD;AAAA,MACD;AACA,eAAS;AAAA,QACR;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA,GAAI,QAAQ,aAAa,EAAE,YAAY,QAAQ,WAAW,IAAI,CAAC;AAAA,MAChE,CAAC;AAAA,IACF;AAAA,EACD;AACD;AAEA,SAAS,sBAA6B,MAAsD;AAC3F,SAAO,uBAAuB,IAAI;AACnC;AAEA,SAAS,mBAA0B,SAAuD;AACzF,SAAO,cAAc,OAAO;AAC7B;AAEA,SAAS,2BAAkC,SAA6C;AACvF,sBAAoB,OAAO;AAC5B;AAEA,SAAS,cAAc,SAAsE;AAC5F,MAAI,CAAC,SAAS;AACb,UAAM,IAAI,gBAAgB,uDAAuD;AAAA,EAClF;AACD;AAEA,SAAS,gBAAuB,MAAsE;AACrG,MAAI,CAAC,MAAM;AACV,UAAM,IAAI,gBAAgB,kDAAkD;AAAA,EAC7E;AACA,MAAI,CAAC,KAAK,QAAQ,KAAK,KAAK,SAAS,WAAW,GAAG;AAClD,UAAM,IAAI,gBAAgB,6DAA6D;AAAA,EACxF;AACD;AAEA,SAAS,aAAa,QAAsE;AAC3F,MAAI,CAAC,QAAQ;AACZ,UAAM,IAAI,gBAAgB,+DAA+D;AAAA,EAC1F;AACD;AAEA,IAAO,cAAQ;AAAA,EACd;AACD","sourcesContent":["import type { ExecutorConfig } from \"@autometa/config\";\nimport { AutomationError } from \"@autometa/errors\";\nimport type { ExecuteFeatureOptions, ExecutorRuntime } from \"@autometa/executor\";\nimport { registerFeaturePlan, type HookLogListener } from \"@autometa/executor\";\nimport type {\n\tScopeExecutionAdapter,\n\tScopePlan,\n} from \"@autometa/scopes\";\nimport { createExecutionAdapter } from \"@autometa/scopes\";\nimport type { SimpleFeature } from \"@autometa/gherkin\";\nimport { buildTestPlan } from \"@autometa/test-builder\";\nimport type {\n\tBuildTestPlanOptions,\n\tTestPlan,\n} from \"@autometa/test-builder\";\n\ntype AdapterFactory<World> = (plan: ScopePlan<World>) => ScopeExecutionAdapter<World>;\ntype PlanBuilder<World> = (options: BuildTestPlanOptions<World>) => TestPlan<World>;\ntype RegistrationHandler<World> = (options: ExecuteFeatureOptions<World>) => void;\n\nexport interface CoordinateFeatureOptions<World> {\n\treadonly feature: SimpleFeature;\n\treadonly scopePlan: ScopePlan<World>;\n\treadonly config: ExecutorConfig;\n\treadonly runtime?: ExecutorRuntime;\n\treadonly planBuilder?: PlanBuilder<World>;\n\treadonly adapterFactory?: AdapterFactory<World>;\n\treadonly registerPlan?: RegistrationHandler<World>;\n\treadonly featureScope?: BuildTestPlanOptions<World>[\"featureScope\"];\n\treadonly hookLogger?: HookLogListener;\n}\n\nexport interface CoordinateFeatureResult<World> {\n\treadonly feature: SimpleFeature;\n\treadonly adapter: ScopeExecutionAdapter<World>;\n\treadonly plan: TestPlan<World>;\n\treadonly config: ExecutorConfig;\n\tregister(runtime?: ExecutorRuntime): void;\n}\n\nexport function coordinateFeature<World>(\n\toptions: CoordinateFeatureOptions<World>\n): CoordinateFeatureResult<World> {\n\tconst { feature, scopePlan, config } = options;\n\n\tassertFeature(feature);\n\tassertScopePlan(scopePlan);\n\tassertConfig(config);\n\n\tconst createAdapter = options.adapterFactory ?? defaultAdapterFactory;\n\tconst buildPlan = options.planBuilder ?? defaultPlanBuilder;\n\tconst register = options.registerPlan ?? defaultRegistrationHandler;\n\n\tconst adapter = createAdapter(scopePlan);\n\tconst planOptions: BuildTestPlanOptions<World> = {\n\t\tfeature,\n\t\tadapter,\n\t\t...(options.featureScope !== undefined\n\t\t\t? { featureScope: options.featureScope }\n\t\t\t: {}),\n\t};\n\n\tconst plan = buildPlan(planOptions);\n\n\treturn {\n\t\tfeature,\n\t\tadapter,\n\t\tplan,\n\t\tconfig,\n\t\tregister(runtime) {\n\t\t\tconst executorRuntime = runtime ?? options.runtime;\n\t\t\tif (!executorRuntime) {\n\t\t\t\tthrow new AutomationError(\n\t\t\t\t\t\"An executor runtime is required to register the feature plan\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tregister({\n\t\t\t\tplan,\n\t\t\t\tadapter,\n\t\t\t\truntime: executorRuntime,\n\t\t\t\tconfig,\n\t\t\t\t...(options.hookLogger ? { hookLogger: options.hookLogger } : {}),\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction defaultAdapterFactory<World>(plan: ScopePlan<World>): ScopeExecutionAdapter<World> {\n\treturn createExecutionAdapter(plan);\n}\n\nfunction defaultPlanBuilder<World>(options: BuildTestPlanOptions<World>): TestPlan<World> {\n\treturn buildTestPlan(options);\n}\n\nfunction defaultRegistrationHandler<World>(options: ExecuteFeatureOptions<World>): void {\n\tregisterFeaturePlan(options);\n}\n\nfunction assertFeature(feature: SimpleFeature | undefined): asserts feature is SimpleFeature {\n\tif (!feature) {\n\t\tthrow new AutomationError(\"A Gherkin feature is required to coordinate execution\");\n\t}\n}\n\nfunction assertScopePlan<World>(plan: ScopePlan<World> | undefined): asserts plan is ScopePlan<World> {\n\tif (!plan) {\n\t\tthrow new AutomationError(\"A scope plan is required to coordinate execution\");\n\t}\n\tif (!plan.root || plan.root.children.length === 0) {\n\t\tthrow new AutomationError(\"The provided scope plan does not contain any feature scopes\");\n\t}\n}\n\nfunction assertConfig(config: ExecutorConfig | undefined): asserts config is ExecutorConfig {\n\tif (!config) {\n\t\tthrow new AutomationError(\"An executor configuration is required to coordinate execution\");\n\t}\n}\n\nexport default {\n\tcoordinateFeature,\n};"]}
|
package/package.json
CHANGED
|
@@ -1,56 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autometa/coordinator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.
|
|
7
|
-
"module": "dist/
|
|
6
|
+
"main": "dist/index.cjs",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
9
12
|
"exports": {
|
|
10
|
-
"import": "./dist/
|
|
11
|
-
"require": "./dist/index.
|
|
12
|
-
"default": "./dist/
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"default": "./dist/index.js",
|
|
13
16
|
"types": "./dist/index.d.ts"
|
|
14
17
|
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@autometa/config": "1.0.0-rc.0",
|
|
20
|
+
"@autometa/errors": "1.0.0-rc.0",
|
|
21
|
+
"@autometa/gherkin": "1.0.0-rc.0",
|
|
22
|
+
"@autometa/scopes": "1.0.0-rc.0",
|
|
23
|
+
"@autometa/executor": "1.0.0-rc.0",
|
|
24
|
+
"@autometa/test-builder": "1.0.0-rc.0"
|
|
25
|
+
},
|
|
15
26
|
"license": "MIT",
|
|
16
27
|
"devDependencies": {
|
|
17
28
|
"@types/node": "^18.11.18",
|
|
18
|
-
"@types/uuid": "^9.0.5",
|
|
19
29
|
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
20
30
|
"@typescript-eslint/parser": "^5.54.1",
|
|
21
|
-
"@vitest/coverage-istanbul": "^1.4.0",
|
|
22
|
-
"@vitest/coverage-v8": "^1.4.0",
|
|
23
31
|
"eslint": "^8.37.0",
|
|
24
32
|
"eslint-config-prettier": "^8.3.0",
|
|
25
|
-
"istanbul": "^0.4.5",
|
|
26
33
|
"rimraf": "^4.1.2",
|
|
27
34
|
"tsup": "^7.2.0",
|
|
28
35
|
"typescript": "^4.9.5",
|
|
36
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
29
37
|
"vitest": "1.4.0",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"tsyringe": "^4.8.0",
|
|
35
|
-
"@autometa/app": "^0.4.2",
|
|
36
|
-
"@autometa/asserters": "^0.1.8",
|
|
37
|
-
"@autometa/config": "^0.1.27",
|
|
38
|
-
"@autometa/errors": "^0.2.2",
|
|
39
|
-
"@autometa/events": "^0.3.2",
|
|
40
|
-
"@autometa/gherkin": "^0.7.2",
|
|
41
|
-
"@autometa/scopes": "^0.7.2",
|
|
42
|
-
"@autometa/test-builder": "^0.4.2",
|
|
43
|
-
"@autometa/types": "^0.4.1",
|
|
44
|
-
"@autometa/jest-executor": "^0.6.4"
|
|
38
|
+
"eslint-config-custom": "0.6.0",
|
|
39
|
+
"tsup-config": "0.1.0",
|
|
40
|
+
"tsconfig": "0.7.0"
|
|
45
41
|
},
|
|
46
42
|
"scripts": {
|
|
43
|
+
"type-check": "tsc --noEmit -p tsconfig.dev.json",
|
|
44
|
+
"type-check:watch": "tsc --noEmit --watch -p tsconfig.dev.json",
|
|
45
|
+
"build": "tsup && pnpm run build:types",
|
|
46
|
+
"build:types": "rimraf tsconfig.types.tsbuildinfo && tsc --build tsconfig.types.json",
|
|
47
|
+
"build:watch": "tsup --watch",
|
|
48
|
+
"dev": "tsup --watch",
|
|
47
49
|
"test": "vitest run --passWithNoTests",
|
|
50
|
+
"test:watch": "vitest --passWithNoTests",
|
|
51
|
+
"test:ui": "vitest --ui --passWithNoTests",
|
|
48
52
|
"coverage": "vitest run --coverage --passWithNoTests",
|
|
49
|
-
"prettify": "prettier --config .prettierrc 'src/**/*.ts' --write",
|
|
50
53
|
"lint": "eslint . --max-warnings 0",
|
|
51
54
|
"lint:fix": "eslint . --fix",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"build:watch": "tsup --watch"
|
|
55
|
+
"prettify": "prettier --config .prettierrc 'src/**/*.ts' --write",
|
|
56
|
+
"clean": "rimraf dist"
|
|
55
57
|
}
|
|
56
58
|
}
|
package/.eslintignore
DELETED
package/.eslintrc.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @autometa/coordinator@0.1.1 coverage /Users/ben.aherne/Documents/GitHub/autometa/packages/coordinator
|
|
3
|
-
> vitest run --coverage --passWithNoTests
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
RUN v0.29.8 /Users/ben.aherne/Documents/GitHub/autometa/packages/coordinator
|
|
7
|
-
Coverage enabled with istanbul
|
|
8
|
-
|
|
9
|
-
% Coverage report from istanbul
|
|
10
|
-
----------|---------|----------|---------|---------|-------------------
|
|
11
|
-
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
12
|
-
----------|---------|----------|---------|---------|-------------------
|
|
13
|
-
All files | 0 | 0 | 0 | 0 |
|
|
14
|
-
----------|---------|----------|---------|---------|-------------------
|
|
15
|
-
No test files found, exiting with code 0
|
|
16
|
-
|
|
17
|
-
include: **/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}
|
|
18
|
-
exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*
|
|
19
|
-
watch exclude: **/node_modules/**, **/dist/**
|
|
File without changes
|
package/.turbo/turbo-test.log
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @autometa/coordinator@0.3.28 test /Users/ben.aherne/Documents/GitHub/autometa/packages/coordinator
|
|
3
|
-
> vitest run --passWithNoTests
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
RUN v1.4.0 /Users/ben.aherne/Documents/GitHub/autometa/packages/coordinator
|
|
7
|
-
|
|
8
|
-
No test files found, exiting with code 0
|
|
9
|
-
include: **/*.{test,spec}.?(c|m)[jt]s?(x)
|
|
10
|
-
exclude: **/node_modules/**, **/dist/**, **/cypress/**, **/.{idea,git,cache,output,temp}/**, **/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*
|
|
11
|
-
|
|
12
|
-
watch exclude: **/node_modules/**, **/dist/**
|