testeranto 0.62.0 → 0.70.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 (151) hide show
  1. package/README.md +42 -21
  2. package/dist/cjs-shim.js +2 -2
  3. package/dist/common/Node.js +7 -24
  4. package/dist/common/NodeWriter.js +7 -9
  5. package/dist/common/Project.js +103 -266
  6. package/dist/common/SubPackages/puppeteer.js +1 -1
  7. package/dist/common/SubPackages/react-dom/component/web.js +1 -1
  8. package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
  9. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  10. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
  11. package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
  12. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -2
  13. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
  14. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  15. package/dist/common/Types.js +2 -32
  16. package/dist/common/Web.js +25 -18
  17. package/dist/common/electron.js +177 -107
  18. package/dist/common/esbuildConfigs/index.js +5 -5
  19. package/dist/common/esbuildConfigs/node.js +17 -15
  20. package/dist/common/esbuildConfigs/report.js +12 -47
  21. package/dist/common/esbuildConfigs/tests.js +0 -1
  22. package/dist/common/esbuildConfigs/web.js +14 -11
  23. package/dist/common/lib/abstractBase.js +13 -6
  24. package/dist/common/lib/basebuilder.js +11 -11
  25. package/dist/common/lib/classBuilder.js +2 -3
  26. package/dist/common/lib/core.js +37 -8
  27. package/dist/common/lib/index.js +10 -8
  28. package/dist/common/lib/types.js +2 -0
  29. package/dist/common/preload.js +15 -25
  30. package/dist/common/puppeteerConfiger.js +24 -0
  31. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  32. package/dist/module/Node.js +7 -24
  33. package/dist/module/NodeWriter.js +7 -9
  34. package/dist/module/Project.js +104 -267
  35. package/dist/module/SubPackages/puppeteer.js +1 -1
  36. package/dist/module/SubPackages/react/jsx/web.js +1 -1
  37. package/dist/module/SubPackages/react-dom/component/node.js +2 -2
  38. package/dist/module/SubPackages/react-dom/component/web.js +1 -1
  39. package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
  40. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  41. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  42. package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
  43. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -2
  44. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
  45. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  46. package/dist/module/Types.js +3 -30
  47. package/dist/module/Web.js +26 -19
  48. package/dist/module/electron.js +179 -109
  49. package/dist/module/esbuildConfigs/index.js +5 -5
  50. package/dist/module/esbuildConfigs/node.js +17 -15
  51. package/dist/module/esbuildConfigs/report.js +11 -48
  52. package/dist/module/esbuildConfigs/tests.js +0 -1
  53. package/dist/module/esbuildConfigs/web.js +14 -11
  54. package/dist/module/lib/abstractBase.js +13 -6
  55. package/dist/module/lib/basebuilder.js +11 -11
  56. package/dist/module/lib/classBuilder.js +2 -3
  57. package/dist/module/lib/core.js +39 -10
  58. package/dist/module/lib/index.js +10 -8
  59. package/dist/module/lib/types.js +1 -0
  60. package/dist/module/preload.js +12 -25
  61. package/dist/module/puppeteerConfiger.js +19 -0
  62. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  63. package/dist/types/Node.d.ts +3 -2
  64. package/dist/types/Project.d.ts +1 -2
  65. package/dist/types/SubPackages/puppeteer.d.ts +3 -3
  66. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  67. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  68. package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
  69. package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
  70. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  71. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  72. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  73. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
  74. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
  75. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
  76. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
  77. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
  78. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
  79. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  80. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  81. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
  82. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
  83. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
  84. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
  85. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
  86. package/dist/types/Types.d.ts +19 -100
  87. package/dist/types/Web.d.ts +3 -2
  88. package/dist/types/esbuildConfigs/features.d.ts +1 -1
  89. package/dist/types/esbuildConfigs/index.d.ts +1 -1
  90. package/dist/types/esbuildConfigs/node.d.ts +1 -1
  91. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  92. package/dist/types/esbuildConfigs/tests.d.ts +1 -1
  93. package/dist/types/esbuildConfigs/web.d.ts +1 -1
  94. package/dist/types/lib/abstractBase.d.ts +25 -24
  95. package/dist/types/lib/basebuilder.d.ts +8 -7
  96. package/dist/types/lib/classBuilder.d.ts +3 -2
  97. package/dist/types/lib/core.d.ts +3 -2
  98. package/dist/types/lib/index.d.ts +4 -3
  99. package/dist/types/lib/types.d.ts +70 -0
  100. package/dist/types/puppeteerConfiger.d.ts +4 -0
  101. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  102. package/package.json +4 -3
  103. package/src/Node.ts +24 -54
  104. package/src/NodeWriter.ts +21 -18
  105. package/src/Project.ts +165 -620
  106. package/src/Report.tsx +1 -1
  107. package/src/SubPackages/puppeteer.ts +19 -14
  108. package/src/SubPackages/react/component/node.ts +20 -32
  109. package/src/SubPackages/react/component/web.ts +20 -30
  110. package/src/SubPackages/react/jsx/index.ts +13 -24
  111. package/src/SubPackages/react/jsx/web.ts +10 -8
  112. package/src/SubPackages/react-dom/component/node.ts +17 -23
  113. package/src/SubPackages/react-dom/component/web.ts +30 -50
  114. package/src/SubPackages/react-dom/jsx/web.ts +41 -48
  115. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
  116. package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
  117. package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
  118. package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
  119. package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
  120. package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
  121. package/src/SubPackages/react-test-renderer/jsx/index.ts +16 -21
  122. package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
  123. package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
  124. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
  125. package/src/Types.ts +73 -307
  126. package/src/Web.ts +54 -53
  127. package/src/cjs-shim.js +2 -2
  128. package/src/electron.ts +258 -191
  129. package/src/esbuildConfigs/features.ts +3 -4
  130. package/src/esbuildConfigs/index.ts +8 -8
  131. package/src/esbuildConfigs/node.ts +21 -20
  132. package/src/esbuildConfigs/report.ts +15 -51
  133. package/src/esbuildConfigs/tests.ts +3 -9
  134. package/src/esbuildConfigs/web.ts +18 -18
  135. package/src/lib/abstractBase.ts +78 -125
  136. package/src/lib/basebuilder.ts +109 -134
  137. package/src/lib/classBuilder.ts +26 -45
  138. package/src/lib/core.ts +101 -69
  139. package/src/lib/index.ts +53 -52
  140. package/src/lib/types.ts +206 -0
  141. package/src/preload.ts +12 -28
  142. package/src/puppeteerConfiger.ts +26 -0
  143. package/src/web.html.ts +1 -1
  144. package/dist/common/lib/browser.js +0 -26
  145. package/dist/common/nodeWriterElectron.js +0 -55
  146. package/dist/module/lib/browser.js +0 -22
  147. package/dist/module/nodeWriterElectron.js +0 -52
  148. package/dist/types/lib/browser.d.ts +0 -6
  149. package/dist/types/nodeWriterElectron.d.ts +0 -2
  150. package/src/lib/browser.ts +0 -34
  151. package/src/nodeWriterElectron.ts +0 -71
