testeranto 0.62.0 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +38 -26
  2. package/dist/cjs-shim.js +2 -2
  3. package/dist/common/Node.js +14 -51
  4. package/dist/common/PM/index.js +71 -0
  5. package/dist/common/PM/main.js +361 -0
  6. package/dist/common/PM/node.js +176 -0
  7. package/dist/common/PM/web.js +174 -0
  8. package/dist/common/Project.js +121 -266
  9. package/dist/common/Puppeteer.js +109 -0
  10. package/dist/common/Reporter.js +119 -0
  11. package/dist/common/Scheduler.js +1 -0
  12. package/dist/common/SubPackages/puppeteer.js +3 -1
  13. package/dist/common/SubPackages/react-dom/component/web.js +98 -45
  14. package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
  15. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  16. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
  17. package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
  18. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
  19. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
  20. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  21. package/dist/common/Types.js +2 -32
  22. package/dist/common/Web.js +25 -37
  23. package/dist/common/esbuildConfigs/index.js +5 -5
  24. package/dist/common/esbuildConfigs/node.js +17 -15
  25. package/dist/common/esbuildConfigs/report.js +12 -47
  26. package/dist/common/esbuildConfigs/tests.js +0 -1
  27. package/dist/common/esbuildConfigs/web.js +17 -12
  28. package/dist/common/lib/abstractBase.js +190 -35
  29. package/dist/common/lib/basebuilder.js +56 -29
  30. package/dist/common/lib/classBuilder.js +8 -5
  31. package/dist/common/lib/core.js +42 -17
  32. package/dist/common/lib/index.js +11 -8
  33. package/dist/common/lib/types.js +2 -0
  34. package/dist/common/preload.js +14 -28
  35. package/dist/common/puppeteerConfiger.js +24 -0
  36. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  37. package/dist/module/Node.js +14 -51
  38. package/dist/module/PM/index.js +67 -0
  39. package/dist/module/PM/main.js +331 -0
  40. package/dist/module/PM/node.js +168 -0
  41. package/dist/module/PM/web.js +167 -0
  42. package/dist/module/Project.js +122 -267
  43. package/dist/module/Puppeteer.js +104 -0
  44. package/dist/module/Reporter.js +114 -0
  45. package/dist/module/Scheduler.js +1 -0
  46. package/dist/module/SubPackages/puppeteer.js +3 -1
  47. package/dist/module/SubPackages/react/jsx/node.js +1 -1
  48. package/dist/module/SubPackages/react/jsx/web.js +1 -1
  49. package/dist/module/SubPackages/react-dom/component/node.js +2 -2
  50. package/dist/module/SubPackages/react-dom/component/web.js +98 -45
  51. package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
  52. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  53. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  54. package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
  55. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
  56. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
  57. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  58. package/dist/module/Types.js +3 -30
  59. package/dist/module/Web.js +26 -38
  60. package/dist/module/esbuildConfigs/index.js +5 -5
  61. package/dist/module/esbuildConfigs/node.js +17 -15
  62. package/dist/module/esbuildConfigs/report.js +11 -48
  63. package/dist/module/esbuildConfigs/tests.js +0 -1
  64. package/dist/module/esbuildConfigs/web.js +17 -12
  65. package/dist/module/lib/abstractBase.js +190 -35
  66. package/dist/module/lib/basebuilder.js +56 -29
  67. package/dist/module/lib/classBuilder.js +8 -5
  68. package/dist/module/lib/core.js +44 -19
  69. package/dist/module/lib/index.js +11 -8
  70. package/dist/module/preload.js +15 -27
  71. package/dist/module/puppeteerConfiger.js +19 -0
  72. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  73. package/dist/prebuild/Report.css +1616 -584
  74. package/dist/prebuild/Report.js +2635 -2506
  75. package/dist/types/Node.d.ts +3 -2
  76. package/dist/types/PM/index.d.ts +19 -0
  77. package/dist/types/PM/main.d.ts +28 -0
  78. package/dist/types/PM/node.d.ts +26 -0
  79. package/dist/types/PM/web.d.ts +24 -0
  80. package/dist/types/Project.d.ts +1 -2
  81. package/dist/types/Puppeteer.d.ts +1 -0
  82. package/dist/types/Reporter.d.ts +1 -0
  83. package/dist/types/Scheduler.d.ts +0 -0
  84. package/dist/types/SubPackages/puppeteer.d.ts +3 -3
  85. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  86. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  87. package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
  88. package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
  89. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  90. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  91. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  92. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
  93. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
  94. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
  95. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
  96. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
  97. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
  98. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  99. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  100. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
  101. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
  102. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
  103. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
  104. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
  105. package/dist/types/Types.d.ts +19 -100
  106. package/dist/types/Web.d.ts +3 -2
  107. package/dist/types/esbuildConfigs/features.d.ts +1 -1
  108. package/dist/types/esbuildConfigs/index.d.ts +1 -1
  109. package/dist/types/esbuildConfigs/node.d.ts +1 -1
  110. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  111. package/dist/types/esbuildConfigs/tests.d.ts +1 -1
  112. package/dist/types/esbuildConfigs/web.d.ts +1 -1
  113. package/dist/types/lib/abstractBase.d.ts +26 -24
  114. package/dist/types/lib/basebuilder.d.ts +10 -7
  115. package/dist/types/lib/classBuilder.d.ts +4 -3
  116. package/dist/types/lib/core.d.ts +5 -4
  117. package/dist/types/lib/index.d.ts +7 -5
  118. package/dist/types/lib/types.d.ts +62 -0
  119. package/dist/types/preload.d.ts +0 -1
  120. package/dist/types/puppeteerConfiger.d.ts +4 -0
  121. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  122. package/package.json +6 -7
  123. package/src/Node.ts +30 -85
  124. package/src/PM/index.ts +102 -0
  125. package/src/PM/main.ts +420 -0
  126. package/src/PM/node.ts +515 -0
  127. package/src/PM/web.ts +497 -0
  128. package/src/Project.ts +183 -619
  129. package/src/Puppeteer.ts +131 -0
  130. package/src/Report.tsx +158 -44
  131. package/src/Reporter.ts +134 -0
  132. package/src/Scheduler.ts +0 -0
  133. package/src/SubPackages/puppeteer.ts +19 -14
  134. package/src/SubPackages/react/component/node.ts +20 -32
  135. package/src/SubPackages/react/component/web.ts +20 -30
  136. package/src/SubPackages/react/jsx/index.ts +13 -24
  137. package/src/SubPackages/react/jsx/node.ts +5 -8
  138. package/src/SubPackages/react/jsx/web.ts +10 -8
  139. package/src/SubPackages/react-dom/component/node.ts +17 -23
  140. package/src/SubPackages/react-dom/component/web.ts +134 -95
  141. package/src/SubPackages/react-dom/jsx/web.ts +41 -48
  142. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
  143. package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
  144. package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
  145. package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
  146. package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
  147. package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
  148. package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
  149. package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
  150. package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
  151. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
  152. package/src/Types.ts +73 -307
  153. package/src/Web.ts +40 -81
  154. package/src/cjs-shim.js +2 -2
  155. package/src/esbuildConfigs/features.ts +3 -4
  156. package/src/esbuildConfigs/index.ts +8 -8
  157. package/src/esbuildConfigs/node.ts +21 -20
  158. package/src/esbuildConfigs/report.ts +15 -51
  159. package/src/esbuildConfigs/tests.ts +3 -9
  160. package/src/esbuildConfigs/web.ts +22 -20
  161. package/src/lib/abstractBase.ts +312 -164
  162. package/src/lib/basebuilder.ts +123 -127
  163. package/src/lib/classBuilder.ts +30 -48
  164. package/src/lib/core.ts +115 -84
  165. package/src/lib/index.ts +58 -56
  166. package/src/lib/types.ts +197 -0
  167. package/src/preload.ts +14 -30
  168. package/src/puppeteerConfiger.ts +26 -0
  169. package/src/web.html.ts +1 -1
  170. package/dist/common/NodeWriter.js +0 -56
  171. package/dist/common/electron.js +0 -196
  172. package/dist/common/lib/browser.js +0 -26
  173. package/dist/common/nodeWriterElectron.js +0 -55
  174. package/dist/module/NodeWriter.js +0 -50
  175. package/dist/module/electron.js +0 -191
  176. package/dist/module/lib/browser.js +0 -22
  177. package/dist/module/nodeWriterElectron.js +0 -52
  178. package/dist/types/NodeWriter.d.ts +0 -2
  179. package/dist/types/lib/browser.d.ts +0 -6
  180. package/dist/types/nodeWriterElectron.d.ts +0 -2
  181. package/src/NodeWriter.ts +0 -69
  182. package/src/electron.ts +0 -250
  183. package/src/lib/browser.ts +0 -34
  184. package/src/nodeWriterElectron.ts +0 -71
  185. package/yarn-error.log +0 -3144
  186. /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
