testeranto 0.114.1 → 0.121.1
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.
- package/README.md +6 -1
- package/bundle.js +1 -1
- package/dist/common/Init.js +55 -61
- package/dist/common/PM/base.js +233 -0
- package/dist/common/PM/main.js +217 -434
- package/dist/common/build.js +113 -92
- package/dist/common/defaultConfig.js +2 -2
- package/dist/common/esbuildConfigs/index.js +1 -1
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +7 -3
- package/dist/common/esbuildConfigs/node.js +5 -3
- package/dist/common/esbuildConfigs/web.js +3 -3
- package/dist/common/init-docs.js +2 -46
- package/dist/common/lib/abstractBase.js +60 -54
- package/dist/common/lib/basebuilder.js +7 -8
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +6 -18
- package/dist/common/lib/index.js +6 -1
- package/dist/common/run.js +10 -2
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/utils.js +9 -21
- package/dist/module/Init.js +55 -61
- package/dist/module/PM/base.js +226 -0
- package/dist/module/PM/main.js +218 -435
- package/dist/module/Project.js +117 -0
- package/dist/module/TestReport.js +13 -4
- package/dist/module/build.js +113 -92
- package/dist/module/defaultConfig.js +2 -2
- package/dist/module/esbuildConfigs/index.js +1 -1
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +7 -3
- package/dist/module/esbuildConfigs/node.js +5 -3
- package/dist/module/esbuildConfigs/web.js +3 -3
- package/dist/module/init-docs.js +2 -13
- package/dist/module/lib/abstractBase.js +60 -54
- package/dist/module/lib/basebuilder.js +7 -8
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +6 -18
- package/dist/module/lib/index.js +6 -1
- package/dist/module/run.js +10 -2
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/utils.js +8 -17
- package/dist/prebuild/Project.css +11367 -0
- package/dist/prebuild/Project.js +24640 -0
- package/dist/prebuild/ReportClient.js +1 -1
- package/dist/prebuild/TestReport.js +9 -11
- package/dist/prebuild/build.mjs +142 -81
- package/dist/prebuild/init-docs.mjs +28 -83
- package/dist/prebuild/run.mjs +618 -537
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/Init.d.ts +1 -1
- package/dist/types/PM/base.d.ts +38 -0
- package/dist/types/PM/main.d.ts +20 -44
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +19 -11
- package/dist/types/lib/basebuilder.d.ts +1 -2
- package/dist/types/lib/index.d.ts +3 -3
- package/dist/types/lib/types.d.ts +2 -5
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/utils.d.ts +4 -7
- package/package.json +6 -5
- package/src/Init.ts +60 -68
- package/src/PM/base.ts +301 -0
- package/src/PM/main.ts +276 -567
- package/src/Project.tsx +197 -0
- package/src/ReportClient.tsx +1 -1
- package/src/TestReport.tsx +30 -15
- package/src/build.ts +140 -104
- package/src/defaultConfig.ts +2 -2
- package/src/esbuildConfigs/index.ts +1 -1
- package/src/esbuildConfigs/inputFilesPlugin.ts +7 -6
- package/src/esbuildConfigs/node.ts +5 -3
- package/src/esbuildConfigs/web.ts +4 -3
- package/src/init-docs.ts +2 -15
- package/src/lib/abstractBase.ts +113 -93
- package/src/lib/basebuilder.ts +8 -9
- package/src/lib/classBuilder.ts +11 -10
- package/src/lib/core.ts +15 -27
- package/src/lib/index.ts +13 -6
- package/src/lib/types.ts +3 -8
- package/src/run.ts +21 -5
- package/src/utils.ts +27 -39
- package/tsc.log +12 -23
- package/dist/common/puppeteerConfiger.js +0 -24
- package/dist/module/puppeteerConfiger.js +0 -19
- package/dist/types/puppeteerConfiger.d.ts +0 -4
- package/src/puppeteerConfiger.ts +0 -26
package/dist/common/PM/main.js
CHANGED
|
@@ -46,15 +46,12 @@ const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
|
46
46
|
const eslint_1 = require("eslint");
|
|
47
47
|
const tsc_prog_1 = __importDefault(require("tsc-prog"));
|
|
48
48
|
const utils_1 = require("../utils");
|
|
49
|
-
const
|
|
49
|
+
const base_js_1 = require("./base.js");
|
|
50
50
|
const eslint = new eslint_1.ESLint();
|
|
51
51
|
const formatter = await eslint.loadFormatter("./node_modules/testeranto/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs");
|
|
52
52
|
const changes = {};
|
|
53
53
|
const fileHashes = {};
|
|
54
|
-
const fileStreams3 = [];
|
|
55
|
-
const fPaths = [];
|
|
56
54
|
const files = {};
|
|
57
|
-
const recorders = {};
|
|
58
55
|
const screenshots = {};
|
|
59
56
|
async function fileHash(filePath, algorithm = "md5") {
|
|
60
57
|
return new Promise((resolve, reject) => {
|
|
@@ -72,23 +69,6 @@ async function fileHash(filePath, algorithm = "md5") {
|
|
|
72
69
|
});
|
|
73
70
|
});
|
|
74
71
|
}
|
|
75
|
-
const getRunnables = (tests, payload = {
|
|
76
|
-
nodeEntryPoints: {},
|
|
77
|
-
webEntryPoints: {},
|
|
78
|
-
}) => {
|
|
79
|
-
return tests.reduce((pt, cv, cndx, cry) => {
|
|
80
|
-
if (cv[1] === "node") {
|
|
81
|
-
pt.nodeEntryPoints[cv[0]] = path_1.default.resolve(`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
|
|
82
|
-
}
|
|
83
|
-
else if (cv[1] === "web") {
|
|
84
|
-
pt.webEntryPoints[cv[0]] = path_1.default.resolve(`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
|
|
85
|
-
}
|
|
86
|
-
if (cv[3].length) {
|
|
87
|
-
getRunnables(cv[3], payload);
|
|
88
|
-
}
|
|
89
|
-
return pt;
|
|
90
|
-
}, payload);
|
|
91
|
-
};
|
|
92
72
|
const statusMessagePretty = (failures, test) => {
|
|
93
73
|
if (failures === 0) {
|
|
94
74
|
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`> ${test} completed successfully`)));
|
|
@@ -123,27 +103,51 @@ function isValidUrl(string) {
|
|
|
123
103
|
return false;
|
|
124
104
|
}
|
|
125
105
|
}
|
|
126
|
-
class PM_Main extends
|
|
127
|
-
constructor(configs) {
|
|
128
|
-
super();
|
|
129
|
-
this.shutdownMode = false;
|
|
106
|
+
class PM_Main extends base_js_1.PM_Base {
|
|
107
|
+
constructor(configs, name, mode) {
|
|
108
|
+
super(configs);
|
|
130
109
|
this.bigBoard = {};
|
|
131
110
|
this.stop = () => {
|
|
132
111
|
console.log(ansi_colors_1.default.inverse("Testeranto-Run is shutting down gracefully..."));
|
|
133
|
-
this.mode = "
|
|
112
|
+
this.mode = "once";
|
|
134
113
|
this.nodeMetafileWatcher.close();
|
|
135
114
|
this.webMetafileWatcher.close();
|
|
136
115
|
this.checkForShutdown();
|
|
137
116
|
};
|
|
117
|
+
this.getRunnables = (tests, payload = {
|
|
118
|
+
nodeEntryPoints: {},
|
|
119
|
+
webEntryPoints: {},
|
|
120
|
+
}) => {
|
|
121
|
+
return tests.reduce((pt, cv, cndx, cry) => {
|
|
122
|
+
if (cv[1] === "node") {
|
|
123
|
+
pt.nodeEntryPoints[cv[0]] = path_1.default.resolve(`./testeranto/bundles/node/${this.name}/${cv[0]
|
|
124
|
+
.split(".")
|
|
125
|
+
.slice(0, -1)
|
|
126
|
+
.concat("mjs")
|
|
127
|
+
.join(".")}`);
|
|
128
|
+
}
|
|
129
|
+
else if (cv[1] === "web") {
|
|
130
|
+
pt.webEntryPoints[cv[0]] = path_1.default.resolve(`./testeranto/bundles/web/${this.name}/${cv[0]
|
|
131
|
+
.split(".")
|
|
132
|
+
.slice(0, -1)
|
|
133
|
+
.concat("mjs")
|
|
134
|
+
.join(".")}`);
|
|
135
|
+
}
|
|
136
|
+
if (cv[3].length) {
|
|
137
|
+
this.getRunnables(cv[3], payload);
|
|
138
|
+
}
|
|
139
|
+
return pt;
|
|
140
|
+
}, payload);
|
|
141
|
+
};
|
|
138
142
|
this.tscCheck = async ({ entrypoint, addableFiles, platform, }) => {
|
|
139
143
|
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`tsc < ${entrypoint}`)));
|
|
140
|
-
this.
|
|
144
|
+
this.typeCheckIsRunning(entrypoint);
|
|
141
145
|
const program = tsc_prog_1.default.createProgramFromConfig({
|
|
142
146
|
basePath: process.cwd(), // always required, used for relative paths
|
|
143
147
|
configFilePath: "tsconfig.json", // config to inherit from (optional)
|
|
144
148
|
compilerOptions: {
|
|
145
149
|
rootDir: "src",
|
|
146
|
-
outDir: (0, utils_1.tscPather)(entrypoint, platform),
|
|
150
|
+
outDir: (0, utils_1.tscPather)(entrypoint, platform, this.name),
|
|
147
151
|
// declaration: true,
|
|
148
152
|
// skipLibCheck: true,
|
|
149
153
|
noEmit: true,
|
|
@@ -151,32 +155,25 @@ class PM_Main extends index_js_1.PM {
|
|
|
151
155
|
include: addableFiles, //["src/**/*"],
|
|
152
156
|
// exclude: ["**/*.test.ts", "**/*.spec.ts"],
|
|
153
157
|
});
|
|
154
|
-
const tscPath = (0, utils_1.tscPather)(entrypoint, platform);
|
|
158
|
+
const tscPath = (0, utils_1.tscPather)(entrypoint, platform, this.name);
|
|
155
159
|
let allDiagnostics = program.getSemanticDiagnostics();
|
|
156
|
-
const
|
|
160
|
+
const results = [];
|
|
157
161
|
allDiagnostics.forEach((diagnostic) => {
|
|
158
162
|
if (diagnostic.file) {
|
|
159
163
|
let { line, character } = typescript_1.default.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
160
164
|
let message = typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
161
|
-
|
|
165
|
+
results.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
162
166
|
}
|
|
163
167
|
else {
|
|
164
|
-
|
|
168
|
+
results.push(typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
165
169
|
}
|
|
166
170
|
});
|
|
167
|
-
fs_1.default.writeFileSync(tscPath,
|
|
168
|
-
this.
|
|
169
|
-
if (this.shutdownMode) {
|
|
170
|
-
this.checkForShutdown();
|
|
171
|
-
}
|
|
172
|
-
// fs.writeFileSync(
|
|
173
|
-
// tscExitCodePather(entrypoint, platform),
|
|
174
|
-
// d.length.toString()
|
|
175
|
-
// );
|
|
171
|
+
fs_1.default.writeFileSync(tscPath, results.join("\n"));
|
|
172
|
+
this.typeCheckIsNowDone(entrypoint, results.length);
|
|
176
173
|
};
|
|
177
174
|
this.eslintCheck = async (entrypoint, platform, addableFiles) => {
|
|
178
|
-
this.bigBoard[entrypoint].staticErrors = "?";
|
|
179
175
|
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`eslint < ${entrypoint}`)));
|
|
176
|
+
this.lintIsRunning(entrypoint);
|
|
180
177
|
const results = (await eslint.lintFiles(addableFiles))
|
|
181
178
|
.filter((r) => r.messages.length)
|
|
182
179
|
.filter((r) => {
|
|
@@ -186,21 +183,14 @@ class PM_Main extends index_js_1.PM {
|
|
|
186
183
|
delete r.source;
|
|
187
184
|
return r;
|
|
188
185
|
});
|
|
189
|
-
fs_1.default.writeFileSync((0, utils_1.lintPather)(entrypoint, platform), await formatter.format(results));
|
|
190
|
-
this.
|
|
191
|
-
if (this.shutdownMode) {
|
|
192
|
-
this.checkForShutdown();
|
|
193
|
-
}
|
|
194
|
-
// fs.writeFileSync(
|
|
195
|
-
// lintExitCodePather(entrypoint, platform),
|
|
196
|
-
// results.length.toString()
|
|
197
|
-
// );
|
|
186
|
+
fs_1.default.writeFileSync((0, utils_1.lintPather)(entrypoint, platform, this.name), await formatter.format(results));
|
|
187
|
+
this.lintIsNowDone(entrypoint, results.length);
|
|
198
188
|
};
|
|
199
189
|
this.makePrompt = async (entryPoint, addableFiles, platform) => {
|
|
200
190
|
this.bigBoard[entryPoint].prompt = "?";
|
|
201
|
-
const promptPath =
|
|
202
|
-
const testPaths = path_1.default.join("
|
|
203
|
-
const featuresPath = path_1.default.join("
|
|
191
|
+
const promptPath = (0, utils_1.promptPather)(entryPoint, platform, this.name);
|
|
192
|
+
const testPaths = path_1.default.join("testeranto", "reports", this.name, platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
|
|
193
|
+
const featuresPath = path_1.default.join("testeranto", "reports", this.name, platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
|
|
204
194
|
fs_1.default.writeFileSync(promptPath, `
|
|
205
195
|
${addableFiles
|
|
206
196
|
.map((x) => {
|
|
@@ -208,55 +198,93 @@ ${addableFiles
|
|
|
208
198
|
})
|
|
209
199
|
.join("\n")}
|
|
210
200
|
|
|
211
|
-
/read ${(0, utils_1.lintPather)(entryPoint, platform)}
|
|
212
|
-
/read ${(0, utils_1.tscPather)(entryPoint, platform)}
|
|
201
|
+
/read ${(0, utils_1.lintPather)(entryPoint, platform, this.name)}
|
|
202
|
+
/read ${(0, utils_1.tscPather)(entryPoint, platform, this.name)}
|
|
213
203
|
/read ${testPaths}
|
|
214
204
|
|
|
215
205
|
/load ${featuresPath}
|
|
216
206
|
|
|
217
|
-
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${(0, utils_1.tscPather)(entryPoint, platform)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${(0, utils_1.lintPather)(entryPoint, platform)}"
|
|
207
|
+
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${(0, utils_1.tscPather)(entryPoint, platform, this.name)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${(0, utils_1.lintPather)(entryPoint, platform, this.name)}"
|
|
218
208
|
`);
|
|
219
|
-
this.bigBoard[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load
|
|
209
|
+
this.bigBoard[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load testeranto/${this.name}/reports/${platform}/${entryPoint
|
|
220
210
|
.split(".")
|
|
221
211
|
.slice(0, -1)
|
|
222
212
|
.join(".")}/prompt.txt`;
|
|
223
|
-
|
|
224
|
-
this.checkForShutdown();
|
|
225
|
-
}
|
|
213
|
+
this.checkForShutdown();
|
|
226
214
|
};
|
|
227
215
|
this.checkForShutdown = () => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
216
|
+
this.writeBigBoard();
|
|
217
|
+
if (this.mode === "dev")
|
|
218
|
+
return;
|
|
219
|
+
let inflight = false;
|
|
220
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
221
|
+
if (this.bigBoard[k].prompt === "?") {
|
|
222
|
+
console.log(ansi_colors_1.default.blue(ansi_colors_1.default.inverse(`🕕 prompt ${k}`)));
|
|
223
|
+
inflight = true;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
227
|
+
if (this.bigBoard[k].runTimeError === "?") {
|
|
228
|
+
console.log(ansi_colors_1.default.blue(ansi_colors_1.default.inverse(`🕕 runTimeError ${k}`)));
|
|
229
|
+
inflight = true;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
233
|
+
if (this.bigBoard[k].staticErrors === "?") {
|
|
234
|
+
console.log(ansi_colors_1.default.blue(ansi_colors_1.default.inverse(`🕕 staticErrors ${k}`)));
|
|
235
|
+
inflight = true;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
239
|
+
if (this.bigBoard[k].typeErrors === "?") {
|
|
240
|
+
console.log(ansi_colors_1.default.blue(ansi_colors_1.default.inverse(`🕕 typeErrors ${k}`)));
|
|
241
|
+
inflight = true;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
this.writeBigBoard();
|
|
245
|
+
if (!inflight) {
|
|
240
246
|
this.browser.disconnect().then(() => {
|
|
241
|
-
|
|
242
|
-
console.log(ansi_colors_1.default.inverse("Goodbye"));
|
|
247
|
+
console.log(ansi_colors_1.default.inverse(`${this.name} has been tested. Goodbye.`));
|
|
243
248
|
process.exit();
|
|
244
249
|
});
|
|
245
250
|
}
|
|
246
251
|
};
|
|
247
|
-
this.
|
|
248
|
-
this.bigBoard[src].
|
|
252
|
+
this.typeCheckIsRunning = (src) => {
|
|
253
|
+
this.bigBoard[src].typeErrors = "?";
|
|
249
254
|
};
|
|
250
|
-
this.
|
|
251
|
-
this.bigBoard[src].
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
+
this.typeCheckIsNowDone = (src, failures) => {
|
|
256
|
+
this.bigBoard[src].typeErrors = failures;
|
|
257
|
+
this.writeBigBoard();
|
|
258
|
+
this.checkForShutdown();
|
|
259
|
+
};
|
|
260
|
+
this.lintIsRunning = (src) => {
|
|
261
|
+
this.bigBoard[src].staticErrors = "?";
|
|
262
|
+
this.writeBigBoard();
|
|
263
|
+
};
|
|
264
|
+
this.lintIsNowDone = (src, failures) => {
|
|
265
|
+
this.bigBoard[src].staticErrors = failures;
|
|
266
|
+
this.writeBigBoard();
|
|
267
|
+
this.checkForShutdown();
|
|
268
|
+
};
|
|
269
|
+
this.bddTestIsRunning = (src) => {
|
|
270
|
+
this.bigBoard[src].runTimeError = "?";
|
|
271
|
+
this.writeBigBoard();
|
|
272
|
+
};
|
|
273
|
+
this.bddTestIsNowDone = (src, failures) => {
|
|
274
|
+
this.bigBoard[src].runTimeError = failures;
|
|
275
|
+
this.writeBigBoard();
|
|
276
|
+
this.checkForShutdown();
|
|
255
277
|
};
|
|
256
278
|
this.launchNode = async (src, dest) => {
|
|
257
|
-
// console.log(ansiC.yellow(`! node, ${src}`));
|
|
258
279
|
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`! node, ${src}`)));
|
|
259
|
-
this.
|
|
280
|
+
this.bddTestIsRunning(src);
|
|
281
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
282
|
+
.split(".")
|
|
283
|
+
.slice(0, -1)
|
|
284
|
+
.join(".")}/node`;
|
|
285
|
+
if (!fs_1.default.existsSync(reportDest)) {
|
|
286
|
+
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
287
|
+
}
|
|
260
288
|
const destFolder = dest.replace(".mjs", "");
|
|
261
289
|
let argz = "";
|
|
262
290
|
const testConfig = this.configs.tests.find((t) => {
|
|
@@ -273,7 +301,7 @@ ${addableFiles
|
|
|
273
301
|
scheduled: true,
|
|
274
302
|
name: src,
|
|
275
303
|
ports: portsToUse,
|
|
276
|
-
fs:
|
|
304
|
+
fs: reportDest,
|
|
277
305
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
278
306
|
});
|
|
279
307
|
}
|
|
@@ -329,18 +357,16 @@ ${addableFiles
|
|
|
329
357
|
defaultModule
|
|
330
358
|
.receiveTestResourceConfig(argz)
|
|
331
359
|
.then(async ({ features, failed }) => {
|
|
332
|
-
this.receiveFeatures(features, destFolder, src);
|
|
333
|
-
// console.log(`${src} completed with ${failed} errors`);
|
|
360
|
+
this.receiveFeatures(features, destFolder, src, "node");
|
|
334
361
|
statusMessagePretty(failed, src);
|
|
335
|
-
this.
|
|
362
|
+
this.bddTestIsNowDone(src, failed);
|
|
336
363
|
})
|
|
337
364
|
.catch((e) => {
|
|
338
365
|
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e}`)));
|
|
339
|
-
|
|
366
|
+
this.bddTestIsNowDone(src, -1);
|
|
340
367
|
})
|
|
341
368
|
.finally(() => {
|
|
342
369
|
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
343
|
-
this.testIsNowDone(src);
|
|
344
370
|
});
|
|
345
371
|
});
|
|
346
372
|
});
|
|
@@ -366,7 +392,6 @@ ${addableFiles
|
|
|
366
392
|
// // console.log(`${i}: ${msg._args[i]}`);
|
|
367
393
|
// });
|
|
368
394
|
page.exposeFunction("custom-screenshot", async (ssOpts, testName) => {
|
|
369
|
-
// console.log("main.ts browser custom-screenshot", testName);
|
|
370
395
|
const p = ssOpts.path;
|
|
371
396
|
const dir = path_1.default.dirname(p);
|
|
372
397
|
fs_1.default.mkdirSync(dir, {
|
|
@@ -378,10 +403,8 @@ ${addableFiles
|
|
|
378
403
|
screenshots[testName] = [];
|
|
379
404
|
}
|
|
380
405
|
screenshots[testName].push(sPromise);
|
|
381
|
-
// sPromise.then(())
|
|
382
406
|
await sPromise;
|
|
383
407
|
return sPromise;
|
|
384
|
-
// page.evaluate(`window["screenshot done"]`);
|
|
385
408
|
});
|
|
386
409
|
page.exposeFunction("writeFileSync", (fp, contents, testName) => {
|
|
387
410
|
const dir = path_1.default.dirname(fp);
|
|
@@ -412,9 +435,6 @@ ${addableFiles
|
|
|
412
435
|
});
|
|
413
436
|
page.exposeFunction("createWriteStream", (fp, testName) => {
|
|
414
437
|
const f = fs_1.default.createWriteStream(fp);
|
|
415
|
-
// if (!files[testName]) {
|
|
416
|
-
// files[testName] = new Set();
|
|
417
|
-
// }
|
|
418
438
|
files[testName].add(fp);
|
|
419
439
|
const p = new Promise((res, rej) => {
|
|
420
440
|
res(fp);
|
|
@@ -432,21 +452,11 @@ ${addableFiles
|
|
|
432
452
|
page.exposeFunction("end", async (uid) => {
|
|
433
453
|
return fileStreams2[uid].end();
|
|
434
454
|
});
|
|
435
|
-
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
436
|
-
// fs.writeFileSync(
|
|
437
|
-
// p + "/manifest.json",
|
|
438
|
-
// JSON.stringify(Array.from(files[testName]))
|
|
439
|
-
// );
|
|
440
|
-
// delete files[testName];
|
|
441
|
-
// Promise.all(screenshots[testName] || []).then(() => {
|
|
442
|
-
// delete screenshots[testName];
|
|
443
|
-
// // page.close();
|
|
444
|
-
// });
|
|
445
|
-
// });
|
|
446
455
|
return page;
|
|
447
456
|
})
|
|
448
457
|
.then(async (page) => {
|
|
449
458
|
await page.goto(`file://${`${dest}.html`}`, {});
|
|
459
|
+
/* @ts-ignore:next-line */
|
|
450
460
|
res(page);
|
|
451
461
|
});
|
|
452
462
|
});
|
|
@@ -517,10 +527,16 @@ ${addableFiles
|
|
|
517
527
|
}
|
|
518
528
|
}
|
|
519
529
|
};
|
|
520
|
-
this.launchWeb = (
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
this.
|
|
530
|
+
this.launchWeb = (src, dest) => {
|
|
531
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`! web ${src}`)));
|
|
532
|
+
this.bddTestIsRunning(src);
|
|
533
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
534
|
+
.split(".")
|
|
535
|
+
.slice(0, -1)
|
|
536
|
+
.join(".")}/web`;
|
|
537
|
+
if (!fs_1.default.existsSync(reportDest)) {
|
|
538
|
+
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
539
|
+
}
|
|
524
540
|
// sidecars.map((sidecar) => {
|
|
525
541
|
// if (sidecar[1] === "node") {
|
|
526
542
|
// return this.launchNodeSideCar(
|
|
@@ -534,7 +550,7 @@ ${addableFiles
|
|
|
534
550
|
const webArgz = JSON.stringify({
|
|
535
551
|
name: dest,
|
|
536
552
|
ports: [].toString(),
|
|
537
|
-
fs:
|
|
553
|
+
fs: reportDest,
|
|
538
554
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
539
555
|
});
|
|
540
556
|
const d = `${dest}?cacheBust=${Date.now()}`;
|
|
@@ -555,9 +571,9 @@ ${addableFiles
|
|
|
555
571
|
this.browser
|
|
556
572
|
.newPage()
|
|
557
573
|
.then((page) => {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
574
|
+
page.on("console", (msg) => {
|
|
575
|
+
console.log("web > ", msg.args(), msg.text());
|
|
576
|
+
});
|
|
561
577
|
page.exposeFunction("screencast", async (ssOpts, testName) => {
|
|
562
578
|
const p = ssOpts.path;
|
|
563
579
|
const dir = path_1.default.dirname(p);
|
|
@@ -648,37 +664,6 @@ ${addableFiles
|
|
|
648
664
|
page.exposeFunction("end", async (uid) => {
|
|
649
665
|
return fileStreams2[uid].end();
|
|
650
666
|
});
|
|
651
|
-
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
652
|
-
// // console.log("closing", p);
|
|
653
|
-
// console.log("\t GOODBYE customclose");
|
|
654
|
-
// fs.writeFileSync(
|
|
655
|
-
// p + "/manifest.json",
|
|
656
|
-
// JSON.stringify(Array.from(files[testName]))
|
|
657
|
-
// );
|
|
658
|
-
// delete files[testName];
|
|
659
|
-
// // console.log("screenshots[testName]", screenshots[testName]);
|
|
660
|
-
// Promise.all(screenshots[testName] || []).then(() => {
|
|
661
|
-
// delete screenshots[testName];
|
|
662
|
-
// });
|
|
663
|
-
// // globalThis["writeFileSync"](
|
|
664
|
-
// // p + "/manifest.json",
|
|
665
|
-
// // // files.entries()
|
|
666
|
-
// // JSON.stringify(Array.from(files[testName]))
|
|
667
|
-
// // );
|
|
668
|
-
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
669
|
-
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
670
|
-
// // Promise.all([...doneFileStream2, ...screenshots2]).then(() => {
|
|
671
|
-
// // page.close();
|
|
672
|
-
// // });
|
|
673
|
-
// // Promise.all(screenshots).then(() => {
|
|
674
|
-
// // page.close();
|
|
675
|
-
// // });
|
|
676
|
-
// // setTimeout(() => {
|
|
677
|
-
// // console.log("Delayed for 1 second.");
|
|
678
|
-
// // page.close();
|
|
679
|
-
// // }, 5000);
|
|
680
|
-
// // return page.close();
|
|
681
|
-
// });
|
|
682
667
|
page.exposeFunction("page", () => {
|
|
683
668
|
return page.mainFrame()._id;
|
|
684
669
|
});
|
|
@@ -711,33 +696,33 @@ ${addableFiles
|
|
|
711
696
|
})
|
|
712
697
|
.then(async (page) => {
|
|
713
698
|
const close = () => {
|
|
714
|
-
if (!files[
|
|
715
|
-
files[
|
|
699
|
+
if (!files[src]) {
|
|
700
|
+
files[src] = new Set();
|
|
716
701
|
}
|
|
717
702
|
// files[t].add(filepath);
|
|
718
|
-
fs_1.default.writeFileSync(destFolder + "/manifest.json", JSON.stringify(Array.from(files[
|
|
719
|
-
delete files[
|
|
720
|
-
Promise.all(screenshots[
|
|
721
|
-
delete screenshots[
|
|
703
|
+
fs_1.default.writeFileSync(destFolder + "/manifest.json", JSON.stringify(Array.from(files[src])));
|
|
704
|
+
delete files[src];
|
|
705
|
+
Promise.all(screenshots[src] || []).then(() => {
|
|
706
|
+
delete screenshots[src];
|
|
722
707
|
page.close();
|
|
723
|
-
this.testIsNowDone(t);
|
|
724
708
|
stderrStream.close();
|
|
725
709
|
stdoutStream.close();
|
|
726
710
|
});
|
|
727
711
|
};
|
|
728
712
|
page.on("pageerror", (err) => {
|
|
729
|
-
console.debug(`Error from ${
|
|
713
|
+
console.debug(`Error from ${src}: [${err.name}] `);
|
|
730
714
|
stderrStream.write(err.name);
|
|
731
715
|
if (err.cause) {
|
|
732
|
-
console.debug(`Error from ${
|
|
716
|
+
console.debug(`Error from ${src} cause: [${err.cause}] `);
|
|
733
717
|
stderrStream.write(err.cause);
|
|
734
718
|
}
|
|
735
719
|
if (err.stack) {
|
|
736
|
-
console.debug(`Error from stack ${
|
|
720
|
+
console.debug(`Error from stack ${src}: [${err.stack}] `);
|
|
737
721
|
stderrStream.write(err.stack);
|
|
738
722
|
}
|
|
739
|
-
console.debug(`Error from message ${
|
|
723
|
+
console.debug(`Error from message ${src}: [${err.message}] `);
|
|
740
724
|
stderrStream.write(err.message);
|
|
725
|
+
this.bddTestIsNowDone(src, -1);
|
|
741
726
|
close();
|
|
742
727
|
});
|
|
743
728
|
page.on("console", (log) => {
|
|
@@ -754,24 +739,24 @@ ${addableFiles
|
|
|
754
739
|
await page
|
|
755
740
|
.evaluate(evaluation)
|
|
756
741
|
.then(async ({ failed, features }) => {
|
|
757
|
-
this.receiveFeatures(features, destFolder,
|
|
742
|
+
this.receiveFeatures(features, destFolder, src, "web");
|
|
758
743
|
// console.log(`${t} completed with ${failed} errors`);
|
|
759
|
-
statusMessagePretty(failed,
|
|
760
|
-
this.
|
|
744
|
+
statusMessagePretty(failed, src);
|
|
745
|
+
this.bddTestIsNowDone(src, failed);
|
|
761
746
|
})
|
|
762
747
|
.catch((e) => {
|
|
763
748
|
// console.log(red, `${t} errored with`, e);
|
|
764
|
-
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${
|
|
749
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e}`)));
|
|
765
750
|
})
|
|
766
751
|
.finally(() => {
|
|
767
|
-
|
|
752
|
+
this.bddTestIsNowDone(src, -1);
|
|
768
753
|
close();
|
|
769
754
|
});
|
|
770
755
|
return page;
|
|
771
756
|
});
|
|
772
757
|
};
|
|
773
|
-
this.receiveFeatures = (features, destFolder, srcTest) => {
|
|
774
|
-
const featureDestination = path_1.default.resolve(process.cwd(), "
|
|
758
|
+
this.receiveFeatures = (features, destFolder, srcTest, platform) => {
|
|
759
|
+
const featureDestination = path_1.default.resolve(process.cwd(), "reports", "features", "strings", srcTest.split(".").slice(0, -1).join(".") + ".features.txt");
|
|
775
760
|
features
|
|
776
761
|
.reduce(async (mm, featureStringKey) => {
|
|
777
762
|
const accum = await mm;
|
|
@@ -779,7 +764,7 @@ ${addableFiles
|
|
|
779
764
|
if (isUrl) {
|
|
780
765
|
const u = new URL(featureStringKey);
|
|
781
766
|
if (u.protocol === "file:") {
|
|
782
|
-
const newPath = `${process.cwd()}/
|
|
767
|
+
const newPath = `${process.cwd()}/testeranto/features/internal/${path_1.default.relative(process.cwd(), u.pathname)}`;
|
|
783
768
|
await fs_1.default.promises.mkdir(path_1.default.dirname(newPath), { recursive: true });
|
|
784
769
|
try {
|
|
785
770
|
await fs_1.default.unlinkSync(newPath);
|
|
@@ -800,7 +785,7 @@ ${addableFiles
|
|
|
800
785
|
accum.files.push(newPath);
|
|
801
786
|
}
|
|
802
787
|
else if (u.protocol === "http:" || u.protocol === "https:") {
|
|
803
|
-
const newPath = `${process.cwd()}/
|
|
788
|
+
const newPath = `${process.cwd()}/testeranto/features/external${u.hostname}${u.pathname}`;
|
|
804
789
|
const body = await this.configs.featureIngestor(featureStringKey);
|
|
805
790
|
writeFileAndCreateDir(newPath, body);
|
|
806
791
|
accum.files.push(newPath);
|
|
@@ -816,7 +801,12 @@ ${addableFiles
|
|
|
816
801
|
}, Promise.resolve({ files: [], strings: [] }))
|
|
817
802
|
.then(({ files, strings }) => {
|
|
818
803
|
// writeFileAndCreateDir(`${featureDestination}`, JSON.stringify(strings));
|
|
819
|
-
fs_1.default.writeFileSync(
|
|
804
|
+
fs_1.default.writeFileSync(
|
|
805
|
+
// `${destFolder}/featurePrompt.txt`,
|
|
806
|
+
`testeranto/reports/${this.name}/${srcTest
|
|
807
|
+
.split(".")
|
|
808
|
+
.slice(0, -1)
|
|
809
|
+
.join(".")}/${platform}/featurePrompt.txt`, files
|
|
820
810
|
.map((f) => {
|
|
821
811
|
return `/read ${f}`;
|
|
822
812
|
})
|
|
@@ -824,16 +814,11 @@ ${addableFiles
|
|
|
824
814
|
});
|
|
825
815
|
// this.writeBigBoard();
|
|
826
816
|
};
|
|
827
|
-
this.receiveExitCode = (srcTest, failures) => {
|
|
828
|
-
this.bigBoard[srcTest].runTimeError = failures;
|
|
829
|
-
this.writeBigBoard();
|
|
830
|
-
};
|
|
831
817
|
this.writeBigBoard = () => {
|
|
832
|
-
fs_1.default.writeFileSync(
|
|
818
|
+
fs_1.default.writeFileSync(`./testeranto/reports/${this.name}/summary.json`, JSON.stringify(this.bigBoard, null, 2));
|
|
833
819
|
};
|
|
834
|
-
this.
|
|
835
|
-
this.
|
|
836
|
-
this.configs = configs;
|
|
820
|
+
this.name = name;
|
|
821
|
+
this.mode = mode;
|
|
837
822
|
this.ports = {};
|
|
838
823
|
this.configs.tests.forEach(([t]) => {
|
|
839
824
|
this.bigBoard[t] = {
|
|
@@ -846,294 +831,52 @@ ${addableFiles
|
|
|
846
831
|
this.configs.ports.forEach((element) => {
|
|
847
832
|
this.ports[element] = "true"; // set ports as open
|
|
848
833
|
});
|
|
849
|
-
globalThis["waitForSelector"] = async (pageKey, sel) => {
|
|
850
|
-
const page = (await this.browser.pages()).find(
|
|
851
|
-
/* @ts-ignore:next-line */
|
|
852
|
-
(p) => p.mainFrame()._id === pageKey);
|
|
853
|
-
await (page === null || page === void 0 ? void 0 : page.waitForSelector(sel));
|
|
854
|
-
};
|
|
855
|
-
globalThis["screencastStop"] = async (path) => {
|
|
856
|
-
return recorders[path].stop();
|
|
857
|
-
};
|
|
858
|
-
globalThis["closePage"] = async (pageKey) => {
|
|
859
|
-
const page = (await this.browser.pages()).find(
|
|
860
|
-
/* @ts-ignore:next-line */
|
|
861
|
-
(p) => p.mainFrame()._id === pageKey);
|
|
862
|
-
/* @ts-ignore:next-line */
|
|
863
|
-
return page.close();
|
|
864
|
-
};
|
|
865
|
-
globalThis["goto"] = async (pageKey, url) => {
|
|
866
|
-
const page = (await this.browser.pages()).find(
|
|
867
|
-
/* @ts-ignore:next-line */
|
|
868
|
-
(p) => p.mainFrame()._id === pageKey);
|
|
869
|
-
await (page === null || page === void 0 ? void 0 : page.goto(url));
|
|
870
|
-
return;
|
|
871
|
-
};
|
|
872
|
-
globalThis["newPage"] = () => {
|
|
873
|
-
return this.browser.newPage();
|
|
874
|
-
};
|
|
875
|
-
globalThis["pages"] = () => {
|
|
876
|
-
return this.browser.pages();
|
|
877
|
-
};
|
|
878
|
-
globalThis["mkdirSync"] = (fp) => {
|
|
879
|
-
if (!fs_1.default.existsSync(fp)) {
|
|
880
|
-
return fs_1.default.mkdirSync(fp, {
|
|
881
|
-
recursive: true,
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
return false;
|
|
885
|
-
};
|
|
886
|
-
globalThis["writeFileSync"] = (filepath, contents, testName) => {
|
|
887
|
-
fs_1.default.mkdirSync(path_1.default.dirname(filepath), {
|
|
888
|
-
recursive: true,
|
|
889
|
-
});
|
|
890
|
-
if (!files[testName]) {
|
|
891
|
-
files[testName] = new Set();
|
|
892
|
-
}
|
|
893
|
-
files[testName].add(filepath);
|
|
894
|
-
return fs_1.default.writeFileSync(filepath, contents);
|
|
895
|
-
};
|
|
896
|
-
globalThis["createWriteStream"] = (filepath, testName) => {
|
|
897
|
-
const f = fs_1.default.createWriteStream(filepath);
|
|
898
|
-
fileStreams3.push(f);
|
|
899
|
-
// files.add(filepath);
|
|
900
|
-
if (!files[testName]) {
|
|
901
|
-
files[testName] = new Set();
|
|
902
|
-
}
|
|
903
|
-
files[testName].add(filepath);
|
|
904
|
-
return Object.assign(Object.assign({}, JSON.parse(JSON.stringify(f))), { uid: fileStreams3.length - 1 });
|
|
905
|
-
};
|
|
906
|
-
globalThis["write"] = (uid, contents) => {
|
|
907
|
-
fileStreams3[uid].write(contents);
|
|
908
|
-
};
|
|
909
|
-
globalThis["end"] = (uid) => {
|
|
910
|
-
fileStreams3[uid].end();
|
|
911
|
-
};
|
|
912
|
-
globalThis["customScreenShot"] = async (opts, pageKey, testName) => {
|
|
913
|
-
const page = (await this.browser.pages()).find(
|
|
914
|
-
/* @ts-ignore:next-line */
|
|
915
|
-
(p) => p.mainFrame()._id === pageKey);
|
|
916
|
-
const p = opts.path;
|
|
917
|
-
const dir = path_1.default.dirname(p);
|
|
918
|
-
fs_1.default.mkdirSync(dir, {
|
|
919
|
-
recursive: true,
|
|
920
|
-
});
|
|
921
|
-
if (!files[opts.path]) {
|
|
922
|
-
files[opts.path] = new Set();
|
|
923
|
-
}
|
|
924
|
-
files[opts.path].add(opts.path);
|
|
925
|
-
const sPromise = page.screenshot(Object.assign(Object.assign({}, opts), { path: p }));
|
|
926
|
-
if (!screenshots[opts.path]) {
|
|
927
|
-
screenshots[opts.path] = [];
|
|
928
|
-
}
|
|
929
|
-
screenshots[opts.path].push(sPromise);
|
|
930
|
-
await sPromise;
|
|
931
|
-
return sPromise;
|
|
932
|
-
};
|
|
933
|
-
globalThis["screencast"] = async (opts, pageKey) => {
|
|
934
|
-
const page = (await this.browser.pages()).find(
|
|
935
|
-
/* @ts-ignore:next-line */
|
|
936
|
-
(p) => p.mainFrame()._id === pageKey);
|
|
937
|
-
const p = opts.path;
|
|
938
|
-
const dir = path_1.default.dirname(p);
|
|
939
|
-
fs_1.default.mkdirSync(dir, {
|
|
940
|
-
recursive: true,
|
|
941
|
-
});
|
|
942
|
-
const recorder = await (page === null || page === void 0 ? void 0 : page.screencast(Object.assign(Object.assign({}, opts), { path: p })));
|
|
943
|
-
recorders[opts.path] = recorder;
|
|
944
|
-
return opts.path;
|
|
945
|
-
};
|
|
946
|
-
}
|
|
947
|
-
customclose() {
|
|
948
|
-
throw new Error("Method not implemented.");
|
|
949
|
-
}
|
|
950
|
-
waitForSelector(p, s) {
|
|
951
|
-
throw new Error("Method not implemented.");
|
|
952
|
-
}
|
|
953
|
-
closePage(p) {
|
|
954
|
-
throw new Error("Method not implemented.");
|
|
955
|
-
}
|
|
956
|
-
newPage() {
|
|
957
|
-
throw new Error("Method not implemented.");
|
|
958
|
-
}
|
|
959
|
-
goto(p, url) {
|
|
960
|
-
throw new Error("Method not implemented.");
|
|
961
|
-
}
|
|
962
|
-
$(selector) {
|
|
963
|
-
throw new Error("Method not implemented.");
|
|
964
|
-
}
|
|
965
|
-
screencast(opts) {
|
|
966
|
-
throw new Error("Method not implemented.");
|
|
967
|
-
}
|
|
968
|
-
customScreenShot(opts, cdpPage) {
|
|
969
|
-
throw new Error("Method not implemented.");
|
|
970
|
-
}
|
|
971
|
-
end(accessObject) {
|
|
972
|
-
throw new Error("Method not implemented.");
|
|
973
|
-
}
|
|
974
|
-
existsSync(destFolder) {
|
|
975
|
-
return fs_1.default.existsSync(destFolder);
|
|
976
|
-
}
|
|
977
|
-
async mkdirSync(fp) {
|
|
978
|
-
if (!fs_1.default.existsSync(fp)) {
|
|
979
|
-
return fs_1.default.mkdirSync(fp, {
|
|
980
|
-
recursive: true,
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
return false;
|
|
984
|
-
}
|
|
985
|
-
writeFileSync(fp, contents) {
|
|
986
|
-
fs_1.default.writeFileSync(fp, contents);
|
|
987
|
-
}
|
|
988
|
-
createWriteStream(filepath) {
|
|
989
|
-
return fs_1.default.createWriteStream(filepath);
|
|
990
|
-
}
|
|
991
|
-
testArtiFactoryfileWriter(tLog, callback) {
|
|
992
|
-
return (fPath, value) => {
|
|
993
|
-
callback(new Promise((res, rej) => {
|
|
994
|
-
tLog("testArtiFactory =>", fPath);
|
|
995
|
-
const cleanPath = path_1.default.resolve(fPath);
|
|
996
|
-
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
997
|
-
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
998
|
-
fs_1.default.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
999
|
-
if (error) {
|
|
1000
|
-
console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
1001
|
-
}
|
|
1002
|
-
fs_1.default.writeFileSync(path_1.default.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
|
|
1003
|
-
encoding: "utf-8",
|
|
1004
|
-
});
|
|
1005
|
-
if (Buffer.isBuffer(value)) {
|
|
1006
|
-
fs_1.default.writeFileSync(fPath, value, "binary");
|
|
1007
|
-
res();
|
|
1008
|
-
}
|
|
1009
|
-
else if (`string` === typeof value) {
|
|
1010
|
-
fs_1.default.writeFileSync(fPath, value.toString(), {
|
|
1011
|
-
encoding: "utf-8",
|
|
1012
|
-
});
|
|
1013
|
-
res();
|
|
1014
|
-
}
|
|
1015
|
-
else {
|
|
1016
|
-
/* @ts-ignore:next-line */
|
|
1017
|
-
const pipeStream = value;
|
|
1018
|
-
const myFile = fs_1.default.createWriteStream(fPath);
|
|
1019
|
-
pipeStream.pipe(myFile);
|
|
1020
|
-
pipeStream.on("close", () => {
|
|
1021
|
-
myFile.close();
|
|
1022
|
-
res();
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
|
-
});
|
|
1026
|
-
}));
|
|
1027
|
-
};
|
|
1028
|
-
}
|
|
1029
|
-
write(accessObject, contents) {
|
|
1030
|
-
throw new Error("Method not implemented.");
|
|
1031
|
-
}
|
|
1032
|
-
page() {
|
|
1033
|
-
throw new Error("Method not implemented.");
|
|
1034
|
-
}
|
|
1035
|
-
click(selector) {
|
|
1036
|
-
throw new Error("Method not implemented.");
|
|
1037
|
-
}
|
|
1038
|
-
focusOn(selector) {
|
|
1039
|
-
throw new Error("Method not implemented.");
|
|
1040
|
-
}
|
|
1041
|
-
typeInto(value) {
|
|
1042
|
-
throw new Error("Method not implemented.");
|
|
1043
|
-
}
|
|
1044
|
-
getValue(value) {
|
|
1045
|
-
throw new Error("Method not implemented.");
|
|
1046
|
-
}
|
|
1047
|
-
getAttribute(selector, attribute) {
|
|
1048
|
-
throw new Error("Method not implemented.");
|
|
1049
|
-
}
|
|
1050
|
-
isDisabled(selector) {
|
|
1051
|
-
throw new Error("Method not implemented.");
|
|
1052
|
-
}
|
|
1053
|
-
screencastStop(s) {
|
|
1054
|
-
throw new Error("Method not implemented.");
|
|
1055
|
-
}
|
|
1056
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
1057
|
-
async metafileOutputs(platform) {
|
|
1058
|
-
const metafile = JSON.parse(fs_1.default.readFileSync(`docs/${platform}/metafile.json`).toString()).metafile;
|
|
1059
|
-
if (!metafile)
|
|
1060
|
-
return;
|
|
1061
|
-
const outputs = metafile.outputs;
|
|
1062
|
-
Object.keys(outputs).forEach(async (k) => {
|
|
1063
|
-
const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
|
|
1064
|
-
if (!fs_1.default.existsSync(i))
|
|
1065
|
-
return false;
|
|
1066
|
-
if (i.startsWith("node_modules"))
|
|
1067
|
-
return false;
|
|
1068
|
-
return true;
|
|
1069
|
-
});
|
|
1070
|
-
const f = `${k.split(".").slice(0, -1).join(".")}/`;
|
|
1071
|
-
if (!fs_1.default.existsSync(f)) {
|
|
1072
|
-
fs_1.default.mkdirSync(f);
|
|
1073
|
-
}
|
|
1074
|
-
const entrypoint = outputs[k].entryPoint;
|
|
1075
|
-
if (entrypoint) {
|
|
1076
|
-
const changeDigest = await filesHash(addableFiles);
|
|
1077
|
-
if (changeDigest === changes[entrypoint]) {
|
|
1078
|
-
// skip
|
|
1079
|
-
}
|
|
1080
|
-
else {
|
|
1081
|
-
changes[entrypoint] = changeDigest;
|
|
1082
|
-
this.tscCheck({
|
|
1083
|
-
platform,
|
|
1084
|
-
addableFiles,
|
|
1085
|
-
entrypoint: "./" + entrypoint,
|
|
1086
|
-
});
|
|
1087
|
-
this.eslintCheck("./" + entrypoint, platform, addableFiles);
|
|
1088
|
-
this.makePrompt("./" + entrypoint, addableFiles, platform);
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
});
|
|
1092
834
|
}
|
|
1093
835
|
async start() {
|
|
836
|
+
if (!fs_1.default.existsSync(`testeranto/reports/${this.name}`)) {
|
|
837
|
+
fs_1.default.mkdirSync(`testeranto/reports/${this.name}`);
|
|
838
|
+
}
|
|
1094
839
|
this.browser = (await puppeteer_core_1.default.launch({
|
|
1095
840
|
slowMo: 1,
|
|
1096
|
-
// timeout: 1,
|
|
1097
841
|
waitForInitialPage: false,
|
|
1098
842
|
executablePath:
|
|
1099
843
|
// process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
|
|
1100
844
|
"/opt/homebrew/bin/chromium",
|
|
1101
845
|
headless: true,
|
|
1102
|
-
dumpio:
|
|
1103
|
-
|
|
1104
|
-
devtools: true,
|
|
846
|
+
dumpio: false,
|
|
847
|
+
devtools: false,
|
|
1105
848
|
args: [
|
|
1106
|
-
"--auto-open-devtools-for-tabs",
|
|
1107
|
-
`--remote-debugging-port=3234`,
|
|
1108
|
-
// "--disable-features=IsolateOrigins,site-per-process",
|
|
1109
|
-
"--disable-site-isolation-trials",
|
|
1110
|
-
"--allow-insecure-localhost",
|
|
1111
849
|
"--allow-file-access-from-files",
|
|
850
|
+
"--allow-insecure-localhost",
|
|
1112
851
|
"--allow-running-insecure-content",
|
|
852
|
+
"--auto-open-devtools-for-tabs",
|
|
1113
853
|
"--disable-dev-shm-usage",
|
|
1114
854
|
"--disable-extensions",
|
|
1115
855
|
"--disable-gpu",
|
|
1116
856
|
"--disable-setuid-sandbox",
|
|
1117
857
|
"--disable-site-isolation-trials",
|
|
858
|
+
"--disable-site-isolation-trials",
|
|
1118
859
|
"--disable-web-security",
|
|
1119
860
|
"--no-first-run",
|
|
1120
861
|
"--no-sandbox",
|
|
1121
862
|
"--no-startup-window",
|
|
1122
|
-
// "--no-zygote",
|
|
1123
863
|
"--reduce-security-for-testing",
|
|
1124
864
|
"--remote-allow-origins=*",
|
|
865
|
+
`--remote-debugging-port=3234`,
|
|
1125
866
|
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
867
|
+
// "--disable-features=IsolateOrigins,site-per-process",
|
|
1126
868
|
// "--disable-features=IsolateOrigins",
|
|
869
|
+
// "--disk-cache-dir=/dev/null",
|
|
870
|
+
// "--disk-cache-size=1",
|
|
871
|
+
// "--no-zygote",
|
|
1127
872
|
// "--remote-allow-origins=ws://localhost:3234",
|
|
1128
873
|
// "--single-process",
|
|
874
|
+
// "--start-maximized",
|
|
1129
875
|
// "--unsafely-treat-insecure-origin-as-secure",
|
|
1130
876
|
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
1131
|
-
// "--disk-cache-dir=/dev/null",
|
|
1132
|
-
// "--disk-cache-size=1",
|
|
1133
|
-
// "--start-maximized",
|
|
1134
877
|
],
|
|
1135
878
|
}));
|
|
1136
|
-
const { nodeEntryPoints, webEntryPoints } = getRunnables(this.configs.tests);
|
|
879
|
+
const { nodeEntryPoints, webEntryPoints } = this.getRunnables(this.configs.tests);
|
|
1137
880
|
Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
|
|
1138
881
|
this.launchNode(k, outputFile);
|
|
1139
882
|
try {
|
|
@@ -1162,15 +905,55 @@ ${addableFiles
|
|
|
1162
905
|
});
|
|
1163
906
|
});
|
|
1164
907
|
this.metafileOutputs("node");
|
|
1165
|
-
|
|
908
|
+
const w = `./testeranto/bundles/node/${this.name}/metafile.json`;
|
|
909
|
+
console.log("w", w);
|
|
910
|
+
this.nodeMetafileWatcher = (0, fs_1.watch)(w, async (e, filename) => {
|
|
1166
911
|
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`< ${e} ${filename} (node)`)));
|
|
1167
912
|
this.metafileOutputs("node");
|
|
1168
913
|
});
|
|
1169
914
|
this.metafileOutputs("web");
|
|
1170
|
-
this.webMetafileWatcher = (0, fs_1.watch)(
|
|
915
|
+
this.webMetafileWatcher = (0, fs_1.watch)(`./testeranto/bundles/web/${this.name}/metafile.json`, async (e, filename) => {
|
|
1171
916
|
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`< ${e} ${filename} (web)`)));
|
|
1172
917
|
this.metafileOutputs("web");
|
|
1173
918
|
});
|
|
1174
919
|
}
|
|
920
|
+
async metafileOutputs(platform) {
|
|
921
|
+
const metafile = JSON.parse(fs_1.default
|
|
922
|
+
.readFileSync(`./testeranto/bundles/${platform}/${this.name}/metafile.json`)
|
|
923
|
+
.toString()).metafile;
|
|
924
|
+
if (!metafile)
|
|
925
|
+
return;
|
|
926
|
+
const outputs = metafile.outputs;
|
|
927
|
+
Object.keys(outputs).forEach(async (k) => {
|
|
928
|
+
const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
|
|
929
|
+
if (!fs_1.default.existsSync(i))
|
|
930
|
+
return false;
|
|
931
|
+
if (i.startsWith("node_modules"))
|
|
932
|
+
return false;
|
|
933
|
+
return true;
|
|
934
|
+
});
|
|
935
|
+
const f = `${k.split(".").slice(0, -1).join(".")}/`;
|
|
936
|
+
if (!fs_1.default.existsSync(f)) {
|
|
937
|
+
fs_1.default.mkdirSync(f);
|
|
938
|
+
}
|
|
939
|
+
const entrypoint = outputs[k].entryPoint;
|
|
940
|
+
if (entrypoint) {
|
|
941
|
+
const changeDigest = await filesHash(addableFiles);
|
|
942
|
+
if (changeDigest === changes[entrypoint]) {
|
|
943
|
+
// skip
|
|
944
|
+
}
|
|
945
|
+
else {
|
|
946
|
+
changes[entrypoint] = changeDigest;
|
|
947
|
+
this.tscCheck({
|
|
948
|
+
platform,
|
|
949
|
+
addableFiles,
|
|
950
|
+
entrypoint: "./" + entrypoint,
|
|
951
|
+
});
|
|
952
|
+
this.eslintCheck("./" + entrypoint, platform, addableFiles);
|
|
953
|
+
this.makePrompt("./" + entrypoint, addableFiles, platform);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
}
|
|
1175
958
|
}
|
|
1176
959
|
exports.PM_Main = PM_Main;
|