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/core.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IStore } from "../SubPackages/react/jsx";
|
|
2
|
+
import {
|
|
3
|
+
IBaseTest,
|
|
4
|
+
ITestSpecification,
|
|
5
|
+
ITestImplementation,
|
|
6
|
+
} from "../Types.js";
|
|
4
7
|
|
|
8
|
+
import { ITestInterface } from "./types.js";
|
|
5
9
|
import {
|
|
6
10
|
DefaultTestInterface,
|
|
7
11
|
ILogWriter,
|
|
@@ -9,66 +13,92 @@ import {
|
|
|
9
13
|
ITTestResourceRequest,
|
|
10
14
|
ITestArtifactory,
|
|
11
15
|
ITestJob,
|
|
12
|
-
defaultTestResourceRequirement
|
|
16
|
+
defaultTestResourceRequirement,
|
|
13
17
|
} from "./index.js";
|
|
14
18
|
import {
|
|
15
|
-
BaseSuite,
|
|
19
|
+
BaseSuite,
|
|
20
|
+
BaseGiven,
|
|
21
|
+
BaseWhen,
|
|
22
|
+
BaseThen,
|
|
23
|
+
BaseCheck,
|
|
16
24
|
} from "./abstractBase.js";
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
} from "./classBuilder.js";
|
|
20
|
-
import { IStore } from "../SubPackages/react/jsx";
|
|
25
|
+
import { ClassBuilder } from "./classBuilder.js";
|
|
26
|
+
import { PM } from "../PM/index";
|
|
21
27
|
|
|
22
|
-
export default abstract class Testeranto<
|
|
28
|
+
export default abstract class Testeranto<
|
|
29
|
+
ITestShape extends IBaseTest
|
|
30
|
+
> extends ClassBuilder<ITestShape> {
|
|
23
31
|
constructor(
|
|
24
|
-
input: ITestShape[
|
|
32
|
+
input: ITestShape["iinput"],
|
|
25
33
|
testSpecification: ITestSpecification<ITestShape>,
|
|
26
|
-
testImplementation: ITestImplementation<ITestShape
|
|
34
|
+
testImplementation: ITestImplementation<ITestShape>,
|
|
27
35
|
testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement,
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
testInterface: Partial<ITestInterface<ITestShape>>
|
|
37
|
+
// puppetMaster: PM
|
|
30
38
|
) {
|
|
31
39
|
const fullTestInterface = DefaultTestInterface(testInterface);
|
|
32
|
-
|
|
33
40
|
super(
|
|
34
41
|
testImplementation,
|
|
35
42
|
testSpecification,
|
|
36
43
|
input,
|
|
37
44
|
|
|
38
|
-
class extends BaseSuite<
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
class extends BaseSuite<ITestShape> {
|
|
46
|
+
afterAll(store: IStore, artifactory: ITestArtifactory, pm: PM) {
|
|
47
|
+
// const pagesHandler = {
|
|
48
|
+
// get(target, prop) {
|
|
49
|
+
// console.log(`Getting pages property ${prop}`);
|
|
50
|
+
// return target[prop];
|
|
51
|
+
// },
|
|
52
|
+
// };
|
|
53
|
+
|
|
54
|
+
// const browserHandler = {
|
|
55
|
+
// get(target, prop) {
|
|
56
|
+
// console.log(`Getting browser property ${prop}`);
|
|
57
|
+
// if (prop === "pages") {
|
|
58
|
+
// // return target[prop];
|
|
59
|
+
// return new Proxy(target[prop], pagesHandler);
|
|
60
|
+
// } else {
|
|
61
|
+
// return target[prop];
|
|
62
|
+
// }
|
|
63
|
+
// },
|
|
64
|
+
// };
|
|
65
|
+
// const proxy = new Proxy(utils.browser, browserHandler);
|
|
66
|
+
|
|
67
|
+
return fullTestInterface.afterAll(
|
|
68
|
+
store,
|
|
69
|
+
(fPath: string, value: unknown) =>
|
|
70
|
+
// TODO does not work?
|
|
71
|
+
{
|
|
72
|
+
artifactory(`afterAll4-${this.name}/${fPath}`, value);
|
|
73
|
+
},
|
|
74
|
+
pm
|
|
75
|
+
);
|
|
76
|
+
}
|
|
41
77
|
|
|
42
78
|
assertThat(t) {
|
|
43
79
|
fullTestInterface.assertThis(t);
|
|
44
80
|
}
|
|
45
81
|
|
|
46
82
|
async setup(
|
|
47
|
-
s: ITestShape[
|
|
83
|
+
s: ITestShape["iinput"],
|
|
48
84
|
artifactory: ITestArtifactory,
|
|
49
85
|
tr,
|
|
50
|
-
|
|
51
|
-
): Promise<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.testResourceConfiguration,
|
|
62
|
-
artifactory
|
|
63
|
-
);
|
|
86
|
+
pm
|
|
87
|
+
): Promise<ITestShape["isubject"]> {
|
|
88
|
+
return (
|
|
89
|
+
fullTestInterface.beforeAll ||
|
|
90
|
+
(async (
|
|
91
|
+
input: ITestShape["iinput"],
|
|
92
|
+
artifactory: ITestArtifactory,
|
|
93
|
+
tr,
|
|
94
|
+
pm: PM
|
|
95
|
+
) => input as any)
|
|
96
|
+
)(s, this.testResourceConfiguration, artifactory, pm);
|
|
64
97
|
}
|
|
65
98
|
} as any,
|
|
66
99
|
|
|
67
|
-
class Given extends BaseGiven<
|
|
68
|
-
|
|
69
|
-
> {
|
|
70
|
-
|
|
71
|
-
async givenThat(subject, testResource, artifactory, initializer) {
|
|
100
|
+
class Given extends BaseGiven<ITestShape> {
|
|
101
|
+
async givenThat(subject, testResource, artifactory, initializer, pm) {
|
|
72
102
|
return fullTestInterface.beforeEach(
|
|
73
103
|
subject,
|
|
74
104
|
initializer,
|
|
@@ -77,60 +107,56 @@ export default abstract class Testeranto<ITestShape extends IBaseTest> extends C
|
|
|
77
107
|
artifactory(`beforeEach/${fPath}`, value),
|
|
78
108
|
testResource,
|
|
79
109
|
this.initialValues,
|
|
80
|
-
|
|
110
|
+
pm
|
|
81
111
|
);
|
|
82
112
|
}
|
|
83
113
|
|
|
84
114
|
afterEach(
|
|
85
|
-
store: ITestShape[
|
|
115
|
+
store: ITestShape["istore"],
|
|
86
116
|
key: string,
|
|
87
|
-
artifactory
|
|
117
|
+
artifactory,
|
|
118
|
+
pm
|
|
88
119
|
): Promise<unknown> {
|
|
89
120
|
return new Promise((res) =>
|
|
90
|
-
res(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return fullTestInterface.afterAll(store, (fPath: string, value: unknown) =>
|
|
100
|
-
// TODO does not work?
|
|
101
|
-
{ artifactory(`afterAll4-${this.name}/${fPath}`, value) },
|
|
102
|
-
utils
|
|
121
|
+
res(
|
|
122
|
+
fullTestInterface.afterEach(
|
|
123
|
+
store,
|
|
124
|
+
key,
|
|
125
|
+
(fPath: string, value: unknown) =>
|
|
126
|
+
artifactory(`after/${fPath}`, value),
|
|
127
|
+
pm
|
|
128
|
+
)
|
|
129
|
+
)
|
|
103
130
|
);
|
|
104
131
|
}
|
|
105
132
|
} as any,
|
|
106
133
|
|
|
107
|
-
class When extends BaseWhen<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
134
|
+
class When extends BaseWhen<ITestShape> {
|
|
135
|
+
async andWhen(store, whenCB, testResource, pm) {
|
|
136
|
+
return await fullTestInterface.andWhen(
|
|
137
|
+
store,
|
|
138
|
+
whenCB,
|
|
139
|
+
testResource,
|
|
140
|
+
pm
|
|
141
|
+
);
|
|
112
142
|
}
|
|
113
143
|
} as any,
|
|
114
144
|
|
|
115
|
-
class Then extends BaseThen<
|
|
116
|
-
ITestShape
|
|
117
|
-
> {
|
|
118
|
-
|
|
145
|
+
class Then extends BaseThen<ITestShape> {
|
|
119
146
|
async butThen(
|
|
120
147
|
store: any,
|
|
121
148
|
thenCB,
|
|
122
149
|
testResourceConfiguration?: any
|
|
123
|
-
): Promise<ITestShape[
|
|
150
|
+
): Promise<ITestShape["iselection"]> {
|
|
124
151
|
return await fullTestInterface.butThen(
|
|
125
152
|
store,
|
|
126
153
|
thenCB,
|
|
127
|
-
testResourceConfiguration
|
|
154
|
+
testResourceConfiguration
|
|
155
|
+
);
|
|
128
156
|
}
|
|
129
157
|
} as any,
|
|
130
158
|
|
|
131
|
-
class Check extends BaseCheck<
|
|
132
|
-
ITestShape
|
|
133
|
-
> {
|
|
159
|
+
class Check extends BaseCheck<ITestShape> {
|
|
134
160
|
initialValues: any;
|
|
135
161
|
|
|
136
162
|
constructor(
|
|
@@ -145,38 +171,43 @@ export default abstract class Testeranto<ITestShape extends IBaseTest> extends C
|
|
|
145
171
|
this.initialValues = initialValues;
|
|
146
172
|
}
|
|
147
173
|
|
|
148
|
-
async checkThat(subject, testResourceConfiguration, artifactory) {
|
|
174
|
+
async checkThat(subject, testResourceConfiguration, artifactory, pm) {
|
|
149
175
|
return fullTestInterface.beforeEach(
|
|
150
176
|
subject,
|
|
151
177
|
this.initialValues,
|
|
152
|
-
(fPath: string, value: unknown) =>
|
|
178
|
+
(fPath: string, value: unknown) =>
|
|
179
|
+
artifactory(`before/${fPath}`, value),
|
|
153
180
|
testResourceConfiguration,
|
|
154
|
-
this.initialValues
|
|
181
|
+
this.initialValues,
|
|
182
|
+
pm
|
|
155
183
|
);
|
|
156
184
|
}
|
|
157
185
|
|
|
158
186
|
afterEach(
|
|
159
|
-
store: ITestShape[
|
|
187
|
+
store: ITestShape["istore"],
|
|
160
188
|
key: string,
|
|
161
|
-
artifactory
|
|
189
|
+
artifactory,
|
|
190
|
+
pm
|
|
162
191
|
): Promise<unknown> {
|
|
163
192
|
return new Promise((res) =>
|
|
164
|
-
res(
|
|
165
|
-
|
|
166
|
-
|
|
193
|
+
res(
|
|
194
|
+
fullTestInterface.afterEach(
|
|
195
|
+
store,
|
|
196
|
+
key,
|
|
197
|
+
(fPath: string, value: unknown) =>
|
|
198
|
+
// TODO does not work?
|
|
199
|
+
artifactory(`afterEach2-${this.name}/${fPath}`, value),
|
|
200
|
+
pm
|
|
201
|
+
)
|
|
202
|
+
)
|
|
167
203
|
);
|
|
168
204
|
}
|
|
169
205
|
} as any,
|
|
170
206
|
|
|
171
|
-
testResourceRequirement
|
|
172
|
-
|
|
207
|
+
testResourceRequirement
|
|
208
|
+
// puppetMaster
|
|
173
209
|
);
|
|
174
210
|
}
|
|
175
211
|
|
|
176
|
-
abstract receiveTestResourceConfig(
|
|
177
|
-
t: ITestJob,
|
|
178
|
-
partialTestResource: ITTestResourceConfiguration,
|
|
179
|
-
utils: IUtils
|
|
180
|
-
);
|
|
181
|
-
|
|
212
|
+
abstract receiveTestResourceConfig(partialTestResource: string);
|
|
182
213
|
}
|
package/src/lib/index.ts
CHANGED
|
@@ -1,29 +1,49 @@
|
|
|
1
|
+
import { PM } from "../PM/index.js";
|
|
2
|
+
import { IBaseTest } from "../Types.js";
|
|
1
3
|
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
+
import {
|
|
5
|
+
IGivens,
|
|
6
|
+
BaseCheck,
|
|
7
|
+
BaseSuite,
|
|
8
|
+
BaseWhen,
|
|
9
|
+
BaseThen,
|
|
10
|
+
} from "./abstractBase.js";
|
|
11
|
+
import { ITestInterface } from "./types.js";
|
|
12
|
+
|
|
13
|
+
// import { INodeUtils, ITestInterface, IUtils, IWebUtils } from "./types.js";
|
|
4
14
|
|
|
5
15
|
export const BaseTestInterface: ITestInterface<IBaseTest> = {
|
|
6
|
-
beforeAll:
|
|
7
|
-
beforeEach: async function (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
beforeAll: async (s) => s,
|
|
17
|
+
beforeEach: async function (
|
|
18
|
+
subject: any,
|
|
19
|
+
initialValues: any,
|
|
20
|
+
x: any,
|
|
21
|
+
testResource: any,
|
|
22
|
+
pm: PM
|
|
23
|
+
) {
|
|
24
|
+
return subject as any;
|
|
25
|
+
},
|
|
26
|
+
afterEach: async (s) => s,
|
|
27
|
+
afterAll: (store: IBaseTest["istore"]) => undefined,
|
|
28
|
+
butThen: async (store: IBaseTest["istore"], thenCb) => thenCb(store),
|
|
29
|
+
andWhen: (a) => a,
|
|
30
|
+
assertThis: () => null,
|
|
13
31
|
};
|
|
14
32
|
|
|
15
|
-
export const DefaultTestInterface = (
|
|
33
|
+
export const DefaultTestInterface = (
|
|
34
|
+
p: Partial<ITestInterface<any>>
|
|
35
|
+
): ITestInterface<any> => {
|
|
16
36
|
return {
|
|
17
37
|
...BaseTestInterface,
|
|
18
|
-
...p
|
|
19
|
-
}
|
|
20
|
-
}
|
|
38
|
+
...p,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
21
41
|
|
|
22
42
|
export type ITTestResourceConfiguration = {
|
|
23
43
|
name: string;
|
|
24
44
|
fs: string;
|
|
25
45
|
ports: number[];
|
|
26
|
-
|
|
46
|
+
browserWSEndpoint: string;
|
|
27
47
|
};
|
|
28
48
|
|
|
29
49
|
export type ITTestResourceRequirement = {
|
|
@@ -39,51 +59,44 @@ export type ITTestResourceRequest = {
|
|
|
39
59
|
export type ITLog = (...string) => void;
|
|
40
60
|
|
|
41
61
|
export type ILogWriter = {
|
|
42
|
-
createWriteStream: (line: string) => any | any
|
|
43
|
-
writeFileSync: (fp: string, contents: string) => any
|
|
44
|
-
mkdirSync: (
|
|
45
|
-
testArtiFactoryfileWriter: (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
62
|
+
createWriteStream: (line: string) => any | any;
|
|
63
|
+
writeFileSync: (fp: string, contents: string) => any;
|
|
64
|
+
mkdirSync: () => any;
|
|
65
|
+
testArtiFactoryfileWriter: (
|
|
66
|
+
tLog: ITLog,
|
|
67
|
+
n: (Promise) => void
|
|
68
|
+
) => (fPath: string, value: unknown) => void;
|
|
69
|
+
};
|
|
49
70
|
|
|
50
71
|
export type ITestArtificer = (key: string, data: any) => void;
|
|
51
72
|
|
|
52
73
|
type ITest = {
|
|
53
74
|
toObj(): object;
|
|
54
75
|
name: string;
|
|
55
|
-
givens: IGivens<
|
|
56
|
-
|
|
57
|
-
>;
|
|
58
|
-
checks: BaseCheck<
|
|
59
|
-
IBaseTest
|
|
60
|
-
>[];
|
|
76
|
+
givens: IGivens<IBaseTest>;
|
|
77
|
+
checks: BaseCheck<IBaseTest>[];
|
|
61
78
|
testResourceConfiguration: ITTestResourceConfiguration;
|
|
62
79
|
};
|
|
63
80
|
|
|
64
|
-
export type ITestJob = {
|
|
81
|
+
export type ITestJob<T = PM> = {
|
|
65
82
|
toObj(): object;
|
|
66
83
|
test: ITest;
|
|
67
|
-
runner: (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
>;
|
|
84
|
+
runner: (
|
|
85
|
+
x: ITTestResourceConfiguration,
|
|
86
|
+
t: ITLog
|
|
87
|
+
) => Promise<BaseSuite<IBaseTest>>;
|
|
72
88
|
testResourceRequirement: ITTestResourceRequirement;
|
|
73
|
-
receiveTestResourceConfig: (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
artifacts: Promise<unknown>[],
|
|
79
|
-
logPromise: Promise<unknown>
|
|
80
|
-
}>
|
|
89
|
+
receiveTestResourceConfig: (pm: PM) => Promise<{
|
|
90
|
+
failed: number;
|
|
91
|
+
artifacts: Promise<unknown>[];
|
|
92
|
+
logPromise: Promise<unknown>;
|
|
93
|
+
}>;
|
|
81
94
|
};
|
|
82
95
|
|
|
83
96
|
export type ITestResults = Promise<{ test: ITest }>[];
|
|
84
97
|
|
|
85
98
|
export const defaultTestResourceRequirement: ITTestResourceRequest = {
|
|
86
|
-
ports: 0
|
|
99
|
+
ports: 0,
|
|
87
100
|
};
|
|
88
101
|
|
|
89
102
|
export type ITestArtifactory = (key: string, value: unknown) => unknown;
|
|
@@ -94,23 +107,12 @@ export type ITestCheckCallback<ITestShape extends IBaseTest> = {
|
|
|
94
107
|
features: string[],
|
|
95
108
|
callbackA: (
|
|
96
109
|
whens: {
|
|
97
|
-
[K in keyof ITestShape["whens"]]: (
|
|
98
|
-
...unknown
|
|
99
|
-
) => BaseWhen<
|
|
100
|
-
ITestShape
|
|
101
|
-
>;
|
|
110
|
+
[K in keyof ITestShape["whens"]]: (...unknown) => BaseWhen<ITestShape>;
|
|
102
111
|
},
|
|
103
112
|
thens: {
|
|
104
|
-
[K in keyof ITestShape["thens"]]: (
|
|
105
|
-
...unknown
|
|
106
|
-
) => BaseThen<
|
|
107
|
-
ITestShape
|
|
108
|
-
>;
|
|
113
|
+
[K in keyof ITestShape["thens"]]: (...unknown) => BaseThen<ITestShape>;
|
|
109
114
|
}
|
|
110
115
|
) => Promise<any>,
|
|
111
116
|
...xtrasA: ITestShape["checks"][K]
|
|
112
|
-
) => BaseCheck<
|
|
113
|
-
ITestShape
|
|
114
|
-
>;
|
|
117
|
+
) => BaseCheck<ITestShape>;
|
|
115
118
|
};
|
|
116
|
-
|
package/src/lib/types.ts
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { IBaseTest } from "../Types";
|
|
2
|
+
|
|
3
|
+
// import puppeteer from "puppeteer-core";
|
|
4
|
+
import {
|
|
5
|
+
IGivens,
|
|
6
|
+
BaseCheck,
|
|
7
|
+
BaseSuite,
|
|
8
|
+
BaseGiven,
|
|
9
|
+
BaseWhen,
|
|
10
|
+
BaseThen,
|
|
11
|
+
} from "./abstractBase";
|
|
12
|
+
import { ITTestResourceConfiguration, ITestArtificer } from ".";
|
|
13
|
+
import { PM } from "../PM/index";
|
|
14
|
+
|
|
15
|
+
export type IRunTime = `node` | `web`;
|
|
16
|
+
|
|
17
|
+
export type ITestTypes = [string, IRunTime, { ports: number }, ITestTypes[]];
|
|
18
|
+
|
|
19
|
+
export type IJsonConfig = {
|
|
20
|
+
outdir: string;
|
|
21
|
+
tests: ITestTypes[];
|
|
22
|
+
features: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type IBaseConfig = {
|
|
26
|
+
clearScreen: boolean;
|
|
27
|
+
debugger: boolean;
|
|
28
|
+
devMode: boolean;
|
|
29
|
+
externals: string[];
|
|
30
|
+
features: string;
|
|
31
|
+
minify: boolean;
|
|
32
|
+
nodePlugins: any[];
|
|
33
|
+
outbase: string;
|
|
34
|
+
outdir: string;
|
|
35
|
+
ports: string[];
|
|
36
|
+
tests: ITestTypes[];
|
|
37
|
+
webPlugins: any[];
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type IBuiltConfig = { buildDir: string } & IBaseConfig;
|
|
41
|
+
|
|
42
|
+
export type IWebTestInterface<ITestShape extends IBaseTest> = {
|
|
43
|
+
assertThis: (x: ITestShape["then"]) => void;
|
|
44
|
+
|
|
45
|
+
andWhen: (
|
|
46
|
+
store: ITestShape["istore"],
|
|
47
|
+
whenCB: ITestShape["when"],
|
|
48
|
+
testResource: ITTestResourceConfiguration
|
|
49
|
+
) => Promise<ITestShape["istore"]>;
|
|
50
|
+
butThen: (
|
|
51
|
+
store: ITestShape["istore"],
|
|
52
|
+
thenCB,
|
|
53
|
+
testResource: ITTestResourceConfiguration
|
|
54
|
+
) => Promise<ITestShape["iselection"]>;
|
|
55
|
+
|
|
56
|
+
afterAll: (
|
|
57
|
+
store: ITestShape["istore"],
|
|
58
|
+
artificer: ITestArtificer,
|
|
59
|
+
utils: PM
|
|
60
|
+
) => any;
|
|
61
|
+
afterEach: (
|
|
62
|
+
store: ITestShape["istore"],
|
|
63
|
+
key: string,
|
|
64
|
+
artificer: ITestArtificer,
|
|
65
|
+
utils: PM
|
|
66
|
+
) => Promise<unknown>;
|
|
67
|
+
beforeAll: (
|
|
68
|
+
input: ITestShape["iinput"],
|
|
69
|
+
testResource: ITTestResourceConfiguration,
|
|
70
|
+
artificer: ITestArtificer,
|
|
71
|
+
utils: PM
|
|
72
|
+
) => Promise<ITestShape["isubject"]>;
|
|
73
|
+
beforeEach: (
|
|
74
|
+
subject: ITestShape["isubject"],
|
|
75
|
+
initializer: (c?) => ITestShape["given"],
|
|
76
|
+
artificer: ITestArtificer,
|
|
77
|
+
testResource: ITTestResourceConfiguration,
|
|
78
|
+
initialValues,
|
|
79
|
+
utils: PM
|
|
80
|
+
) => Promise<ITestShape["istore"]>;
|
|
81
|
+
};
|
|
82
|
+
// & ITestInterface<ITestShape>;
|
|
83
|
+
|
|
84
|
+
export type INodeTestInterface<ITestShape extends IBaseTest> = {
|
|
85
|
+
assertThis: (x: ITestShape["then"]) => void;
|
|
86
|
+
andWhen: (
|
|
87
|
+
store: ITestShape["istore"],
|
|
88
|
+
whenCB: ITestShape["when"],
|
|
89
|
+
testResource: ITTestResourceConfiguration
|
|
90
|
+
) => Promise<ITestShape["istore"]>;
|
|
91
|
+
butThen: (
|
|
92
|
+
store: ITestShape["istore"],
|
|
93
|
+
thenCB,
|
|
94
|
+
testResource: ITTestResourceConfiguration
|
|
95
|
+
) => Promise<ITestShape["iselection"]>;
|
|
96
|
+
afterAll: (
|
|
97
|
+
store: ITestShape["istore"],
|
|
98
|
+
artificer: ITestArtificer,
|
|
99
|
+
pm: PM
|
|
100
|
+
) => any;
|
|
101
|
+
afterEach: (
|
|
102
|
+
store: ITestShape["istore"],
|
|
103
|
+
key: string,
|
|
104
|
+
artificer: ITestArtificer,
|
|
105
|
+
pm: PM
|
|
106
|
+
) => Promise<unknown>;
|
|
107
|
+
beforeAll: (
|
|
108
|
+
input: ITestShape["iinput"],
|
|
109
|
+
testResource: ITTestResourceConfiguration,
|
|
110
|
+
artificer: ITestArtificer,
|
|
111
|
+
pm: PM
|
|
112
|
+
) => Promise<ITestShape["isubject"]>;
|
|
113
|
+
beforeEach: (
|
|
114
|
+
subject: ITestShape["isubject"],
|
|
115
|
+
initializer: (c?) => ITestShape["given"],
|
|
116
|
+
artificer: ITestArtificer,
|
|
117
|
+
testResource: ITTestResourceConfiguration,
|
|
118
|
+
initialValues
|
|
119
|
+
// utils: IUtils
|
|
120
|
+
) => Promise<ITestShape["istore"]>;
|
|
121
|
+
};
|
|
122
|
+
// & ITestInterface<ITestShape>;
|
|
123
|
+
|
|
124
|
+
export type ITestInterface<ITestShape extends IBaseTest> = {
|
|
125
|
+
assertThis: (x: ITestShape["then"]) => void;
|
|
126
|
+
|
|
127
|
+
andWhen: (
|
|
128
|
+
store: ITestShape["istore"],
|
|
129
|
+
whenCB: ITestShape["when"],
|
|
130
|
+
testResource: ITTestResourceConfiguration,
|
|
131
|
+
pm: PM
|
|
132
|
+
) => Promise<ITestShape["istore"]>;
|
|
133
|
+
butThen: (
|
|
134
|
+
store: ITestShape["istore"],
|
|
135
|
+
thenCB,
|
|
136
|
+
testResource: ITTestResourceConfiguration
|
|
137
|
+
) => Promise<ITestShape["iselection"]>;
|
|
138
|
+
|
|
139
|
+
afterAll: (
|
|
140
|
+
store: ITestShape["istore"],
|
|
141
|
+
artificer: ITestArtificer,
|
|
142
|
+
pm: PM
|
|
143
|
+
) => any;
|
|
144
|
+
afterEach: (
|
|
145
|
+
store: ITestShape["istore"],
|
|
146
|
+
key: string,
|
|
147
|
+
artificer: ITestArtificer,
|
|
148
|
+
pm: PM
|
|
149
|
+
) => Promise<unknown>;
|
|
150
|
+
beforeAll: (
|
|
151
|
+
input: ITestShape["iinput"],
|
|
152
|
+
testResource: ITTestResourceConfiguration,
|
|
153
|
+
artificer: ITestArtificer,
|
|
154
|
+
pm: PM
|
|
155
|
+
) => Promise<ITestShape["isubject"]>;
|
|
156
|
+
beforeEach: (
|
|
157
|
+
subject: ITestShape["isubject"],
|
|
158
|
+
initializer: (c?) => ITestShape["given"],
|
|
159
|
+
artificer: ITestArtificer,
|
|
160
|
+
testResource: ITTestResourceConfiguration,
|
|
161
|
+
initialValues,
|
|
162
|
+
pm: PM
|
|
163
|
+
) => Promise<ITestShape["istore"]>;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type ISuiteKlasser<ITestShape extends IBaseTest> = (
|
|
167
|
+
name: string,
|
|
168
|
+
index: number,
|
|
169
|
+
givens: IGivens<ITestShape>,
|
|
170
|
+
checks: BaseCheck<ITestShape>[]
|
|
171
|
+
) => BaseSuite<ITestShape>;
|
|
172
|
+
|
|
173
|
+
export type IGivenKlasser<ITestShape extends IBaseTest> = (
|
|
174
|
+
name,
|
|
175
|
+
features,
|
|
176
|
+
whens,
|
|
177
|
+
thens,
|
|
178
|
+
givenCB
|
|
179
|
+
) => BaseGiven<ITestShape>;
|
|
180
|
+
|
|
181
|
+
export type IWhenKlasser<ITestShape extends IBaseTest> = (
|
|
182
|
+
s,
|
|
183
|
+
o
|
|
184
|
+
) => BaseWhen<ITestShape>;
|
|
185
|
+
|
|
186
|
+
export type IThenKlasser<ITestShape extends IBaseTest> = (
|
|
187
|
+
s,
|
|
188
|
+
o
|
|
189
|
+
) => BaseThen<ITestShape>;
|
|
190
|
+
|
|
191
|
+
export type ICheckKlasser<ITestShape extends IBaseTest> = (
|
|
192
|
+
n,
|
|
193
|
+
f,
|
|
194
|
+
cb,
|
|
195
|
+
w,
|
|
196
|
+
t
|
|
197
|
+
) => BaseCheck<ITestShape>;
|