@@ -0,0 +1,131 @@
1
+ import readline from "readline";
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import { jsonc } from "jsonc";
5
+ import { v4 as uuidv4 } from "uuid";
6
+
7
+ import { IBuiltConfig, IRunTime } from "./lib/types";
8
+
9
+ import { PM_Main } from "./PM/main.js";
10
+
11
+ var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
12
+
13
+ const node2web: Record<string, string[]> = {};
14
+ const web2node: Record<string, string[]> = {};
15
+ const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
16
+
17
+ readline.emitKeypressEvents(process.stdin);
18
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
19
+
20
+ console.log("\n Puppeteer is running. Press 'q' to quit\n");
21
+ process.stdin.on("keypress", (str, key) => {
22
+ if (key.name === "q") {
23
+ process.exit();
24
+ }
25
+ });
26
+
27
+ const main = async () => {
28
+ const configs = jsonc.parse(
29
+ (await fs.readFileSync("./docs/testeranto.json")).toString()
30
+ ) as IBuiltConfig;
31
+
32
+ const pm = new PM_Main(configs);
33
+
34
+ await pm.startPuppeteer(
35
+ {
36
+ waitForInitialPage: false,
37
+ executablePath: "/opt/homebrew/bin/chromium",
38
+ headless: true,
39
+ dumpio: true,
40
+ args: [
41
+ "--allow-file-access-from-files",
42
+ "--allow-running-insecure-content",
43
+ "--auto-open-devtools-for-tabs",
44
+ "--disable-dev-shm-usage",
45
+ "--disable-extensions",
46
+ "--disable-gpu",
47
+ "--disable-setuid-sandbox",
48
+ "--disable-site-isolation-trials",
49
+ "--disable-web-security",
50
+ "--disable-web-security",
51
+ "--no-first-run",
52
+ "--no-sandbox",
53
+ "--no-startup-window",
54
+ // "--no-zygote",
55
+ "--reduce-security-for-testing",
56
+ "--remote-allow-origins=*",
57
+ "--unsafely-treat-insecure-origin-as-secure=*",
58
+ // "--disable-features=IsolateOrigins",
59
+ // "--remote-allow-origins=ws://localhost:3234",
60
+ // "--single-process",
61
+ // "--unsafely-treat-insecure-origin-as-secure",
62
+ // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
63
+ `--remote-debugging-port=3234`,
64
+
65
+ // "--disk-cache-dir=/dev/null",
66
+ // "--disk-cache-size=1",
67
+ // "--start-maximized",
68
+ ],
69
+ },
70
+ "."
71
+ );
72
+
73
+ const destinationOfRuntime = (f: string, r: IRunTime) => {
74
+ return path
75
+ .normalize(`${configs.buildDir}/${r}/${f}`)
76
+ .split(".")
77
+ .slice(0, -1)
78
+ .join(".");
79
+ };
80
+
81
+ configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
82
+ if (runtime === "node") {
83
+ pm.launchNode(test, destinationOfRuntime(test, "node"));
84
+ } else if (runtime === "web") {
85
+ pm.launchWeb(test, destinationOfRuntime(test, "web"));
86
+ } else {
87
+ console.error("runtime makes no sense", runtime);
88
+ }
89
+ });
90
+
91
+ console.log("ready and watching for changes...", configs.buildDir);
92
+ fs.watch(
93
+ configs.buildDir,
94
+ {
95
+ recursive: true,
96
+ },
97
+ (eventType, changedFile) => {
98
+ if (changedFile) {
99
+ configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
100
+ if (eventType === "change" || eventType === "rename") {
101
+ if (
102
+ changedFile ===
103
+ test
104
+ .replace("./", "node/")
105
+ .split(".")
106
+ .slice(0, -1)
107
+ .concat("mjs")
108
+ .join(".")
109
+ ) {
110
+ pm.launchNode(test, destinationOfRuntime(test, "node"));
111
+ }
112
+
113
+ if (
114
+ changedFile ===
115
+ test
116
+ .replace("./", "web/")
117
+ .split(".")
118
+ .slice(0, -1)
119
+ .concat("mjs")
120
+ .join(".")
121
+ ) {
122
+ pm.launchWeb(test, destinationOfRuntime(test, "web"));
123
+ }
124
+ }
125
+ });
126
+ }
127
+ }
128
+ );
129
+ };
130
+
131
+ main();
package/src/Report.tsx CHANGED
@@ -10,8 +10,8 @@ import { Sigma, RandomizeNodePositions, RelativeSize } from 'react-sigma';
10
10
 