@@ -1,51 +1,15 @@
1
- // import { jsonc } from "jsonc";
2
-
3
- // import { IBaseConfig, IJsonConfig } from "../Types";
4
-
5
- // import baseEsBuildConfig from "./index.js";
6
-
7
- // import fs from "fs"
8
- // import { BuildOptions } from "esbuild";
9
- // // import { CssModulesPlugin } from 'esbuild-css-modules-plugin';
10
- // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
11
-
12
- // export default (config: IBaseConfig): BuildOptions => {
13
- // return {
14
- // bundle: true,
15
- // entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
16
- // minify: config.minify === true,
17
- // outbase: config.outbase,
18
- // write: true,
19
- // outfile: `${jsonConfig.outdir}/report.js`,
20
- // external: [
21
- // "tests.json",
22
- // "features.test.js"
23
- // ],
24
- // // plugins: [
25
- // // CssModulesPlugin({
26
- // // // @see https://github.com/indooorsman/esbuild-css-modules-plugin/blob/main/index.d.ts for more details
27
- // // force: true,
28
- // // emitDeclarationFile: true,
29
- // // localsConvention: 'camelCaseOnly',
30
- // // namedExports: true,
31
- // // inject: false
32
- // // })
33
- // // ]
34
- // }
35
- // // return {
36
- // // bundle: true,
37
- // // entryPoints: [
38
- // // "./node_modules/testeranto/dist/module/Report.js",
39
- // // jsonConfig.features
40
- // // ],
41
- // // minify: config.minify === true,
42
- // // outbase: ".",
43
- // // outdir: 'docs',
44
- // // write: true,
45
- // // // outfile: `${jsonConfig.outdir}/Report.js`,
46
- // // external: [
47
- // // "features.test.js",
48
- // // "testeranto.json"
49
- // // ]
50
- // // }
51
- // }
1
+ import { BuildOptions } from "esbuild";
2
+
3
+ import { IBaseConfig } from "../lib/types";
4
+
5
+ export default (config: IBaseConfig): BuildOptions => {
6
+ return {
7
+ bundle: true,
8
+ entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
9
+ minify: config.minify === true,
10
+ outbase: config.outbase,
11
+ write: true,
12
+ outfile: `${config.outdir}/report.js`,
13
+ external: ["tests.json", "features.test.js"],
14
+ };
15
+ };
@@ -1,11 +1,5 @@
1
- import { jsonc } from "jsonc";
2
-
3
- import { IBaseConfig, IJsonConfig } from "../Types";
4
-
5
- import fs from "fs"
6
1
  import { BuildOptions } from "esbuild";
