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
@@ -1,22 +0,0 @@
1
- export class TBrowser {
2
- constructor(browser) {
3
- this.browser = browser;
4
- }
5
- pages() {
6
- return new Promise(async (res, rej) => {
7
- res((await this.browser.pages()).map((p) => {
8
- // const handler = {
9
- // apply: function (target, thisArg, argumentsList) {
10
- // console.log('screenshot was called with ' + JSON.stringify(argumentsList));
11
- // const x: ScreenshotOptions = argumentsList[0]
12
- // x.path = "./dist/" + x.path;
13
- // console.log('x.path' + x.path, target, thisArg);
14
- // return target(...argumentsList);
15
- // }
16
- // };
17
- // p.screenshot = new Proxy(p.screenshot, handler);
18
- return p;
19
- }));
20
- });
21
- }
22
- }
@@ -1,52 +0,0 @@
1
- // import fs from "fs";
2
- const fs = require("fs");
3
- // import path from "path";
4
- const path = require("path");
5
- const fPaths = [];
6
- export const NodeWriterElectron = {
7
- createWriteStream: (filepath) => {
8
- return fs.createWriteStream(filepath);
9
- },
10
- writeFileSync: (fp, contents) => {
11
- fs.writeFileSync(fp, contents);
12
- },
13
- mkdirSync: async (fp) => {
14
- await fs.mkdirSync(fp, { recursive: true });
15
- },
16
- testArtiFactoryfileWriter: (tLog, callback) => (fPath, value) => {
17
- callback(new Promise((res, rej) => {
18
- tLog("testArtiFactory =>", fPath);
19
- const cleanPath = path.resolve(fPath);
20
- fPaths.push(cleanPath.replace(process.cwd(), ``));
21
- const targetDir = cleanPath.split("/").slice(0, -1).join("/");
22
- fs.mkdir(targetDir, { recursive: true }, async (error) => {
23
- if (error) {
24
- console.error(`❗️testArtiFactory failed`, targetDir, error);
25
- }
26
- fs.writeFileSync(path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
27
- encoding: "utf-8",
28
- });
29
- if (Buffer.isBuffer(value)) {
30
- fs.writeFileSync(fPath, value, "binary");
31
- res();
32
- }
33
- else if (`string` === typeof value) {
34
- fs.writeFileSync(fPath, value.toString(), {
35
- encoding: "utf-8",
36
- });
37
- res();
38
- }
39
- else {
40
- /* @ts-ignore:next-line */
41
- const pipeStream = value;
42
- const myFile = fs.createWriteStream(fPath);
43
- pipeStream.pipe(myFile);
44
- pipeStream.on("close", () => {
45
- myFile.close();
46
- res();
47
- });
48
- }
49
- });
50
- }));
51
- }
52
- };
@@ -1,2 +0,0 @@
1
- import { ILogWriter } from "./lib/index.js";
2
- export declare const NodeWriter: ILogWriter;
@@ -1,6 +0,0 @@
1
- import { Browser, Page } from "puppeteer-core";
2
- export declare class TBrowser {
3
- browser: Browser;
4
- constructor(browser: Browser);
5
- pages(): Promise<Page[]>;
6
- }
@@ -1,2 +0,0 @@
1
- import { ILogWriter } from "./lib/index.js";
2
- export declare const NodeWriterElectron: ILogWriter;
package/src/NodeWriter.ts DELETED
@@ -1,69 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { PassThrough } from "stream";
4
-
5
- import { ILogWriter, ITLog } from "./lib/index.js";
6
-
7
- type IFPaths = string[];
8
- const fPaths: IFPaths = [];
9
-
10
- export const NodeWriter: ILogWriter = {
11
- createWriteStream: (filepath: string): fs.WriteStream => {
12
- return fs.createWriteStream(filepath);
13
- },
14
- writeFileSync: (fp: string, contents: string) => {
15
- fs.writeFileSync(
16
- fp,
17
- contents
18
- );
19
- },
20
- mkdirSync: async (fp: string) => {
21
- await fs.mkdirSync(fp, { recursive: true });
22
- },
23
- testArtiFactoryfileWriter:
24
- (tLog: ITLog, callback: (Promise) => void) =>
25
- (fPath, value: string | Buffer | PassThrough) => {
26
- callback(new Promise<void>((res, rej) => {
27
- tLog("testArtiFactory =>", fPath);
28
-
29
- const cleanPath = path.resolve(fPath);
30
- fPaths.push(cleanPath.replace(process.cwd(), ``));
31
-
32
- const targetDir = cleanPath.split("/").slice(0, -1).join("/");
33
-
34
- fs.mkdir(targetDir, { recursive: true }, async (error) => {
35
- if (error) {
36
- console.error(`❗️testArtiFactory failed`, targetDir, error);
37
- }
38
-
39
- fs.writeFileSync(
40
- path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"),
41
- fPaths.join(`\n`),
42
- {
43
- encoding: "utf-8",
44
- }
45
- );
46
-
47
- if (Buffer.isBuffer(value)) {
48
- fs.writeFileSync(fPath, value, "binary");
49
- res();
50
- } else if (`string` === typeof value) {
51
- fs.writeFileSync(fPath, value.toString(), {
52
- encoding: "utf-8",
53
- });
54
- res();
55
- } else {
56
- /* @ts-ignore:next-line */
57
- const pipeStream: PassThrough = value;
58
- const myFile = fs.createWriteStream(fPath);
59
- pipeStream.pipe(myFile);
60
- pipeStream.on("close", () => {
61
- myFile.close();
62
- res();
63
- });
64
- }
65
- });
66
- }))
67
-
68
- }
69
- }
package/src/electron.ts DELETED
@@ -1,250 +0,0 @@
1
- import { app, BrowserWindow, utilityProcess } from "electron";
2
- import pie from "puppeteer-in-electron";
3
- import puppeteer from "puppeteer-core";
4
- import { IBuiltConfig, IJsonConfig, IRunTime, ITestTypes } from "./Types";
5
- import fs from "fs";
6
- import path from "path";
7
- import { jsonc } from 'jsonc';
8
-
9
- const remoteMain = require("@electron/remote/main");
10
-
11
- remoteMain.initialize();
12
-
13
- const main = async () => {
14
-
15
- const configs = jsonc.parse(
16
- (await fs.readFileSync("./docs/testeranto.json")).toString()
17
- ) as IBuiltConfig;
18
-
19
- const loadReport = (configs: IBuiltConfig) => {
20
- const win = new BrowserWindow(
21
- {
22
- show: true,
23
- webPreferences: {
24
- offscreen: false,
25
- devTools: true,
26
- }
27
- }
28
- );
29
-
30
- win.loadFile(`/${configs.buildDir}/report.html`).then(async (x) => {
31
- // pie.connect(app, puppeteer).then(async (browser) => {
32
- // pie.getPage(browser, win).then(async (page) => {
33
- // await page.screenshot({
34
- // path: 'electron-puppeteer-screenshot1.jpg'
35
- // });
36
- // })
37
- // })
38
- })
39
- }
40
-
41
- const launchNode = (t: string, x: string) => {
42
- const f = x.replace(".ts", ".mjs");
43
-
44
- const a = JSON.stringify(
45
- {
46
- scheduled: true,
47
- name: x,
48
- ports: [],
49
- fs:
50
- path.resolve(
51
- configs.buildDir,
52
- "node",
53
- t,
54
- ),
55
- }
56
- )
57
- console.log("launchNode", f, a);
58
-
59
- const child = utilityProcess.fork(f, [a], {});
60
- child.postMessage({ message: 'hello' })
61
- child.on('message', (data) => {
62
- console.log("from child", data);
63
- launchWebSecondary(process.cwd() + data);
64
- })
65
- child.on('exit', (data) => {
66
- console.log("node process ended with: ", data);
67
- fileStream.close()
68
- })
69
- // child.stdout
70
- // child..on("", (data) => {
71
- // console.log("from child", data) // hello world!
72
- // launchWebSecondary(process.cwd() + data);
73
- // })
74
- // Create a write stream for the file
75
- const fileStream = fs.createWriteStream('errors.txt');
76
-
77
- // Pipe the child process's stdout to the file
78
- child.stdout?.pipe(fileStream);
79
-
80
- // // Handle errors
81
- // child.on('error', (err) => {
82
- // console.error('Error spawning child process:', err);
83
- // });
84
-
85
- // fileStream.on('error', (err) => {
86
- // console.error('Error writing to file:', err);
87
- // });
88
-
89
- // // Log a message when the child process exits
90
- // child.on('close', (code) => {
91
- // console.log(`Child process exited with code ${code}`);
92
- // });
93
- // console.log("child", child);
94
- // child.stdout?.on("data", (x) => {
95
- // console.log("x", x)
96
- // })
97
- }
98
-
99
- const launchWebSecondary = (htmlFile: string) => {
100
- console.log("launchWebSecondary", htmlFile)
101
- const subWin = new BrowserWindow(
102
- {
103
- show: true,
104
-
105
- webPreferences: {
106
- nodeIntegration: true,
107
- nodeIntegrationInWorker: true,
108
- contextIsolation: false,
109
- preload: path.join(app.getAppPath(), 'preload.js'),
110
- offscreen: false,
111
- devTools: false,
112
- }
113
- }
114
-
115
- )
116
- remoteMain.enable(subWin.webContents);
117
- subWin.webContents.openDevTools()
118
- subWin.loadFile(htmlFile);
119
-
120
- }
121
-
122
- const launchWeb = (t: string, changedFile: string) => {
123
- console.log("launchWeb", changedFile)
124
- const subWin = new BrowserWindow(
125
- {
126
- show: true,
127
-
128
- webPreferences: {
129
- nodeIntegration: true,
130
- nodeIntegrationInWorker: true,
131
- contextIsolation: false,
132
- preload: path.join(app.getAppPath(), 'preload.js'),
133
- offscreen: false,
134
- devTools: true,
135
- }
136
- }
137
-
138
- )
139
- remoteMain.enable(subWin.webContents);
140
- // subWin.webContents.openDevTools()
141
-
142
- const htmlFile = changedFile.split(".").slice(0, -1).concat("html").join(".")
143
-
144
- subWin.loadFile(htmlFile, {
145
- query: {
146
- requesting: encodeURIComponent(JSON.stringify({
147
- name: changedFile,
148
- ports: [].toString(),
149
- fs:
150
- path.resolve(
151
- configs.buildDir,
152
- "web",
153
- t,
154
- ),
155
- }
156
- ))
157
- }
158
- })
159
-
160
- }
161
-
162
- const watcher = (test: string, runtime: IRunTime) => {
163
- return path.normalize(
164
- `${configs.buildDir}/${runtime}/${test.split('.').slice(0, -1).concat('mjs').join('.')}`
165
- );
166
- };
167
-
168
- const changer = (f: string) => {
169
- return path.normalize(`${configs.buildDir}/${f}`);
170
- };
171
- const changer2 = (f: string, r: IRunTime) => {
172
- return path.normalize(`${configs.buildDir}/${r}/${f}`);
173
- };
174
-
175
- pie.initialize(app, 2999).then(async () => {
176
-
177
- app.on("ready", () => {
178
- loadReport(configs);
179
-
180
- console.log("running all the tests once initially");;
181
- configs.modules.forEach((t) => {
182
- if (t.runtime === "node") {
183
- launchNode(t.test, changer2(t.test, "node"));
184
- } else if (t.runtime === "web") {
185
- launchWeb(t.test, changer2(t.test, "web"));
186
- } else {
187
- console.error("runtime makes no sense", t.runtime);
188
- }
189
- })
190
-
191
-
192
- console.log("ready and watching for changes...", configs.buildDir);
193
- fs.watch(configs.buildDir, {
194
- recursive: true,
195
- }, (eventType, changedFile) => {
196
- console.log(eventType, changedFile);
197
- if (changedFile) {
198
- configs.modules.forEach((t) => {
199
- if (watcher(t.test, t.runtime) === changer(changedFile)) {
200
- if (t.runtime === "node") {
201
- launchNode(t.test, changer(changedFile))
202
- } else if (t.runtime === "web") {
203
- launchWeb(t.test, changer(changedFile))
204
- } else {
205
- console.error("runtime makes no sense", t.runtime);
206
- }
207
- }
208
- })
209
- }
210
-
211
- })
212
- });
213
- });
214
-
215
- await pie.connect(app, puppeteer);
216
-
217
- };
218
-
219
- main();
220
-
221
- // ipcMain.handle('web-log', (x, message: string) => {
222
- // console.log("web-log)", message);
223
- // });
224
-
225
- // ipcMain.handle('web-error', (x, message: string) => {
226
- // console.log("web-error)", message);
227
- // });
228
-
229
- // ipcMain.handle('web-warn', (x, message: string) => {
230
- // console.log("web-warn)", message);
231
- // });
232
-
233
- // ipcMain.handle('web-info', (x, message: string) => {
234
- // console.log("web-info)", message);
235
- // });
236
-
237
- // ipcMain.handle('quit-app', (x, failed: number) => {
238
- // console.log("quit-app", failed);
239
- // app.exit(failed);
240
- // });
241
-
242
- // process.stdin.on("data", (configTests) => {
243
- // main(JSON.parse(configTests.toString()) as ITestTypes[]);
244
- // });
245
-
246
- // const watchables = (tests: ITestTypes[]) => {
247
- // return tests.map((t) => {
248
- // return [t[1], `dist/${t[1]}/${t[0].replace(".mts", ".mjs")}`]
249
- // })
250
- // }
@@ -1,34 +0,0 @@
1
- import { Browser, Page } from "puppeteer-core";
2
-
3
- export class TBrowser {
4
- browser: Browser;
5
- constructor(browser: Browser) {
6
- this.browser = browser;
7
- }
8
- pages(): Promise<Page[]> {
9
-
10
- return new Promise(async (res, rej) => {
11
-
12
-
13
- res(
14
- (await this.browser.pages()).map((p) => {
15
- // const handler = {
16
- // apply: function (target, thisArg, argumentsList) {
17
- // console.log('screenshot was called with ' + JSON.stringify(argumentsList));
18
- // const x: ScreenshotOptions = argumentsList[0]
19
- // x.path = "./dist/" + x.path;
20
- // console.log('x.path' + x.path, target, thisArg);
21
- // return target(...argumentsList);
22
- // }
23
- // };
24
- // p.screenshot = new Proxy(p.screenshot, handler);
25
- return p;
26
- })
27
- );
28
- });
29
-
30
- }
31
- // pages(): Promise<TPage[]> {
32
- // return super.pages();
33
- // }
34
- }
@@ -1,71 +0,0 @@
1
- // import fs from "fs";
2
- const fs = require("fs");
3
- // import path from "path";
4
- const path = require("path");
5
- import { PassThrough } from "stream";
6
-
7
- import { ILogWriter, ITLog } from "./lib/index.js";
8
-
9
- type IFPaths = string[];
10
- const fPaths: IFPaths = [];
11
-
12
- export const NodeWriterElectron: ILogWriter = {
13
- createWriteStream: (filepath: string): fs.WriteStream => {
14
- return fs.createWriteStream(filepath);
15
- },
16
- writeFileSync: (fp: string, contents: string) => {
17
- fs.writeFileSync(
18
- fp,
19
- contents
20
- );
21
- },
22
- mkdirSync: async (fp: string) => {
23
- await fs.mkdirSync(fp, { recursive: true });
24
- },
25
- testArtiFactoryfileWriter:
26
- (tLog: ITLog, callback: (Promise) => void) =>
27
- (fPath, value: string | Buffer | PassThrough) => {
28
- callback(new Promise<void>((res, rej) => {
29
- tLog("testArtiFactory =>", fPath);
30
-
31
- const cleanPath = path.resolve(fPath);
32
- fPaths.push(cleanPath.replace(process.cwd(), ``));
33
-
34
- const targetDir = cleanPath.split("/").slice(0, -1).join("/");
35
-
36
- fs.mkdir(targetDir, { recursive: true }, async (error) => {
37
- if (error) {
38
- console.error(`❗️testArtiFactory failed`, targetDir, error);
39
- }
40
-
41
- fs.writeFileSync(
42
- path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"),
43
- fPaths.join(`\n`),
44
- {
45
- encoding: "utf-8",
46
- }
47
- );
48
-
49
- if (Buffer.isBuffer(value)) {
50
- fs.writeFileSync(fPath, value, "binary");
51
- res();
52
- } else if (`string` === typeof value) {
53
- fs.writeFileSync(fPath, value.toString(), {
54
- encoding: "utf-8",
55
- });
56
- res();
57
- } else {
58
- /* @ts-ignore:next-line */
59
- const pipeStream: PassThrough = value;
60
- const myFile = fs.createWriteStream(fPath);
61
- pipeStream.pipe(myFile);
62
- pipeStream.on("close", () => {
63
- myFile.close();
64
- res();
65
- });
66
- }
67
- });
68
- }))
69
-
70
- }
71
- }