testeranto 0.90.0 → 0.100.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 (133) hide show
  1. package/bundle.js +4 -7
  2. package/dist/common/src/Node.js +5 -3
  3. package/dist/common/src/PM/main.js +254 -126
  4. package/dist/common/src/PM/node.js +20 -5
  5. package/dist/common/src/PM/web.js +19 -4
  6. package/dist/common/src/SubPackages/puppeteer.js +1 -1
  7. package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
  8. package/dist/common/src/SubPackages/react/jsx/node.js +2 -2
  9. package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
  10. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  11. package/dist/common/src/Web.js +25 -21
  12. package/dist/common/src/cli.js +439 -0
  13. package/dist/common/src/cli2.js +144 -0
  14. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +18 -8
  15. package/dist/common/src/esbuildConfigs/node.js +1 -4
  16. package/dist/common/src/esbuildConfigs/web.js +1 -1
  17. package/dist/common/src/lib/abstractBase.js +31 -263
  18. package/dist/common/src/lib/basebuilder.js +1 -11
  19. package/dist/common/src/lib/classBuilder.js +1 -1
  20. package/dist/common/src/lib/core.js +8 -28
  21. package/dist/common/src/lib/types.js +1 -0
  22. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  23. package/dist/module/src/Node.js +5 -3
  24. package/dist/module/src/PM/main.js +254 -126
  25. package/dist/module/src/PM/node.js +20 -5
  26. package/dist/module/src/PM/web.js +19 -4
  27. package/dist/module/src/SubPackages/puppeteer.js +1 -1
  28. package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
  29. package/dist/module/src/SubPackages/react/jsx/node.js +2 -2
  30. package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
  31. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  32. package/dist/module/src/Web.js +25 -21
  33. package/dist/module/src/cli.js +411 -0
  34. package/dist/module/src/cli2.js +116 -0
  35. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +18 -8
  36. package/dist/module/src/esbuildConfigs/node.js +1 -4
  37. package/dist/module/src/esbuildConfigs/web.js +1 -1
  38. package/dist/module/src/lib/abstractBase.js +31 -263
  39. package/dist/module/src/lib/basebuilder.js +1 -11
  40. package/dist/module/src/lib/classBuilder.js +1 -1
  41. package/dist/module/src/lib/core.js +8 -28
  42. package/dist/module/src/lib/types.js +1 -0
  43. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  44. package/dist/prebuild/cli.mjs +1491 -0
  45. package/dist/prebuild/{run-tests.mjs → cli2.mjs} +223 -212
  46. package/dist/types/src/Node.d.ts +6 -3
  47. package/dist/types/src/PM/index.d.ts +10 -2
  48. package/dist/types/src/PM/main.d.ts +14 -7
  49. package/dist/types/src/PM/node.d.ts +9 -2
  50. package/dist/types/src/PM/web.d.ts +9 -3
  51. package/dist/types/src/SubPackages/puppeteer.d.ts +1 -1
  52. package/dist/types/src/SubPackages/react/component/node.d.ts +1 -1
  53. package/dist/types/src/SubPackages/react/component/web.d.ts +1 -1
  54. package/dist/types/src/SubPackages/react/jsx/node.d.ts +3 -3
  55. package/dist/types/src/SubPackages/react/jsx/web.d.ts +2 -2
  56. package/dist/types/src/SubPackages/react-dom/component/node.d.ts +2 -2
  57. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +1 -1
  58. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +1 -1
  59. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +2 -2
  60. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
  61. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
  62. package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +2 -2
  63. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +2 -2
  64. package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +2 -2
  65. package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +2 -2
  66. package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +3 -2
  67. package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +2 -2
  68. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +2 -2
  69. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +2 -2
  70. package/dist/types/src/Types.d.ts +60 -21
  71. package/dist/types/src/Web.d.ts +3 -3
  72. package/dist/types/src/lib/abstractBase.d.ts +6 -2
  73. package/dist/types/src/lib/core.d.ts +3 -3
  74. package/dist/types/src/lib/index.d.ts +1 -1
  75. package/dist/types/src/lib/types.d.ts +6 -30
  76. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  77. package/package.json +23 -20
  78. package/src/Node.ts +6 -3
  79. package/src/PM/index.ts +12 -8
  80. package/src/PM/main.ts +331 -165
  81. package/src/PM/node.ts +42 -7
  82. package/src/PM/web.ts +33 -5
  83. package/src/SubPackages/puppeteer.ts +1 -1
  84. package/src/SubPackages/react/jsx/index.ts +15 -7
  85. package/src/SubPackages/react/jsx/node.ts +18 -6
  86. package/src/SubPackages/react-dom/component/web.ts +28 -51
  87. package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
  88. package/src/SubPackages/react-test-renderer/jsx/node.ts +16 -1
  89. package/src/Types.ts +362 -114
  90. package/src/Web.ts +45 -23
  91. package/src/cli.ts +535 -0
  92. package/src/cli2.ts +157 -0
  93. package/src/esbuildConfigs/inputFilesPlugin.ts +27 -9
  94. package/src/esbuildConfigs/node.ts +4 -7
  95. package/src/esbuildConfigs/web.ts +4 -3
  96. package/src/lib/abstractBase.ts +84 -291
  97. package/src/lib/basebuilder.ts +1 -12
  98. package/src/lib/classBuilder.ts +2 -1
  99. package/src/lib/core.ts +17 -29
  100. package/src/lib/types.ts +5 -177
  101. package/dist/common/src/Aider.js +0 -143
  102. package/dist/common/src/Project.js +0 -225
  103. package/dist/common/src/Puppeteer.js +0 -113
  104. package/dist/common/src/build-tests.js +0 -39
  105. package/dist/common/src/esbuildConfigs/features.js +0 -14
  106. package/dist/common/src/esbuildConfigs/report.js +0 -14
  107. package/dist/common/src/esbuildConfigs/tests.js +0 -13
  108. package/dist/common/src/run-tests.js +0 -39
  109. package/dist/module/src/Aider.js +0 -136
  110. package/dist/module/src/Project.js +0 -218
  111. package/dist/module/src/Puppeteer.js +0 -108
  112. package/dist/module/src/build-tests.js +0 -11
  113. package/dist/module/src/esbuildConfigs/features.js +0 -12
  114. package/dist/module/src/esbuildConfigs/report.js +0 -14
  115. package/dist/module/src/esbuildConfigs/tests.js +0 -11
  116. package/dist/module/src/run-tests.js +0 -11
  117. package/dist/prebuild/build-tests.mjs +0 -552
  118. package/dist/types/src/Aider.d.ts +0 -1
  119. package/dist/types/src/Project.d.ts +0 -12
  120. package/dist/types/src/Puppeteer.d.ts +0 -2
  121. package/dist/types/src/esbuildConfigs/features.d.ts +0 -4
  122. package/dist/types/src/esbuildConfigs/report.d.ts +0 -0
  123. package/dist/types/src/esbuildConfigs/tests.d.ts +0 -4
  124. package/src/Aider.ts +0 -168
  125. package/src/Project.ts +0 -291
  126. package/src/Puppeteer.ts +0 -145
  127. package/src/build-tests.ts +0 -12
  128. package/src/esbuildConfigs/features.ts +0 -17
  129. package/src/esbuildConfigs/report.ts +0 -15
  130. package/src/esbuildConfigs/tests.ts +0 -14
  131. package/src/run-tests.ts +0 -12
  132. /package/dist/types/src/{build-tests.d.ts → cli.d.ts} +0 -0
  133. /package/dist/types/src/{run-tests.d.ts → cli2.d.ts} +0 -0