11
11
  import 'bootstrap/dist/css/bootstrap.min.css';
12
12
 
13
- import type { ITestTypes } from "./Types";
14
13
  import { TesterantoFeatures } from "./Features.js";
14
+ import { IRunTime, ITestTypes } from "./lib/types.js";
15
15
 
16
16
  type IGraphData = {
17
17
  nodes: { id: string, label: string }[],
@@ -45,14 +45,34 @@ document.addEventListener("DOMContentLoaded", function () {
45
45
  });
46
46
 
47
47
  const Report = () => {
48
+
49
+ const [state, setState] = useState<{
50
+ tests: ITestTypes[],
51
+ buildDir: string,
52
+ features: TesterantoFeatures
53
+ results: any
54
+ }>({
55
+ tests: [],
56
+ buildDir: "",
57
+ features: new TesterantoFeatures({}, {
58
+ undirected: [],
59
+ directed: [],
60
+ dags: []
61
+ }),
62
+ results: {}
63
+ });
64
+
48
65
  const [tests, setTests] = useState<
49
66
  {
50
- tests: ITestTypes[]
67
+ tests: ITestTypes[],
68
+ buildDir: string,
51
69
  }
52
70
 
53
71
  >({
54
- tests: []
72
+ tests: [],
73
+ buildDir: ""
55
74
  });
75
+
56
76
  const [features, setFeatures] = useState<TesterantoFeatures>(
57
77
  new TesterantoFeatures({}, {
58
78
  undirected: [],
@@ -61,34 +81,102 @@ const Report = () => {
61
81
  })
62
82
  );
63
83
 
64
- useEffect(() => {
65
- const importFeatures = async () => {
66
- const module = await import('features.test.js');
67
- console.log("imported features", module.default);
68
- setFeatures(module.default);
69
- };
70
- importFeatures();
71
- }, []);
84
+ const [results, setResults] = useState<Record<string, { exitcode, log, testresults, manifest }>>(
85
+ {}
86
+ );
72
87
 
88
+ const importState = async () => {
89
+ const features = await import('features.test.js');
90
+ const config = await (await fetch("./testeranto.json")).json();
91
+ const results = await Promise.all(config.tests.map((test) => {
92
+ return new Promise(async (res, rej) => {
93
+ const src: string = test[0];
94
+ const runtime: IRunTime = test[1];
95
+ const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
96
+ const exitcode = await (await fetch(config.buildDir + "/" + s + "/exitcode")).text()
97
+ const log = await (await fetch(config.buildDir + "/" + s + "/log.txt")).text()
98
+ const testresults = await (await fetch(config.buildDir + "/" + s + "/tests.json")).json()
99
+ const manifest = await (await fetch(config.buildDir + "/" + s + "/manifest.json")).json()
100
+
101
+ res({ src, exitcode, log, testresults, manifest })
102
+ })
103
+ }))
104
+ // const results = await config.tests.reduce(async (p, test) => {
105
+ // const src: string = test[0];
106
+ // const runtime: IRunTime = test[1];
107
+ // console.log(runtime)
108
+ // const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
109
+ // // const srr
110
+ // console.log("s", s)
111
+
112
+ // const exitcode = await (await fetch(config.buildDir + "/" + s + "/exitcode")).text()
113
+ // const log = await (await fetch(config.buildDir + "/" + s + "/log.txt")).text()
114
+ // const testresults = await (await fetch(config.buildDir + "/" + s + "/tests.json")).text()
115
+
116
+ // // setResults({ src, exitcode, log, testresults })
117
+ // // console.log("a", await a.text())
118
+ // p[src] = { exitcode, log, testresults }
119
+ // return p
120
+ // }, {});
121
+
122
+ console.log("results", results)
123
+
124
+
125
+ setState({ tests: config.tests as any, results, features: features as any, buildDir: config.buildDir })
126
+ };
127
+
128
+ const importFeatures = async () => {
129
+ const module = await import('features.test.js');
130
+ setFeatures(module.default);
131
+ };
132
+
133
+ const importTests = async () => {
134
+ const x = await fetch("./testeranto.json")
135
+ const y = await x.json();
136
+ setTests(y as any);
137
+ };
138
+
139
+ useEffect(() => { importState(); }, []);
140
+
141
+ useEffect(() => { importFeatures(); }, []);
142
+ useEffect(() => { importTests(); }, []);
73
143
 
74
144
  useEffect(() => {
75
- const importTests = async () => {
76
- const x = await fetch("./testeranto.json")
77
- const y = await x.json();
78
- console.log("imported tests", y);
79
- setTests(y as any);
145
+ const collateResults = async () => {
146
+ console.log("collating", tests, features);
147
+ const r = tests.tests.reduce(async (p, test) => {
148
+ const src: string = test[0];
149
+ const runtime: IRunTime = test[1];
150
+ console.log(runtime)
151
+ const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
152
+ // const srr
153
+ // console.log(s)
154
+
155
+ const exitcode = await (await fetch(s + "/exitcode")).text()
156
+ const log = await (await fetch(s + "/log.txt")).text()
157
+ const testresults = await (await fetch(s + "/tests.json")).text()
158
+
159
+ // setResults({ src, exitcode, log, testresults })
160
+ // console.log("a", await a.text())
161
+ p[src] = { exitcode, log, testresults }
162
+ }, {});
163
+
164
+ setResults(r);
165
+ // const x = await fetch("./testeranto.json")
166
+ // const y = await x.json();
167
+ // setTests(y as any);
80
168
  // const module = await import('tests.json', {
81
169
  // with: {
82
170
  // type: 'json'
83
171
  // }
84
172
  // });
85
173
  // console.log("imported tests", module.default);
86
- // setTests(module.default);
174
+ // setResults("foo");
87
175
  };
88
-
89
- importTests();
176
+ collateResults();
90
177
  }, []);
91
178
 
179
+ console.log("state.results", state.results);
92
180
 
93
181
  return (
94
182
  <div>
@@ -96,6 +184,7 @@ const Report = () => {
96
184
  {`
97
185
  pre, code, p {
98
186
  max-width: 30rem;
187
+ text-wrap: auto;
99
188
  }
100
189
  footer {
101
190
  background-color: lightgray;
@@ -108,11 +197,16 @@ footer {
108
197
  `}
109
198
  </style>
110
199
 
111
- {features && tests && < Tabs defaultActiveKey="home" >
200
+ {features && tests && < Tabs defaultActiveKey="config" >
201
+
202
+
112
203
 
113
- <Tab eventKey="home" title="config">
114
- <pre>{JSON.stringify(features, null, 2)}</pre>
115
- <pre>{JSON.stringify(tests, null, 2)}</pre>
204
+ <Tab eventKey="config" title="config">
205
+ <pre>{JSON.stringify(state, null, 2)}</pre>
206
+ </Tab>
207
+
208
+ <Tab eventKey="results" title="results">
209
+ <pre>{JSON.stringify(state.results, null, 2)}</pre>
116
210
  </Tab>
117
211
 
118
212
  <Tab eventKey="features" title="features">
@@ -168,7 +262,7 @@ footer {
168
262
  </Tab>
169
263
 
170
264
  <Tab eventKey="feature.tests" title="tests">
171
- <pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
265
+ <pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
172
266
  </Tab>
173
267
  </Tabs>
174
268
  </Col>
@@ -221,7 +315,7 @@ footer {
221
315
  </Tab>
222
316
 
223
317
  <Tab eventKey="feature.tests" title="tests">
224
- <pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
318
+ <pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
225
319
  </Tab>
226
320
  </Tabs>
227
321
  </Col>
@@ -270,7 +364,7 @@ footer {
270
364
  </Tab>
271
365
 
272
366
  <Tab eventKey="feature.tests" title="tests">
273
- <pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
367
+ <pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
274
368
  </Tab>
275
369
  </Tabs>
276
370
  </Col>
@@ -317,7 +411,7 @@ footer {
317
411
  </Tab>
318
412
 
319
413
  <Tab eventKey="feature.tests" title="tests">
320
- <pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
414
+ <pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
321
415
  </Tab>
322
416
  </Tabs>
323
417
  </Col>
@@ -332,33 +426,53 @@ footer {
332
426
  </Tab.Container>
333
427
  </Tab>
334
428
 
335
- <Tab eventKey="results" title="tests">
429
+ <Tab eventKey="tests" title="tests">
336
430
  <Tab.Container id="left-tabs-example5" defaultActiveKey="feature-0">
337
431
  <Row>
338
432
  <Col sm={2}>
339
433
  {/* <Tree tests={features.tests} /> */}
340
- {/* <Nav variant="pills" className="flex-column">
341
- {
342
- features.tests.map((t, ndx) =>
343
- <Nav.Item key={ndx}>
344
- <Nav.Link eventKey={`test-${ndx}`}>
345
- {t[0]} - {t[1]}
346
- </Nav.Link>
347
- </Nav.Item>
348
- )
349
- }
350
- </Nav> */}
434
+ <Nav variant="pills" className="flex-column">
435
+ {
436
+ tests.tests.map((t, ndx) =>
437
+ <Nav.Item key={ndx}>
438
+ <Nav.Link eventKey={`test-${ndx}`}>
439
+ {t[0]} - {t[1]}
440
+ </Nav.Link>
441
+ </Nav.Item>
442
+ )
443
+ }
444
+ </Nav>
351
445
  </Col>
352
446
  <Col sm={6}>
353
447
  <Tab.Content>
354
- {/* {tests.tests.map((t, ndx) => {
355
- return (
356
- <Tab.Pane eventKey={`feature-${ndx}`} key={ndx}>
357
- <pre>{JSON.stringify(t, null, 2)}</pre>
448
+
449
+ {
450
+ tests.tests.map((t, ndx) =>
451
+ <Tab.Pane eventKey={`test-${ndx}`}>
452
+ {/* <pre>{JSON.stringify(t, null, 2)}</pre> */}
453
+ {/* <pre>{JSON.stringify(state.results, null, 2)}</pre> */}
454
+ <pre>{JSON.stringify(Object.entries(state.results).filter(([k, v]: [string, { src: string }]) => {
455
+ console.log(v.src, tests.tests[ndx][0])
456
+ return v.src === tests.tests[ndx][0]
457
+ }), null, 2)}</pre>
458
+
459
+ {/* {tests.tests.map((t, ndx) => {
460
+ return (
461
+ <Tab.Pane eventKey={`feature-${ndx}`} key={ndx}>
462
+ <pre>{JSON.stringify(t, null, 2)}</pre>
463
+ </Tab.Pane>
464
+ )
465
+ }
466
+ )} */}
467
+
358
468
  </Tab.Pane>
469
+
359
470
  )
360
471
  }
361
- )} */}
472
+
473
+
474
+
475
+
362
476
  </Tab.Content>
363
477
  </Col>
364
478
 
@@ -0,0 +1,134 @@
1
+ import readline from "readline";
2
+ import fs from "fs";
3
+ import { jsonc } from "jsonc";
4
+ import puppeteer from "puppeteer-core";
5
+
6
+ import { IBuiltConfig, IRunTime } from "./lib/types";
7
+
8
+ // import { PM_Main } from "./PM/main.js";
9
+
10
+ // var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
11
+
12
+ // const node2web: Record<string, string[]> = {};
13
+ // const web2node: Record<string, string[]> = {};
14
+ // const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
15
+
16
+ readline.emitKeypressEvents(process.stdin);
17
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
18
+
19
+ console.log("\n Puppeteer is running. Press 'q' to quit\n");
20
+ process.stdin.on("keypress", (str, key) => {
21
+ if (key.name === "q") {
22
+ process.exit();
23
+ }
24
+ });
25
+
26
+ const main = async () => {
27
+ const configs = jsonc.parse(
28
+ (await fs.readFileSync("./docs/testeranto.json")).toString()
29
+ ) as IBuiltConfig;
30
+
31
+ // const pm = new PM_Main(configs);
32
+
33
+ // await puppeteer.launch(options);
34
+ const browser = await puppeteer.launch(
35
+ {
36
+ waitForInitialPage: false,
37
+ executablePath: "/opt/homebrew/bin/chromium",
38
+ headless: false,
39
+ args: [
40
+ "--allow-file-access-from-files",
41
+ "--allow-running-insecure-content",
42
+ // "--auto-open-devtools-for-tabs",
43
+ "--disable-dev-shm-usage",
44
+ "--disable-extensions",
45
+ "--disable-gpu",
46
+ "--disable-setuid-sandbox",
47
+ "--disable-site-isolation-trials",
48
+ "--disable-web-security",
49
+ "--disable-web-security",
50
+ "--no-first-run",
51
+ "--no-sandbox",
52
+ "--no-startup-window",
53
+ "--no-zygote",
54
+ "--reduce-security-for-testing",
55
+ "--remote-allow-origins=*",
56
+ // "--remote-allow-origins=ws://localhost:3234",
57
+ "--unsafely-treat-insecure-origin-as-secure=*",
58
+ // "--disable-features=IsolateOrigins",
59
+ // "--single-process",
60
+ // "--unsafely-treat-insecure-origin-as-secure",
61
+ // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
62
+ // `--remote-debugging-port=3234`,
63
+ ],
64
+ }
65
+ // "."
66
+ );
67
+
68
+ console.log("Creating new page...");
69
+ const page = await browser.newPage();
70
+
71
+ await page.setViewport({ width: 0, height: 0 });
72
+
73
+ console.log("Requesting url...");
74
+ await page.goto(`file://${process.cwd()}/docs/report.html`);
75
+
76
+ // const destinationOfRuntime = (f: string, r: IRunTime) => {
77
+ // return path
78
+ // .normalize(`${configs.buildDir}/${r}/${f}`)
79
+ // .split(".")
80
+ // .slice(0, -1)
81
+ // .join(".");
82
+ // };
83
+
84
+ // configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
85
+ // if (runtime === "node") {
86
+ // pm.launchNode(test, destinationOfRuntime(test, "node"));
87
+ // } else if (runtime === "web") {
88
+ // pm.launchWeb(test, destinationOfRuntime(test, "web"));
89
+ // } else {
90
+ // console.error("runtime makes no sense", runtime);
91
+ // }
92
+ // });
93
+
94
+ // console.log("ready and watching for changes...", configs.buildDir);
95
+ // fs.watch(
96
+ // configs.buildDir,
97
+ // {
98
+ // recursive: true,
99
+ // },
100
+ // (eventType, changedFile) => {
101
+ // if (changedFile) {
102
+ // configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
103
+ // if (eventType === "change" || eventType === "rename") {
104
+ // if (
105
+ // changedFile ===
106
+ // test
107
+ // .replace("./", "node/")
108
+ // .split(".")
109
+ // .slice(0, -1)
110
+ // .concat("mjs")
111
+ // .join(".")
112
+ // ) {
113
+ // pm.launchNode(test, destinationOfRuntime(test, "node"));
114
+ // }
115
+
116
+ // if (
117
+ // changedFile ===
118
+ // test
119
+ // .replace("./", "web/")
120
+ // .split(".")
121
+ // .slice(0, -1)
122
+ // .concat("mjs")
123
+ // .join(".")
124
+ // ) {
125
+ // pm.launchWeb(test, destinationOfRuntime(test, "web"));
126
+ // }
127
+ // }
128
+ // });
129
+ // }
130
+ // }
131
+ // );
132
+ };
133
+
134
+ main();
File without changes
@@ -2,22 +2,27 @@ import React from "react";
2
2
 
3
3
  import Testeranto from "../Node.js";
4
4
 
5
- import { IBaseTest, IPartialInterface, ITestImplementation, ITestSpecification } from "../Types";
5
+ import {
6
+ IBaseTest,
7
+ IPartialNodeInterface,
8
+ ITestImplementation,
9
+ ITestSpecification,
10
+ } from "../Types";
6
11
 
7
12
  type IInput = string;
8
13
  type ISelection = any;
9
- type IStore = any
10
- type ISubject = any
14
+ type IStore = any;
15
+ type ISubject = any;
11
16
 
12
- export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec, object>
17
+ export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec>;
13
18
 
14
19
  export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
15
20
 
16
21
  export default <ITestShape extends IBaseTest>(
17
22
  testInput: IInput,
18
23
  testSpecifications: ISpec<ITestShape>,
19
- testImplementations: ITestImplementation<ITestShape, object>,
20
- testInterface?: IPartialInterface<ITestShape>
24
+ testImplementations: ITestImplementation<ITestShape>,
25
+ testInterface?: IPartialNodeInterface<ITestShape>
21
26
  ) => {
22
27
  return Testeranto<ITestShape>(
23
28
  testInput,
@@ -25,22 +30,22 @@ export default <ITestShape extends IBaseTest>(
25
30
  testImplementations,
26
31
  {
27
32
  beforeAll(x) {
28
- process.parentPort.postMessage(`/dist/web/src/ClassicalComponent/test.html`)
33
+ // process.parentPort.postMessage(
34
+ // `/docs/web/src/ClassicalComponent/test.html`
35
+ // );
29
36
 
30
37
  return x;
31
38
  },
32
- beforeEach: async (
33
- ): Promise<IStore> => {
39
+ beforeEach: async (): Promise<IStore> => {
34
40
  return new Promise((resolve, rej) => {
35
- resolve(React.createElement(testInput, {
36
- }, []));
41
+ resolve(React.createElement(testInput, {}, []));
37
42
  });
38
43
  },
39
44
  andWhen: function (s: IStore, whenCB): Promise<ISelection> {
40
45
  return whenCB()(s);
41
46
  },
42
47
 
43
- ...testInterface
44
- },
45
- )
48
+ ...testInterface,
49
+ }
50
+ );
46
51
  };