@autometa/coordinator 0.0.0 → 0.1.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/CHANGELOG.md +21 -0
- package/dist/esm/index.js +89 -3
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.cts +50 -0
- package/dist/index.d.ts +49 -2
- package/dist/index.js +93 -2
- package/dist/index.js.map +1 -0
- package/package.json +15 -13
- package/tsup.config.ts +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @autometa/coordinator
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 554b77e: Releasing packages
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [554b77e]
|
|
12
|
+
- @autometa/app@0.1.0
|
|
13
|
+
- @autometa/asserters@0.1.0
|
|
14
|
+
- @autometa/config@0.1.0
|
|
15
|
+
- @autometa/errors@0.1.0
|
|
16
|
+
- @autometa/events@0.1.0
|
|
17
|
+
- @autometa/gherkin@0.4.0
|
|
18
|
+
- @autometa/jest-executor@0.1.0
|
|
19
|
+
- @autometa/scopes@0.2.0
|
|
20
|
+
- @autometa/test-builder@0.1.0
|
|
21
|
+
- @autometa/types@0.4.0
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __accessCheck = (obj, member, msg) => {
|
|
2
|
+
if (!member.has(obj))
|
|
3
|
+
throw TypeError("Cannot " + msg);
|
|
4
|
+
};
|
|
5
|
+
var __privateGet = (obj, member, getter) => {
|
|
6
|
+
__accessCheck(obj, member, "read from private field");
|
|
7
|
+
return getter ? getter.call(obj) : member.get(obj);
|
|
8
|
+
};
|
|
9
|
+
var __privateAdd = (obj, member, value) => {
|
|
10
|
+
if (member.has(obj))
|
|
11
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
12
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
13
|
+
};
|
|
14
|
+
var __privateSet = (obj, member, value, setter) => {
|
|
15
|
+
__accessCheck(obj, member, "write to private field");
|
|
16
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
17
|
+
return value;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// src/coordinator.ts
|
|
21
|
+
import { TestBuilder } from "@autometa/test-builder";
|
|
22
|
+
import { Files } from "@autometa/scopes";
|
|
23
|
+
import { AutomationError } from "@autometa/errors";
|
|
24
|
+
import { AssertDefined } from "@autometa/asserters";
|
|
25
|
+
var _fs, _builder, _bridge;
|
|
26
|
+
var Coordinator = class {
|
|
27
|
+
constructor(global, configs, opts) {
|
|
28
|
+
this.global = global;
|
|
29
|
+
this.configs = configs;
|
|
30
|
+
this.opts = opts;
|
|
31
|
+
__privateAdd(this, _fs, void 0);
|
|
32
|
+
__privateAdd(this, _builder, void 0);
|
|
33
|
+
__privateAdd(this, _bridge, void 0);
|
|
34
|
+
AssertDefined(configs, "Config");
|
|
35
|
+
}
|
|
36
|
+
run(feature, caller, events, executor) {
|
|
37
|
+
AssertDefined(executor, "Executor");
|
|
38
|
+
const fs = this.fileSystem(caller);
|
|
39
|
+
const path = fs.fromUrlPattern(feature.path);
|
|
40
|
+
path.loadApps();
|
|
41
|
+
const gherkin = path.getFeatureFile();
|
|
42
|
+
if (!Array.isArray(gherkin)) {
|
|
43
|
+
this.start(gherkin, feature, events, executor);
|
|
44
|
+
} else {
|
|
45
|
+
for (const featGherkin of gherkin) {
|
|
46
|
+
this.start(featGherkin, feature, events, executor);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
start(gherkin, feature, events, executor) {
|
|
51
|
+
this.global.unlock();
|
|
52
|
+
this.loadSteps();
|
|
53
|
+
this.global.lock();
|
|
54
|
+
__privateSet(this, _builder, new TestBuilder(gherkin));
|
|
55
|
+
__privateSet(this, _bridge, __privateGet(this, _builder).onFeatureExecuted(feature));
|
|
56
|
+
const { app, world } = this.opts[this.config.environment ?? "default"];
|
|
57
|
+
executor({ app, world }, __privateGet(this, _bridge), events, this.configs);
|
|
58
|
+
}
|
|
59
|
+
get fs() {
|
|
60
|
+
if (!__privateGet(this, _fs)) {
|
|
61
|
+
throw new AutomationError("File System not initialized");
|
|
62
|
+
}
|
|
63
|
+
return __privateGet(this, _fs);
|
|
64
|
+
}
|
|
65
|
+
get config() {
|
|
66
|
+
return this.configs.current;
|
|
67
|
+
}
|
|
68
|
+
fileSystem(caller) {
|
|
69
|
+
const { roots } = this.config;
|
|
70
|
+
const { steps, features, app } = roots;
|
|
71
|
+
__privateSet(this, _fs, new Files().withFeatureRoot(features).withCallerFile(caller).withStepsRoot(steps).withAppRoot(app));
|
|
72
|
+
return this.fs;
|
|
73
|
+
}
|
|
74
|
+
loadSteps() {
|
|
75
|
+
const { steps } = this.config.roots;
|
|
76
|
+
if (typeof steps === "string") {
|
|
77
|
+
this.fs.fromUrlPattern(steps).loadStepDefinitions();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
for (const stepRoot of steps) {
|
|
81
|
+
this.fs.fromUrlPattern(stepRoot).loadStepDefinitions();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
_fs = new WeakMap();
|
|
86
|
+
_builder = new WeakMap();
|
|
87
|
+
_bridge = new WeakMap();
|
|
3
88
|
export {
|
|
4
|
-
|
|
89
|
+
Coordinator
|
|
5
90
|
};
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/coordinator.ts"],"sourcesContent":["import { Config } from \"@autometa/config\";\nimport { FeatureBridge, TestBuilder } from \"@autometa/test-builder\";\nimport { AutometaApp, AutometaWorld } from \"@autometa/app\";\nimport { TestEventEmitter } from \"@autometa/events\";\nimport { Class } from \"@autometa/types\";\nimport { FeatureScope, Files, GlobalScope } from \"@autometa/scopes\";\nimport { AutomationError } from \"@autometa/errors\";\nimport { AssertDefined } from \"@autometa/asserters\";\nimport { CoordinatorOpts } from \"./types\";\nimport { Feature } from \"@autometa/gherkin\";\nexport class Coordinator {\n #fs: Files;\n #builder: TestBuilder;\n #bridge: FeatureBridge;\n constructor(\n readonly global: GlobalScope,\n readonly configs: Config,\n readonly opts: Record<string, CoordinatorOpts>\n ) {\n AssertDefined(configs, \"Config\");\n }\n\n run(\n feature: FeatureScope,\n caller: string,\n events: TestEventEmitter,\n executor: (\n { app, world }: { app: Class<AutometaApp>; world: Class<AutometaWorld> },\n bridge: FeatureBridge,\n events: TestEventEmitter,\n config: Config\n ) => void\n ) {\n AssertDefined(executor, \"Executor\");\n\n const fs = this.fileSystem(caller);\n const path = fs.fromUrlPattern(feature.path);\n path.loadApps();\n\n const gherkin = path.getFeatureFile();\n if (!Array.isArray(gherkin)) {\n this.start(gherkin, feature, events, executor);\n } else {\n for (const featGherkin of gherkin) {\n this.start(featGherkin, feature, events, executor);\n }\n }\n }\n\n private start(\n gherkin: Feature,\n feature: FeatureScope,\n events: TestEventEmitter,\n executor: (\n { app, world }: { app: Class<AutometaApp>; world: Class<AutometaWorld> },\n bridge: FeatureBridge,\n events: TestEventEmitter,\n config: Config\n ) => void\n ) {\n this.global.unlock();\n this.loadSteps();\n this.global.lock();\n this.#builder = new TestBuilder(gherkin);\n this.#bridge = this.#builder.onFeatureExecuted(feature);\n const { app, world } = this.opts[this.config.environment ?? \"default\"];\n executor({ app, world }, this.#bridge, events, this.configs);\n }\n\n get fs() {\n if (!this.#fs) {\n throw new AutomationError(\"File System not initialized\");\n }\n return this.#fs;\n }\n\n get config() {\n return this.configs.current;\n }\n\n fileSystem(caller: string) {\n const { roots } = this.config;\n const { steps, features, app } = roots;\n\n this.#fs = new Files()\n .withFeatureRoot(features)\n .withCallerFile(caller)\n .withStepsRoot(steps)\n .withAppRoot(app);\n return this.fs;\n }\n\n loadSteps() {\n const { steps } = this.config.roots;\n if (typeof steps === \"string\") {\n this.fs.fromUrlPattern(steps).loadStepDefinitions();\n return;\n }\n for (const stepRoot of steps) {\n this.fs.fromUrlPattern(stepRoot).loadStepDefinitions();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,SAAwB,mBAAmB;AAI3C,SAAuB,aAA0B;AACjD,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAP9B;AAUO,IAAM,cAAN,MAAkB;AAAA,EAIvB,YACW,QACA,SACA,MACT;AAHS;AACA;AACA;AANX;AACA;AACA;AAME,kBAAc,SAAS,QAAQ;AAAA,EACjC;AAAA,EAEA,IACE,SACA,QACA,QACA,UAMA;AACA,kBAAc,UAAU,UAAU;AAElC,UAAM,KAAK,KAAK,WAAW,MAAM;AACjC,UAAM,OAAO,GAAG,eAAe,QAAQ,IAAI;AAC3C,SAAK,SAAS;AAEd,UAAM,UAAU,KAAK,eAAe;AACpC,QAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAK,MAAM,SAAS,SAAS,QAAQ,QAAQ;AAAA,IAC/C,OAAO;AACL,iBAAW,eAAe,SAAS;AACjC,aAAK,MAAM,aAAa,SAAS,QAAQ,QAAQ;AAAA,MACnD;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,MACN,SACA,SACA,QACA,UAMA;AACA,SAAK,OAAO,OAAO;AACnB,SAAK,UAAU;AACf,SAAK,OAAO,KAAK;AACjB,uBAAK,UAAW,IAAI,YAAY,OAAO;AACvC,uBAAK,SAAU,mBAAK,UAAS,kBAAkB,OAAO;AACtD,UAAM,EAAE,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,OAAO,eAAe,SAAS;AACrE,aAAS,EAAE,KAAK,MAAM,GAAG,mBAAK,UAAS,QAAQ,KAAK,OAAO;AAAA,EAC7D;AAAA,EAEA,IAAI,KAAK;AACP,QAAI,CAAC,mBAAK,MAAK;AACb,YAAM,IAAI,gBAAgB,6BAA6B;AAAA,IACzD;AACA,WAAO,mBAAK;AAAA,EACd;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,WAAW,QAAgB;AACzB,UAAM,EAAE,MAAM,IAAI,KAAK;AACvB,UAAM,EAAE,OAAO,UAAU,IAAI,IAAI;AAEjC,uBAAK,KAAM,IAAI,MAAM,EAClB,gBAAgB,QAAQ,EACxB,eAAe,MAAM,EACrB,cAAc,KAAK,EACnB,YAAY,GAAG;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY;AACV,UAAM,EAAE,MAAM,IAAI,KAAK,OAAO;AAC9B,QAAI,OAAO,UAAU,UAAU;AAC7B,WAAK,GAAG,eAAe,KAAK,EAAE,oBAAoB;AAClD;AAAA,IACF;AACA,eAAW,YAAY,OAAO;AAC5B,WAAK,GAAG,eAAe,QAAQ,EAAE,oBAAoB;AAAA,IACvD;AAAA,EACF;AACF;AA3FE;AACA;AACA;","names":[]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Config } from '@autometa/config';
|
|
2
|
+
import { FeatureBridge } from '@autometa/test-builder';
|
|
3
|
+
import { AutometaApp, AutometaWorld } from '@autometa/app';
|
|
4
|
+
import { TestEventEmitter } from '@autometa/events';
|
|
5
|
+
import { Class } from '@autometa/types';
|
|
6
|
+
import { GlobalScope, FeatureScope, Files } from '@autometa/scopes';
|
|
7
|
+
import { DependencyContainer } from 'tsyringe';
|
|
8
|
+
|
|
9
|
+
type CoordinatorOpts = {
|
|
10
|
+
app: Class<AutometaApp>;
|
|
11
|
+
world: Class<AutometaWorld>;
|
|
12
|
+
container: DependencyContainer;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
declare class Coordinator {
|
|
16
|
+
#private;
|
|
17
|
+
readonly global: GlobalScope;
|
|
18
|
+
readonly configs: Config;
|
|
19
|
+
readonly opts: Record<string, CoordinatorOpts>;
|
|
20
|
+
constructor(global: GlobalScope, configs: Config, opts: Record<string, CoordinatorOpts>);
|
|
21
|
+
run(feature: FeatureScope, caller: string, events: TestEventEmitter, executor: ({ app, world }: {
|
|
22
|
+
app: Class<AutometaApp>;
|
|
23
|
+
world: Class<AutometaWorld>;
|
|
24
|
+
}, bridge: FeatureBridge, events: TestEventEmitter, config: Config) => void): void;
|
|
25
|
+
private start;
|
|
26
|
+
get fs(): Files;
|
|
27
|
+
get config(): {
|
|
28
|
+
runner: "jest" | "vitest";
|
|
29
|
+
roots: {
|
|
30
|
+
features: string[];
|
|
31
|
+
steps: string[];
|
|
32
|
+
app: string[];
|
|
33
|
+
parameterTypes?: string[] | undefined;
|
|
34
|
+
};
|
|
35
|
+
environment?: string | undefined;
|
|
36
|
+
test?: {
|
|
37
|
+
timeout?: number | [number, "ms" | "s" | "m" | "h"] | undefined;
|
|
38
|
+
tagFilter?: string | undefined;
|
|
39
|
+
groupLogging?: boolean | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
shim?: {
|
|
42
|
+
errorCause?: boolean | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
events?: string[] | undefined;
|
|
45
|
+
};
|
|
46
|
+
fileSystem(caller: string): Files;
|
|
47
|
+
loadSteps(): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { Coordinator, CoordinatorOpts };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import { Config } from '@autometa/config';
|
|
2
|
+
import { FeatureBridge } from '@autometa/test-builder';
|
|
3
|
+
import { AutometaApp, AutometaWorld } from '@autometa/app';
|
|
4
|
+
import { TestEventEmitter } from '@autometa/events';
|
|
5
|
+
import { Class } from '@autometa/types';
|
|
6
|
+
import { GlobalScope, FeatureScope, Files } from '@autometa/scopes';
|
|
7
|
+
import { DependencyContainer } from 'tsyringe';
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
type CoordinatorOpts = {
|
|
10
|
+
app: Class<AutometaApp>;
|
|
11
|
+
world: Class<AutometaWorld>;
|
|
12
|
+
container: DependencyContainer;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
declare class Coordinator {
|
|
16
|
+
#private;
|
|
17
|
+
readonly global: GlobalScope;
|
|
18
|
+
readonly configs: Config;
|
|
19
|
+
readonly opts: Record<string, CoordinatorOpts>;
|
|
20
|
+
constructor(global: GlobalScope, configs: Config, opts: Record<string, CoordinatorOpts>);
|
|
21
|
+
run(feature: FeatureScope, caller: string, events: TestEventEmitter, executor: ({ app, world }: {
|
|
22
|
+
app: Class<AutometaApp>;
|
|
23
|
+
world: Class<AutometaWorld>;
|
|
24
|
+
}, bridge: FeatureBridge, events: TestEventEmitter, config: Config) => void): void;
|
|
25
|
+
private start;
|
|
26
|
+
get fs(): Files;
|
|
27
|
+
get config(): {
|
|
28
|
+
runner: "jest" | "vitest";
|
|
29
|
+
roots: {
|
|
30
|
+
features: string[];
|
|
31
|
+
steps: string[];
|
|
32
|
+
app: string[];
|
|
33
|
+
parameterTypes?: string[] | undefined;
|
|
34
|
+
};
|
|
35
|
+
environment?: string | undefined;
|
|
36
|
+
test?: {
|
|
37
|
+
timeout?: number | [number, "ms" | "s" | "m" | "h"] | undefined;
|
|
38
|
+
tagFilter?: string | undefined;
|
|
39
|
+
groupLogging?: boolean | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
shim?: {
|
|
42
|
+
errorCause?: boolean | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
events?: string[] | undefined;
|
|
45
|
+
};
|
|
46
|
+
fileSystem(caller: string): Files;
|
|
47
|
+
loadSteps(): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { Coordinator, CoordinatorOpts };
|
package/dist/index.js
CHANGED
|
@@ -16,11 +16,102 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
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
|
+
};
|
|
19
37
|
|
|
20
38
|
// src/index.ts
|
|
21
39
|
var src_exports = {};
|
|
22
40
|
__export(src_exports, {
|
|
23
|
-
|
|
41
|
+
Coordinator: () => Coordinator
|
|
24
42
|
});
|
|
25
43
|
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
|
|
44
|
+
|
|
45
|
+
// src/coordinator.ts
|
|
46
|
+
var import_test_builder = require("@autometa/test-builder");
|
|
47
|
+
var import_scopes = require("@autometa/scopes");
|
|
48
|
+
var import_errors = require("@autometa/errors");
|
|
49
|
+
var import_asserters = require("@autometa/asserters");
|
|
50
|
+
var _fs, _builder, _bridge;
|
|
51
|
+
var Coordinator = class {
|
|
52
|
+
constructor(global, configs, opts) {
|
|
53
|
+
this.global = global;
|
|
54
|
+
this.configs = configs;
|
|
55
|
+
this.opts = opts;
|
|
56
|
+
__privateAdd(this, _fs, void 0);
|
|
57
|
+
__privateAdd(this, _builder, void 0);
|
|
58
|
+
__privateAdd(this, _bridge, void 0);
|
|
59
|
+
(0, import_asserters.AssertDefined)(configs, "Config");
|
|
60
|
+
}
|
|
61
|
+
run(feature, caller, events, executor) {
|
|
62
|
+
(0, import_asserters.AssertDefined)(executor, "Executor");
|
|
63
|
+
const fs = this.fileSystem(caller);
|
|
64
|
+
const path = fs.fromUrlPattern(feature.path);
|
|
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);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
start(gherkin, feature, events, executor) {
|
|
76
|
+
this.global.unlock();
|
|
77
|
+
this.loadSteps();
|
|
78
|
+
this.global.lock();
|
|
79
|
+
__privateSet(this, _builder, new import_test_builder.TestBuilder(gherkin));
|
|
80
|
+
__privateSet(this, _bridge, __privateGet(this, _builder).onFeatureExecuted(feature));
|
|
81
|
+
const { app, world } = this.opts[this.config.environment ?? "default"];
|
|
82
|
+
executor({ app, world }, __privateGet(this, _bridge), events, this.configs);
|
|
83
|
+
}
|
|
84
|
+
get fs() {
|
|
85
|
+
if (!__privateGet(this, _fs)) {
|
|
86
|
+
throw new import_errors.AutomationError("File System not initialized");
|
|
87
|
+
}
|
|
88
|
+
return __privateGet(this, _fs);
|
|
89
|
+
}
|
|
90
|
+
get config() {
|
|
91
|
+
return this.configs.current;
|
|
92
|
+
}
|
|
93
|
+
fileSystem(caller) {
|
|
94
|
+
const { roots } = this.config;
|
|
95
|
+
const { steps, features, app } = roots;
|
|
96
|
+
__privateSet(this, _fs, new import_scopes.Files().withFeatureRoot(features).withCallerFile(caller).withStepsRoot(steps).withAppRoot(app));
|
|
97
|
+
return this.fs;
|
|
98
|
+
}
|
|
99
|
+
loadSteps() {
|
|
100
|
+
const { steps } = this.config.roots;
|
|
101
|
+
if (typeof steps === "string") {
|
|
102
|
+
this.fs.fromUrlPattern(steps).loadStepDefinitions();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
for (const stepRoot of steps) {
|
|
106
|
+
this.fs.fromUrlPattern(stepRoot).loadStepDefinitions();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
_fs = new WeakMap();
|
|
111
|
+
_builder = new WeakMap();
|
|
112
|
+
_bridge = new WeakMap();
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
Coordinator
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/coordinator.ts"],"sourcesContent":["export * from \"./coordinator\";\nexport * from \"./types\";\n","import { Config } from \"@autometa/config\";\nimport { FeatureBridge, TestBuilder } from \"@autometa/test-builder\";\nimport { AutometaApp, AutometaWorld } from \"@autometa/app\";\nimport { TestEventEmitter } from \"@autometa/events\";\nimport { Class } from \"@autometa/types\";\nimport { FeatureScope, Files, GlobalScope } from \"@autometa/scopes\";\nimport { AutomationError } from \"@autometa/errors\";\nimport { AssertDefined } from \"@autometa/asserters\";\nimport { CoordinatorOpts } from \"./types\";\nimport { Feature } from \"@autometa/gherkin\";\nexport class Coordinator {\n #fs: Files;\n #builder: TestBuilder;\n #bridge: FeatureBridge;\n constructor(\n readonly global: GlobalScope,\n readonly configs: Config,\n readonly opts: Record<string, CoordinatorOpts>\n ) {\n AssertDefined(configs, \"Config\");\n }\n\n run(\n feature: FeatureScope,\n caller: string,\n events: TestEventEmitter,\n executor: (\n { app, world }: { app: Class<AutometaApp>; world: Class<AutometaWorld> },\n bridge: FeatureBridge,\n events: TestEventEmitter,\n config: Config\n ) => void\n ) {\n AssertDefined(executor, \"Executor\");\n\n const fs = this.fileSystem(caller);\n const path = fs.fromUrlPattern(feature.path);\n path.loadApps();\n\n const gherkin = path.getFeatureFile();\n if (!Array.isArray(gherkin)) {\n this.start(gherkin, feature, events, executor);\n } else {\n for (const featGherkin of gherkin) {\n this.start(featGherkin, feature, events, executor);\n }\n }\n }\n\n private start(\n gherkin: Feature,\n feature: FeatureScope,\n events: TestEventEmitter,\n executor: (\n { app, world }: { app: Class<AutometaApp>; world: Class<AutometaWorld> },\n bridge: FeatureBridge,\n events: TestEventEmitter,\n config: Config\n ) => void\n ) {\n this.global.unlock();\n this.loadSteps();\n this.global.lock();\n this.#builder = new TestBuilder(gherkin);\n this.#bridge = this.#builder.onFeatureExecuted(feature);\n const { app, world } = this.opts[this.config.environment ?? \"default\"];\n executor({ app, world }, this.#bridge, events, this.configs);\n }\n\n get fs() {\n if (!this.#fs) {\n throw new AutomationError(\"File System not initialized\");\n }\n return this.#fs;\n }\n\n get config() {\n return this.configs.current;\n }\n\n fileSystem(caller: string) {\n const { roots } = this.config;\n const { steps, features, app } = roots;\n\n this.#fs = new Files()\n .withFeatureRoot(features)\n .withCallerFile(caller)\n .withStepsRoot(steps)\n .withAppRoot(app);\n return this.fs;\n }\n\n loadSteps() {\n const { steps } = this.config.roots;\n if (typeof steps === \"string\") {\n this.fs.fromUrlPattern(steps).loadStepDefinitions();\n return;\n }\n for (const stepRoot of steps) {\n this.fs.fromUrlPattern(stepRoot).loadStepDefinitions();\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,0BAA2C;AAI3C,oBAAiD;AACjD,oBAAgC;AAChC,uBAA8B;AAP9B;AAUO,IAAM,cAAN,MAAkB;AAAA,EAIvB,YACW,QACA,SACA,MACT;AAHS;AACA;AACA;AANX;AACA;AACA;AAME,wCAAc,SAAS,QAAQ;AAAA,EACjC;AAAA,EAEA,IACE,SACA,QACA,QACA,UAMA;AACA,wCAAc,UAAU,UAAU;AAElC,UAAM,KAAK,KAAK,WAAW,MAAM;AACjC,UAAM,OAAO,GAAG,eAAe,QAAQ,IAAI;AAC3C,SAAK,SAAS;AAEd,UAAM,UAAU,KAAK,eAAe;AACpC,QAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAK,MAAM,SAAS,SAAS,QAAQ,QAAQ;AAAA,IAC/C,OAAO;AACL,iBAAW,eAAe,SAAS;AACjC,aAAK,MAAM,aAAa,SAAS,QAAQ,QAAQ;AAAA,MACnD;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,MACN,SACA,SACA,QACA,UAMA;AACA,SAAK,OAAO,OAAO;AACnB,SAAK,UAAU;AACf,SAAK,OAAO,KAAK;AACjB,uBAAK,UAAW,IAAI,gCAAY,OAAO;AACvC,uBAAK,SAAU,mBAAK,UAAS,kBAAkB,OAAO;AACtD,UAAM,EAAE,KAAK,MAAM,IAAI,KAAK,KAAK,KAAK,OAAO,eAAe,SAAS;AACrE,aAAS,EAAE,KAAK,MAAM,GAAG,mBAAK,UAAS,QAAQ,KAAK,OAAO;AAAA,EAC7D;AAAA,EAEA,IAAI,KAAK;AACP,QAAI,CAAC,mBAAK,MAAK;AACb,YAAM,IAAI,8BAAgB,6BAA6B;AAAA,IACzD;AACA,WAAO,mBAAK;AAAA,EACd;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK,QAAQ;AAAA,EACtB;AAAA,EAEA,WAAW,QAAgB;AACzB,UAAM,EAAE,MAAM,IAAI,KAAK;AACvB,UAAM,EAAE,OAAO,UAAU,IAAI,IAAI;AAEjC,uBAAK,KAAM,IAAI,oBAAM,EAClB,gBAAgB,QAAQ,EACxB,eAAe,MAAM,EACrB,cAAc,KAAK,EACnB,YAAY,GAAG;AAClB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY;AACV,UAAM,EAAE,MAAM,IAAI,KAAK,OAAO;AAC9B,QAAI,OAAO,UAAU,UAAU;AAC7B,WAAK,GAAG,eAAe,KAAK,EAAE,oBAAoB;AAClD;AAAA,IACF;AACA,eAAW,YAAY,OAAO;AAC5B,WAAK,GAAG,eAAe,QAAQ,EAAE,oBAAoB;AAAA,IACvD;AAAA,EACF;AACF;AA3FE;AACA;AACA;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autometa/coordinator",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,30 +18,32 @@
|
|
|
18
18
|
"@types/uuid": "^9.0.1",
|
|
19
19
|
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
|
20
20
|
"@typescript-eslint/parser": "^5.54.1",
|
|
21
|
+
"@vitest/coverage-istanbul": "^0.31.0",
|
|
21
22
|
"eslint": "^8.37.0",
|
|
22
|
-
"eslint-config-custom": "0.
|
|
23
|
+
"eslint-config-custom": "0.6.0",
|
|
23
24
|
"eslint-config-prettier": "^8.3.0",
|
|
24
25
|
"rimraf": "^4.1.2",
|
|
25
26
|
"tsconfig": " *",
|
|
26
|
-
"tsup": "^
|
|
27
|
+
"tsup": "^7.2.0",
|
|
27
28
|
"typescript": "^4.9.5",
|
|
28
29
|
"vitest": "^0.29.8"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@autometa/app": "^0.
|
|
32
|
-
"@autometa/asserters": "^0.
|
|
33
|
-
"@autometa/config": "^0.
|
|
34
|
-
"@autometa/errors": "^0.
|
|
35
|
-
"@autometa/events": "^0.0
|
|
36
|
-
"@autometa/gherkin": "^0.
|
|
37
|
-
"@autometa/jest-executor": "^0.
|
|
38
|
-
"@autometa/scopes": "^0.
|
|
39
|
-
"@autometa/test-builder": "^0.
|
|
40
|
-
"@autometa/types": "^0.
|
|
32
|
+
"@autometa/app": "^0.1.0",
|
|
33
|
+
"@autometa/asserters": "^0.1.0",
|
|
34
|
+
"@autometa/config": "^0.1.0",
|
|
35
|
+
"@autometa/errors": "^0.1.0",
|
|
36
|
+
"@autometa/events": "^0.1.0",
|
|
37
|
+
"@autometa/gherkin": "^0.4.0",
|
|
38
|
+
"@autometa/jest-executor": "^0.1.0",
|
|
39
|
+
"@autometa/scopes": "^0.2.0",
|
|
40
|
+
"@autometa/test-builder": "^0.1.0",
|
|
41
|
+
"@autometa/types": "^0.4.0",
|
|
41
42
|
"tsyringe": "^4.8.0"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
45
|
"test": "vitest run --passWithNoTests",
|
|
46
|
+
"coverage": "vitest run --coverage --passWithNoTests",
|
|
45
47
|
"prettify": "prettier --config .prettierrc 'src/**/*.ts' --write",
|
|
46
48
|
"lint": "eslint . --max-warnings 0",
|
|
47
49
|
"lint:fix": "eslint . --fix",
|
package/tsup.config.ts
CHANGED
|
@@ -4,7 +4,7 @@ export default defineConfig({
|
|
|
4
4
|
clean: true, // clean up the dist folder
|
|
5
5
|
format: ["cjs", "esm"], // generate cjs and esm files
|
|
6
6
|
dts: true,
|
|
7
|
-
sourcemap:
|
|
7
|
+
sourcemap:true, // generate sourcemaps
|
|
8
8
|
skipNodeModulesBundle: true,
|
|
9
9
|
entryPoints: ["src/index.ts"],
|
|
10
10
|
target: "es2020",
|