package/src/Aider.ts DELETED
@@ -1,168 +0,0 @@
1
- import fs from "fs";
2
- import { exec, spawn } from "child_process";
3
-
4
- export const execCommand = async (command) => {
5
- const ls = spawn(command.split(" ")[0], command.split(" ").slice(1, -1));
6
-
7
- process.stdin.pipe(ls.stdin);
8
- ls.stdout.pipe(process.stdout);
9
- ls.stderr.pipe(process.stdout);
10
- // ls.stdout.on("data", function (data) {
11
- // console.log("stdout: " + data.toString());
12
- // });
13
-
14
- // ls.stderr.on("data", function (data) {
15
- // console.log("stderr: " + data.toString());
16
- // });
17
-
18
- ls.on("exit", function (code) {
19
- console.log("child process exited with code " + code?.toString() || -1);
20
- });
21
-
22
- // return new Promise<void>((resolve, reject) => {
23
- // const [cmd, ...args] = command.split(" ");
24
- // const childProcess = spawn(cmd, args);
25
- // childProcess.stdout.on("data", (data) => {
26
- // process.stdout.write(data.toString());
27
- // });
28
- // childProcess.stderr.on("data", (data) => {
29
- // process.stderr.write(data.toString());
30
- // });
31
- // childProcess.on("error", (error) => {
32
- // reject(error);
33
- // });
34
- // childProcess.on("exit", (code) => {
35
- // if (code === 0) {
36
- // resolve();
37
- // } else {
38
- // reject(new Error(`Command exited with code ${code}.`));
39
- // }
40
- // });
41
- // });
42
- };
43
-
44
- const key = process.argv[2];
45
- console.log(key);
46
- const exitcode = fs.readFileSync(`${key}/exitcode`).toString();
47
-
48
- console.log("exitcode", exitcode);
49
-
50
- // if (exitcode != "0") {
51
- if (exitcode != "0") {
52
- const inputFiles = JSON.parse(
53
- fs.readFileSync(`${key}/inputFiles.json`).toString()
54
- );
55
-
56
- inputFiles.push(`${key}/tests.json`);
57
-
58
- // const features = await await Promise.all(
59
- // Array.from(
60
- // new Set(
61
- // JSON.parse(fs.readFileSync(`${key}/tests.json`).toString())
62
- // .givens.reduce((mm: any[], lm: { features: any[] }) => {
63
- // mm.push(
64
- // lm.features.reduce((mm2: any[], lm2: any) => {
65
- // mm2.push(lm2);
66
- // return mm2;
67
- // }, [])
68
- // );
69
- // return mm;
70
- // }, [])
71
- // .flat()
72
- // .flat()
73
- // )
74
- // ) as string[]
75
- // );
76
-
77
- // const final = features.reduce((mm, [k, v], ndx) => {
78
- // mm[k] = v;
79
- // return mm;
80
- // }, {});
81
-
82
- // const as = JSON.stringify(final);
83
-
84
- // const scriptCommand = `aider --model deepseek --api-key deepseek=${
85
- // process.env.DEEPSEEK_KEY
86
- // } --message "Fix the failing tests" --read ${key}/inputFiles.json ${inputFiles
87
- // .map((i) => `--file ${i}`)
88
- // .join(" ")}`;
89
-
90
- const scriptCommand = `aider --message "Fix the failing tests" --model deepseek --api-key deepseek=${
91
- process.env.DEEPSEEK_KEY
92
- } --file ./${inputFiles.join(" ./")}`;
93
-
94
- console.log("scriptCommand", scriptCommand);
95
-
96
- execCommand(scriptCommand);
97
-
98
- // fs.writeFile(`./${key}/features.json`, as, () => {
99
- // inputFiles.push(`./${key}/features.json`);
100
-
101
- // // itermTab(scriptCommand).then(() => console.log("yay"));
102
-
103
- // // const child = spawn("xterm -e", scriptCommand.split(" "), {
104
- // // detached: true,
105
- // // stdio: "ignore",
106
- // // });
107
- // // runCommandInITerm(scriptCommand);
108
- // });
109
-
110
- // .reduce(async (mm, feature) => {
111
- // const req = await octokit.request(
112
- // `GET /repos/adamwong246/kokomobay-taskman/contents/Task/${feature}.json`,
113
- // {
114
- // owner: "adamwong246",
115
- // repo: "kokomoBay-taskman",
116
- // path: `Task/${feature}.json`,
117
- // headers: {
118
- // "X-GitHub-Api-Version": "2022-11-28",
119
- // },
120
- // }
121
- // );
122
-
123
- // const j = JSON.parse(atob(req.data.content));
124
- // (await mm).push([
125
- // feature,
126
- // JSON.stringify({
127
- // name: j.name,
128
- // body: j.body,
129
- // }),
130
- // ]);
131
-
132
- // return mm;
133
- // }, Promise.resolve<[string, string][]>([]))
134
- // .then((z) => {
135
- // const final = z.reduce((mm, [k, v], ndx) => {
136
- // mm[k] = v;
137
- // return mm;
138
- // }, {});
139
-
140
- // const as = JSON.stringify(final);
141
-
142
- // fs.writeFile(`./${key}/features.json`, as, () => {
143
- // inputFiles.push(`./${key}/features.json`);
144
-
145
- // const scriptCommand = `aider --model deepseek --api-key deepseek=${
146
- // process.env.DEEPSEEK_KEY
147
- // } --message "Fix the failing tests" ${inputFiles.join(" ")}`;
148
-
149
- // console.log("scriptCommand", scriptCommand);
150
-
151
- // execCommand(scriptCommand);
152
- // // itermTab(scriptCommand).then(() => console.log("yay"));
153
-
154
- // // const child = spawn("xterm -e", scriptCommand.split(" "), {
155
- // // detached: true,
156
- // // stdio: "ignore",
157
- // // });
158
- // // runCommandInITerm(scriptCommand);
159
- // });
160
- // //
161
- // });
162
-
163
- // features.then((x) => {
164
- // console.log("done", x);
165
- // });
166
- } else {
167
- console.log("that test is not failing");
168
- }
package/src/Project.ts DELETED
@@ -1,291 +0,0 @@
1
- import { spawn } from "child_process";
2
-
3
- import esbuild from "esbuild";
4
- import fs from "fs";
5
- import path from "path";
6
- import readline from "readline";
7
- import { glob } from "glob";
8
-
9
- import esbuildNodeConfiger from "./esbuildConfigs/node.js";
10
- import esbuildWebConfiger from "./esbuildConfigs/web.js";
11
- import webHtmlFrame from "./web.html.js";
12
- import { ITestTypes, IBaseConfig, IRunTime } from "./lib/types.js";
13
-
14
- readline.emitKeypressEvents(process.stdin);
15
- if (process.stdin.isTTY) process.stdin.setRawMode(true);
16
-
17
- const logContent: string[] = [];
18
-
19
- function parseTsErrors(): void {
20
- try {
21
- // const logContent = fs.readFileSync(logPath, "utf-8").split("\n");
22
- const regex = /(^src(.*?))\(\d*,\d*\): error/gm;
23
- const brokenFilesToLines: Record<string, Set<number>> = {};
24
-
25
- for (let i = 0; i < logContent.length - 1; i++) {
26
- let m;
27
-
28
- while ((m = regex.exec(logContent[i])) !== null) {
29
- // This is necessary to avoid infinite loops with zero-width matches
30
- if (m.index === regex.lastIndex) {
31
- regex.lastIndex++;
32
- }
33
- if (!brokenFilesToLines[m[1]]) {
34
- brokenFilesToLines[m[1]] = new Set<number>();
35
- }
36
- brokenFilesToLines[m[1]].add(i);
37
- }
38
- }
39
-
40
- const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
41
- mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
42
- const a = Array.from(brokenFilesToLines[lm]);
43
-
44
- return Object.keys(a).reduce((mm2, lm2, ndx2) => {
45
- const acc: string[] = [];
46
-
47
- let j = a[lm2] + 1;
48
-
49
- let working = true;
50
- while (j < logContent.length - 1 && working) {
51
- if (
52
- !logContent[j].match(regex) &&
53
- working &&
54
- !logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)
55
- ) {
56
- acc.push(logContent[j]);
57
- } else {
58
- working = false;
59
- }
60
-
61
- j++;
62
- }
63
-
64
- mm2[lm] = [logContent[l], ...acc];
65
-
66
- return mm2;
67
- }, {} as any)[lm];
68
- });
69
- return mm;
70
- }, {});
71
-
72
- Object.keys(final).forEach((k) => {
73
- fs.mkdirSync(`./docs/types/${k.split("/").slice(0, -1).join("/")}`, {
74
- recursive: true,
75
- });
76
- fs.writeFileSync(
77
- `./docs/types/${k}.type_errors.txt`,
78
- final[k].flat().flat().join("\r\n")
79
- );
80
- });
81
- } catch (error) {
82
- console.error("Error reading or parsing the log file:", error);
83
- process.exit(1);
84
- }
85
- }
86
-
87
- const compile = () => {
88
- return new Promise((resolve, reject) => {
89
- const tsc = spawn("tsc", ["-noEmit"]);
90
-
91
- tsc.stdout.on("data", (data) => {
92
- // console.log(`stdout: ${data}`);
93
- const lines = data.toString().split("\n");
94
- logContent.push(...lines);
95
- });
96
-
97
- tsc.stderr.on("data", (data) => {
98
- // console.error(`stderr: ${data}`);
99
- });
100
-
101
- tsc.on("close", (code) => {
102
- parseTsErrors();
103
-
104
- resolve(`tsc process exited with code ${code}`);
105
- // if (code !== 0) {
106
- // resolve(`tsc process exited with code ${code}`);
107
- // // reject(`tsc process exited with code ${code}`);
108
- // } else {
109
- // resolve({});
110
- // }
111
- });
112
- });
113
- };
114
-
115
- export class ITProject {
116
- config: IBaseConfig;
117
- mode: `DEV` | `PROD`;
118
- nodeDone: boolean = false;
119
- webDone: boolean = false;
120
-
121
- constructor(configs: IBaseConfig) {
122
- this.config = configs;
123
-
124
- this.mode = this.config.devMode ? "DEV" : "PROD";
125
-
126
- process.stdin.on("keypress", (str, key) => {
127
- if (key.name === "q") {
128
- console.log("Testeranto-EsBuild is shutting down...");
129
- this.mode = "PROD";
130
- this.onDone();
131
- }
132
- });
133
-
134
- fs.writeFileSync(
135
- `${this.config.outdir}/testeranto.json`,
136
- JSON.stringify(
137
- {
138
- ...this.config,
139
- buildDir: process.cwd() + "/" + this.config.outdir,
140
- },
141
- null,
142
- 2
143
- )
144
- );
145
-
146
- compile();
147
-
148
- Promise.resolve(
149
- Promise.all(
150
- [...this.getSecondaryEndpointsPoints("web")].map(
151
- async (sourceFilePath) => {
152
- const sourceFileSplit = sourceFilePath.split("/");
153
- const sourceDir = sourceFileSplit.slice(0, -1);
154
- const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
155
- const sourceFileNameMinusJs = sourceFileName
156
- .split(".")
157
- .slice(0, -1)
158
- .join(".");
159
-
160
- const htmlFilePath = path.normalize(
161
- `${process.cwd()}/${this.config.outdir}/web/${sourceDir.join(
162
- "/"
163
- )}/${sourceFileNameMinusJs}.html`
164
- );
165
- const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
166
-
167
- return fs.promises
168
- .mkdir(path.dirname(htmlFilePath), { recursive: true })
169
- .then((x) =>
170
- fs.writeFileSync(
171
- htmlFilePath,
172
- webHtmlFrame(jsfilePath, htmlFilePath)
173
- )
174
- );
175
- }
176
- )
177
- )
178
- );
179
-
180
- const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
181
-
182
- glob(`./${this.config.outdir}/chunk-*.mjs`, {
183
- ignore: "node_modules/**",
184
- }).then((chunks) => {
185
- chunks.forEach((chunk) => {
186
- fs.unlinkSync(chunk);
187
- });
188
- });
189
-
190
- Promise.all([
191
- esbuild
192
- .context(esbuildNodeConfiger(this.config, nodeEntryPoints))
193
- .then(async (nodeContext) => {
194
- if (this.config.devMode) {
195
- await nodeContext.watch().then((v) => {
196
- this.onNodeDone();
197
- });
198
- } else {
199
- nodeContext.rebuild().then((v) => {
200
- this.onNodeDone();
201
- });
202
- }
203
-
204
- return nodeContext;
205
- }),
206
- esbuild
207
- .context(esbuildWebConfiger(this.config, webEntryPoints))
208
- .then(async (webContext) => {
209
- if (this.config.devMode) {
210
- await webContext.watch().then((v) => {
211
- this.onWebDone();
212
- });
213
- } else {
214
- webContext.rebuild().then((v) => {
215
- this.onWebDone();
216
- });
217
- }
218
- return webContext;
219
- }),
220
- ]);
221
- }
222
-
223
- onNodeDone = () => {
224
- this.nodeDone = true;
225
- this.onDone();
226
- };
227
- onWebDone = () => {
228
- this.webDone = true;
229
- this.onDone();
230
- };
231
-
232
- onDone = () => {
233
- // console.log(this.nodeDone && this.webDone && this.mode === "PROD");
234
- if (this.nodeDone && this.webDone && this.mode === "PROD") {
235
- console.log("Testeranto-EsBuild is all done. Goodbye!");
236
- process.exit();
237
- } else {
238
- if (this.mode === "PROD") {
239
- console.log("waiting for tests to finish");
240
- console.log(
241
- JSON.stringify(
242
- {
243
- nodeDone: this.nodeDone,
244
- webDone: this.webDone,
245
- mode: this.mode,
246
- },
247
- null,
248
- 2
249
- )
250
- );
251
- } else {
252
- console.log("waiting for tests to change");
253
- }
254
- console.log("press 'q' to quit");
255
- }
256
- };
257
-
258
- public getSecondaryEndpointsPoints(runtime?: IRunTime): string[] {
259
- const meta = (ts: ITestTypes[], st: Set<string>): Set<string> => {
260
- ts.forEach((t) => {
261
- if (t[1] === runtime) {
262
- st.add(t[0]);
263
- }
264
- if (Array.isArray(t[3])) {
265
- meta(t[3], st);
266
- }
267
- });
268
- return st;
269
- };
270
- return Array.from(meta(this.config.tests, new Set()));
271
- }
272
- }
273
-
274
- const getRunnables = (
275
- tests: ITestTypes[],
276
- payload = [new Set<string>(), new Set<string>()]
277
- ): [Set<string>, Set<string>] => {
278
- return tests.reduce((pt, cv, cndx, cry) => {
279
- if (cv[1] === "node") {
280
- pt[0].add(cv[0]);
281
- } else if (cv[1] === "web") {
282
- pt[1].add(cv[0]);
283
- }
284
-
285
- if (cv[3].length) {
286
- getRunnables(cv[3], payload);
287
- }
288
-
289
- return pt;
290
- }, payload as [Set<string>, Set<string>]);
291
- };
package/src/Puppeteer.ts DELETED
@@ -1,145 +0,0 @@
1
- import readline from "readline";
2
- import fs from "fs";
3
- import watch from "recursive-watch";
4
-
5
- import { PM_Main } from "./PM/main.js";
6
- import { destinationOfRuntime } from "./utils.js";
7
- import { IBaseConfig, IBuiltConfig } from "./lib/types.js";
8
-
9
- readline.emitKeypressEvents(process.stdin);
10
- if (process.stdin.isTTY) process.stdin.setRawMode(true);
11
-
12
- export default async (partialConfig) => {
13
- const config: IBuiltConfig = {
14
- ...partialConfig,
15
- buildDir: process.cwd() + "/" + partialConfig.outdir,
16
- };
17
-
18
- fs.writeFileSync(
19
- `${config.outdir}/testeranto.json`,
20
- JSON.stringify(
21
- {
22
- ...config,
23
- buildDir: process.cwd() + "/" + config.outdir,
24
- },
25
- null,
26
- 2
27
- )
28
- );
29
-
30
- const pm = new PM_Main(config);
31
-
32
- await pm.startPuppeteer(
33
- {
34
- // timeout: 1,
35
- waitForInitialPage: false,
36
- executablePath:
37
- // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
38
- "/opt/homebrew/bin/chromium",
39
- headless: false,
40
- dumpio: true,
41
- // timeout: 0,
42
- devtools: true,
43
- args: [
44
- "--auto-open-devtools-for-tabs",
45
- `--remote-debugging-port=3234`,
46
-
47
- // "--disable-features=IsolateOrigins,site-per-process",
48
- "--disable-site-isolation-trials",
49
- "--allow-insecure-localhost",
50
- "--allow-file-access-from-files",
51
- "--allow-running-insecure-content",
52
-
53
- "--disable-dev-shm-usage",
54
- "--disable-extensions",
55
- "--disable-gpu",
56
- "--disable-setuid-sandbox",
57
- "--disable-site-isolation-trials",
58
- "--disable-web-security",
59
- "--no-first-run",
60
- "--no-sandbox",
61
- "--no-startup-window",
62
- // "--no-zygote",
63
- "--reduce-security-for-testing",
64
- "--remote-allow-origins=*",
65
- "--unsafely-treat-insecure-origin-as-secure=*",
66
- // "--disable-features=IsolateOrigins",
67
- // "--remote-allow-origins=ws://localhost:3234",
68
- // "--single-process",
69
- // "--unsafely-treat-insecure-origin-as-secure",
70
- // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
71
-
72
- // "--disk-cache-dir=/dev/null",
73
- // "--disk-cache-size=1",
74
- // "--start-maximized",
75
- ],
76
- },
77
- "."
78
- );
79
-
80
- console.log(
81
- "\n Puppeteer is running. Press 'q' to shutdown softly. Press 'x' to shutdown forcefully.\n"
82
- );
83
- process.stdin.on("keypress", (str, key) => {
84
- if (key.name === "q") {
85
- pm.shutDown();
86
- // process.exit();
87
- }
88
- if (key.name === "x") {
89
- // pm.shutDown();
90
- process.exit(-1);
91
- }
92
- });
93
-
94
- config.tests.forEach(([test, runtime, tr, sidecars]) => {
95
- if (runtime === "node") {
96
- pm.launchNode(test, destinationOfRuntime(test, "node", config));
97
- } else if (runtime === "web") {
98
- pm.launchWeb(test, destinationOfRuntime(test, "web", config), sidecars);
99
- } else {
100
- console.error("runtime makes no sense", runtime);
101
- }
102
- });
103
-
104
- if (config.devMode) {
105
- console.log("ready and watching for changes...", config.buildDir);
106
-
107
- watch(config.buildDir, (eventType, changedFile) => {
108
- if (changedFile) {
109
- config.tests.forEach(([test, runtime, tr, sidecars]) => {
110
- if (eventType === "change" || eventType === "rename") {
111
- if (
112
- changedFile ===
113
- test
114
- .replace("./", "node/")
115
- .split(".")
116
- .slice(0, -1)
117
- .concat("mjs")
118
- .join(".")
119
- ) {
120
- pm.launchNode(test, destinationOfRuntime(test, "node", config));
121
- }
122
-
123
- if (
124
- changedFile ===
125
- test
126
- .replace("./", "web/")
127
- .split(".")
128
- .slice(0, -1)
129
- .concat("mjs")
130
- .join(".")
131
- ) {
132
- pm.launchWeb(
133
- test,
134
- destinationOfRuntime(test, "web", config),
135
- sidecars
136
- );
137
- }
138
- }
139
- });
140
- }
141
- });
142
- } else {
143
- pm.shutDown();
144
- }
145
- };
@@ -1,12 +0,0 @@
1
- import process from "process";
2
-
3
- import { ITProject } from "./Project";
4
-
5
- if (!process.argv[2]) {
6
- console.log("You didn't pass a config file");
7
- process.exit(-1);
8
- } else {
9
- import(process.cwd() + "/" + process.argv[2]).then((module) => {
10
- new ITProject(module.default);
11
- });
12
- }
@@ -1,17 +0,0 @@
1
- import { BuildOptions } from "esbuild";
2
- import { IBaseConfig } from "../lib/types";
3
-
4
- export default (config: IBaseConfig): BuildOptions => {
5
- return {
6
- bundle: true,
7
- entryPoints: [config.features],
8
- minify: config.minify === true,
9
- outbase: config.outbase,
10
- write: true,
11
-
12
- outfile: `${config.outdir}/features.test.js`,
13
- // external: ["graphology"],
14
-
15
- format: "esm",
16
- };
17
- };
@@ -1,15 +0,0 @@
1
- // import { BuildOptions } from "esbuild";
2
-
3
- // import { IBaseConfig } from "../lib/types";
4
-
5
- // export default (config: IBaseConfig): BuildOptions => {
6
- // return {
7
- // bundle: true,
8
- // entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
9
- // minify: config.minify === true,
10
- // outbase: config.outbase,
11
- // write: true,
12
- // outfile: `${config.outdir}/report.js`,
13
- // external: ["tests.json", "features.test.js"],
14
- // };
15
- // };
@@ -1,14 +0,0 @@
1
- import { BuildOptions } from "esbuild";
2
- import { IBaseConfig } from "../lib/types";
3
-
4
- export default (config: IBaseConfig): BuildOptions => {
5
- return {
6
- bundle: true,
7
- entryPoints: [config.features],
8
- minify: config.minify === true,
9
- outbase: config.outbase,
10
- write: true,
11
- outfile: `${config.outdir}/tests.test.js`,
12
- // external: ["graphology"]
13
- };
14
- };
package/src/run-tests.ts DELETED
@@ -1,12 +0,0 @@
1
- import Puppeteer from "./Puppeteer.js";
2
-
3
- import process from "process";
4
-
5
- if (!process.argv[2]) {
6
- console.log("You didn't pass a config file");
7
- process.exit(-1);
8
- } else {
9
- import(process.cwd() + "/" + process.argv[2]).then((module) => {
10
- Puppeteer(module.default);
11
- });
12
- }
File without changes
File without changes