testeranto 0.49.10 → 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 +5 -14
  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 +4 -13
  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/react-dom/jsx/node.d.ts +6 -0
  107. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  108. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  109. package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
  110. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +9 -0
  111. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
  112. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  113. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
  114. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
  115. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
  116. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
  117. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
  118. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
  119. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
  120. package/dist/types/Types.d.ts +116 -3
  121. package/dist/types/Web.d.ts +4 -11
  122. package/dist/types/esbuildConfigs/features.d.ts +4 -0
  123. package/dist/types/esbuildConfigs/index.d.ts +4 -0
  124. package/dist/types/esbuildConfigs/node.d.ts +4 -0
  125. package/dist/types/esbuildConfigs/report.d.ts +0 -0
  126. package/dist/types/esbuildConfigs/tests.d.ts +4 -0
  127. package/dist/types/esbuildConfigs/web.d.ts +4 -0
  128. package/dist/types/lib/abstractBase.d.ts +102 -0
  129. package/dist/types/lib/basebuilder.d.ts +24 -0
  130. package/dist/types/lib/browser.d.ts +6 -0
  131. package/dist/types/lib/classBuilder.d.ts +6 -0
  132. package/dist/types/lib/core.d.ts +7 -0
  133. package/dist/types/lib/index.d.ts +57 -0
  134. package/dist/types/nodeWriterElectron.d.ts +2 -0
  135. package/dist/types/report.html.d.ts +2 -0
  136. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  137. package/dist/types/web.html.d.ts +2 -0
  138. package/electronBuild.ts +32 -0
  139. package/index.html +30 -0
  140. package/package.json +120 -85
  141. package/src/Features.ts +2 -4
  142. package/src/Node.ts +114 -160
  143. package/src/NodeWriter.ts +1 -4
  144. package/src/Project.ts +610 -753
  145. package/src/Report.tsx +30 -15
  146. package/src/SubPackages/puppeteer.ts +46 -0
  147. package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
  148. package/src/SubPackages/react/component/web.ts +53 -0
  149. package/src/SubPackages/react/jsx/index.ts +43 -0
  150. package/src/SubPackages/react/jsx/node.ts +29 -0
  151. package/src/SubPackages/react/jsx/web.ts +28 -0
  152. package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
  153. package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
  154. package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
  155. package/src/SubPackages/react-dom/jsx/node.ts +68 -0
  156. package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +18 -54
  157. package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
  158. package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
  159. package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
  160. package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
  161. package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
  162. package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
  163. package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
  164. package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
  165. package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
  166. package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
  167. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
  168. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
  169. package/src/Types.ts +334 -3
  170. package/src/Web.ts +104 -230
  171. package/src/cjs-shim.js +12 -0
  172. package/src/electron.ts +237 -46
  173. package/src/esbuildConfigs/features.ts +18 -0
  174. package/src/esbuildConfigs/index.ts +22 -0
  175. package/src/esbuildConfigs/node.ts +59 -0
  176. package/src/esbuildConfigs/report.ts +51 -0
  177. package/src/esbuildConfigs/tests.ts +20 -0
  178. package/src/esbuildConfigs/web.ts +73 -0
  179. package/src/lib/abstractBase.ts +459 -0
  180. package/src/lib/basebuilder.ts +253 -0
  181. package/src/lib/browser.ts +34 -0
  182. package/src/lib/classBuilder.ts +137 -0
  183. package/src/lib/core.ts +182 -0
  184. package/src/lib/index.ts +116 -0
  185. package/src/nodeWriterElectron.ts +71 -0
  186. package/src/preload.ts +23 -21
  187. package/src/report.html.ts +29 -0
  188. package/src/web.html.ts +20 -0
  189. package/tests/Rectangle.test.ts +189 -0
  190. package/tsconfig.json +19 -6
  191. package/tsconfig.module.json +15 -4
  192. package/tsconfig.types.json +14 -4
  193. package/yarn-error.log +3144 -0
  194. package/dist/common/core.js +0 -397
  195. package/dist/common/subPackages/react/jsx/index.js +0 -26
  196. package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
  197. package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
  198. package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
  199. package/dist/module/Report.js +0 -186
  200. package/dist/module/core.js +0 -388
  201. package/dist/module/subPackages/react/jsx/index.js +0 -22
  202. package/dist/module/subPackages/react/jsx/node.js +0 -5
  203. package/dist/module/subPackages/react/jsx/web.js +0 -5
  204. package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
  205. package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
  206. package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
  207. package/dist/types/core.d.ts +0 -220
  208. package/dist/types/subPackages/react/component/node.d.ts +0 -12
  209. package/dist/types/subPackages/react/component/web.d.ts +0 -12
  210. package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
  211. package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
  212. package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
  213. package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
  214. package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
  215. package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
  216. package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
  217. package/dist/types/subPackages/react-test-renderer/component/node.d.ts +0 -9
  218. package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
  219. package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
  220. package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
  221. package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
  222. package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
  223. package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  224. package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  225. package/src/core.ts +0 -1399
  226. package/src/subPackages/react/component/web.ts +0 -80
  227. package/src/subPackages/react/jsx/index.ts +0 -64
  228. package/src/subPackages/react/jsx/node.ts +0 -29
  229. package/src/subPackages/react/jsx/web.ts +0 -29
  230. package/src/subPackages/react-dom/jsx/node.ts +0 -145
  231. package/src/subPackages/react-test-renderer/component/node.ts +0 -30
  232. package/src/subPackages/react-test-renderer/component/web.ts +0 -30
  233. package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
  234. package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
  235. package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
  236. package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
  237. /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  238. /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  239. /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  240. /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  241. /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
