@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/dist/esm/index.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
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.loadParameterTypes();
|
|
53
|
-
this.loadSteps();
|
|
54
|
-
this.global.lock();
|
|
55
|
-
__privateSet(this, _builder, new TestBuilder(gherkin));
|
|
56
|
-
__privateSet(this, _bridge, __privateGet(this, _builder).onFeatureExecuted(feature));
|
|
57
|
-
const { app, world } = this.opts[this.config.environment ?? "default"];
|
|
58
|
-
executor({ app, world }, this.global, __privateGet(this, _bridge), events, this.configs);
|
|
59
|
-
}
|
|
60
|
-
get fs() {
|
|
61
|
-
if (!__privateGet(this, _fs)) {
|
|
62
|
-
throw new AutomationError("File System not initialized");
|
|
63
|
-
}
|
|
64
|
-
return __privateGet(this, _fs);
|
|
65
|
-
}
|
|
66
|
-
get config() {
|
|
67
|
-
return this.configs.current;
|
|
68
|
-
}
|
|
69
|
-
fileSystem(caller) {
|
|
70
|
-
const { roots } = this.config;
|
|
71
|
-
const { steps, features, app, parameterTypes } = roots;
|
|
72
|
-
__privateSet(this, _fs, new Files().withFeatureRoot(features).withCallerFile(caller).withStepsRoot(steps).withParameterTypes(parameterTypes).withAppRoot(app));
|
|
73
|
-
return this.fs;
|
|
74
|
-
}
|
|
75
|
-
loadSteps() {
|
|
76
|
-
const { steps } = this.config.roots;
|
|
77
|
-
if (typeof steps === "string") {
|
|
78
|
-
this.fs.fromUrlPattern(steps).loadStepDefinitions();
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
for (const stepRoot of steps) {
|
|
82
|
-
this.fs.fromUrlPattern(stepRoot).loadStepDefinitions();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
loadParameterTypes() {
|
|
86
|
-
const { parameterTypes } = this.config.roots;
|
|
87
|
-
if (parameterTypes === void 0) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (typeof parameterTypes === "string") {
|
|
91
|
-
this.fs.fromUrlPattern(parameterTypes).loadParameterTypes();
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
for (const paramTypeRoot of parameterTypes) {
|
|
95
|
-
this.fs.fromUrlPattern(paramTypeRoot).loadParameterTypes();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
_fs = new WeakMap();
|
|
100
|
-
_builder = new WeakMap();
|
|
101
|
-
_bridge = new WeakMap();
|
|
102
|
-
export {
|
|
103
|
-
Coordinator
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/coordinator.ts"],"sourcesContent":["import { Config } from \"@autometa/config\";\nimport { FeatureBridge, TestBuilder } from \"@autometa/test-builder\";\nimport { App, World } 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<App>; world: Class<World> },\n global: GlobalScope,\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<App>; world: Class<World> },\n global: GlobalScope,\n bridge: FeatureBridge,\n events: TestEventEmitter,\n config: Config\n ) => void\n ) {\n this.global.unlock();\n this.loadParameterTypes();\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.global, 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, parameterTypes } = roots;\n\n this.#fs = new Files()\n .withFeatureRoot(features)\n .withCallerFile(caller)\n .withStepsRoot(steps)\n .withParameterTypes(parameterTypes)\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 loadParameterTypes() {\n const { parameterTypes } = this.config.roots;\n if (parameterTypes === undefined) {\n return;\n }\n\n if (typeof parameterTypes === \"string\") {\n this.fs.fromUrlPattern(parameterTypes).loadParameterTypes();\n return;\n }\n\n for (const paramTypeRoot of parameterTypes) {\n this.fs.fromUrlPattern(paramTypeRoot).loadParameterTypes();\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,UAOA;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,UAOA;AACA,SAAK,OAAO,OAAO;AACnB,SAAK,mBAAmB;AACxB,SAAK,UAAU;AACf,SAAK,OAAO,KA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AAAA,IAC3D;AAAA,EACF;AACF;AA/GE;AACA;AACA;","names":[]}
|
package/dist/index.d.cts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Config } from '@autometa/config';
|
|
2
|
-
import { FeatureBridge } from '@autometa/test-builder';
|
|
3
|
-
import { App, World } from '@autometa/app';
|
|
4
|
-
import { TestEventEmitter } from '@autometa/events';
|
|
5
|
-
import { Class } from '@autometa/types';
|
|
6
|
-
import { GlobalScope, FeatureScope, Files } from '@autometa/scopes';
|
|
7
|
-
|
|
8
|
-
type CoordinatorOpts = {
|
|
9
|
-
app: Class<App>;
|
|
10
|
-
world: Class<World>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
declare class Coordinator {
|
|
14
|
-
#private;
|
|
15
|
-
readonly global: GlobalScope;
|
|
16
|
-
readonly configs: Config;
|
|
17
|
-
readonly opts: Record<string, CoordinatorOpts>;
|
|
18
|
-
constructor(global: GlobalScope, configs: Config, opts: Record<string, CoordinatorOpts>);
|
|
19
|
-
run(feature: FeatureScope, caller: string, events: TestEventEmitter, executor: ({ app, world }: {
|
|
20
|
-
app: Class<App>;
|
|
21
|
-
world: Class<World>;
|
|
22
|
-
}, global: GlobalScope, bridge: FeatureBridge, events: TestEventEmitter, config: Config) => void): void;
|
|
23
|
-
private start;
|
|
24
|
-
get fs(): Files;
|
|
25
|
-
get config(): {
|
|
26
|
-
runner: "jest" | "vitest";
|
|
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;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { Coordinator, CoordinatorOpts };
|
package/tsup.config.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "tsup";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
clean: true, // clean up the dist folder
|
|
5
|
-
format: ["cjs", "esm"], // generate cjs and esm files
|
|
6
|
-
dts: true,
|
|
7
|
-
sourcemap: true, // generate sourcemaps
|
|
8
|
-
skipNodeModulesBundle: true,
|
|
9
|
-
entryPoints: ["src/index.ts"],
|
|
10
|
-
target: "es2020",
|
|
11
|
-
outDir: "dist",
|
|
12
|
-
legacyOutput: true,
|
|
13
|
-
external: ["dist"],
|
|
14
|
-
});
|