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