7
-
8
- // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
2
+ import { IBaseConfig } from "../lib/types";
9
3
 
10
4
  export default (config: IBaseConfig): BuildOptions => {
11
5
  return {
@@ -16,5 +10,5 @@ export default (config: IBaseConfig): BuildOptions => {
16
10
  write: true,
17
11
  outfile: `${config.outdir}/tests.test.js`,
18
12
  // external: ["graphology"]
19
- }
20
- }
13
+ };
14
+ };
@@ -1,37 +1,34 @@
1
1
  import { BuildOptions } from "esbuild";
2
2
  import path from "path";
3
3
 
4
- import { IBaseConfig, IJsonConfig } from "../Types";
4
+ import { IBaseConfig } from "../lib/types.js";
5
5
 
6
6
  import baseEsBuildConfig from "./index.js";
7
- import { jsonc } from "jsonc";
8
- import fs from "fs"
9
-
10
- // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
11
7
 
12
8
  export default (
13
9
  config: IBaseConfig,
14
10
  entryPoints: Set<string> | string[]
15
11
  ): BuildOptions => {
16
12
  return {
17
-
18
13
  ...baseEsBuildConfig(config),
19
14
 
20
- // inject: ['./node_modules/testeranto/dist/cjs-shim.js'],
15
+ // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
21
16
  // banner: {
22
- // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
17
+ // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
23
18
  // },
24
19
 
20
+ // splitting: true,
21
+
25
22
  outdir: config.outdir + "/web",
26
23
 
27
24
  alias: {
28
- react: path.resolve("./node_modules/react")
25
+ react: path.resolve("./node_modules/react"),
29
26
  },
30
27
 
31
28
  external: [
32
29
  "testeranto.json",
33
30
  "features.test.ts",
34
- // "url",
31
+ // "url",
35
32
 
36
33
  "react",
37
34
  "electron",
@@ -49,7 +46,7 @@ export default (
49
46
  "readline",
50
47
  "zlib",
51
48
  "crypto",
52
- "https"
49
+ "https",
53
50
  ],
54
51
 
55
52
  platform: "browser",
@@ -59,15 +56,18 @@ export default (
59
56
  plugins: [
60
57
  ...(config.webPlugins || []),
61
58
  {
62
- name: 'rebuild-notify',
59
+ name: "rebuild-notify",
63
60
  setup(build) {
64
- build.onEnd(result => {
61
+ build.onEnd((result) => {
65
62
  console.log(`web build ended with ${result.errors.length} errors`);
66
- console.log(result)
67
- result.errors.length !== 0 && process.exit(-1);
68
- })
69
- }
63
+ if (result.errors.length > 0) {
64
+ console.log(result);
65
+ }
66
+ // console.log(result);
67
+ // result.errors.length !== 0 && process.exit(-1);
68
+ });
69
+ },
70
70
  },
71
71
  ],
72
72
  };
73
- }
73
+ };
@@ -1,41 +1,27 @@
1
+ import { IBaseTest } from "../Types";
2
+
1
3
  import { ITTestResourceConfiguration, ITestArtifactory, ITLog } from ".";
