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.
Files changed (186) hide show
  1. package/README.md +38 -26
  2. package/dist/cjs-shim.js +2 -2
  3. package/dist/common/Node.js +14 -51
  4. package/dist/common/PM/index.js +71 -0
  5. package/dist/common/PM/main.js +361 -0
  6. package/dist/common/PM/node.js +176 -0
  7. package/dist/common/PM/web.js +174 -0
  8. package/dist/common/Project.js +121 -266
  9. package/dist/common/Puppeteer.js +109 -0
  10. package/dist/common/Reporter.js +119 -0
  11. package/dist/common/Scheduler.js +1 -0
  12. package/dist/common/SubPackages/puppeteer.js +3 -1
  13. package/dist/common/SubPackages/react-dom/component/web.js +98 -45
  14. package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
  15. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  16. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
  17. package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
  18. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
  19. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
  20. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  21. package/dist/common/Types.js +2 -32
  22. package/dist/common/Web.js +25 -37
  23. package/dist/common/esbuildConfigs/index.js +5 -5
  24. package/dist/common/esbuildConfigs/node.js +17 -15
  25. package/dist/common/esbuildConfigs/report.js +12 -47
  26. package/dist/common/esbuildConfigs/tests.js +0 -1
  27. package/dist/common/esbuildConfigs/web.js +17 -12
  28. package/dist/common/lib/abstractBase.js +190 -35
  29. package/dist/common/lib/basebuilder.js +56 -29
  30. package/dist/common/lib/classBuilder.js +8 -5
  31. package/dist/common/lib/core.js +42 -17
  32. package/dist/common/lib/index.js +11 -8
  33. package/dist/common/lib/types.js +2 -0
  34. package/dist/common/preload.js +14 -28
  35. package/dist/common/puppeteerConfiger.js +24 -0
  36. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  37. package/dist/module/Node.js +14 -51
  38. package/dist/module/PM/index.js +67 -0
  39. package/dist/module/PM/main.js +331 -0
  40. package/dist/module/PM/node.js +168 -0
  41. package/dist/module/PM/web.js +167 -0
  42. package/dist/module/Project.js +122 -267
  43. package/dist/module/Puppeteer.js +104 -0
  44. package/dist/module/Reporter.js +114 -0
  45. package/dist/module/Scheduler.js +1 -0
  46. package/dist/module/SubPackages/puppeteer.js +3 -1
  47. package/dist/module/SubPackages/react/jsx/node.js +1 -1
  48. package/dist/module/SubPackages/react/jsx/web.js +1 -1
  49. package/dist/module/SubPackages/react-dom/component/node.js +2 -2
  50. package/dist/module/SubPackages/react-dom/component/web.js +98 -45
  51. package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
  52. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  53. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  54. package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
  55. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
  56. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
  57. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  58. package/dist/module/Types.js +3 -30
  59. package/dist/module/Web.js +26 -38
  60. package/dist/module/esbuildConfigs/index.js +5 -5
  61. package/dist/module/esbuildConfigs/node.js +17 -15
  62. package/dist/module/esbuildConfigs/report.js +11 -48
  63. package/dist/module/esbuildConfigs/tests.js +0 -1
  64. package/dist/module/esbuildConfigs/web.js +17 -12
  65. package/dist/module/lib/abstractBase.js +190 -35
  66. package/dist/module/lib/basebuilder.js +56 -29
  67. package/dist/module/lib/classBuilder.js +8 -5
  68. package/dist/module/lib/core.js +44 -19
  69. package/dist/module/lib/index.js +11 -8
  70. package/dist/module/preload.js +15 -27
  71. package/dist/module/puppeteerConfiger.js +19 -0
  72. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  73. package/dist/prebuild/Report.css +1616 -584
  74. package/dist/prebuild/Report.js +2635 -2506
  75. package/dist/types/Node.d.ts +3 -2
  76. package/dist/types/PM/index.d.ts +19 -0
  77. package/dist/types/PM/main.d.ts +28 -0
  78. package/dist/types/PM/node.d.ts +26 -0
  79. package/dist/types/PM/web.d.ts +24 -0
  80. package/dist/types/Project.d.ts +1 -2
  81. package/dist/types/Puppeteer.d.ts +1 -0
  82. package/dist/types/Reporter.d.ts +1 -0
  83. package/dist/types/Scheduler.d.ts +0 -0
  84. package/dist/types/SubPackages/puppeteer.d.ts +3 -3
  85. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  86. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  87. package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
  88. package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
  89. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  90. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  91. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  92. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
  93. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
  94. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
  95. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
  96. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
  97. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
  98. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  99. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  100. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
  101. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
  102. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
  103. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
  104. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
  105. package/dist/types/Types.d.ts +19 -100
  106. package/dist/types/Web.d.ts +3 -2
  107. package/dist/types/esbuildConfigs/features.d.ts +1 -1
  108. package/dist/types/esbuildConfigs/index.d.ts +1 -1
  109. package/dist/types/esbuildConfigs/node.d.ts +1 -1
  110. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  111. package/dist/types/esbuildConfigs/tests.d.ts +1 -1
  112. package/dist/types/esbuildConfigs/web.d.ts +1 -1
  113. package/dist/types/lib/abstractBase.d.ts +26 -24
  114. package/dist/types/lib/basebuilder.d.ts +10 -7
  115. package/dist/types/lib/classBuilder.d.ts +4 -3
  116. package/dist/types/lib/core.d.ts +5 -4
  117. package/dist/types/lib/index.d.ts +7 -5
  118. package/dist/types/lib/types.d.ts +62 -0
  119. package/dist/types/preload.d.ts +0 -1
  120. package/dist/types/puppeteerConfiger.d.ts +4 -0
  121. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  122. package/package.json +6 -7
  123. package/src/Node.ts +30 -85
  124. package/src/PM/index.ts +102 -0
  125. package/src/PM/main.ts +420 -0
  126. package/src/PM/node.ts +515 -0
  127. package/src/PM/web.ts +497 -0
  128. package/src/Project.ts +183 -619
  129. package/src/Puppeteer.ts +131 -0
  130. package/src/Report.tsx +158 -44
  131. package/src/Reporter.ts +134 -0
  132. package/src/Scheduler.ts +0 -0
  133. package/src/SubPackages/puppeteer.ts +19 -14
  134. package/src/SubPackages/react/component/node.ts +20 -32
  135. package/src/SubPackages/react/component/web.ts +20 -30
  136. package/src/SubPackages/react/jsx/index.ts +13 -24
  137. package/src/SubPackages/react/jsx/node.ts +5 -8
  138. package/src/SubPackages/react/jsx/web.ts +10 -8
  139. package/src/SubPackages/react-dom/component/node.ts +17 -23
  140. package/src/SubPackages/react-dom/component/web.ts +134 -95
  141. package/src/SubPackages/react-dom/jsx/web.ts +41 -48
  142. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
  143. package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
  144. package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
  145. package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
  146. package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
  147. package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
  148. package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
  149. package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
  150. package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
  151. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
  152. package/src/Types.ts +73 -307
  153. package/src/Web.ts +40 -81
  154. package/src/cjs-shim.js +2 -2
  155. package/src/esbuildConfigs/features.ts +3 -4
  156. package/src/esbuildConfigs/index.ts +8 -8
  157. package/src/esbuildConfigs/node.ts +21 -20
  158. package/src/esbuildConfigs/report.ts +15 -51
  159. package/src/esbuildConfigs/tests.ts +3 -9
  160. package/src/esbuildConfigs/web.ts +22 -20
  161. package/src/lib/abstractBase.ts +312 -164
  162. package/src/lib/basebuilder.ts +123 -127
  163. package/src/lib/classBuilder.ts +30 -48
  164. package/src/lib/core.ts +115 -84
  165. package/src/lib/index.ts +58 -56
  166. package/src/lib/types.ts +197 -0
  167. package/src/preload.ts +14 -30
  168. package/src/puppeteerConfiger.ts +26 -0
  169. package/src/web.html.ts +1 -1
  170. package/dist/common/NodeWriter.js +0 -56
  171. package/dist/common/electron.js +0 -196
  172. package/dist/common/lib/browser.js +0 -26
  173. package/dist/common/nodeWriterElectron.js +0 -55
  174. package/dist/module/NodeWriter.js +0 -50
  175. package/dist/module/electron.js +0 -191
  176. package/dist/module/lib/browser.js +0 -22
  177. package/dist/module/nodeWriterElectron.js +0 -52
  178. package/dist/types/NodeWriter.d.ts +0 -2
  179. package/dist/types/lib/browser.d.ts +0 -6
  180. package/dist/types/nodeWriterElectron.d.ts +0 -2
  181. package/src/NodeWriter.ts +0 -69
  182. package/src/electron.ts +0 -250
  183. package/src/lib/browser.ts +0 -34
  184. package/src/nodeWriterElectron.ts +0 -71
  185. package/yarn-error.log +0 -3144
  186. /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
