testeranto 0.62.0 → 0.73.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 +38 -26
- package/dist/cjs-shim.js +2 -2
- package/dist/common/Node.js +14 -51
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +361 -0
- package/dist/common/PM/node.js +176 -0
- package/dist/common/PM/web.js +174 -0
- package/dist/common/Project.js +121 -266
- package/dist/common/Puppeteer.js +109 -0
- package/dist/common/Reporter.js +119 -0
- package/dist/common/Scheduler.js +1 -0
- package/dist/common/SubPackages/puppeteer.js +3 -1
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/common/Types.js +2 -32
- package/dist/common/Web.js +25 -37
- package/dist/common/esbuildConfigs/index.js +5 -5
- package/dist/common/esbuildConfigs/node.js +17 -15
- package/dist/common/esbuildConfigs/report.js +12 -47
- package/dist/common/esbuildConfigs/tests.js +0 -1
- package/dist/common/esbuildConfigs/web.js +17 -12
- package/dist/common/lib/abstractBase.js +190 -35
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +42 -17
- package/dist/common/lib/index.js +11 -8
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +14 -28
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +14 -51
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +331 -0
- package/dist/module/PM/node.js +168 -0
- package/dist/module/PM/web.js +167 -0
- package/dist/module/Project.js +122 -267
- package/dist/module/Puppeteer.js +104 -0
- package/dist/module/Reporter.js +114 -0
- package/dist/module/Scheduler.js +1 -0
- package/dist/module/SubPackages/puppeteer.js +3 -1
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-dom/component/node.js +2 -2
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/module/Types.js +3 -30
- package/dist/module/Web.js +26 -38
- package/dist/module/esbuildConfigs/index.js +5 -5
- package/dist/module/esbuildConfigs/node.js +17 -15
- package/dist/module/esbuildConfigs/report.js +11 -48
- package/dist/module/esbuildConfigs/tests.js +0 -1
- package/dist/module/esbuildConfigs/web.js +17 -12
- package/dist/module/lib/abstractBase.js +190 -35
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +44 -19
- package/dist/module/lib/index.js +11 -8
- package/dist/module/preload.js +15 -27
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.css +1616 -584
- package/dist/prebuild/Report.js +2635 -2506
- package/dist/types/Node.d.ts +3 -2
- package/dist/types/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +28 -0
- package/dist/types/PM/node.d.ts +26 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Project.d.ts +1 -2
- package/dist/types/Puppeteer.d.ts +1 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/puppeteer.d.ts +3 -3
- package/dist/types/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
- package/dist/types/Types.d.ts +19 -100
- package/dist/types/Web.d.ts +3 -2
- package/dist/types/esbuildConfigs/features.d.ts +1 -1
- package/dist/types/esbuildConfigs/index.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/report.d.ts +4 -0
- package/dist/types/esbuildConfigs/tests.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +26 -24
- package/dist/types/lib/basebuilder.d.ts +10 -7
- package/dist/types/lib/classBuilder.d.ts +4 -3
- package/dist/types/lib/core.d.ts +5 -4
- package/dist/types/lib/index.d.ts +7 -5
- package/dist/types/lib/types.d.ts +62 -0
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +6 -7
- package/src/Node.ts +30 -85
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +420 -0
- package/src/PM/node.ts +515 -0
- package/src/PM/web.ts +497 -0
- package/src/Project.ts +183 -619
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +158 -44
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +19 -14
- package/src/SubPackages/react/component/node.ts +20 -32
- package/src/SubPackages/react/component/web.ts +20 -30
- package/src/SubPackages/react/jsx/index.ts +13 -24
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react/jsx/web.ts +10 -8
- package/src/SubPackages/react-dom/component/node.ts +17 -23
- package/src/SubPackages/react-dom/component/web.ts +134 -95
- package/src/SubPackages/react-dom/jsx/web.ts +41 -48
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
- package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
- package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
- package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
- package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
- package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
- package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
- package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
- package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
- package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
- package/src/Types.ts +73 -307
- package/src/Web.ts +40 -81
- package/src/cjs-shim.js +2 -2
- package/src/esbuildConfigs/features.ts +3 -4
- package/src/esbuildConfigs/index.ts +8 -8
- package/src/esbuildConfigs/node.ts +21 -20
- package/src/esbuildConfigs/report.ts +15 -51
- package/src/esbuildConfigs/tests.ts +3 -9
- package/src/esbuildConfigs/web.ts +22 -20
- package/src/lib/abstractBase.ts +312 -164
- package/src/lib/basebuilder.ts +123 -127
- package/src/lib/classBuilder.ts +30 -48
- package/src/lib/core.ts +115 -84
- package/src/lib/index.ts +58 -56
- package/src/lib/types.ts +197 -0
- package/src/preload.ts +14 -30
- package/src/puppeteerConfiger.ts +26 -0
- package/src/web.html.ts +1 -1
- package/dist/common/NodeWriter.js +0 -56
- package/dist/common/electron.js +0 -196
- package/dist/common/lib/browser.js +0 -26
- package/dist/common/nodeWriterElectron.js +0 -55
- package/dist/module/NodeWriter.js +0 -50
- package/dist/module/electron.js +0 -191
- package/dist/module/lib/browser.js +0 -22
- package/dist/module/nodeWriterElectron.js +0 -52
- package/dist/types/NodeWriter.d.ts +0 -2
- package/dist/types/lib/browser.d.ts +0 -6
- package/dist/types/nodeWriterElectron.d.ts +0 -2
- package/src/NodeWriter.ts +0 -69
- package/src/electron.ts +0 -250
- package/src/lib/browser.ts +0 -34
- package/src/nodeWriterElectron.ts +0 -71
- package/yarn-error.log +0 -3144
- /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
package/src/lib/basebuilder.ts
CHANGED
|
@@ -1,45 +1,43 @@
|
|
|
1
|
+
import { PassThrough } from "stream";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
ITTestResourceRequest,
|
|
5
|
+
ITestJob,
|
|
6
|
+
ITLog,
|
|
7
|
+
ILogWriter,
|
|
8
|
+
ITTestResourceConfiguration,
|
|
9
|
+
} from ".";
|
|
10
|
+
import { IBaseTest, ITestSpecification } from "../Types.js";
|
|
1
11
|
|
|
2
12
|
import {
|
|
3
|
-
IBaseTest,
|
|
4
|
-
ICheckKlasser,
|
|
5
|
-
IGivenKlasser,
|
|
6
13
|
ISuiteKlasser,
|
|
7
|
-
|
|
14
|
+
IGivenKlasser,
|
|
15
|
+
IWhenKlasser,
|
|
8
16
|
IThenKlasser,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "
|
|
17
|
+
ICheckKlasser,
|
|
18
|
+
// IUtils,
|
|
19
|
+
} from "./types.js";
|
|
12
20
|
|
|
13
21
|
import {
|
|
14
|
-
|
|
15
22
|
BaseCheck,
|
|
16
23
|
BaseSuite,
|
|
17
24
|
BaseWhen,
|
|
18
25
|
BaseThen,
|
|
19
|
-
BaseGiven
|
|
26
|
+
BaseGiven,
|
|
20
27
|
} from "./abstractBase.js";
|
|
28
|
+
import { PM } from "../PM/index.js";
|
|
21
29
|
|
|
22
|
-
import {
|
|
23
|
-
ITTestResourceRequest,
|
|
24
|
-
ITestJob,
|
|
25
|
-
ITLog,
|
|
26
|
-
ILogWriter,
|
|
27
|
-
ITTestResourceConfiguration,
|
|
28
|
-
} from ".";
|
|
29
30
|
export abstract class BaseBuilder<
|
|
30
31
|
ITestShape extends IBaseTest,
|
|
31
32
|
SuiteExtensions,
|
|
32
33
|
GivenExtensions,
|
|
33
34
|
WhenExtensions,
|
|
34
35
|
ThenExtensions,
|
|
35
|
-
CheckExtensions
|
|
36
|
+
CheckExtensions
|
|
36
37
|
> {
|
|
37
|
-
|
|
38
38
|
specs: any;
|
|
39
39
|
|
|
40
|
-
assertThis: (t:
|
|
41
|
-
|
|
42
|
-
}
|
|
40
|
+
assertThis: (t: ITestShape["then"]) => {};
|
|
43
41
|
|
|
44
42
|
testResourceRequirement: ITTestResourceRequest;
|
|
45
43
|
artifacts: Promise<unknown>[] = [];
|
|
@@ -50,17 +48,18 @@ export abstract class BaseBuilder<
|
|
|
50
48
|
whenOverides: Record<keyof WhenExtensions, IWhenKlasser<ITestShape>>;
|
|
51
49
|
thenOverides: Record<keyof ThenExtensions, IThenKlasser<ITestShape>>;
|
|
52
50
|
checkOverides: Record<keyof CheckExtensions, ICheckKlasser<ITestShape>>;
|
|
51
|
+
puppetMaster: PM;
|
|
53
52
|
|
|
54
53
|
constructor(
|
|
55
|
-
public readonly input: ITestShape[
|
|
54
|
+
public readonly input: ITestShape["iinput"],
|
|
56
55
|
suitesOverrides: Record<keyof SuiteExtensions, ISuiteKlasser<ITestShape>>,
|
|
57
56
|
givenOverides: Record<keyof GivenExtensions, IGivenKlasser<ITestShape>>,
|
|
58
57
|
whenOverides: Record<keyof WhenExtensions, IWhenKlasser<ITestShape>>,
|
|
59
58
|
thenOverides: Record<keyof ThenExtensions, IThenKlasser<ITestShape>>,
|
|
60
59
|
checkOverides: Record<keyof CheckExtensions, ICheckKlasser<ITestShape>>,
|
|
61
|
-
logWriter: ILogWriter,
|
|
62
60
|
testResourceRequirement: ITTestResourceRequest,
|
|
63
|
-
testSpecification: any
|
|
61
|
+
testSpecification: any
|
|
62
|
+
// puppetMaster: PM
|
|
64
63
|
) {
|
|
65
64
|
this.artifacts = [];
|
|
66
65
|
this.testResourceRequirement = testResourceRequirement;
|
|
@@ -70,53 +69,52 @@ export abstract class BaseBuilder<
|
|
|
70
69
|
this.thenOverides = thenOverides;
|
|
71
70
|
this.checkOverides = checkOverides;
|
|
72
71
|
this.testSpecification = testSpecification;
|
|
72
|
+
// this.puppetMaster = puppetMaster;
|
|
73
73
|
|
|
74
74
|
this.specs = testSpecification(
|
|
75
75
|
this.Suites(),
|
|
76
76
|
this.Given(),
|
|
77
77
|
this.When(),
|
|
78
78
|
this.Then(),
|
|
79
|
-
this.Check()
|
|
79
|
+
this.Check()
|
|
80
80
|
);
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
82
|
+
this.testJobs = this.specs.map((suite: BaseSuite<ITestShape>) => {
|
|
83
|
+
const suiteRunner =
|
|
84
|
+
(suite: BaseSuite<ITestShape>) =>
|
|
85
|
+
async (
|
|
86
|
+
// testResourceConfiguration: ITTestResourceConfiguration,
|
|
87
|
+
puppetMaster: PM,
|
|
88
|
+
tLog: ITLog
|
|
89
|
+
): Promise<BaseSuite<ITestShape>> => {
|
|
90
|
+
await puppetMaster.startPuppeteer(
|
|
91
|
+
{
|
|
92
|
+
browserWSEndpoint:
|
|
93
|
+
puppetMaster.testResourceConfiguration.browserWSEndpoint,
|
|
94
|
+
},
|
|
95
|
+
puppetMaster.testResourceConfiguration.fs
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
return await suite.run(
|
|
99
|
+
input,
|
|
100
|
+
puppetMaster.testResourceConfiguration,
|
|
101
|
+
(fPath: string, value: string | Buffer | PassThrough) =>
|
|
102
|
+
puppetMaster.testArtiFactoryfileWriter(
|
|
103
|
+
tLog,
|
|
104
|
+
(p: Promise<void>) => {
|
|
105
|
+
this.artifacts.push(p);
|
|
106
|
+
}
|
|
107
|
+
)(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
|
|
108
|
+
tLog,
|
|
109
|
+
puppetMaster
|
|
110
|
+
);
|
|
111
|
+
};
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
suite: BaseSuite<ITestShape>,
|
|
113
|
-
utils: IUtils
|
|
114
|
-
) => {
|
|
115
|
-
const runner = suiteRunner(suite, utils);
|
|
113
|
+
const runner = suiteRunner(suite);
|
|
116
114
|
|
|
117
115
|
return {
|
|
118
116
|
test: suite,
|
|
119
|
-
testResourceRequirement,
|
|
117
|
+
// testResourceRequirement,
|
|
120
118
|
|
|
121
119
|
toObj: () => {
|
|
122
120
|
return suite.toObj();
|
|
@@ -125,63 +123,74 @@ export abstract class BaseBuilder<
|
|
|
125
123
|
runner,
|
|
126
124
|
|
|
127
125
|
receiveTestResourceConfig: async function (
|
|
128
|
-
testResourceConfiguration = {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
|
|
126
|
+
// testResourceConfiguration = {
|
|
127
|
+
// name: "",
|
|
128
|
+
// fs: ".",
|
|
129
|
+
// ports: [],
|
|
130
|
+
// browserWSEndpoint: "",
|
|
131
|
+
// },
|
|
132
|
+
puppetMaster: PM
|
|
135
133
|
) {
|
|
136
|
-
console.log(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
134
|
+
// console.log(
|
|
135
|
+
// `testResourceConfiguration! ${JSON.stringify(
|
|
136
|
+
// testResourceConfiguration,
|
|
137
|
+
// null,
|
|
138
|
+
// 2
|
|
139
|
+
// )}`
|
|
140
|
+
// );
|
|
141
|
+
// console.log("puppetMaster", puppetMaster);
|
|
142
|
+
|
|
143
|
+
await puppetMaster
|
|
144
|
+
.mkdirSync
|
|
145
|
+
// ""
|
|
146
|
+
// puppetMaster.testResourceConfiguration.fs + "/"
|
|
147
|
+
();
|
|
148
|
+
// if (!puppetMaster.existsSync(destFolder)) {
|
|
149
|
+
// puppetMaster.mkdirSync(destFolder, { recursive: true });
|
|
150
|
+
// }
|
|
151
|
+
|
|
152
|
+
// puppetMaster.writeFileSync(
|
|
153
|
+
// // puppetMaster.testResourceConfiguration.fs + `/tests.json`,
|
|
154
|
+
// `tests.json`,
|
|
155
|
+
// JSON.stringify(this.toObj(), null, 2)
|
|
156
|
+
// );
|
|
157
|
+
|
|
158
|
+
const logFilePath = "log.txt";
|
|
159
|
+
// puppetMaster.testResourceConfiguration.fs + `/log.txt`;
|
|
160
|
+
|
|
161
|
+
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
162
|
+
|
|
163
|
+
// console.log("access", access);
|
|
153
164
|
const tLog = (...l: string[]) => {
|
|
154
|
-
//
|
|
155
|
-
|
|
165
|
+
// access.write(`${l.toString()}\n`);
|
|
166
|
+
// console.log("tLog", l);
|
|
167
|
+
puppetMaster.write(access, `${l.toString()}\n`);
|
|
156
168
|
};
|
|
157
|
-
const suiteDone: BaseSuite<
|
|
158
|
-
ITestShape
|
|
159
|
-
> = await runner(testResourceConfiguration, tLog, y);
|
|
160
|
-
const resultsFilePath = (
|
|
161
|
-
`${testResourceConfiguration.fs}/results.json`
|
|
162
|
-
);
|
|
163
169
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
170
|
+
const suiteDone: BaseSuite<ITestShape> = await runner(
|
|
171
|
+
puppetMaster,
|
|
172
|
+
tLog
|
|
167
173
|
);
|
|
168
174
|
|
|
169
175
|
const logPromise = new Promise((res, rej) => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const numberOfFailures = Object.keys(suiteDone.givens).filter(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
puppetMaster.end(access);
|
|
177
|
+
res(true);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
|
|
181
|
+
return suiteDone.givens[k].error;
|
|
182
|
+
}).length;
|
|
183
|
+
puppetMaster.writeFileSync(`exitcode`, numberOfFailures.toString());
|
|
184
|
+
|
|
185
|
+
puppetMaster.writeFileSync(
|
|
186
|
+
`tests.json`,
|
|
187
|
+
JSON.stringify(this.toObj(), null, 2)
|
|
188
|
+
);
|
|
180
189
|
console.log(`exiting gracefully with ${numberOfFailures} failures.`);
|
|
181
190
|
return {
|
|
182
191
|
failed: numberOfFailures,
|
|
183
192
|
artifacts: this.artifacts || [],
|
|
184
|
-
logPromise
|
|
193
|
+
logPromise,
|
|
185
194
|
};
|
|
186
195
|
},
|
|
187
196
|
};
|
|
@@ -200,26 +209,17 @@ export abstract class BaseBuilder<
|
|
|
200
209
|
(
|
|
201
210
|
name: string,
|
|
202
211
|
features: string[],
|
|
203
|
-
whens: BaseWhen<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
ITestShape
|
|
208
|
-
>[],
|
|
209
|
-
gcb,
|
|
210
|
-
) => BaseGiven<
|
|
211
|
-
ITestShape
|
|
212
|
-
>
|
|
212
|
+
whens: BaseWhen<ITestShape>[],
|
|
213
|
+
thens: BaseThen<ITestShape>[],
|
|
214
|
+
gcb
|
|
215
|
+
) => BaseGiven<ITestShape>
|
|
213
216
|
> {
|
|
214
217
|
return this.givenOverides;
|
|
215
218
|
}
|
|
216
219
|
|
|
217
220
|
When(): Record<
|
|
218
221
|
keyof WhenExtensions,
|
|
219
|
-
(arg0: ITestShape[
|
|
220
|
-
BaseWhen<
|
|
221
|
-
ITestShape
|
|
222
|
-
>
|
|
222
|
+
(arg0: ITestShape["istore"], ...arg1: any) => BaseWhen<ITestShape>
|
|
223
223
|
> {
|
|
224
224
|
return this.whenOverides;
|
|
225
225
|
}
|
|
@@ -227,11 +227,9 @@ export abstract class BaseBuilder<
|
|
|
227
227
|
Then(): Record<
|
|
228
228
|
keyof ThenExtensions,
|
|
229
229
|
(
|
|
230
|
-
selection: ITestShape[
|
|
230
|
+
selection: ITestShape["iselection"],
|
|
231
231
|
expectation: any
|
|
232
|
-
) => BaseThen<
|
|
233
|
-
ITestShape
|
|
234
|
-
>
|
|
232
|
+
) => BaseThen<ITestShape>
|
|
235
233
|
> {
|
|
236
234
|
return this.thenOverides;
|
|
237
235
|
}
|
|
@@ -244,10 +242,8 @@ export abstract class BaseBuilder<
|
|
|
244
242
|
whens,
|
|
245
243
|
thens,
|
|
246
244
|
x
|
|
247
|
-
) => BaseCheck<
|
|
248
|
-
ITestShape
|
|
249
|
-
>
|
|
245
|
+
) => BaseCheck<ITestShape>
|
|
250
246
|
> {
|
|
251
247
|
return this.checkOverides;
|
|
252
248
|
}
|
|
253
|
-
}
|
|
249
|
+
}
|
package/src/lib/classBuilder.ts
CHANGED
|
@@ -1,46 +1,35 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
2
|
IBaseTest,
|
|
3
|
-
ICheckKlasser,
|
|
4
|
-
IGivenKlasser,
|
|
5
|
-
ISuiteKlasser,
|
|
6
3
|
ITestImplementation,
|
|
7
4
|
ITestSpecification,
|
|
8
|
-
|
|
9
|
-
IWhenKlasser,
|
|
10
|
-
} from "../Types";
|
|
5
|
+
} from "../Types.js";
|
|
11
6
|
|
|
7
|
+
import { BaseBuilder } from "./basebuilder.js";
|
|
12
8
|
|
|
13
9
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} from ".";
|
|
10
|
+
ISuiteKlasser,
|
|
11
|
+
IGivenKlasser,
|
|
12
|
+
IWhenKlasser,
|
|
13
|
+
IThenKlasser,
|
|
14
|
+
ICheckKlasser,
|
|
15
|
+
} from "./types.js";
|
|
16
|
+
import { PM } from "../PM/index.js";
|
|
17
|
+
import { ITTestResourceRequest } from "./index.js";
|
|
21
18
|
|
|
22
19
|
export abstract class ClassBuilder<
|
|
23
20
|
ITestShape extends IBaseTest
|
|
24
|
-
> extends BaseBuilder<
|
|
25
|
-
ITestShape,
|
|
26
|
-
any,
|
|
27
|
-
any,
|
|
28
|
-
any,
|
|
29
|
-
any,
|
|
30
|
-
any
|
|
31
|
-
> {
|
|
32
|
-
|
|
21
|
+
> extends BaseBuilder<ITestShape, any, any, any, any, any> {
|
|
33
22
|
constructor(
|
|
34
23
|
testImplementation: ITestImplementation<ITestShape, any>,
|
|
35
24
|
testSpecification: ITestSpecification<ITestShape>,
|
|
36
|
-
input: ITestShape[
|
|
25
|
+
input: ITestShape["iinput"],
|
|
37
26
|
suiteKlasser: ISuiteKlasser<ITestShape>,
|
|
38
27
|
givenKlasser: IGivenKlasser<ITestShape>,
|
|
39
28
|
whenKlasser: IWhenKlasser<ITestShape>,
|
|
40
29
|
thenKlasser: IThenKlasser<ITestShape>,
|
|
41
30
|
checkKlasser: ICheckKlasser<ITestShape>,
|
|
42
|
-
testResourceRequirement: ITTestResourceRequest
|
|
43
|
-
|
|
31
|
+
testResourceRequirement: ITTestResourceRequest
|
|
32
|
+
// puppetMaster: PM
|
|
44
33
|
) {
|
|
45
34
|
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
46
35
|
(a, [key], index) => {
|
|
@@ -56,28 +45,22 @@ export abstract class ClassBuilder<
|
|
|
56
45
|
},
|
|
57
46
|
{}
|
|
58
47
|
);
|
|
59
|
-
const classyGivens = Object.entries(testImplementation.givens)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
49
|
+
(a, [key, givEn]) => {
|
|
50
|
+
a[key] = (features, whens, thens, givEn) => {
|
|
51
|
+
return new givenKlasser.prototype.constructor(
|
|
52
|
+
key,
|
|
63
53
|
features,
|
|
64
54
|
whens,
|
|
65
55
|
thens,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
givEn
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
return a;
|
|
78
|
-
},
|
|
79
|
-
{}
|
|
80
|
-
);
|
|
56
|
+
testImplementation.givens[key],
|
|
57
|
+
givEn
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
return a;
|
|
61
|
+
},
|
|
62
|
+
{}
|
|
63
|
+
);
|
|
81
64
|
|
|
82
65
|
const classyWhens = Object.entries(testImplementation.whens).reduce(
|
|
83
66
|
(a, [key, whEn]: [string, (x) => any]) => {
|
|
@@ -128,10 +111,9 @@ export abstract class ClassBuilder<
|
|
|
128
111
|
classyWhens,
|
|
129
112
|
classyThens,
|
|
130
113
|
classyChecks,
|
|
131
|
-
logWriter,
|
|
132
114
|
testResourceRequirement,
|
|
133
115
|
testSpecification
|
|
116
|
+
// puppetMaster
|
|
134
117
|
);
|
|
135
118
|
}
|
|
136
|
-
|
|
137
|
-
}
|
|
119
|
+
}
|