testeranto 0.113.1 → 0.121.1
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 +6 -2
- package/bundle.js +1 -1
- package/dist/common/Init.js +55 -61
- package/dist/common/PM/base.js +233 -0
- package/dist/common/PM/main.js +217 -434
- package/dist/common/build.js +113 -92
- package/dist/common/defaultConfig.js +2 -2
- package/dist/common/esbuildConfigs/index.js +1 -1
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +7 -3
- package/dist/common/esbuildConfigs/node.js +5 -3
- package/dist/common/esbuildConfigs/web.js +3 -3
- package/dist/common/init-docs.js +2 -46
- package/dist/common/lib/abstractBase.js +60 -54
- package/dist/common/lib/basebuilder.js +7 -8
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +6 -18
- package/dist/common/lib/index.js +6 -1
- package/dist/common/run.js +10 -2
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/utils.js +9 -21
- package/dist/module/Init.js +55 -61
- package/dist/module/PM/base.js +226 -0
- package/dist/module/PM/main.js +218 -435
- package/dist/module/Project.js +117 -0
- package/dist/module/TestReport.js +13 -4
- package/dist/module/build.js +113 -92
- package/dist/module/defaultConfig.js +2 -2
- package/dist/module/esbuildConfigs/index.js +1 -1
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +7 -3
- package/dist/module/esbuildConfigs/node.js +5 -3
- package/dist/module/esbuildConfigs/web.js +3 -3
- package/dist/module/init-docs.js +2 -13
- package/dist/module/lib/abstractBase.js +60 -54
- package/dist/module/lib/basebuilder.js +7 -8
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +6 -18
- package/dist/module/lib/index.js +6 -1
- package/dist/module/run.js +10 -2
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/utils.js +8 -17
- package/dist/prebuild/Project.css +11367 -0
- package/dist/prebuild/Project.js +24640 -0
- package/dist/prebuild/ReportClient.js +1 -1
- package/dist/prebuild/TestReport.js +9 -11
- package/dist/prebuild/build.mjs +142 -81
- package/dist/prebuild/init-docs.mjs +28 -83
- package/dist/prebuild/run.mjs +618 -537
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Init.d.ts +1 -1
- package/dist/types/PM/base.d.ts +38 -0
- package/dist/types/PM/main.d.ts +20 -44
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +19 -11
- package/dist/types/lib/basebuilder.d.ts +1 -2
- package/dist/types/lib/index.d.ts +3 -3
- package/dist/types/lib/types.d.ts +2 -5
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/utils.d.ts +4 -7
- package/package.json +7 -6
- package/src/Init.ts +60 -68
- package/src/PM/base.ts +301 -0
- package/src/PM/main.ts +276 -567
- package/src/Project.tsx +197 -0
- package/src/ReportClient.tsx +1 -1
- package/src/TestReport.tsx +30 -15
- package/src/build.ts +140 -104
- package/src/defaultConfig.ts +2 -2
- package/src/esbuildConfigs/index.ts +1 -1
- package/src/esbuildConfigs/inputFilesPlugin.ts +7 -6
- package/src/esbuildConfigs/node.ts +5 -3
- package/src/esbuildConfigs/web.ts +4 -3
- package/src/init-docs.ts +2 -15
- package/src/lib/abstractBase.ts +113 -93
- package/src/lib/basebuilder.ts +8 -9
- package/src/lib/classBuilder.ts +11 -10
- package/src/lib/core.ts +15 -27
- package/src/lib/index.ts +13 -6
- package/src/lib/types.ts +3 -8
- package/src/run.ts +21 -5
- package/src/utils.ts +27 -39
- package/tsc.log +12 -23
- package/dist/common/puppeteerConfiger.js +0 -24
- package/dist/module/puppeteerConfiger.js +0 -19
- package/dist/types/puppeteerConfiger.d.ts +0 -4
- package/src/puppeteerConfiger.ts +0 -26
|
@@ -8,18 +8,20 @@ import featuresPlugin from "./featuresPlugin";
|
|
|
8
8
|
|
|
9
9
|
export default (
|
|
10
10
|
config: IBaseConfig,
|
|
11
|
-
entryPoints: Set<string> | string[]
|
|
11
|
+
entryPoints: Set<string> | string[],
|
|
12
|
+
testName: string
|
|
12
13
|
): BuildOptions => {
|
|
13
14
|
const { inputFilesPluginFactory, register } = inputFilesPlugin(
|
|
14
15
|
"node",
|
|
15
|
-
entryPoints
|
|
16
|
+
// entryPoints,
|
|
17
|
+
testName
|
|
16
18
|
);
|
|
17
19
|
return {
|
|
18
20
|
...baseEsBuildConfig(config),
|
|
19
21
|
|
|
20
22
|
splitting: true,
|
|
21
23
|
|
|
22
|
-
outdir:
|
|
24
|
+
outdir: `testeranto/bundles/node/${testName}/`,
|
|
23
25
|
|
|
24
26
|
// inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
|
|
25
27
|
metafile: true,
|
|
@@ -9,17 +9,18 @@ import featuresPlugin from "./featuresPlugin.js";
|
|
|
9
9
|
|
|
10
10
|
export default (
|
|
11
11
|
config: IBaseConfig,
|
|
12
|
-
entryPoints: Set<string> | string[]
|
|
12
|
+
entryPoints: Set<string> | string[],
|
|
13
|
+
testName: string
|
|
13
14
|
): BuildOptions => {
|
|
14
15
|
const { inputFilesPluginFactory, register } = inputFilesPlugin(
|
|
15
16
|
"web",
|
|
16
|
-
|
|
17
|
+
testName
|
|
17
18
|
);
|
|
18
19
|
|
|
19
20
|
return {
|
|
20
21
|
...baseEsBuildConfig(config),
|
|
21
22
|
|
|
22
|
-
outdir:
|
|
23
|
+
outdir: `testeranto/bundles/web/${testName}`,
|
|
23
24
|
|
|
24
25
|
alias: {
|
|
25
26
|
react: path.resolve("./node_modules/react"),
|
package/src/init-docs.ts
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
1
|
import Init from "./Init";
|
|
3
2
|
|
|
4
3
|
console.log("Initializing a testeranto project");
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
console.log("You didn't pass a config file, so I will create one for you.");
|
|
5
|
+
Init();
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
"testeranto.mts",
|
|
11
|
-
fs.readFileSync("node_modules/testeranto/src/defaultConfig.ts")
|
|
12
|
-
);
|
|
13
|
-
import(process.cwd() + "/" + "testeranto.mts").then((module) => {
|
|
14
|
-
Init(module.default);
|
|
15
|
-
});
|
|
16
|
-
} else {
|
|
17
|
-
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
18
|
-
Init(module.default);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
7
|
+
console.log("testeranto project initialized");
|
package/src/lib/abstractBase.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
// import { IBaseTest } from "../Types";
|
|
2
1
|
import { PM } from "../PM/index.js";
|
|
2
|
+
import { Ibdd_in, Ibdd_out } from "../Types.js";
|
|
3
3
|
|
|
4
4
|
import { ITTestResourceConfiguration, ITestArtifactory, ITLog } from ".";
|
|
5
|
-
import { IBaseTest } from "../../dist/types/src/Types.js";
|
|
6
|
-
import { Ibdd_in, Ibdd_out } from "../Types.js";
|
|
7
5
|
|
|
8
6
|
export type IGivens<
|
|
9
7
|
I extends Ibdd_in<
|
|
@@ -72,10 +70,12 @@ export abstract class BaseSuite<
|
|
|
72
70
|
|
|
73
71
|
public toObj() {
|
|
74
72
|
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
73
|
+
const checks = Object.keys(this.checks).map((k) => this.checks[k].toObj());
|
|
75
74
|
|
|
76
75
|
return {
|
|
77
76
|
name: this.name,
|
|
78
77
|
givens,
|
|
78
|
+
checks,
|
|
79
79
|
fails: this.fails,
|
|
80
80
|
features: this.features(),
|
|
81
81
|
};
|
|
@@ -106,7 +106,7 @@ export abstract class BaseSuite<
|
|
|
106
106
|
pm: PM
|
|
107
107
|
): Promise<BaseSuite<I, O>> {
|
|
108
108
|
this.testResourceConfiguration = testResourceConfiguration;
|
|
109
|
-
tLog("test resources: ", JSON.stringify(testResourceConfiguration));
|
|
109
|
+
// tLog("test resources: ", JSON.stringify(testResourceConfiguration));
|
|
110
110
|
|
|
111
111
|
const suiteArtifactory = (fPath: string, value: unknown) =>
|
|
112
112
|
artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
@@ -116,39 +116,38 @@ export abstract class BaseSuite<
|
|
|
116
116
|
const sNdx = this.index;
|
|
117
117
|
const sName = this.name;
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
);
|
|
133
|
-
}
|
|
119
|
+
const beforeAllProxy = new Proxy(pm, {
|
|
120
|
+
get(target, prop, receiver) {
|
|
121
|
+
if (prop === "customScreenShot") {
|
|
122
|
+
return (opts, p) =>
|
|
123
|
+
target.customScreenShot(
|
|
124
|
+
{
|
|
125
|
+
...opts,
|
|
126
|
+
// path: `${filepath}/${opts.path}`,
|
|
127
|
+
path: `suite-${sNdx}/beforeAll/${opts.path}`,
|
|
128
|
+
},
|
|
129
|
+
p
|
|
130
|
+
);
|
|
131
|
+
}
|
|
134
132
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
if (prop === "writeFileSync") {
|
|
134
|
+
return (fp, contents) =>
|
|
135
|
+
target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
136
|
+
}
|
|
139
137
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
/* @ts-ignore:next-line */
|
|
139
|
+
return Reflect.get(...arguments);
|
|
140
|
+
},
|
|
141
|
+
});
|
|
144
142
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
const subject = await this.setup(
|
|
144
|
+
input,
|
|
145
|
+
suiteArtifactory,
|
|
146
|
+
testResourceConfiguration,
|
|
147
|
+
beforeAllProxy
|
|
148
|
+
);
|
|
151
149
|
|
|
150
|
+
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
152
151
|
const giver = this.givens[gKey];
|
|
153
152
|
try {
|
|
154
153
|
this.store = await giver.give(
|
|
@@ -168,6 +167,18 @@ export abstract class BaseSuite<
|
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
169
|
|
|
170
|
+
for (const [ndx, thater] of this.checks.entries()) {
|
|
171
|
+
await thater.check(
|
|
172
|
+
subject,
|
|
173
|
+
thater.name,
|
|
174
|
+
testResourceConfiguration,
|
|
175
|
+
this.assertThat,
|
|
176
|
+
suiteArtifactory,
|
|
177
|
+
tLog,
|
|
178
|
+
pm
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
171
182
|
try {
|
|
172
183
|
this.afterAll(
|
|
173
184
|
this.store,
|
|
@@ -181,18 +192,6 @@ export abstract class BaseSuite<
|
|
|
181
192
|
// return this;
|
|
182
193
|
}
|
|
183
194
|
|
|
184
|
-
// for (const [ndx, thater] of this.checks.entries()) {
|
|
185
|
-
// await thater.check(
|
|
186
|
-
// subject,
|
|
187
|
-
// thater.name,
|
|
188
|
-
// testResourceConfiguration,
|
|
189
|
-
// this.assertThat,
|
|
190
|
-
// suiteArtifactory,
|
|
191
|
-
// tLog,
|
|
192
|
-
// pm
|
|
193
|
-
// );
|
|
194
|
-
// }
|
|
195
|
-
|
|
196
195
|
// @TODO fix me
|
|
197
196
|
// for (const k of Object.keys(this.givens)) {
|
|
198
197
|
// const giver = this.givens[k];
|
|
@@ -241,7 +240,6 @@ export abstract class BaseGiven<
|
|
|
241
240
|
thens: BaseThen<I>[],
|
|
242
241
|
givenCB: I["given"],
|
|
243
242
|
initialValues: any
|
|
244
|
-
// key: string
|
|
245
243
|
) {
|
|
246
244
|
this.name = name;
|
|
247
245
|
this.features = features;
|
|
@@ -431,7 +429,8 @@ export abstract class BaseGiven<
|
|
|
431
429
|
afterEachProxy
|
|
432
430
|
);
|
|
433
431
|
} catch (e) {
|
|
434
|
-
console.error("afterEach failed!
|
|
432
|
+
console.error("afterEach failed!", e);
|
|
433
|
+
this.error = e.message;
|
|
435
434
|
}
|
|
436
435
|
}
|
|
437
436
|
return this.store;
|
|
@@ -481,7 +480,6 @@ export abstract class BaseWhen<
|
|
|
481
480
|
) {
|
|
482
481
|
tLog(" When:", this.name);
|
|
483
482
|
|
|
484
|
-
const name = this.name;
|
|
485
483
|
const andWhenProxy = new Proxy(pm, {
|
|
486
484
|
get(target, prop, receiver) {
|
|
487
485
|
if (prop === "customScreenShot") {
|
|
@@ -540,11 +538,13 @@ export abstract class BaseThen<
|
|
|
540
538
|
> {
|
|
541
539
|
public name: string;
|
|
542
540
|
thenCB: (storeState: I["iselection"]) => I["then"];
|
|
541
|
+
go: (storeState: I["iselection"]) => I["then"];
|
|
543
542
|
error: boolean;
|
|
544
543
|
|
|
545
544
|
constructor(name: string, thenCB: (val: I["iselection"]) => I["then"]) {
|
|
546
545
|
this.name = name;
|
|
547
546
|
this.thenCB = thenCB;
|
|
547
|
+
|
|
548
548
|
this.error = false;
|
|
549
549
|
}
|
|
550
550
|
|
|
@@ -557,7 +557,7 @@ export abstract class BaseThen<
|
|
|
557
557
|
|
|
558
558
|
abstract butThen(
|
|
559
559
|
store: I["istore"],
|
|
560
|
-
thenCB,
|
|
560
|
+
thenCB: (s: I["iselection"]) => I["isubject"],
|
|
561
561
|
testResourceConfiguration: ITTestResourceConfiguration,
|
|
562
562
|
pm: PM
|
|
563
563
|
): Promise<I["iselection"]>;
|
|
@@ -569,7 +569,17 @@ export abstract class BaseThen<
|
|
|
569
569
|
pm: PM,
|
|
570
570
|
filepath: string
|
|
571
571
|
): Promise<I["then"] | undefined> {
|
|
572
|
-
|
|
572
|
+
this.go = async (s: I["iselection"]) => {
|
|
573
|
+
tLog(" Then!!!:", this.name);
|
|
574
|
+
|
|
575
|
+
try {
|
|
576
|
+
await this.thenCB(s);
|
|
577
|
+
} catch (e) {
|
|
578
|
+
console.log("test failed", e);
|
|
579
|
+
this.error = e.message;
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
|
|
573
583
|
try {
|
|
574
584
|
const butThenProxy = new Proxy(pm, {
|
|
575
585
|
get(target, prop, receiver) {
|
|
@@ -596,7 +606,7 @@ export abstract class BaseThen<
|
|
|
596
606
|
|
|
597
607
|
return this.butThen(
|
|
598
608
|
store,
|
|
599
|
-
this.
|
|
609
|
+
this.go,
|
|
600
610
|
testResourceConfiguration,
|
|
601
611
|
butThenProxy
|
|
602
612
|
).catch((e) => {
|
|
@@ -609,6 +619,8 @@ export abstract class BaseThen<
|
|
|
609
619
|
throw e;
|
|
610
620
|
}
|
|
611
621
|
}
|
|
622
|
+
|
|
623
|
+
check() {}
|
|
612
624
|
}
|
|
613
625
|
|
|
614
626
|
export abstract class BaseCheck<
|
|
@@ -629,44 +641,74 @@ export abstract class BaseCheck<
|
|
|
629
641
|
Record<string, any>
|
|
630
642
|
>
|
|
631
643
|
> {
|
|
644
|
+
key: string;
|
|
632
645
|
name: string;
|
|
633
646
|
features: string[];
|
|
634
|
-
checkCB: (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
647
|
+
checkCB: (store: I["istore"], pm: PM) => any;
|
|
648
|
+
initialValues: any;
|
|
649
|
+
store: I["istore"];
|
|
650
|
+
// whens: {
|
|
651
|
+
// [K in keyof O["whens"]]: (p, tc) => BaseWhen<I>;
|
|
652
|
+
// };
|
|
653
|
+
// thens: {
|
|
654
|
+
// [K in keyof O["thens"]]: (p, tc) => BaseThen<I>;
|
|
655
|
+
// };
|
|
656
|
+
checker: any;
|
|
641
657
|
|
|
642
658
|
constructor(
|
|
643
659
|
name: string,
|
|
644
660
|
features: string[],
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
661
|
+
checker: (store: I["istore"], pm: PM) => any,
|
|
662
|
+
x: any,
|
|
663
|
+
checkCB: any
|
|
648
664
|
) {
|
|
649
665
|
this.name = name;
|
|
650
666
|
this.features = features;
|
|
651
667
|
this.checkCB = checkCB;
|
|
652
|
-
this.
|
|
653
|
-
this.thens = thens;
|
|
668
|
+
this.checker = checker;
|
|
654
669
|
}
|
|
655
670
|
|
|
656
671
|
abstract checkThat(
|
|
657
672
|
subject: I["isubject"],
|
|
658
673
|
testResourceConfiguration,
|
|
659
674
|
artifactory: ITestArtifactory,
|
|
675
|
+
initializer,
|
|
676
|
+
initialValues,
|
|
660
677
|
pm: PM
|
|
661
678
|
): Promise<I["istore"]>;
|
|
662
679
|
|
|
680
|
+
toObj() {
|
|
681
|
+
return {
|
|
682
|
+
key: this.key,
|
|
683
|
+
name: this.name,
|
|
684
|
+
functionAsString: this.checkCB.toString(),
|
|
685
|
+
// thens: this.thens.map((t) => t.toObj()),
|
|
686
|
+
// error: this.error ? [this.error, this.error.stack] : null,
|
|
687
|
+
// fail: this.fail ? [this.fail] : false,
|
|
688
|
+
features: this.features,
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
|
|
663
692
|
async afterEach(
|
|
664
693
|
store: I["istore"],
|
|
665
694
|
key: string,
|
|
666
|
-
|
|
695
|
+
artifactory: ITestArtifactory,
|
|
667
696
|
pm: PM
|
|
668
697
|
): Promise<unknown> {
|
|
669
|
-
return;
|
|
698
|
+
return store;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
beforeAll(
|
|
702
|
+
store: I["istore"],
|
|
703
|
+
// artifactory: ITestArtifactory
|
|
704
|
+
// subject,
|
|
705
|
+
initializer,
|
|
706
|
+
artifactory,
|
|
707
|
+
testResource,
|
|
708
|
+
initialValues,
|
|
709
|
+
pm
|
|
710
|
+
) {
|
|
711
|
+
return store;
|
|
670
712
|
}
|
|
671
713
|
|
|
672
714
|
async check(
|
|
@@ -678,41 +720,19 @@ export abstract class BaseCheck<
|
|
|
678
720
|
tLog: ITLog,
|
|
679
721
|
pm: PM
|
|
680
722
|
) {
|
|
723
|
+
this.key = key;
|
|
681
724
|
tLog(`\n Check: ${this.name}`);
|
|
682
|
-
|
|
725
|
+
this.store = await this.checkThat(
|
|
683
726
|
subject,
|
|
684
727
|
testResourceConfiguration,
|
|
685
728
|
artifactory,
|
|
729
|
+
this.checkCB,
|
|
730
|
+
this.initialValues,
|
|
686
731
|
pm
|
|
687
732
|
);
|
|
688
|
-
await this.checkCB(
|
|
689
|
-
Object.entries(this.whens).reduce((a, [key, when]) => {
|
|
690
|
-
a[key] = async (payload) => {
|
|
691
|
-
return await when(payload, testResourceConfiguration).test(
|
|
692
|
-
store,
|
|
693
|
-
testResourceConfiguration,
|
|
694
|
-
tLog,
|
|
695
|
-
pm,
|
|
696
|
-
"x"
|
|
697
|
-
);
|
|
698
|
-
};
|
|
699
|
-
return a;
|
|
700
|
-
}, {}),
|
|
701
|
-
Object.entries(this.thens).reduce((a, [key, then]) => {
|
|
702
|
-
a[key] = async (payload) => {
|
|
703
|
-
const t = await then(payload, testResourceConfiguration).test(
|
|
704
|
-
store,
|
|
705
|
-
testResourceConfiguration,
|
|
706
|
-
tLog,
|
|
707
|
-
pm
|
|
708
|
-
);
|
|
709
|
-
tester(t);
|
|
710
|
-
};
|
|
711
|
-
return a;
|
|
712
|
-
}, {})
|
|
713
|
-
);
|
|
714
733
|
|
|
715
|
-
await this.
|
|
734
|
+
await this.checker(this.store, pm);
|
|
735
|
+
|
|
716
736
|
return;
|
|
717
737
|
}
|
|
718
738
|
}
|
package/src/lib/basebuilder.ts
CHANGED
|
@@ -58,7 +58,7 @@ export abstract class BaseBuilder<
|
|
|
58
58
|
puppetMaster: PM;
|
|
59
59
|
|
|
60
60
|
constructor(
|
|
61
|
-
|
|
61
|
+
input: I["iinput"],
|
|
62
62
|
suitesOverrides: Record<keyof SuiteExtensions, ISuiteKlasser<I, O>>,
|
|
63
63
|
givenOverides: Record<keyof GivenExtensions, IGivenKlasser<I>>,
|
|
64
64
|
whenOverides: Record<keyof WhenExtensions, IWhenKlasser<I>>,
|
|
@@ -142,7 +142,7 @@ export abstract class BaseBuilder<
|
|
|
142
142
|
puppetMaster.writeFileSync(
|
|
143
143
|
`littleBoard.html`,
|
|
144
144
|
`
|
|
145
|
-
|
|
145
|
+
<!DOCTYPE html>
|
|
146
146
|
<html lang="en">
|
|
147
147
|
|
|
148
148
|
<head>
|
|
@@ -152,15 +152,14 @@ export abstract class BaseBuilder<
|
|
|
152
152
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
153
153
|
<meta name="author" content="" />
|
|
154
154
|
|
|
155
|
-
<link rel="stylesheet" href="/kokomoBay/
|
|
156
|
-
<script src="/kokomoBay/
|
|
155
|
+
<link rel="stylesheet" href="/kokomoBay/testeranto/TestReport.css" />
|
|
156
|
+
<script src="/kokomoBay/testeranto/TestReport.js"></script>
|
|
157
157
|
|
|
158
158
|
</head>
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
</body>
|
|
160
|
+
<body>
|
|
161
|
+
<div id="root"/>
|
|
162
|
+
</body>
|
|
164
163
|
`
|
|
165
164
|
);
|
|
166
165
|
|
|
@@ -218,7 +217,7 @@ export abstract class BaseBuilder<
|
|
|
218
217
|
keyof CheckExtensions,
|
|
219
218
|
(
|
|
220
219
|
feature: string,
|
|
221
|
-
callback: (whens, thens) => any,
|
|
220
|
+
callback: (whens, thens, pm: PM) => any,
|
|
222
221
|
whens,
|
|
223
222
|
thens,
|
|
224
223
|
x
|
package/src/lib/classBuilder.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
ICheckKlasser,
|
|
15
15
|
} from "./types.js";
|
|
16
16
|
import { ITTestResourceRequest } from "./index.js";
|
|
17
|
+
import { BaseCheck } from "./abstractBase.js";
|
|
17
18
|
|
|
18
19
|
export abstract class ClassBuilder<
|
|
19
20
|
I extends Ibdd_in<
|
|
@@ -61,14 +62,15 @@ export abstract class ClassBuilder<
|
|
|
61
62
|
|
|
62
63
|
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
63
64
|
(a, [key, g]) => {
|
|
64
|
-
a[key] = (features, whens, thens
|
|
65
|
+
a[key] = (features, whens, thens) => {
|
|
66
|
+
// console.log("givEn", givEn.toString());
|
|
65
67
|
return new givenKlasser.prototype.constructor(
|
|
66
68
|
key,
|
|
67
69
|
features,
|
|
68
70
|
whens,
|
|
69
71
|
thens,
|
|
70
|
-
testImplementation.givens[key]
|
|
71
|
-
givEn
|
|
72
|
+
testImplementation.givens[key]
|
|
73
|
+
// givEn
|
|
72
74
|
);
|
|
73
75
|
};
|
|
74
76
|
return a;
|
|
@@ -103,19 +105,18 @@ export abstract class ClassBuilder<
|
|
|
103
105
|
);
|
|
104
106
|
|
|
105
107
|
const classyChecks = Object.entries(testImplementation.checks).reduce(
|
|
106
|
-
(a, [key,
|
|
107
|
-
a[key] = (
|
|
108
|
+
(a, [key, chEck]) => {
|
|
109
|
+
a[key] = (name, features, checker) => {
|
|
108
110
|
return new checkKlasser.prototype.constructor(
|
|
109
|
-
|
|
111
|
+
key,
|
|
110
112
|
features,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
classyThens
|
|
113
|
+
chEck,
|
|
114
|
+
checker
|
|
114
115
|
);
|
|
115
116
|
};
|
|
116
117
|
return a;
|
|
117
118
|
},
|
|
118
|
-
{}
|
|
119
|
+
{} as Record<string, (n, f, c) => BaseCheck<I, O>>
|
|
119
120
|
);
|
|
120
121
|
|
|
121
122
|
super(
|
package/src/lib/core.ts
CHANGED
|
@@ -111,7 +111,6 @@ export default abstract class Testeranto<
|
|
|
111
111
|
return fullTestInterface.beforeEach(
|
|
112
112
|
subject,
|
|
113
113
|
initializer,
|
|
114
|
-
// artifactory,
|
|
115
114
|
testResource,
|
|
116
115
|
initialValues,
|
|
117
116
|
pm
|
|
@@ -125,17 +124,10 @@ export default abstract class Testeranto<
|
|
|
125
124
|
pm
|
|
126
125
|
): Promise<unknown> {
|
|
127
126
|
return new Promise((res) =>
|
|
128
|
-
res(
|
|
129
|
-
fullTestInterface.afterEach(
|
|
130
|
-
store,
|
|
131
|
-
key,
|
|
132
|
-
// (fPath: string, value: unknown) =>
|
|
133
|
-
// artifactory(`after/${fPath}`, value),
|
|
134
|
-
pm
|
|
135
|
-
)
|
|
136
|
-
)
|
|
127
|
+
res(fullTestInterface.afterEach(store, key, pm))
|
|
137
128
|
);
|
|
138
129
|
}
|
|
130
|
+
s;
|
|
139
131
|
} as any,
|
|
140
132
|
|
|
141
133
|
class When extends BaseWhen<I> {
|
|
@@ -213,23 +205,28 @@ export default abstract class Testeranto<
|
|
|
213
205
|
constructor(
|
|
214
206
|
name: string,
|
|
215
207
|
features: string[],
|
|
216
|
-
checkCallback: (
|
|
208
|
+
checkCallback: (s: I["istore"], pm: PM) => any,
|
|
217
209
|
whens,
|
|
218
210
|
thens,
|
|
219
211
|
initialValues: any
|
|
220
212
|
) {
|
|
221
|
-
super(name, features,
|
|
213
|
+
super(name, features, whens, thens, checkCallback, initialValues);
|
|
222
214
|
this.initialValues = initialValues;
|
|
223
215
|
}
|
|
224
216
|
|
|
225
|
-
async checkThat(
|
|
217
|
+
async checkThat(
|
|
218
|
+
subject,
|
|
219
|
+
testResourceConfiguration,
|
|
220
|
+
artifactory,
|
|
221
|
+
initializer,
|
|
222
|
+
initialValues,
|
|
223
|
+
pm
|
|
224
|
+
) {
|
|
226
225
|
return fullTestInterface.beforeEach(
|
|
227
226
|
subject,
|
|
228
|
-
|
|
229
|
-
// (fPath: string, value: unknown) =>
|
|
230
|
-
// artifactory(`before/${fPath}`, value),
|
|
227
|
+
initializer,
|
|
231
228
|
testResourceConfiguration,
|
|
232
|
-
|
|
229
|
+
initialValues,
|
|
233
230
|
pm
|
|
234
231
|
);
|
|
235
232
|
}
|
|
@@ -241,16 +238,7 @@ export default abstract class Testeranto<
|
|
|
241
238
|
pm
|
|
242
239
|
): Promise<unknown> {
|
|
243
240
|
return new Promise((res) =>
|
|
244
|
-
res(
|
|
245
|
-
fullTestInterface.afterEach(
|
|
246
|
-
store,
|
|
247
|
-
key,
|
|
248
|
-
// (fPath: string, value: unknown) =>
|
|
249
|
-
// // TODO does not work?
|
|
250
|
-
// artifactory(`afterEach2-${this.name}/${fPath}`, value),
|
|
251
|
-
pm
|
|
252
|
-
)
|
|
253
|
-
)
|
|
241
|
+
res(fullTestInterface.afterEach(store, key, pm))
|
|
254
242
|
);
|
|
255
243
|
}
|
|
256
244
|
} as any,
|
package/src/lib/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IBaseTest } from "../../dist/types/src/Types.js";
|
|
2
1
|
import { PM } from "../PM/index.js";
|
|
3
2
|
import { Ibdd_in, Ibdd_out, ITestInterface } from "../Types.js";
|
|
4
3
|
|
|
@@ -39,8 +38,12 @@ export const BaseTestInterface: ITestInterface<
|
|
|
39
38
|
unknown,
|
|
40
39
|
unknown
|
|
41
40
|
>["istore"],
|
|
42
|
-
thenCb
|
|
43
|
-
) =>
|
|
41
|
+
thenCb: any
|
|
42
|
+
) => {
|
|
43
|
+
try {
|
|
44
|
+
thenCb(store);
|
|
45
|
+
} catch (e) {}
|
|
46
|
+
},
|
|
44
47
|
andWhen: (a) => a,
|
|
45
48
|
assertThis: () => null,
|
|
46
49
|
};
|
|
@@ -159,11 +162,11 @@ export type IBaseConfig = {
|
|
|
159
162
|
src: string;
|
|
160
163
|
clearScreen: boolean;
|
|
161
164
|
debugger: boolean;
|
|
162
|
-
devMode: boolean;
|
|
165
|
+
// devMode: boolean;
|
|
163
166
|
externals: string[];
|
|
164
167
|
minify: boolean;
|
|
165
|
-
outbase: string;
|
|
166
|
-
outdir: string;
|
|
168
|
+
// outbase: string;
|
|
169
|
+
// outdir: string;
|
|
167
170
|
ports: string[];
|
|
168
171
|
tests: ITestTypes[];
|
|
169
172
|
|
|
@@ -174,3 +177,7 @@ export type IBaseConfig = {
|
|
|
174
177
|
};
|
|
175
178
|
|
|
176
179
|
export type IBuiltConfig = { buildDir: string } & IBaseConfig;
|
|
180
|
+
|
|
181
|
+
export type IConfigV2 = {
|
|
182
|
+
projects: Record<string, IBaseConfig>;
|
|
183
|
+
};
|
package/src/lib/types.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PM } from "../PM";
|
|
1
2
|
import { Ibdd_in, Ibdd_out } from "../Types";
|
|
2
3
|
|
|
3
4
|
import {
|
|
@@ -30,14 +31,8 @@ export type ITestCheckCallback<
|
|
|
30
31
|
[K in keyof O["checks"]]: (
|
|
31
32
|
name: string,
|
|
32
33
|
features: string[],
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[K in keyof O["whens"]]: (...unknown) => BaseWhen<I>;
|
|
36
|
-
},
|
|
37
|
-
thens: {
|
|
38
|
-
[K in keyof O["thens"]]: (...unknown) => BaseThen<I>;
|
|
39
|
-
}
|
|
40
|
-
) => Promise<any>,
|
|
34
|
+
checkCallback: (store: I["istore"], pm: PM) => Promise<any>,
|
|
35
|
+
|
|
41
36
|
...xtrasA: O["checks"][K]
|
|
42
37
|
) => BaseCheck<I, O>;
|
|
43
38
|
};
|