@@ -1,47 +1,191 @@
1
- import { app, BrowserWindow, ipcMain } from "electron";
1
+ import { app, BrowserWindow, utilityProcess } from "electron";
2
+ import pie from "puppeteer-in-electron";
3
+ import puppeteer from "puppeteer-core";
4
+ import fs from "fs";
2
5
  import path from "path";
3
- import url from "url";
4
- let win;
5
- function createWindow() {
6
- win = new BrowserWindow({
7
- webPreferences: {
8
- devTools: true,
9
- nodeIntegration: true,
10
- nodeIntegrationInWorker: true,
11
- contextIsolation: false,
12
- preload: path.join(app.getAppPath(), 'preload.js'),
13
- sandbox: false
14
- },
15
- width: 800,
16
- height: 600,
17
- show: true,
6
+ import { jsonc } from 'jsonc';
7
+ const remoteMain = require("@electron/remote/main");
8
+ remoteMain.initialize();
9
+ const main = async () => {
10
+ const configs = jsonc.parse((await fs.readFileSync("./docs/testeranto.json")).toString());
11
+ const loadReport = (configs) => {
12
+ const win = new BrowserWindow({
13
+ show: true,
14
+ webPreferences: {
15
+ offscreen: false,
16
+ devTools: true,
17
+ }
18
+ });
19
+ win.loadFile(`/${configs.buildDir}/report.html`).then(async (x) => {
20
+ // pie.connect(app, puppeteer).then(async (browser) => {
21
+ // pie.getPage(browser, win).then(async (page) => {
22
+ // await page.screenshot({
23
+ // path: 'electron-puppeteer-screenshot1.jpg'
24
+ // });
25
+ // })
26
+ // })
27
+ });
28
+ };
29
+ const launchNode = (t, x) => {
30
+ var _a;
31
+ const f = x.replace(".ts", ".mjs");
32
+ const a = JSON.stringify({
33
+ scheduled: true,
34
+ name: x,
35
+ ports: [],
36
+ fs: path.resolve(configs.buildDir, "node", t),
37
+ });
38
+ console.log("launchNode", f, a);
39
+ const child = utilityProcess.fork(f, [a], {});
40
+ child.postMessage({ message: 'hello' });
41
+ child.on('message', (data) => {
42
+ console.log("from child", data);
43
+ launchWebSecondary(process.cwd() + data);
44
+ });
45
+ child.on('exit', (data) => {
46
+ console.log("node process ended with: ", data);
47
+ fileStream.close();
48
+ });
49
+ // child.stdout
50
+ // child..on("", (data) => {
51
+ // console.log("from child", data) // hello world!
52
+ // launchWebSecondary(process.cwd() + data);
53
+ // })
54
+ // Create a write stream for the file
55
+ const fileStream = fs.createWriteStream('errors.txt');
56
+ // Pipe the child process's stdout to the file
57
+ (_a = child.stdout) === null || _a === void 0 ? void 0 : _a.pipe(fileStream);
58
+ // // Handle errors
59
+ // child.on('error', (err) => {
60
+ // console.error('Error spawning child process:', err);
61
+ // });
62
+ // fileStream.on('error', (err) => {
63
+ // console.error('Error writing to file:', err);
64
+ // });
65
+ // // Log a message when the child process exits
66
+ // child.on('close', (code) => {
67
+ // console.log(`Child process exited with code ${code}`);
68
+ // });
69
+ // console.log("child", child);
70
+ // child.stdout?.on("data", (x) => {
71
+ // console.log("x", x)
72
+ // })
73
+ };
74
+ const launchWebSecondary = (htmlFile) => {
75
+ console.log("launchWebSecondary", htmlFile);
76
+ const subWin = new BrowserWindow({
77
+ show: true,
78
+ webPreferences: {
79
+ nodeIntegration: true,
80
+ nodeIntegrationInWorker: true,
81
+ contextIsolation: false,
82
+ preload: path.join(app.getAppPath(), 'preload.js'),
83
+ offscreen: false,
84
+ devTools: false,
85
+ }
86
+ });
87
+ remoteMain.enable(subWin.webContents);
88
+ subWin.webContents.openDevTools();
89
+ subWin.loadFile(htmlFile);
90
+ };
91
+ const launchWeb = (t, changedFile) => {
92
+ console.log("launchWeb", changedFile);
93
+ const subWin = new BrowserWindow({
94
+ show: true,
95
+ webPreferences: {
96
+ nodeIntegration: true,
97
+ nodeIntegrationInWorker: true,
98
+ contextIsolation: false,
99
+ preload: path.join(app.getAppPath(), 'preload.js'),
100
+ offscreen: false,
101
+ devTools: true,
102
+ }
103
+ });
104
+ remoteMain.enable(subWin.webContents);
105
+ // subWin.webContents.openDevTools()
106
+ const htmlFile = changedFile.split(".").slice(0, -1).concat("html").join(".");
107
+ subWin.loadFile(htmlFile, {
108
+ query: {
109
+ requesting: encodeURIComponent(JSON.stringify({
110
+ name: changedFile,
111
+ ports: [].toString(),
112
+ fs: path.resolve(configs.buildDir, "web", t),
113
+ }))
114
+ }
115
+ });
116
+ };
117
+ const watcher = (test, runtime) => {
118
+ return path.normalize(`${configs.buildDir}/${runtime}/${test.split('.').slice(0, -1).concat('mjs').join('.')}`);
119
+ };
120
+ const changer = (f) => {
121
+ return path.normalize(`${configs.buildDir}/${f}`);
122
+ };
123
+ const changer2 = (f, r) => {
124
+ return path.normalize(`${configs.buildDir}/${r}/${f}`);
125
+ };
126
+ pie.initialize(app, 2999).then(async () => {
127
+ app.on("ready", () => {
128
+ loadReport(configs);
129
+ console.log("running all the tests once initially");
130
+ ;
131
+ configs.modules.forEach((t) => {
132
+ if (t.runtime === "node") {
133
+ launchNode(t.test, changer2(t.test, "node"));
134
+ }
135
+ else if (t.runtime === "web") {
136
+ launchWeb(t.test, changer2(t.test, "web"));
137
+ }
138
+ else {
139
+ console.error("runtime makes no sense", t.runtime);
140
+ }
141
+ });
142
+ console.log("ready and watching for changes...", configs.buildDir);
143
+ fs.watch(configs.buildDir, {
144
+ recursive: true,
145
+ }, (eventType, changedFile) => {
146
+ console.log(eventType, changedFile);
147
+ if (changedFile) {
148
+ configs.modules.forEach((t) => {
149
+ if (watcher(t.test, t.runtime) === changer(changedFile)) {
150
+ if (t.runtime === "node") {
151
+ launchNode(t.test, changer(changedFile));
152
+ }
153
+ else if (t.runtime === "web") {
154
+ launchWeb(t.test, changer(changedFile));
155
+ }
156
+ else {
157
+ console.error("runtime makes no sense", t.runtime);
158
+ }
159
+ }
160
+ });
161
+ }
162
+ });
163
+ });
18
164
  });
19
- const u = url.format({
20
- pathname: path.join(process.cwd(), process.argv[2]),
21
- protocol: "file:",
22
- slashes: true,
23
- query: {
24
- requesting: encodeURIComponent(process.argv[3]),
25
- }
26
- });
27
- console.log("loading", u);
28
- win.loadURL(u);
29
- win.webContents.openDevTools();
30
- }
31
- app.on("ready", createWindow);
32
- ipcMain.handle('web-log', (x, message) => {
33
- console.log("web-log)", message);
34
- });
35
- ipcMain.handle('web-error', (x, message) => {
36
- console.log("web-error)", message);
37
- });
38
- ipcMain.handle('web-warn', (x, message) => {
39
- console.log("web-warn)", message);
40
- });
41
- ipcMain.handle('web-info', (x, message) => {
42
- console.log("web-info)", message);
43
- });
44
- ipcMain.handle('quit-app', (x, failed) => {
45
- console.log("quit-app", failed);
46
- // app.exit(failed);
47
- });
165
+ await pie.connect(app, puppeteer);
166
+ };
167
+ main();
168
+ // ipcMain.handle('web-log', (x, message: string) => {
169
+ // console.log("web-log)", message);
170
+ // });
171
+ // ipcMain.handle('web-error', (x, message: string) => {
172
+ // console.log("web-error)", message);
173
+ // });
174
+ // ipcMain.handle('web-warn', (x, message: string) => {
175
+ // console.log("web-warn)", message);
176
+ // });
177
+ // ipcMain.handle('web-info', (x, message: string) => {
178
+ // console.log("web-info)", message);
179
+ // });
180
+ // ipcMain.handle('quit-app', (x, failed: number) => {
181
+ // console.log("quit-app", failed);
182
+ // app.exit(failed);
183
+ // });
184
+ // process.stdin.on("data", (configTests) => {
185
+ // main(JSON.parse(configTests.toString()) as ITestTypes[]);
186
+ // });
187
+ // const watchables = (tests: ITestTypes[]) => {
188
+ // return tests.map((t) => {
189
+ // return [t[1], `dist/${t[1]}/${t[0].replace(".mts", ".mjs")}`]
190
+ // })
191
+ // }
@@ -0,0 +1,12 @@
1
+ export default (config) => {
2
+ return {
3
+ bundle: true,
4
+ entryPoints: [config.features],
5
+ minify: config.minify === true,
6
+ outbase: config.outbase,
7
+ write: true,
8
+ outfile: `${config.outdir}/features.test.js`,
9
+ // external: ["graphology"],
10
+ format: "esm",
11
+ };
12
+ };
@@ -0,0 +1,18 @@
1
+ export default (config) => {
2
+ return {
3
+ target: "esnext",
4
+ format: "esm",
5
+ splitting: true,
6
+ outExtension: { '.js': '.mjs' },
7
+ outbase: config.outbase,
8
+ jsx: 'transform',
9
+ bundle: true,
10
+ minify: config.minify === true,
11
+ write: true,
12
+ loader: {
13
+ '.js': 'jsx',
14
+ '.png': 'binary',
15
+ '.jpg': 'binary',
16
+ },
17
+ };
18
+ };
@@ -0,0 +1,30 @@
1
+ import baseEsBuildConfig from "./index.js";
2
+ // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
3
+ export default (config, entryPoints) => {
4
+ return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], supported: {
5
+ "dynamic-import": true
6
+ }, define: {
7
+ "process.env.FLUENTFFMPEG_COV": "0"
8
+ }, absWorkingDir: process.cwd(), banner: {
9
+ js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
10
+ }, platform: "node", external: [
11
+ "testeranto.json",
12
+ "features.test.js",
13
+ "react",
14
+ "events",
15
+ // "ganache"
16
+ ...config.externals
17
+ ], entryPoints: [...entryPoints], plugins: [
18
+ ...(config.nodePlugins || []),
19
+ {
20
+ name: 'rebuild-notify',
21
+ setup(build) {
22
+ build.onEnd(result => {
23
+ console.log(`node build ended with ${result.errors.length} errors`);
24
+ console.log(result);
25
+ result.errors.length !== 0 && process.exit(-1);
26
+ });
27
+ }
28
+ },
29
+ ] });
30
+ };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // import { jsonc } from "jsonc";
3
+ // import { IBaseConfig, IJsonConfig } from "../Types";
4
+ // import baseEsBuildConfig from "./index.js";
5
+ // import fs from "fs"
6
+ // import { BuildOptions } from "esbuild";
7
+ // // import { CssModulesPlugin } from 'esbuild-css-modules-plugin';
8
+ // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
9
+ // export default (config: IBaseConfig): BuildOptions => {
10
+ // return {
11
+ // bundle: true,
12
+ // entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
13
+ // minify: config.minify === true,
14
+ // outbase: config.outbase,
15
+ // write: true,
16
+ // outfile: `${jsonConfig.outdir}/report.js`,
17
+ // external: [
18
+ // "tests.json",
19
+ // "features.test.js"
20
+ // ],
21
+ // // plugins: [
22
+ // // CssModulesPlugin({
23
+ // // // @see https://github.com/indooorsman/esbuild-css-modules-plugin/blob/main/index.d.ts for more details
24
+ // // force: true,
25
+ // // emitDeclarationFile: true,
26
+ // // localsConvention: 'camelCaseOnly',
27
+ // // namedExports: true,
28
+ // // inject: false
29
+ // // })
30
+ // // ]
31
+ // }
32
+ // // return {
33
+ // // bundle: true,
34
+ // // entryPoints: [
35
+ // // "./node_modules/testeranto/dist/module/Report.js",
36
+ // // jsonConfig.features
37
+ // // ],
38
+ // // minify: config.minify === true,
39
+ // // outbase: ".",
40
+ // // outdir: 'docs',
41
+ // // write: true,
42
+ // // // outfile: `${jsonConfig.outdir}/Report.js`,
43
+ // // external: [
44
+ // // "features.test.js",
45
+ // // "testeranto.json"
46
+ // // ]
47
+ // // }
48
+ // }
@@ -0,0 +1,12 @@
1
+ // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
2
+ export default (config) => {
3
+ return {
4
+ bundle: true,
5
+ entryPoints: [config.features],
6
+ minify: config.minify === true,
7
+ outbase: config.outbase,
8
+ write: true,
9
+ outfile: `${config.outdir}/tests.test.js`,
10
+ // external: ["graphology"]
11
+ };
12
+ };
@@ -0,0 +1,45 @@
1
+ import path from "path";
2
+ import baseEsBuildConfig from "./index.js";
3
+ // const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
4
+ export default (config, entryPoints) => {
5
+ return Object.assign(Object.assign({}, baseEsBuildConfig(config)), {
6
+ // inject: ['./node_modules/testeranto/dist/cjs-shim.js'],
7
+ // banner: {
8
+ // js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
9
+ // },
10
+ outdir: config.outdir + "/web", alias: {
11
+ react: path.resolve("./node_modules/react")
12
+ }, external: [
13
+ "testeranto.json",
14
+ "features.test.ts",
15
+ // "url",
16
+ "react",
17
+ "electron",
18
+ "path",
19
+ "fs",
20
+ "stream",
21
+ "http",
22
+ "constants",
23
+ "net",
24
+ "assert",
25
+ "tls",
26
+ "os",
27
+ "child_process",
28
+ "readline",
29
+ "zlib",
30
+ "crypto",
31
+ "https"
32
+ ], platform: "browser", entryPoints: [...entryPoints], plugins: [
33
+ ...(config.webPlugins || []),
34
+ {
35
+ name: 'rebuild-notify',
36
+ setup(build) {
37
+ build.onEnd(result => {
38
+ console.log(`web build ended with ${result.errors.length} errors`);
39
+ console.log(result);
40
+ result.errors.length !== 0 && process.exit(-1);
41
+ });
42
+ }
43
+ },
44
+ ] });
45
+ };
@@ -0,0 +1,185 @@
1
+ export class BaseSuite {
2
+ constructor(name, index, givens = {}, checks = []) {
3
+ this.name = name;
4
+ this.index = index;
5
+ this.givens = givens;
6
+ this.checks = checks;
7
+ this.fails = [];
8
+ }
9
+ toObj() {
10
+ return {
11
+ name: this.name,
12
+ givens: Object.keys(this.givens).map((k) => this.givens[k].toObj()),
13
+ fails: this.fails,
14
+ };
15
+ }
16
+ setup(s, artifactory, tr, utils) {
17
+ return new Promise((res) => res(s));
18
+ }
19
+ assertThat(t) {
20
+ // console.log("base assertThat")
21
+ return t;
22
+ }
23
+ async run(input, testResourceConfiguration, artifactory, tLog, utils) {
24
+ this.testResourceConfiguration = testResourceConfiguration;
25
+ tLog("test resources: ", testResourceConfiguration);
26
+ const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
27
+ const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, utils);
28
+ tLog("\nSuite:", this.index, this.name);
29
+ for (const k of Object.keys(this.givens)) {
30
+ const giver = this.givens[k];
31
+ try {
32
+ this.store = await giver.give(subject, k, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, utils);
33
+ }
34
+ catch (e) {
35
+ console.error(e);
36
+ this.fails.push(giver);
37
+ return this;
38
+ }
39
+ }
40
+ for (const [ndx, thater] of this.checks.entries()) {
41
+ await thater.check(subject, thater.name, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, utils);
42
+ }
43
+ // @TODO fix me
44
+ for (const k of Object.keys(this.givens)) {
45
+ const giver = this.givens[k];
46
+ giver.afterAll(this.store, artifactory, utils);
47
+ }
48
+ ////////////////
49
+ return this;
50
+ }
51
+ }
52
+ export class BaseGiven {
53
+ constructor(name, features, whens, thens, givenCB, initialValues) {
54
+ this.name = name;
55
+ this.features = features;
56
+ this.whens = whens;
57
+ this.thens = thens;
58
+ this.givenCB = givenCB;
59
+ this.initialValues = initialValues;
60
+ }
61
+ beforeAll(store, artifactory) {
62
+ return store;
63
+ }
64
+ afterAll(store, artifactory, utils) {
65
+ return store;
66
+ }
67
+ toObj() {
68
+ return {
69
+ name: this.name,
70
+ whens: this.whens.map((w) => w.toObj()),
71
+ thens: this.thens.map((t) => t.toObj()),
72
+ error: this.error ? [this.error, this.error.stack] : null,
73
+ features: this.features,
74
+ };
75
+ }
76
+ async afterEach(store, key, artifactory) {
77
+ return store;
78
+ }
79
+ async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
80
+ tLog(`\n Given: ${this.name}`);
81
+ const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
82
+ try {
83
+ this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB);
84
+ // tLog(`\n Given this.store`, this.store);
85
+ for (const whenStep of this.whens) {
86
+ await whenStep.test(this.store, testResourceConfiguration, tLog, utils);
87
+ }
88
+ for (const thenStep of this.thens) {
89
+ const t = await thenStep.test(this.store, testResourceConfiguration, tLog, utils);
90
+ tester(t);
91
+ }
92
+ }
93
+ catch (e) {
94
+ this.error = e;
95
+ tLog(e);
96
+ tLog("\u0007"); // bell
97
+ // throw e;
98
+ }
99
+ finally {
100
+ try {
101
+ await this.afterEach(this.store, key, givenArtifactory);
102
+ }
103
+ catch (e) {
104
+ console.error("afterEach failed! no error will be recorded!", e);
105
+ }
106
+ }
107
+ return this.store;
108
+ }
109
+ }
110
+ export class BaseWhen {
111
+ constructor(name, whenCB) {
112
+ this.name = name;
113
+ this.whenCB = whenCB;
114
+ }
115
+ toObj() {
116
+ return {
117
+ name: this.name,
118
+ error: this.error,
119
+ };
120
+ }
121
+ async test(store, testResourceConfiguration, tLog, utils) {
122
+ tLog(" When:", this.name);
123
+ try {
124
+ return await this.andWhen(store, this.whenCB, testResourceConfiguration);
125
+ }
126
+ catch (e) {
127
+ this.error = true;
128
+ throw e;
129
+ }
130
+ }
131
+ }
132
+ export class BaseThen {
133
+ constructor(name, thenCB) {
134
+ this.name = name;
135
+ this.thenCB = thenCB;
136
+ }
137
+ toObj() {
138
+ return {
139
+ name: this.name,
140
+ error: this.error,
141
+ };
142
+ }
143
+ async test(store, testResourceConfiguration, tLog, utils) {
144
+ tLog(" Then:", this.name);
145
+ try {
146
+ const x = (await this.butThen(store, this.thenCB, testResourceConfiguration));
147
+ return x;
148
+ }
149
+ catch (e) {
150
+ console.log("test failed", e);
151
+ this.error = true;
152
+ throw e;
153
+ }
154
+ }
155
+ }
156
+ export class BaseCheck {
157
+ constructor(name, features, checkCB, whens, thens) {
158
+ this.name = name;
159
+ this.features = features;
160
+ this.checkCB = checkCB;
161
+ this.whens = whens;
162
+ this.thens = thens;
163
+ }
164
+ async afterEach(store, key, cb) {
165
+ return;
166
+ }
167
+ async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
168
+ tLog(`\n Check: ${this.name}`);
169
+ const store = await this.checkThat(subject, testResourceConfiguration, artifactory);
170
+ await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
171
+ a[key] = async (payload) => {
172
+ return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, utils);
173
+ };
174
+ return a;
175
+ }, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
176
+ a[key] = async (payload) => {
177
+ const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, utils);
178
+ tester(t);
179
+ };
180
+ return a;
181
+ }, {}));
182
+ await this.afterEach(store, key);
183
+ return;
184
+ }
185
+ }
@@ -0,0 +1,82 @@
1
+ export class BaseBuilder {
2
+ constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, checkOverides, logWriter, testResourceRequirement, testSpecification) {
3
+ this.input = input;
4
+ this.artifacts = [];
5
+ this.artifacts = [];
6
+ this.testResourceRequirement = testResourceRequirement;
7
+ this.suitesOverrides = suitesOverrides;
8
+ this.givenOverides = givenOverides;
9
+ this.whenOverides = whenOverides;
10
+ this.thenOverides = thenOverides;
11
+ this.checkOverides = checkOverides;
12
+ this.testSpecification = testSpecification;
13
+ this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
14
+ const suiteRunner = (suite, utils) => async (testResourceConfiguration, tLog, utils) => {
15
+ return await suite.run(input, testResourceConfiguration, (fPath, value) => logWriter.testArtiFactoryfileWriter(tLog, (p) => {
16
+ this.artifacts.push(p);
17
+ })(testResourceConfiguration.fs + "/" + fPath, value), tLog, utils);
18
+ };
19
+ this.testJobs = this.specs.map((suite, utils) => {
20
+ const runner = suiteRunner(suite, utils);
21
+ return {
22
+ test: suite,
23
+ testResourceRequirement,
24
+ toObj: () => {
25
+ return suite.toObj();
26
+ },
27
+ runner,
28
+ receiveTestResourceConfig: async function (testResourceConfiguration = {
29
+ name: "",
30
+ fs: ".",
31
+ ports: [],
32
+ scheduled: false
33
+ }, y) {
34
+ console.log(`testResourceConfiguration ${JSON.stringify(testResourceConfiguration, null, 2)}`);
35
+ await logWriter.mkdirSync(testResourceConfiguration.fs);
36
+ logWriter.writeFileSync(`${testResourceConfiguration.fs}/tests.json`, JSON.stringify(this.toObj(), null, 2));
37
+ const logFilePath = `${testResourceConfiguration.fs}/log.txt`;
38
+ const access = await logWriter.createWriteStream(logFilePath);
39
+ const tLog = (...l) => {
40
+ // console.log(...l);
41
+ access.write(`${l.toString()}\n`);
42
+ };
43
+ const suiteDone = await runner(testResourceConfiguration, tLog, y);
44
+ const resultsFilePath = (`${testResourceConfiguration.fs}/results.json`);
45
+ logWriter.writeFileSync(resultsFilePath, JSON.stringify(suiteDone.toObj(), null, 2));
46
+ const logPromise = new Promise((res, rej) => {
47
+ access.on("finish", () => { res(true); });
48
+ });
49
+ access.end();
50
+ const numberOfFailures = Object.keys(suiteDone.givens).filter((k) => {
51
+ // console.log(`suiteDone.givens[k].error`, suiteDone.givens[k].error);
52
+ return suiteDone.givens[k].error;
53
+ }).length;
54
+ console.log(`exiting gracefully with ${numberOfFailures} failures.`);
55
+ return {
56
+ failed: numberOfFailures,
57
+ artifacts: this.artifacts || [],
58
+ logPromise
59
+ };
60
+ },
61
+ };
62
+ });
63
+ }
64
+ Specs() {
65
+ return this.specs;
66
+ }
67
+ Suites() {
68
+ return this.suitesOverrides;
69
+ }
70
+ Given() {
71
+ return this.givenOverides;
72
+ }
73
+ When() {
74
+ return this.whenOverides;
75
+ }
76
+ Then() {
77
+ return this.thenOverides;
78
+ }
79
+ Check() {
80
+ return this.checkOverides;
81
+ }
82
+ }