testeranto 0.111.0 → 0.112.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.
- package/dist/common/Init.js +68 -0
- package/dist/common/Node.js +27 -0
- package/dist/common/PM/index.js +7 -0
- package/dist/common/PM/main.js +1176 -0
- package/dist/common/PM/node.js +128 -0
- package/dist/common/PM/web.js +121 -0
- package/dist/common/ReportServer.js +22 -0
- package/dist/common/SubPackages/react/component/node.js +19 -0
- package/dist/common/SubPackages/react/component/web.js +19 -0
- package/dist/common/SubPackages/react/jsx/index.js +21 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-dom/component/node.js +88 -0
- package/dist/common/SubPackages/react-dom/component/web.js +67 -0
- package/dist/common/SubPackages/react-dom/jsx/index.js +2 -0
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/SubPackages/react-dom/jsx/web.js +128 -0
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +54 -0
- package/dist/common/SubPackages/react-test-renderer/component/index.js +2 -0
- package/dist/common/SubPackages/react-test-renderer/component/interface.js +70 -0
- package/dist/common/SubPackages/react-test-renderer/component/node.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/component/web.js +8 -0
- package/dist/common/SubPackages/react-test-renderer/fc/node.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +60 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +67 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +52 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +10 -0
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +10 -0
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -0
- package/dist/common/build.js +222 -0
- package/dist/common/defaultConfig.js +20 -0
- package/dist/common/esbuildConfigs/eslint-formatter-testeranto.js +6 -0
- package/dist/common/esbuildConfigs/featuresPlugin.js +39 -0
- package/dist/common/esbuildConfigs/index.js +21 -0
- package/dist/common/esbuildConfigs/inputFilesPlugin.js +27 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/init-docs.js +53 -0
- package/dist/common/lib/abstractBase.js +329 -0
- package/dist/common/lib/basebuilder.js +98 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +117 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/package.json +3 -0
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/run.js +62 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -0
- package/dist/common/utils.js +43 -0
- package/dist/common/web.html.js +22 -0
- package/dist/module/Footer.js +4 -0
- package/dist/module/Init.js +63 -0
- package/dist/module/Node.js +20 -0
- package/dist/module/PM/index.js +3 -0
- package/dist/module/PM/main.js +1136 -0
- package/dist/module/PM/node.js +121 -0
- package/dist/module/PM/web.js +117 -0
- package/dist/module/ReportClient.js +97 -0
- package/dist/module/ReportServer.js +17 -0
- package/dist/module/SubPackages/react/component/node.js +14 -0
- package/dist/module/SubPackages/react/component/web.js +14 -0
- package/dist/module/SubPackages/react/jsx/index.js +15 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-dom/component/node.js +80 -0
- package/dist/module/SubPackages/react-dom/component/web.js +62 -0
- package/dist/module/SubPackages/react-dom/jsx/index.js +1 -0
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/SubPackages/react-dom/jsx/web.js +90 -0
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -0
- package/dist/module/SubPackages/react-test-renderer/component/interface.js +31 -0
- package/dist/module/SubPackages/react-test-renderer/component/node.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/component/web.js +3 -0
- package/dist/module/SubPackages/react-test-renderer/fc/node.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +22 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +28 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +16 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +5 -0
- package/dist/module/TestReport.js +91 -0
- package/dist/module/Types.js +1 -0
- package/dist/module/Web.js +42 -0
- package/dist/module/build.js +184 -0
- package/dist/module/defaultConfig.js +18 -0
- package/dist/module/esbuildConfigs/eslint-formatter-testeranto.js +3 -0
- package/dist/module/esbuildConfigs/featuresPlugin.js +34 -0
- package/dist/module/esbuildConfigs/index.js +19 -0
- package/dist/module/esbuildConfigs/inputFilesPlugin.js +22 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/init-docs.js +15 -0
- package/dist/module/lib/abstractBase.js +321 -0
- package/dist/module/lib/basebuilder.js +94 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +114 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/package.json +3 -0
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/run.js +24 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -0
- package/dist/module/utils.js +29 -0
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/ReportClient.css +11367 -0
- package/dist/prebuild/ReportClient.js +24641 -0
- package/dist/prebuild/ReportServer.mjs +16 -0
- package/dist/prebuild/TestReport.css +11367 -0
- package/dist/prebuild/TestReport.js +27484 -0
- package/dist/prebuild/build.mjs +376 -0
- package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +9 -0
- package/dist/prebuild/init-docs.mjs +104 -0
- package/dist/prebuild/run.mjs +1153 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/Init.d.ts +2 -0
- package/dist/types/Node.d.ts +12 -0
- package/dist/types/PM/index.d.ts +34 -0
- package/dist/types/PM/main.d.ts +66 -0
- package/dist/types/PM/node.d.ts +40 -0
- package/dist/types/PM/web.d.ts +38 -0
- package/dist/types/ReportServer.d.ts +1 -0
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +12 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/SubPackages/react-dom/component/node.d.ts +11 -0
- package/dist/types/SubPackages/react-dom/component/web.d.ts +20 -0
- package/dist/types/SubPackages/react-dom/jsx/index.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +7 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +6 -0
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +13 -0
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +16 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +15 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +61 -0
- package/dist/types/Web.d.ts +9 -0
- package/dist/types/build.d.ts +1 -0
- package/dist/types/defaultConfig.d.ts +3 -0
- package/dist/types/esbuildConfigs/eslint-formatter-testeranto.d.ts +2 -0
- package/dist/types/esbuildConfigs/featuresPlugin.d.ts +5 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +6 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/init-docs.d.ts +1 -0
- package/dist/types/lib/abstractBase.d.ts +110 -0
- package/dist/types/lib/basebuilder.d.ts +27 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +83 -0
- package/dist/types/lib/types.d.ts +14 -0
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/run.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/utils.d.ts +15 -0
- package/dist/types/web.html.d.ts +2 -0
- package/package.json +1 -1
- package/src/PM/main.ts +25 -57
- package/src/ReportClient.tsx +43 -41
- package/src/run.ts +8 -5
- package/src/utils.ts +10 -0
- package/tsc.log +8 -8
|
@@ -0,0 +1,1176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.PM_Main = void 0;
|
|
40
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
41
|
+
const fs_1 = __importStar(require("fs"));
|
|
42
|
+
const path_1 = __importDefault(require("path"));
|
|
43
|
+
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
44
|
+
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
45
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
46
|
+
const eslint_1 = require("eslint");
|
|
47
|
+
const tsc_prog_1 = __importDefault(require("tsc-prog"));
|
|
48
|
+
const utils_1 = require("../utils");
|
|
49
|
+
const index_js_1 = require("./index.js");
|
|
50
|
+
const eslint = new eslint_1.ESLint();
|
|
51
|
+
const formatter = await eslint.loadFormatter("./node_modules/testeranto/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs");
|
|
52
|
+
const changes = {};
|
|
53
|
+
const fileHashes = {};
|
|
54
|
+
const fileStreams3 = [];
|
|
55
|
+
const fPaths = [];
|
|
56
|
+
const files = {};
|
|
57
|
+
const recorders = {};
|
|
58
|
+
const screenshots = {};
|
|
59
|
+
async function fileHash(filePath, algorithm = "md5") {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
const hash = node_crypto_1.default.createHash(algorithm);
|
|
62
|
+
const fileStream = fs_1.default.createReadStream(filePath);
|
|
63
|
+
fileStream.on("data", (data) => {
|
|
64
|
+
hash.update(data);
|
|
65
|
+
});
|
|
66
|
+
fileStream.on("end", () => {
|
|
67
|
+
const fileHash = hash.digest("hex");
|
|
68
|
+
resolve(fileHash);
|
|
69
|
+
});
|
|
70
|
+
fileStream.on("error", (error) => {
|
|
71
|
+
reject(`Error reading file: ${error.message}`);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
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
|
+
const statusMessagePretty = (failures, test) => {
|
|
93
|
+
if (failures === 0) {
|
|
94
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`> ${test} completed successfully`)));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`> ${test} failed ${failures} times`)));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
async function writeFileAndCreateDir(filePath, data) {
|
|
101
|
+
const dirPath = path_1.default.dirname(filePath);
|
|
102
|
+
try {
|
|
103
|
+
await fs_1.default.promises.mkdir(dirPath, { recursive: true });
|
|
104
|
+
await fs_1.default.appendFileSync(filePath, data);
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error(`Error writing file: ${error}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const filesHash = async (files, algorithm = "md5") => {
|
|
111
|
+
return new Promise((resolve, reject) => {
|
|
112
|
+
resolve(files.reduce(async (mm, f) => {
|
|
113
|
+
return (await mm) + (await fileHash(f));
|
|
114
|
+
}, Promise.resolve("")));
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
function isValidUrl(string) {
|
|
118
|
+
try {
|
|
119
|
+
new URL(string);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
class PM_Main extends index_js_1.PM {
|
|
127
|
+
constructor(configs) {
|
|
128
|
+
super();
|
|
129
|
+
this.shutdownMode = false;
|
|
130
|
+
this.bigBoard = {};
|
|
131
|
+
this.stop = () => {
|
|
132
|
+
console.log(ansi_colors_1.default.inverse("Testeranto-Run is shutting down gracefully..."));
|
|
133
|
+
this.mode = "PROD";
|
|
134
|
+
this.nodeMetafileWatcher.close();
|
|
135
|
+
this.webMetafileWatcher.close();
|
|
136
|
+
this.checkForShutdown();
|
|
137
|
+
};
|
|
138
|
+
this.tscCheck = async ({ entrypoint, addableFiles, platform, }) => {
|
|
139
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`tsc < ${entrypoint}`)));
|
|
140
|
+
this.bigBoard[entrypoint].typeErrors = "?";
|
|
141
|
+
const program = tsc_prog_1.default.createProgramFromConfig({
|
|
142
|
+
basePath: process.cwd(), // always required, used for relative paths
|
|
143
|
+
configFilePath: "tsconfig.json", // config to inherit from (optional)
|
|
144
|
+
compilerOptions: {
|
|
145
|
+
rootDir: "src",
|
|
146
|
+
outDir: (0, utils_1.tscPather)(entrypoint, platform),
|
|
147
|
+
// declaration: true,
|
|
148
|
+
// skipLibCheck: true,
|
|
149
|
+
noEmit: true,
|
|
150
|
+
},
|
|
151
|
+
include: addableFiles, //["src/**/*"],
|
|
152
|
+
// exclude: ["**/*.test.ts", "**/*.spec.ts"],
|
|
153
|
+
});
|
|
154
|
+
const tscPath = (0, utils_1.tscPather)(entrypoint, platform);
|
|
155
|
+
let allDiagnostics = program.getSemanticDiagnostics();
|
|
156
|
+
const d = [];
|
|
157
|
+
allDiagnostics.forEach((diagnostic) => {
|
|
158
|
+
if (diagnostic.file) {
|
|
159
|
+
let { line, character } = typescript_1.default.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
|
|
160
|
+
let message = typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
161
|
+
d.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
d.push(typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
fs_1.default.writeFileSync(tscPath, d.join("\n"));
|
|
168
|
+
this.bigBoard[entrypoint].typeErrors = d.length;
|
|
169
|
+
if (this.shutdownMode) {
|
|
170
|
+
this.checkForShutdown();
|
|
171
|
+
}
|
|
172
|
+
// fs.writeFileSync(
|
|
173
|
+
// tscExitCodePather(entrypoint, platform),
|
|
174
|
+
// d.length.toString()
|
|
175
|
+
// );
|
|
176
|
+
};
|
|
177
|
+
this.eslintCheck = async (entrypoint, platform, addableFiles) => {
|
|
178
|
+
this.bigBoard[entrypoint].staticErrors = "?";
|
|
179
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`eslint < ${entrypoint}`)));
|
|
180
|
+
const results = (await eslint.lintFiles(addableFiles))
|
|
181
|
+
.filter((r) => r.messages.length)
|
|
182
|
+
.filter((r) => {
|
|
183
|
+
return r.messages[0].ruleId !== null;
|
|
184
|
+
})
|
|
185
|
+
.map((r) => {
|
|
186
|
+
delete r.source;
|
|
187
|
+
return r;
|
|
188
|
+
});
|
|
189
|
+
fs_1.default.writeFileSync((0, utils_1.lintPather)(entrypoint, platform), await formatter.format(results));
|
|
190
|
+
this.bigBoard[entrypoint].staticErrors = results.length;
|
|
191
|
+
if (this.shutdownMode) {
|
|
192
|
+
this.checkForShutdown();
|
|
193
|
+
}
|
|
194
|
+
// fs.writeFileSync(
|
|
195
|
+
// lintExitCodePather(entrypoint, platform),
|
|
196
|
+
// results.length.toString()
|
|
197
|
+
// );
|
|
198
|
+
};
|
|
199
|
+
this.makePrompt = async (entryPoint, addableFiles, platform) => {
|
|
200
|
+
this.bigBoard[entryPoint].prompt = "?";
|
|
201
|
+
const promptPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
|
|
202
|
+
const testPaths = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
|
|
203
|
+
const featuresPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
|
|
204
|
+
fs_1.default.writeFileSync(promptPath, `
|
|
205
|
+
${addableFiles
|
|
206
|
+
.map((x) => {
|
|
207
|
+
return `/add ${x}`;
|
|
208
|
+
})
|
|
209
|
+
.join("\n")}
|
|
210
|
+
|
|
211
|
+
/read ${(0, utils_1.lintPather)(entryPoint, platform)}
|
|
212
|
+
/read ${(0, utils_1.tscPather)(entryPoint, platform)}
|
|
213
|
+
/read ${testPaths}
|
|
214
|
+
|
|
215
|
+
/load ${featuresPath}
|
|
216
|
+
|
|
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)}"
|
|
218
|
+
`);
|
|
219
|
+
this.bigBoard[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load docs/${platform}/${entryPoint
|
|
220
|
+
.split(".")
|
|
221
|
+
.slice(0, -1)
|
|
222
|
+
.join(".")}/prompt.txt`;
|
|
223
|
+
if (this.shutdownMode) {
|
|
224
|
+
this.checkForShutdown();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
this.checkForShutdown = () => {
|
|
228
|
+
const anyRunning = Object.values(this.bigBoard).filter((x) => x.prompt === "?").length +
|
|
229
|
+
Object.values(this.bigBoard).filter((x) => x.runTimeError === "?")
|
|
230
|
+
.length +
|
|
231
|
+
Object.values(this.bigBoard).filter((x) => x.staticErrors === "?")
|
|
232
|
+
.length +
|
|
233
|
+
Object.values(this.bigBoard).filter((x) => x.typeErrors === "?")
|
|
234
|
+
.length >
|
|
235
|
+
0;
|
|
236
|
+
if (anyRunning) {
|
|
237
|
+
console.log(ansi_colors_1.default.inverse("Shutting down. Please wait"));
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.browser.disconnect().then(() => {
|
|
241
|
+
fs_1.default.writeFileSync("docs/summary.json", JSON.stringify(this.bigBoard, null, 2));
|
|
242
|
+
console.log(ansi_colors_1.default.inverse("Goodbye"));
|
|
243
|
+
process.exit();
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
this.testIsNowRunning = (src) => {
|
|
248
|
+
this.bigBoard[src].status = "running";
|
|
249
|
+
};
|
|
250
|
+
this.testIsNowDone = (src) => {
|
|
251
|
+
this.bigBoard[src].status = "waiting";
|
|
252
|
+
if (this.shutdownMode) {
|
|
253
|
+
this.checkForShutdown();
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
this.launchNode = async (src, dest) => {
|
|
257
|
+
// console.log(ansiC.yellow(`! node, ${src}`));
|
|
258
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`! node, ${src}`)));
|
|
259
|
+
this.testIsNowRunning(src);
|
|
260
|
+
const destFolder = dest.replace(".mjs", "");
|
|
261
|
+
let argz = "";
|
|
262
|
+
const testConfig = this.configs.tests.find((t) => {
|
|
263
|
+
return t[0] === src;
|
|
264
|
+
});
|
|
265
|
+
if (!testConfig) {
|
|
266
|
+
console.log(ansi_colors_1.default.inverse("missing test config! Exiting ungracefully!"));
|
|
267
|
+
process.exit(-1);
|
|
268
|
+
}
|
|
269
|
+
const testConfigResource = testConfig[2];
|
|
270
|
+
let portsToUse = [];
|
|
271
|
+
if (testConfigResource.ports === 0) {
|
|
272
|
+
argz = JSON.stringify({
|
|
273
|
+
scheduled: true,
|
|
274
|
+
name: src,
|
|
275
|
+
ports: portsToUse,
|
|
276
|
+
fs: destFolder,
|
|
277
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
else if (testConfigResource.ports > 0) {
|
|
281
|
+
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen);
|
|
282
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
283
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
284
|
+
portsToUse.push(openPorts[i][0]);
|
|
285
|
+
this.ports[openPorts[i][0]] = false; // port is now closed
|
|
286
|
+
}
|
|
287
|
+
argz = JSON.stringify({
|
|
288
|
+
scheduled: true,
|
|
289
|
+
name: src,
|
|
290
|
+
// ports: [3333],
|
|
291
|
+
ports: portsToUse,
|
|
292
|
+
fs: destFolder,
|
|
293
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.queue.push(src);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
console.error("negative port makes no sense", src);
|
|
303
|
+
process.exit(-1);
|
|
304
|
+
}
|
|
305
|
+
const builtfile = dest;
|
|
306
|
+
const webSideCares = [];
|
|
307
|
+
// await Promise.all(
|
|
308
|
+
// testConfig[3].map(async (sidecar) => {
|
|
309
|
+
// if (sidecar[1] === "web") {
|
|
310
|
+
// const s = await this.launchWebSideCar(
|
|
311
|
+
// sidecar[0],
|
|
312
|
+
// destinationOfRuntime(sidecar[0], "web", this.configs),
|
|
313
|
+
// sidecar
|
|
314
|
+
// );
|
|
315
|
+
// webSideCares.push(s);
|
|
316
|
+
// return s;
|
|
317
|
+
// }
|
|
318
|
+
// if (sidecar[1] === "node") {
|
|
319
|
+
// return this.launchNodeSideCar(
|
|
320
|
+
// sidecar[0],
|
|
321
|
+
// destinationOfRuntime(sidecar[0], "node", this.configs),
|
|
322
|
+
// sidecar
|
|
323
|
+
// );
|
|
324
|
+
// }
|
|
325
|
+
// })
|
|
326
|
+
// );
|
|
327
|
+
this.server[builtfile] = await Promise.resolve(`${`${builtfile}?cacheBust=${Date.now()}`}`).then(s => __importStar(require(s))).then((module) => {
|
|
328
|
+
return module.default.then((defaultModule) => {
|
|
329
|
+
defaultModule
|
|
330
|
+
.receiveTestResourceConfig(argz)
|
|
331
|
+
.then(async ({ features, failed }) => {
|
|
332
|
+
this.receiveFeatures(features, destFolder, src);
|
|
333
|
+
// console.log(`${src} completed with ${failed} errors`);
|
|
334
|
+
statusMessagePretty(failed, src);
|
|
335
|
+
this.receiveExitCode(src, failed);
|
|
336
|
+
})
|
|
337
|
+
.catch((e) => {
|
|
338
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e}`)));
|
|
339
|
+
// console.log(reset, `${src} errored with`, e);
|
|
340
|
+
})
|
|
341
|
+
.finally(() => {
|
|
342
|
+
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
343
|
+
this.testIsNowDone(src);
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
// console.log("portsToUse", portsToUse);
|
|
348
|
+
for (let i = 0; i <= portsToUse.length; i++) {
|
|
349
|
+
if (portsToUse[i]) {
|
|
350
|
+
this.ports[portsToUse[i]] = "true"; //port is open again
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
this.launchWebSideCar = async (src, dest, testConfig) => {
|
|
355
|
+
const d = dest + ".mjs";
|
|
356
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`launchWebSideCar ${src}`)));
|
|
357
|
+
const fileStreams2 = [];
|
|
358
|
+
const doneFileStream2 = [];
|
|
359
|
+
return new Promise((res, rej) => {
|
|
360
|
+
this.browser
|
|
361
|
+
.newPage()
|
|
362
|
+
.then((page) => {
|
|
363
|
+
// page.on("console", (msg) => {
|
|
364
|
+
// console.log("web > ", msg.args(), msg.text());
|
|
365
|
+
// // for (let i = 0; i < msg._args.length; ++i)
|
|
366
|
+
// // console.log(`${i}: ${msg._args[i]}`);
|
|
367
|
+
// });
|
|
368
|
+
page.exposeFunction("custom-screenshot", async (ssOpts, testName) => {
|
|
369
|
+
// console.log("main.ts browser custom-screenshot", testName);
|
|
370
|
+
const p = ssOpts.path;
|
|
371
|
+
const dir = path_1.default.dirname(p);
|
|
372
|
+
fs_1.default.mkdirSync(dir, {
|
|
373
|
+
recursive: true,
|
|
374
|
+
});
|
|
375
|
+
files[testName].add(ssOpts.path);
|
|
376
|
+
const sPromise = page.screenshot(Object.assign(Object.assign({}, ssOpts), { path: p }));
|
|
377
|
+
if (!screenshots[testName]) {
|
|
378
|
+
screenshots[testName] = [];
|
|
379
|
+
}
|
|
380
|
+
screenshots[testName].push(sPromise);
|
|
381
|
+
// sPromise.then(())
|
|
382
|
+
await sPromise;
|
|
383
|
+
return sPromise;
|
|
384
|
+
// page.evaluate(`window["screenshot done"]`);
|
|
385
|
+
});
|
|
386
|
+
page.exposeFunction("writeFileSync", (fp, contents, testName) => {
|
|
387
|
+
const dir = path_1.default.dirname(fp);
|
|
388
|
+
fs_1.default.mkdirSync(dir, {
|
|
389
|
+
recursive: true,
|
|
390
|
+
});
|
|
391
|
+
const p = new Promise(async (res, rej) => {
|
|
392
|
+
fs_1.default.writeFileSync(fp, contents);
|
|
393
|
+
res(fp);
|
|
394
|
+
});
|
|
395
|
+
doneFileStream2.push(p);
|
|
396
|
+
if (!files[testName]) {
|
|
397
|
+
files[testName] = new Set();
|
|
398
|
+
}
|
|
399
|
+
files[testName].add(fp);
|
|
400
|
+
return p;
|
|
401
|
+
});
|
|
402
|
+
page.exposeFunction("existsSync", (fp, contents) => {
|
|
403
|
+
return fs_1.default.existsSync(fp);
|
|
404
|
+
});
|
|
405
|
+
page.exposeFunction("mkdirSync", (fp) => {
|
|
406
|
+
if (!fs_1.default.existsSync(fp)) {
|
|
407
|
+
return fs_1.default.mkdirSync(fp, {
|
|
408
|
+
recursive: true,
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
return false;
|
|
412
|
+
});
|
|
413
|
+
page.exposeFunction("createWriteStream", (fp, testName) => {
|
|
414
|
+
const f = fs_1.default.createWriteStream(fp);
|
|
415
|
+
// if (!files[testName]) {
|
|
416
|
+
// files[testName] = new Set();
|
|
417
|
+
// }
|
|
418
|
+
files[testName].add(fp);
|
|
419
|
+
const p = new Promise((res, rej) => {
|
|
420
|
+
res(fp);
|
|
421
|
+
});
|
|
422
|
+
doneFileStream2.push(p);
|
|
423
|
+
f.on("close", async () => {
|
|
424
|
+
await p;
|
|
425
|
+
});
|
|
426
|
+
fileStreams2.push(f);
|
|
427
|
+
return Object.assign(Object.assign({}, JSON.parse(JSON.stringify(f))), { uid: fileStreams2.length - 1 });
|
|
428
|
+
});
|
|
429
|
+
page.exposeFunction("write", async (uid, contents) => {
|
|
430
|
+
return fileStreams2[uid].write(contents);
|
|
431
|
+
});
|
|
432
|
+
page.exposeFunction("end", async (uid) => {
|
|
433
|
+
return fileStreams2[uid].end();
|
|
434
|
+
});
|
|
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
|
+
return page;
|
|
447
|
+
})
|
|
448
|
+
.then(async (page) => {
|
|
449
|
+
await page.goto(`file://${`${dest}.html`}`, {});
|
|
450
|
+
res(page);
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
};
|
|
454
|
+
this.launchNodeSideCar = async (src, dest, testConfig) => {
|
|
455
|
+
const d = dest + ".mjs";
|
|
456
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`launchNodeSideCar ${src}`)));
|
|
457
|
+
const destFolder = dest.replace(".mjs", "");
|
|
458
|
+
let argz = "";
|
|
459
|
+
const testConfigResource = testConfig[2];
|
|
460
|
+
let portsToUse = [];
|
|
461
|
+
if (testConfigResource.ports === 0) {
|
|
462
|
+
argz = JSON.stringify({
|
|
463
|
+
scheduled: true,
|
|
464
|
+
name: src,
|
|
465
|
+
ports: portsToUse,
|
|
466
|
+
fs: destFolder,
|
|
467
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
else if (testConfigResource.ports > 0) {
|
|
471
|
+
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen);
|
|
472
|
+
// console.log("openPorts", openPorts);
|
|
473
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
474
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
475
|
+
portsToUse.push(openPorts[i][0]);
|
|
476
|
+
this.ports[openPorts[i][0]] = false; // port is now closed
|
|
477
|
+
}
|
|
478
|
+
argz = JSON.stringify({
|
|
479
|
+
scheduled: true,
|
|
480
|
+
name: src,
|
|
481
|
+
// ports: [3333],
|
|
482
|
+
ports: portsToUse,
|
|
483
|
+
fs: ".",
|
|
484
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
this.queue.push(src);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
else {
|
|
493
|
+
console.error("negative port makes no sense", src);
|
|
494
|
+
process.exit(-1);
|
|
495
|
+
}
|
|
496
|
+
const builtfile = dest + ".mjs";
|
|
497
|
+
this.server[builtfile] = await Promise.resolve(`${`${builtfile}?cacheBust=${Date.now()}`}`).then(s => __importStar(require(s))).then((module) => {
|
|
498
|
+
return module.default.then((defaultModule) => {
|
|
499
|
+
// console.log("defaultModule", defaultModule);
|
|
500
|
+
const s = new defaultModule();
|
|
501
|
+
s.receiveTestResourceConfig(argz);
|
|
502
|
+
// Object.create(defaultModule);
|
|
503
|
+
// defaultModule
|
|
504
|
+
// .receiveTestResourceConfig(argz)
|
|
505
|
+
// .then((x) => {
|
|
506
|
+
// console.log("then", x);
|
|
507
|
+
// return x;
|
|
508
|
+
// })
|
|
509
|
+
// .catch((e) => {
|
|
510
|
+
// console.log("catch", e);
|
|
511
|
+
// });
|
|
512
|
+
});
|
|
513
|
+
});
|
|
514
|
+
for (let i = 0; i <= portsToUse.length; i++) {
|
|
515
|
+
if (portsToUse[i]) {
|
|
516
|
+
this.ports[portsToUse[i]] = "true"; //port is open again
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
this.launchWeb = (t, dest) => {
|
|
521
|
+
// console.log(green, "! web", t);
|
|
522
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`! web ${t}`)));
|
|
523
|
+
this.testIsNowRunning(t);
|
|
524
|
+
// sidecars.map((sidecar) => {
|
|
525
|
+
// if (sidecar[1] === "node") {
|
|
526
|
+
// return this.launchNodeSideCar(
|
|
527
|
+
// sidecar[0],
|
|
528
|
+
// destinationOfRuntime(sidecar[0], "node", this.configs),
|
|
529
|
+
// sidecar
|
|
530
|
+
// );
|
|
531
|
+
// }
|
|
532
|
+
// });
|
|
533
|
+
const destFolder = dest.replace(".mjs", "");
|
|
534
|
+
const webArgz = JSON.stringify({
|
|
535
|
+
name: dest,
|
|
536
|
+
ports: [].toString(),
|
|
537
|
+
fs: destFolder,
|
|
538
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
539
|
+
});
|
|
540
|
+
const d = `${dest}?cacheBust=${Date.now()}`;
|
|
541
|
+
const evaluation = `
|
|
542
|
+
|
|
543
|
+
import('${d}').then(async (x) => {
|
|
544
|
+
|
|
545
|
+
try {
|
|
546
|
+
return await (await x.default).receiveTestResourceConfig(${webArgz})
|
|
547
|
+
} catch (e) {
|
|
548
|
+
console.log("fail", e)
|
|
549
|
+
}
|
|
550
|
+
})`;
|
|
551
|
+
const fileStreams2 = [];
|
|
552
|
+
const doneFileStream2 = [];
|
|
553
|
+
const stdoutStream = fs_1.default.createWriteStream(`${destFolder}/stdout.log`);
|
|
554
|
+
const stderrStream = fs_1.default.createWriteStream(`${destFolder}/stderr.log`);
|
|
555
|
+
this.browser
|
|
556
|
+
.newPage()
|
|
557
|
+
.then((page) => {
|
|
558
|
+
// page.on("console", (msg) => {
|
|
559
|
+
// // console.log("web > ", msg.args(), msg.text());
|
|
560
|
+
// });
|
|
561
|
+
page.exposeFunction("screencast", async (ssOpts, testName) => {
|
|
562
|
+
const p = ssOpts.path;
|
|
563
|
+
const dir = path_1.default.dirname(p);
|
|
564
|
+
fs_1.default.mkdirSync(dir, {
|
|
565
|
+
recursive: true,
|
|
566
|
+
});
|
|
567
|
+
if (!files[testName]) {
|
|
568
|
+
files[testName] = new Set();
|
|
569
|
+
}
|
|
570
|
+
files[testName].add(ssOpts.path);
|
|
571
|
+
const sPromise = page.screenshot(Object.assign(Object.assign({}, ssOpts), { path: p }));
|
|
572
|
+
if (!screenshots[testName]) {
|
|
573
|
+
screenshots[testName] = [];
|
|
574
|
+
}
|
|
575
|
+
screenshots[testName].push(sPromise);
|
|
576
|
+
// sPromise.then(())
|
|
577
|
+
await sPromise;
|
|
578
|
+
return sPromise;
|
|
579
|
+
// page.evaluate(`window["screenshot done"]`);
|
|
580
|
+
});
|
|
581
|
+
page.exposeFunction("customScreenShot", async (ssOpts, testName) => {
|
|
582
|
+
const p = ssOpts.path;
|
|
583
|
+
const dir = path_1.default.dirname(p);
|
|
584
|
+
fs_1.default.mkdirSync(dir, {
|
|
585
|
+
recursive: true,
|
|
586
|
+
});
|
|
587
|
+
if (!files[testName]) {
|
|
588
|
+
files[testName] = new Set();
|
|
589
|
+
}
|
|
590
|
+
files[testName].add(ssOpts.path);
|
|
591
|
+
const sPromise = page.screenshot(Object.assign(Object.assign({}, ssOpts), { path: p }));
|
|
592
|
+
if (!screenshots[testName]) {
|
|
593
|
+
screenshots[testName] = [];
|
|
594
|
+
}
|
|
595
|
+
screenshots[testName].push(sPromise);
|
|
596
|
+
// sPromise.then(())
|
|
597
|
+
await sPromise;
|
|
598
|
+
return sPromise;
|
|
599
|
+
// page.evaluate(`window["screenshot done"]`);
|
|
600
|
+
});
|
|
601
|
+
page.exposeFunction("writeFileSync", (fp, contents, testName) => {
|
|
602
|
+
return globalThis["writeFileSync"](fp, contents, testName);
|
|
603
|
+
// const dir = path.dirname(fp);
|
|
604
|
+
// fs.mkdirSync(dir, {
|
|
605
|
+
// recursive: true,
|
|
606
|
+
// });
|
|
607
|
+
// const p = new Promise<string>(async (res, rej) => {
|
|
608
|
+
// fs.writeFileSync(fp, contents);
|
|
609
|
+
// res(fp);
|
|
610
|
+
// });
|
|
611
|
+
// doneFileStream2.push(p);
|
|
612
|
+
// if (!files[testName]) {
|
|
613
|
+
// files[testName] = new Set();
|
|
614
|
+
// }
|
|
615
|
+
// files[testName].add(fp);
|
|
616
|
+
// return p;
|
|
617
|
+
});
|
|
618
|
+
page.exposeFunction("existsSync", (fp, contents) => {
|
|
619
|
+
return fs_1.default.existsSync(fp);
|
|
620
|
+
});
|
|
621
|
+
page.exposeFunction("mkdirSync", (fp) => {
|
|
622
|
+
if (!fs_1.default.existsSync(fp)) {
|
|
623
|
+
return fs_1.default.mkdirSync(fp, {
|
|
624
|
+
recursive: true,
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
return false;
|
|
628
|
+
});
|
|
629
|
+
page.exposeFunction("createWriteStream", (fp, testName) => {
|
|
630
|
+
const f = fs_1.default.createWriteStream(fp);
|
|
631
|
+
if (!files[testName]) {
|
|
632
|
+
files[testName] = new Set();
|
|
633
|
+
}
|
|
634
|
+
files[testName].add(fp);
|
|
635
|
+
const p = new Promise((res, rej) => {
|
|
636
|
+
res(fp);
|
|
637
|
+
});
|
|
638
|
+
doneFileStream2.push(p);
|
|
639
|
+
f.on("close", async () => {
|
|
640
|
+
await p;
|
|
641
|
+
});
|
|
642
|
+
fileStreams2.push(f);
|
|
643
|
+
return Object.assign(Object.assign({}, JSON.parse(JSON.stringify(f))), { uid: fileStreams2.length - 1 });
|
|
644
|
+
});
|
|
645
|
+
page.exposeFunction("write", async (uid, contents) => {
|
|
646
|
+
return fileStreams2[uid].write(contents);
|
|
647
|
+
});
|
|
648
|
+
page.exposeFunction("end", async (uid) => {
|
|
649
|
+
return fileStreams2[uid].end();
|
|
650
|
+
});
|
|
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
|
+
page.exposeFunction("page", () => {
|
|
683
|
+
return page.mainFrame()._id;
|
|
684
|
+
});
|
|
685
|
+
page.exposeFunction("click", (sel) => {
|
|
686
|
+
return page.click(sel);
|
|
687
|
+
});
|
|
688
|
+
page.exposeFunction("focusOn", (sel) => {
|
|
689
|
+
return page.focus(sel);
|
|
690
|
+
});
|
|
691
|
+
page.exposeFunction("typeInto", async (value) => await page.keyboard.type(value));
|
|
692
|
+
page.exposeFunction("getValue", (selector) => page.$eval(selector, (input) => input.getAttribute("value")));
|
|
693
|
+
page.exposeFunction("getAttribute", async (selector, attribute) => {
|
|
694
|
+
const attributeValue = await page.$eval(selector, (input) => {
|
|
695
|
+
return input.getAttribute(attribute);
|
|
696
|
+
});
|
|
697
|
+
return attributeValue;
|
|
698
|
+
});
|
|
699
|
+
page.exposeFunction("isDisabled", async (selector) => {
|
|
700
|
+
const attributeValue = await page.$eval(selector, (input) => {
|
|
701
|
+
return input.disabled;
|
|
702
|
+
});
|
|
703
|
+
return attributeValue;
|
|
704
|
+
});
|
|
705
|
+
page.exposeFunction("$", async (selector) => {
|
|
706
|
+
const x = page.$(selector);
|
|
707
|
+
const y = await x;
|
|
708
|
+
return y;
|
|
709
|
+
});
|
|
710
|
+
return page;
|
|
711
|
+
})
|
|
712
|
+
.then(async (page) => {
|
|
713
|
+
const close = () => {
|
|
714
|
+
if (!files[t]) {
|
|
715
|
+
files[t] = new Set();
|
|
716
|
+
}
|
|
717
|
+
// files[t].add(filepath);
|
|
718
|
+
fs_1.default.writeFileSync(destFolder + "/manifest.json", JSON.stringify(Array.from(files[t])));
|
|
719
|
+
delete files[t];
|
|
720
|
+
Promise.all(screenshots[t] || []).then(() => {
|
|
721
|
+
delete screenshots[t];
|
|
722
|
+
page.close();
|
|
723
|
+
this.testIsNowDone(t);
|
|
724
|
+
stderrStream.close();
|
|
725
|
+
stdoutStream.close();
|
|
726
|
+
});
|
|
727
|
+
};
|
|
728
|
+
page.on("pageerror", (err) => {
|
|
729
|
+
console.debug(`Error from ${t}: [${err.name}] `);
|
|
730
|
+
stderrStream.write(err.name);
|
|
731
|
+
if (err.cause) {
|
|
732
|
+
console.debug(`Error from ${t} cause: [${err.cause}] `);
|
|
733
|
+
stderrStream.write(err.cause);
|
|
734
|
+
}
|
|
735
|
+
if (err.stack) {
|
|
736
|
+
console.debug(`Error from stack ${t}: [${err.stack}] `);
|
|
737
|
+
stderrStream.write(err.stack);
|
|
738
|
+
}
|
|
739
|
+
console.debug(`Error from message ${t}: [${err.message}] `);
|
|
740
|
+
stderrStream.write(err.message);
|
|
741
|
+
close();
|
|
742
|
+
});
|
|
743
|
+
page.on("console", (log) => {
|
|
744
|
+
// console.debug(`Log from ${t}: [${log.text()}] `);
|
|
745
|
+
// console.debug(`Log from ${t}: [${JSON.stringify(log.location())}] `);
|
|
746
|
+
// console.debug(
|
|
747
|
+
// `Log from ${t}: [${JSON.stringify(log.stackTrace())}] `
|
|
748
|
+
// );
|
|
749
|
+
stdoutStream.write(log.text());
|
|
750
|
+
stdoutStream.write(JSON.stringify(log.location()));
|
|
751
|
+
stdoutStream.write(JSON.stringify(log.stackTrace()));
|
|
752
|
+
});
|
|
753
|
+
await page.goto(`file://${`${destFolder}.html`}`, {});
|
|
754
|
+
await page
|
|
755
|
+
.evaluate(evaluation)
|
|
756
|
+
.then(async ({ failed, features }) => {
|
|
757
|
+
this.receiveFeatures(features, destFolder, t);
|
|
758
|
+
// console.log(`${t} completed with ${failed} errors`);
|
|
759
|
+
statusMessagePretty(failed, t);
|
|
760
|
+
this.receiveExitCode(t, failed);
|
|
761
|
+
})
|
|
762
|
+
.catch((e) => {
|
|
763
|
+
// console.log(red, `${t} errored with`, e);
|
|
764
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${t} errored with: ${e}`)));
|
|
765
|
+
})
|
|
766
|
+
.finally(() => {
|
|
767
|
+
// this.testIsNowDone(t);
|
|
768
|
+
close();
|
|
769
|
+
});
|
|
770
|
+
return page;
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
this.receiveFeatures = (features, destFolder, srcTest) => {
|
|
774
|
+
const featureDestination = path_1.default.resolve(process.cwd(), "docs", "features", "strings", srcTest.split(".").slice(0, -1).join(".") + ".features.txt");
|
|
775
|
+
features
|
|
776
|
+
.reduce(async (mm, featureStringKey) => {
|
|
777
|
+
const accum = await mm;
|
|
778
|
+
const isUrl = isValidUrl(featureStringKey);
|
|
779
|
+
if (isUrl) {
|
|
780
|
+
const u = new URL(featureStringKey);
|
|
781
|
+
if (u.protocol === "file:") {
|
|
782
|
+
const newPath = `${process.cwd()}/docs/features/internal/${path_1.default.relative(process.cwd(), u.pathname)}`;
|
|
783
|
+
await fs_1.default.promises.mkdir(path_1.default.dirname(newPath), { recursive: true });
|
|
784
|
+
try {
|
|
785
|
+
await fs_1.default.unlinkSync(newPath);
|
|
786
|
+
// console.log(`Removed existing link at ${newPath}`);
|
|
787
|
+
}
|
|
788
|
+
catch (error) {
|
|
789
|
+
if (error.code !== "ENOENT") {
|
|
790
|
+
// throw error;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
// fs.symlink(u.pathname, newPath, (err) => {
|
|
794
|
+
// if (err) {
|
|
795
|
+
// // console.error("Error creating symlink:", err);
|
|
796
|
+
// } else {
|
|
797
|
+
// // console.log("Symlink created successfully");
|
|
798
|
+
// }
|
|
799
|
+
// });
|
|
800
|
+
accum.files.push(newPath);
|
|
801
|
+
}
|
|
802
|
+
else if (u.protocol === "http:" || u.protocol === "https:") {
|
|
803
|
+
const newPath = `${process.cwd()}/docs/features/external${u.hostname}${u.pathname}`;
|
|
804
|
+
const body = await this.configs.featureIngestor(featureStringKey);
|
|
805
|
+
writeFileAndCreateDir(newPath, body);
|
|
806
|
+
accum.files.push(newPath);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
await fs_1.default.promises.mkdir(path_1.default.dirname(featureDestination), {
|
|
811
|
+
recursive: true,
|
|
812
|
+
});
|
|
813
|
+
accum.strings.push(featureStringKey);
|
|
814
|
+
}
|
|
815
|
+
return accum;
|
|
816
|
+
}, Promise.resolve({ files: [], strings: [] }))
|
|
817
|
+
.then(({ files, strings }) => {
|
|
818
|
+
// writeFileAndCreateDir(`${featureDestination}`, JSON.stringify(strings));
|
|
819
|
+
fs_1.default.writeFileSync(`${destFolder}/featurePrompt.txt`, files
|
|
820
|
+
.map((f) => {
|
|
821
|
+
return `/read ${f}`;
|
|
822
|
+
})
|
|
823
|
+
.join("\n"));
|
|
824
|
+
});
|
|
825
|
+
// this.writeBigBoard();
|
|
826
|
+
};
|
|
827
|
+
this.receiveExitCode = (srcTest, failures) => {
|
|
828
|
+
this.bigBoard[srcTest].runTimeError = failures;
|
|
829
|
+
this.writeBigBoard();
|
|
830
|
+
};
|
|
831
|
+
this.writeBigBoard = () => {
|
|
832
|
+
fs_1.default.writeFileSync("./docs/summary.json", JSON.stringify(this.bigBoard, null, 2));
|
|
833
|
+
};
|
|
834
|
+
this.mode = configs.devMode ? "DEV" : "PROD";
|
|
835
|
+
this.server = {};
|
|
836
|
+
this.configs = configs;
|
|
837
|
+
this.ports = {};
|
|
838
|
+
this.configs.tests.forEach(([t]) => {
|
|
839
|
+
this.bigBoard[t] = {
|
|
840
|
+
runTimeError: "?",
|
|
841
|
+
typeErrors: "?",
|
|
842
|
+
staticErrors: "?",
|
|
843
|
+
prompt: "?",
|
|
844
|
+
};
|
|
845
|
+
});
|
|
846
|
+
this.configs.ports.forEach((element) => {
|
|
847
|
+
this.ports[element] = "true"; // set ports as open
|
|
848
|
+
});
|
|
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
|
+
}
|
|
1093
|
+
async start() {
|
|
1094
|
+
this.browser = (await puppeteer_core_1.default.launch({
|
|
1095
|
+
slowMo: 1,
|
|
1096
|
+
// timeout: 1,
|
|
1097
|
+
waitForInitialPage: false,
|
|
1098
|
+
executablePath:
|
|
1099
|
+
// process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
|
|
1100
|
+
"/opt/homebrew/bin/chromium",
|
|
1101
|
+
headless: true,
|
|
1102
|
+
dumpio: true,
|
|
1103
|
+
// timeout: 0,
|
|
1104
|
+
devtools: true,
|
|
1105
|
+
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
|
+
"--allow-file-access-from-files",
|
|
1112
|
+
"--allow-running-insecure-content",
|
|
1113
|
+
"--disable-dev-shm-usage",
|
|
1114
|
+
"--disable-extensions",
|
|
1115
|
+
"--disable-gpu",
|
|
1116
|
+
"--disable-setuid-sandbox",
|
|
1117
|
+
"--disable-site-isolation-trials",
|
|
1118
|
+
"--disable-web-security",
|
|
1119
|
+
"--no-first-run",
|
|
1120
|
+
"--no-sandbox",
|
|
1121
|
+
"--no-startup-window",
|
|
1122
|
+
// "--no-zygote",
|
|
1123
|
+
"--reduce-security-for-testing",
|
|
1124
|
+
"--remote-allow-origins=*",
|
|
1125
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
1126
|
+
// "--disable-features=IsolateOrigins",
|
|
1127
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
1128
|
+
// "--single-process",
|
|
1129
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
1130
|
+
// "--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
|
+
],
|
|
1135
|
+
}));
|
|
1136
|
+
const { nodeEntryPoints, webEntryPoints } = getRunnables(this.configs.tests);
|
|
1137
|
+
Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
|
|
1138
|
+
this.launchNode(k, outputFile);
|
|
1139
|
+
try {
|
|
1140
|
+
(0, fs_1.watch)(outputFile, async (e, filename) => {
|
|
1141
|
+
const hash = await fileHash(outputFile);
|
|
1142
|
+
if (fileHashes[k] !== hash) {
|
|
1143
|
+
fileHashes[k] = hash;
|
|
1144
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`< ${e} ${filename}`)));
|
|
1145
|
+
this.launchNode(k, outputFile);
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
catch (e) {
|
|
1150
|
+
console.error(e);
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
|
|
1154
|
+
this.launchWeb(k, outputFile);
|
|
1155
|
+
(0, fs_1.watch)(outputFile, async (e, filename) => {
|
|
1156
|
+
const hash = await fileHash(outputFile);
|
|
1157
|
+
if (fileHashes[k] !== hash) {
|
|
1158
|
+
fileHashes[k] = hash;
|
|
1159
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`< ${e} ${filename}`)));
|
|
1160
|
+
this.launchWeb(k, outputFile);
|
|
1161
|
+
}
|
|
1162
|
+
});
|
|
1163
|
+
});
|
|
1164
|
+
this.metafileOutputs("node");
|
|
1165
|
+
this.nodeMetafileWatcher = (0, fs_1.watch)("docs/node/metafile.json", async (e, filename) => {
|
|
1166
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`< ${e} ${filename} (node)`)));
|
|
1167
|
+
this.metafileOutputs("node");
|
|
1168
|
+
});
|
|
1169
|
+
this.metafileOutputs("web");
|
|
1170
|
+
this.webMetafileWatcher = (0, fs_1.watch)("docs/web/metafile.json", async (e, filename) => {
|
|
1171
|
+
console.log(ansi_colors_1.default.green(ansi_colors_1.default.inverse(`< ${e} ${filename} (web)`)));
|
|
1172
|
+
this.metafileOutputs("web");
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
exports.PM_Main = PM_Main;
|