package/src/lib/core.ts CHANGED
@@ -1,7 +1,11 @@
1
- import type {
2
- IBaseTest, ITestImplementation, ITestInterface, ITestSpecification, IUtils
3
- } from "../Types";
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, BaseGiven, BaseWhen, BaseThen, BaseCheck
19
+ BaseSuite,
20
+ BaseGiven,
21
+ BaseWhen,
22
+ BaseThen,
23
+ BaseCheck,
16
24
  } from "./abstractBase.js";
17
- import {
18
- ClassBuilder
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<ITestShape extends IBaseTest> extends ClassBuilder<ITestShape> {
28
+ export default abstract class Testeranto<
29
+ ITestShape extends IBaseTest
30
+ > extends ClassBuilder<ITestShape> {
23
31
  constructor(
24
- input: ITestShape['iinput'],
32
+ input: ITestShape["iinput"],
25
33
  testSpecification: ITestSpecification<ITestShape>,
26
- testImplementation: ITestImplementation<ITestShape, object>,
34
+ testImplementation: ITestImplementation<ITestShape>,
27
35
  testResourceRequirement: ITTestResourceRequest = defaultTestResourceRequirement,
28
- logWriter: ILogWriter,
29
- testInterface: Partial<ITestInterface<ITestShape>>,
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
- ITestShape
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['iinput'],
83
+ s: ITestShape["iinput"],
48
84
  artifactory: ITestArtifactory,
49
85
  tr,
50
- // utils: ITestInterface<ITestShape>
51
- ): Promise<
52
- ITestShape['isubject']
53
- > {
54
- return (fullTestInterface.beforeAll || (async (
55
- input: ITestShape['iinput'],
56
- artifactory: ITestArtifactory,
57
- tr,
58
- // utils: ITestInterface<ITestShape>
59
- ) => input as any))(
60
- s,
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
- ITestShape
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
- // utils,
110
+ pm
81
111
  );
82
112
  }
83
113
 
84
114
  afterEach(
85
- store: ITestShape['istore'],
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(fullTestInterface.afterEach(store, key, (fPath: string, value: unknown) =>
91
- artifactory(`after/${fPath}`, value)))
92
- );
93
- }
94
- afterAll(
95
- store: IStore,
96
- artifactory: ITestArtifactory,
97
- utils: IUtils,
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
- ITestShape
109
- > {
110
- async andWhen(store, whenCB, testResource) {
111
- return await fullTestInterface.andWhen(store, whenCB, testResource);
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['iselection']> {
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) => artifactory(`before/${fPath}`, value),
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['istore'],
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(fullTestInterface.afterEach(store, key, (fPath: string, value: unknown) =>
165
- // TODO does not work?
166
- artifactory(`afterEach2-${this.name}/${fPath}`, value)))
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
- logWriter,
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 { IBaseTest, ITestInterface, IUtils } from "../Types.js";
3
- import { IGivens, BaseCheck, BaseSuite, BaseWhen, BaseThen } from "./abstractBase.js";
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: (async (s) => s),
7
- beforeEach: async function (subject: any, initialValues: any, testResource: any) { return subject as any; },
8
- afterEach: (async (s) => s),
9
- afterAll: ((store: IBaseTest['istore']) => undefined),
10
- butThen: (async (store: IBaseTest['istore'], thenCb) => thenCb(store)),
11
- andWhen: ((a) => a),
12
- assertThis: (() => null),
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 = (p: Partial<ITestInterface<any>>): ITestInterface<any> => {
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
- scheduled: boolean;
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: (fp: string) => any
45
- testArtiFactoryfileWriter: (tLog: ITLog, n: (Promise) => void) =>
46
- (fPath: string, value: unknown) =>
47
- void
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
- IBaseTest
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: (x: ITTestResourceConfiguration, t: ITLog) => Promise<
68
- BaseSuite<
69
- IBaseTest
70
- >
71
- >;
84
+ runner: (
85
+ x: ITTestResourceConfiguration,
86
+ t: ITLog
87
+ ) => Promise<BaseSuite<IBaseTest>>;
72
88
  testResourceRequirement: ITTestResourceRequirement;
73
- receiveTestResourceConfig: (
74
- testResource,
75
- utils: IUtils
76
- ) => Promise<{
77
- failed: number,
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
-
@@ -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>;