2
- import { IBaseTest, IUtils } from "../Types";
4
+ import { IUtils } from "./types";
3
5
 
4
- export type IGivens<
5
- ITestShape extends IBaseTest
6
- > = Record<
6
+ export type IGivens<ITestShape extends IBaseTest> = Record<
7
7
  string,
8
- BaseGiven<
9
- ITestShape
10
- >
8
+ BaseGiven<ITestShape>
11
9
  >;
12
10
 
13
- export abstract class BaseSuite<
14
- ITestShape extends IBaseTest
15
- > {
11
+ export abstract class BaseSuite<ITestShape extends IBaseTest> {
16
12
  name: string;
17
- givens: IGivens<
18
- ITestShape
19
- >;
20
- checks: BaseCheck<
21
- ITestShape
22
- >[];
23
- store: ITestShape['istore'];
24
- fails: BaseGiven<
25
- ITestShape
26
- >[];
13
+ givens: IGivens<ITestShape>;
14
+ checks: BaseCheck<ITestShape>[];
15
+ store: ITestShape["istore"];
16
+ fails: BaseGiven<ITestShape>[];
27
17
  testResourceConfiguration: ITTestResourceConfiguration;
28
18
  index: number;
29
19
 
30
20
  constructor(
31
21
  name: string,
32
22
  index: number,
33
- givens: IGivens<
34
- ITestShape
35
- > = {},
36
- checks: BaseCheck<
37
- ITestShape
38
- >[] = []
23
+ givens: IGivens<ITestShape> = {},
24
+ checks: BaseCheck<ITestShape>[] = []
39
25
  ) {
40
26
  this.name = name;
41
27
  this.index = index;
@@ -53,38 +39,31 @@ export abstract class BaseSuite<
53
39
  }
54
40
 
55
41
  setup(
56
- s: ITestShape['iinput'],
42
+ s: ITestShape["iinput"],
57
43
  artifactory: ITestArtifactory,
58
44
  tr: ITTestResourceConfiguration,
59
45
  utils: IUtils
60
- ): Promise<ITestShape['isubject']> {
61
- return new Promise((res) => res(s as unknown as ITestShape['isubject']));
46
+ ): Promise<ITestShape["isubject"]> {
47
+ return new Promise((res) => res(s as unknown as ITestShape["isubject"]));
62
48
  }
63
49
 
64
- assertThat(t: ITestShape['then']): unknown {
50
+ assertThat(t: ITestShape["then"]): unknown {
65
51
  // console.log("base assertThat")
66
52
  return t;
67
53
  }
68
54
 
69
55
  async run(
70
- input: ITestShape['iinput'],
56
+ input: ITestShape["iinput"],
71
57
  testResourceConfiguration: ITTestResourceConfiguration,
72
- artifactory: (
73
- fPath: string,
74
- value: unknown
75
- ) => void,
58
+ artifactory: (fPath: string, value: unknown) => void,
76
59
  tLog: (...string) => void,
77
60
  utils: IUtils
78
- ): Promise<
79
- BaseSuite<
80
- ITestShape
81
- >
82
- > {
61
+ ): Promise<BaseSuite<ITestShape>> {
83
62
  this.testResourceConfiguration = testResourceConfiguration;
84
63
  tLog("test resources: ", testResourceConfiguration);
85
64
 
86
65
  const suiteArtifactory = (fPath: string, value: unknown) =>
87
- artifactory(`suite-${this.index}-${this.name}/${fPath}`, value)
66
+ artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
88
67
  const subject = await this.setup(
89
68
  input,
90
69
  suiteArtifactory,
@@ -126,7 +105,14 @@ export abstract class BaseSuite<
126
105
  // @TODO fix me
127
106
  for (const k of Object.keys(this.givens)) {
128
107
  const giver = this.givens[k];
129
- giver.afterAll(this.store, artifactory, utils);
108
+
109
+ try {
110
+ giver.afterAll(this.store, artifactory, utils);
111
+ } catch (e) {
112
+ console.error(e);
113
+ this.fails.push(giver);
114
+ return this;
115
+ }
130
116
  }
131
117
  ////////////////
132
118
 
@@ -134,33 +120,23 @@ export abstract class BaseSuite<
134
120
  }
135
121
  }
136
122
 
137
- export abstract class BaseGiven<
138
- ITestShape extends IBaseTest
139
- > {
123
+ export abstract class BaseGiven<ITestShape extends IBaseTest> {
140
124
  name: string;
141
125
  features: string[];
142
- whens: BaseWhen<
143
- ITestShape
144
- >[];
145
- thens: BaseThen<
146
- ITestShape
147
- >[];
126
+ whens: BaseWhen<ITestShape>[];
127
+ thens: BaseThen<ITestShape>[];
148
128
  error: Error;
149
- store: ITestShape['istore'];
129
+ store: ITestShape["istore"];
150
130
  recommendedFsPath: string;
151
- givenCB: ITestShape['given'];
131
+ givenCB: ITestShape["given"];
152
132
  initialValues: any;
153
133
 
154
134
  constructor(
155
135
  name: string,
156
136
  features: string[],
157
- whens: BaseWhen<
158
- ITestShape
159
- >[],
160
- thens: BaseThen<
161
- ITestShape
162
- >[],
163
- givenCB: ITestShape['given'],
137
+ whens: BaseWhen<ITestShape>[],
138
+ thens: BaseThen<ITestShape>[],
139
+ givenCB: ITestShape["given"],
164
140
  initialValues: any
165
141
  ) {
166
142
  this.name = name;
@@ -171,16 +147,12 @@ export abstract class BaseGiven<
171
147
  this.initialValues = initialValues;
172
148
  }
173
149
 
174
- beforeAll(
175
- store: ITestShape['istore'],
176
- artifactory: ITestArtifactory,
177
-
178
- ) {
150
+ beforeAll(store: ITestShape["istore"], artifactory: ITestArtifactory) {
179
151
  return store;
180
152
  }
181
153
 
182
154
  afterAll(
183
- store: ITestShape['istore'],
155
+ store: ITestShape["istore"],
184
156
  artifactory: ITestArtifactory,
185
157
  utils: IUtils
186
158
  ) {
@@ -198,22 +170,23 @@ export abstract class BaseGiven<
198
170
  }
199
171
 
200
172
  abstract givenThat(
201
- subject: ITestShape['isubject'],
173
+ subject: ITestShape["isubject"],
202
174
  testResourceConfiguration,
203
175
  artifactory: ITestArtifactory,
204
- givenCB: ITestShape['given']
205
- ): Promise<ITestShape['istore']>;
176
+ givenCB: ITestShape["given"]
177
+ ): Promise<ITestShape["istore"]>;
206
178
 
207
179
  async afterEach(
208
- store: ITestShape['istore'],
180
+ store: ITestShape["istore"],
209
181
  key: string,
210
- artifactory: ITestArtifactory
182
+ artifactory: ITestArtifactory,
183
+ utils: IUtils
211
184
  ): Promise<unknown> {
212
185
  return store;
213
186
  }
214
187
 
215
188
  async give(
216
- subject: ITestShape['isubject'],
189
+ subject: ITestShape["isubject"],
217
190
  key: string,
218
191
  testResourceConfiguration,
219
192
  tester,
@@ -224,7 +197,7 @@ export abstract class BaseGiven<
224
197
  tLog(`\n Given: ${this.name}`);
225
198
 
226
199
  const givenArtifactory = (fPath: string, value: unknown) =>
227
- artifactory(`given-${key}/${fPath}`, value)
200
+ artifactory(`given-${key}/${fPath}`, value);
228
201
  try {
229
202
  this.store = await this.givenThat(
230
203
  subject,
@@ -235,12 +208,7 @@ export abstract class BaseGiven<
235
208
 
236
209
  // tLog(`\n Given this.store`, this.store);
237
210
  for (const whenStep of this.whens) {
238
- await whenStep.test(
239
- this.store,
240
- testResourceConfiguration,
241
- tLog,
242
- utils
243
- );
211
+ await whenStep.test(this.store, testResourceConfiguration, tLog, utils);
244
212
  }
245
213
  for (const thenStep of this.thens) {
246
214
  const t = await thenStep.test(
@@ -258,7 +226,7 @@ export abstract class BaseGiven<
258
226
  // throw e;
259
227
  } finally {
260
228
  try {
261
- await this.afterEach(this.store, key, givenArtifactory);
229
+ await this.afterEach(this.store, key, givenArtifactory, utils);
262
230
  } catch (e) {
263
231
  console.error("afterEach failed! no error will be recorded!", e);
264
232
  }
@@ -267,23 +235,22 @@ export abstract class BaseGiven<
267
235
  }
268
236
  }
269
237
 
270
- export abstract class BaseWhen<
271
- ITestShape extends IBaseTest
272
- > {
238
+ export abstract class BaseWhen<ITestShape extends IBaseTest> {
273
239
  public name: string;
274
- whenCB: (x: ITestShape['iselection']) => ITestShape['then'];
240
+ whenCB: (x: ITestShape["iselection"]) => ITestShape["then"];
275
241
  error: boolean;
276
242
 
277
243
  constructor(
278
244
  name: string,
279
- whenCB: (xyz: ITestShape['iselection']) => ITestShape['then']) {
245
+ whenCB: (xyz: ITestShape["iselection"]) => ITestShape["then"]
246
+ ) {
280
247
  this.name = name;
281
248
  this.whenCB = whenCB;
282
249
  }
283
250
 
284
251
  abstract andWhen(
285
- store: ITestShape['istore'],
286
- whenCB: (x: ITestShape['iselection']) => ITestShape['then'],
252
+ store: ITestShape["istore"],
253
+ whenCB: (x: ITestShape["iselection"]) => ITestShape["then"],
287
254
  testResource
288
255
  );
289
256
 
@@ -295,18 +262,14 @@ export abstract class BaseWhen<
295
262
  }
296
263
 
297
264
  async test(
298
- store: ITestShape['istore'],
265
+ store: ITestShape["istore"],
299
266
  testResourceConfiguration,
300
267
  tLog: ITLog,
301
268
  utils: IUtils
302
269
  ) {
303
270
  tLog(" When:", this.name);
304
271
  try {
305
- return await this.andWhen(
306
- store,
307
- this.whenCB,
308
- testResourceConfiguration
309
- );
272
+ return await this.andWhen(store, this.whenCB, testResourceConfiguration);
310
273
  } catch (e) {
311
274
  this.error = true;
312
275
  throw e;
@@ -314,14 +277,15 @@ export abstract class BaseWhen<
314
277
  }
315
278
  }
316
279
 
317
- export abstract class BaseThen<
318
- ITestShape extends IBaseTest
319
- > {
280
+ export abstract class BaseThen<ITestShape extends IBaseTest> {
320
281
  public name: string;
321
- thenCB: (storeState: ITestShape['iselection']) => ITestShape['then'];
282
+ thenCB: (storeState: ITestShape["iselection"]) => ITestShape["then"];
322
283
  error: boolean;
323
284
 
324
- constructor(name: string, thenCB: (val: ITestShape['iselection']) => ITestShape['then']) {
285
+ constructor(
286
+ name: string,
287
+ thenCB: (val: ITestShape["iselection"]) => ITestShape["then"]
288
+ ) {
325
289
  this.name = name;
326
290
  this.thenCB = thenCB;
327
291
  }
@@ -334,24 +298,24 @@ export abstract class BaseThen<
334
298
  }
335
299
 
336
300
  abstract butThen(
337
- store: ITestShape['istore'],
301
+ store: ITestShape["istore"],
338
302
  thenCB,
339
303
  testResourceConfiguration?
340
- ): Promise<ITestShape['iselection']>;
304
+ ): Promise<ITestShape["iselection"]>;
341
305
 
342
306
  async test(
343
- store: ITestShape['istore'],
307
+ store: ITestShape["istore"],
344
308
  testResourceConfiguration,
345
309
  tLog: ITLog,
346
310
  utils: IUtils
347
- ): Promise<ITestShape['then'] | undefined> {
311
+ ): Promise<ITestShape["then"] | undefined> {
348
312
  tLog(" Then:", this.name);
349
313
  try {
350
- const x = (await this.butThen(
314
+ const x = await this.butThen(
351
315
  store,
352
316
  this.thenCB,
353
317
  testResourceConfiguration
354
- ));
318
+ );
355
319
  return x;
356
320
  } catch (e) {
357
321
  console.log("test failed", e);
@@ -361,27 +325,15 @@ export abstract class BaseThen<
361
325
  }
362
326
  }
363
327
 
364
- export abstract class BaseCheck<
365
- ITestShape extends IBaseTest
366
- > {
328
+ export abstract class BaseCheck<ITestShape extends IBaseTest> {
367
329
  name: string;
368
330
  features: string[];
369
331
  checkCB: (whens, thens) => any;
370
332
  whens: {
371
- [K in keyof ITestShape["whens"]]: (
372
- p,
373
- tc
374
- ) => BaseWhen<
375
- ITestShape
376
- >;
333
+ [K in keyof ITestShape["whens"]]: (p, tc) => BaseWhen<ITestShape>;
377
334
  };
378
335
  thens: {
379
- [K in keyof ITestShape["thens"]]: (
380
- p,
381
- tc
382
- ) => BaseThen<
383
- ITestShape
384
- >;
336
+ [K in keyof ITestShape["thens"]]: (p, tc) => BaseThen<ITestShape>;
385
337
  };
386
338
 
387
339
  constructor(
@@ -399,21 +351,22 @@ export abstract class BaseCheck<
399
351
  }
400
352
 
401
353
  abstract checkThat(
402
- subject: ITestShape['isubject'],
354
+ subject: ITestShape["isubject"],
403
355
  testResourceConfiguration,
404
356
  artifactory: ITestArtifactory
405
- ): Promise<ITestShape['istore']>;
357
+ ): Promise<ITestShape["istore"]>;
406
358
 
407
359
  async afterEach(
408
- store: ITestShape['istore'],
360
+ store: ITestShape["istore"],
409
361
  key: string,
410
- cb?
362
+ cb,
363
+ utils: IUtils
411
364
  ): Promise<unknown> {
412
365
  return;
413
366
  }
414
367
 
415
368
  async check(
416
- subject: ITestShape['isubject'],
369
+ subject: ITestShape["isubject"],
417
370
  key: string,
418
371
  testResourceConfiguration,
419
372
  tester,
@@ -453,7 +406,7 @@ export abstract class BaseCheck<
453
406
  }, {})
454
407
  );
455
408
 
456
- await this.afterEach(store, key);
409
+ await this.afterEach(store, key, () => {}, utils);
457
410
  return;
458
411
  }
459
412
  }