testeranto 0.85.0 → 0.94.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/README.md +1 -3
- package/bin/init-docs.js +24 -0
- package/bundle.js +53 -0
- package/dist/common/dist/module/src/Init.js +40 -0
- package/dist/common/src/Init.js +30 -0
- package/dist/common/src/Node.js +5 -3
- package/dist/common/src/PM/main.js +136 -90
- package/dist/common/src/Project.js +82 -0
- package/dist/common/src/Puppeteer.js +0 -2
- package/dist/common/src/SubPackages/puppeteer.js +1 -1
- package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/common/src/SubPackages/react/jsx/node.js +7 -2
- package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/common/src/Web.js +25 -21
- package/dist/common/{run-tests.js → src/build-tests.js} +10 -5
- package/dist/common/src/defaultConfig.js +19 -0
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +26 -16
- package/dist/common/src/init-docs.js +43 -0
- package/dist/common/src/lib/abstractBase.js +29 -248
- package/dist/common/src/lib/basebuilder.js +1 -11
- package/dist/common/src/lib/classBuilder.js +1 -1
- package/dist/common/src/lib/core.js +8 -26
- package/dist/common/{build-tests.js → src/run-tests.js} +10 -9
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Init.js +30 -0
- package/dist/module/src/Node.js +5 -3
- package/dist/module/src/PM/main.js +136 -90
- package/dist/module/src/Project.js +82 -0
- package/dist/module/src/Puppeteer.js +0 -2
- package/dist/module/src/SubPackages/puppeteer.js +1 -1
- package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/module/src/SubPackages/react/jsx/node.js +7 -2
- package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/module/src/Web.js +25 -21
- package/dist/module/src/build-tests.js +11 -0
- package/dist/module/src/defaultConfig.js +17 -0
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +26 -16
- package/dist/module/src/init-docs.js +15 -0
- package/dist/module/src/lib/abstractBase.js +29 -248
- package/dist/module/src/lib/basebuilder.js +1 -11
- package/dist/module/src/lib/classBuilder.js +1 -1
- package/dist/module/src/lib/core.js +8 -26
- package/dist/module/src/run-tests.js +11 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/build-tests.mjs +553 -0
- package/dist/prebuild/init-docs.mjs +48 -0
- package/dist/prebuild/run-tests.mjs +871 -0
- package/dist/types/dist/module/src/Init.d.ts +2 -0
- package/dist/types/src/Node.d.ts +4 -1
- package/dist/types/src/PM/main.d.ts +2 -1
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
- package/dist/types/src/Web.d.ts +2 -2
- package/dist/types/src/build-tests.d.ts +1 -0
- package/dist/types/src/defaultConfig.d.ts +3 -0
- package/dist/types/src/init-docs.d.ts +1 -0
- package/dist/types/src/lib/abstractBase.d.ts +6 -2
- package/dist/types/src/lib/core.d.ts +3 -3
- package/dist/types/src/lib/types.d.ts +5 -1
- package/dist/types/src/run-tests.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +21 -24
- package/src/Init.ts +28 -0
- package/src/Node.ts +6 -3
- package/src/PM/main.ts +168 -110
- package/src/Project.ts +103 -0
- package/src/Puppeteer.ts +0 -2
- package/src/SubPackages/puppeteer.ts +1 -1
- package/src/SubPackages/react/jsx/index.ts +15 -7
- package/src/SubPackages/react/jsx/node.ts +6 -5
- package/src/SubPackages/react-dom/component/web.ts +28 -51
- package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
- package/src/Web.ts +45 -23
- package/src/build-tests.ts +12 -0
- package/src/defaultConfig.ts +20 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +46 -17
- package/src/init-docs.ts +19 -0
- package/src/lib/abstractBase.ts +38 -255
- package/src/lib/basebuilder.ts +1 -12
- package/src/lib/classBuilder.ts +2 -1
- package/src/lib/core.ts +17 -29
- package/src/lib/types.ts +3 -1
- package/src/run-tests.ts +12 -0
- package/tsconfig.json +1 -1
- package/build-tests.ts +0 -16
- package/dist/common/init-docs.js +0 -8
- package/dist/module/build-tests.js +0 -10
- package/dist/module/init-docs.js +0 -3
- package/dist/module/run-tests.js +0 -6
- package/dist/prebuild/Puppeteer.mjs +0 -82033
- package/dist/types/build-tests.d.ts +0 -3
- package/dist/types/init-docs.d.ts +0 -2
- package/dist/types/run-tests.d.ts +0 -2
- package/init-docs.ts +0 -5
- package/pupBuild.js +0 -18
- package/run-tests.ts +0 -9
package/README.md
CHANGED
|
@@ -12,9 +12,7 @@ example repo: [kokomo bay](https://github.com/ChromaPDX/kokomoBay)
|
|
|
12
12
|
|
|
13
13
|
## Demo
|
|
14
14
|
|
|
15
|
-
<
|
|
16
|
-
<a href="https://www.youtube.com/watch?v=WvU5xMqGi6Q"><img src="https://img.youtube.com/vi/WvU5xMqGi6Q/0.jpg" alt="IMAGE ALT TEXT"></a>
|
|
17
|
-
</div>
|
|
15
|
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/WvU5xMqGi6Q" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
|
18
16
|
|
|
19
17
|
## What is testeranto?
|
|
20
18
|
|
package/bin/init-docs.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import Init from "../dist/module/src/Init";
|
|
4
|
+
console.log("Initializing a testeranto project");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
if (!process.argv[2]) {
|
|
9
|
+
console.log("You didn't pass a config file, so I will create one for you.")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
fs.writeFileSync("testeranto.mts", fs.readFileSync("node_modules/testeranto/src/defaultConfig.ts"))
|
|
13
|
+
import(process.cwd() + "/" + "testeranto.mts").then((module) => {
|
|
14
|
+
Init(module.default);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
21
|
+
Init(module.default);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
}
|
package/bundle.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild'
|
|
2
|
+
|
|
3
|
+
await esbuild.build({
|
|
4
|
+
entryPoints: ['src/init-docs.ts'],
|
|
5
|
+
bundle: true,
|
|
6
|
+
format: "esm",
|
|
7
|
+
platform: "node",
|
|
8
|
+
// format: "node",
|
|
9
|
+
outfile: 'dist/prebuild/init-docs.mjs',
|
|
10
|
+
// external: ['crypto', 'os'],
|
|
11
|
+
supported: {
|
|
12
|
+
"dynamic-import": true,
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
banner: {
|
|
16
|
+
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
await esbuild.build({
|
|
21
|
+
entryPoints: ['src/build-tests.ts'],
|
|
22
|
+
bundle: true,
|
|
23
|
+
format: "esm",
|
|
24
|
+
platform: "node",
|
|
25
|
+
// format: "node",
|
|
26
|
+
outfile: 'dist/prebuild/build-tests.mjs',
|
|
27
|
+
// external: ['crypto', 'os'],
|
|
28
|
+
packages: "external",
|
|
29
|
+
supported: {
|
|
30
|
+
"dynamic-import": true,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
banner: {
|
|
34
|
+
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
await esbuild.build({
|
|
39
|
+
entryPoints: ['src/run-tests.ts'],
|
|
40
|
+
bundle: true,
|
|
41
|
+
format: "esm",
|
|
42
|
+
platform: "node",
|
|
43
|
+
// format: "node",
|
|
44
|
+
outfile: 'dist/prebuild/run-tests.mjs',
|
|
45
|
+
packages: "external",
|
|
46
|
+
supported: {
|
|
47
|
+
"dynamic-import": true,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
banner: {
|
|
51
|
+
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
52
|
+
},
|
|
53
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
exports.default = async (partialConfig) => {
|
|
8
|
+
const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
|
|
9
|
+
try {
|
|
10
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}`);
|
|
11
|
+
}
|
|
12
|
+
catch (_a) {
|
|
13
|
+
// console.log()
|
|
14
|
+
}
|
|
15
|
+
fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
|
|
16
|
+
try {
|
|
17
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/node`);
|
|
18
|
+
}
|
|
19
|
+
catch (_b) {
|
|
20
|
+
// console.log()
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/web`);
|
|
24
|
+
}
|
|
25
|
+
catch (_c) {
|
|
26
|
+
// console.log()
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/features`);
|
|
30
|
+
}
|
|
31
|
+
catch (_d) {
|
|
32
|
+
// console.log()
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/ts`);
|
|
36
|
+
}
|
|
37
|
+
catch (_e) {
|
|
38
|
+
// console.log()
|
|
39
|
+
}
|
|
40
|
+
};
|
package/dist/common/src/Init.js
CHANGED
|
@@ -6,5 +6,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const fs_1 = __importDefault(require("fs"));
|
|
7
7
|
exports.default = async (partialConfig) => {
|
|
8
8
|
const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
|
|
9
|
+
try {
|
|
10
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}`);
|
|
11
|
+
}
|
|
12
|
+
catch (_a) {
|
|
13
|
+
// console.log()
|
|
14
|
+
}
|
|
9
15
|
fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
|
|
16
|
+
try {
|
|
17
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/node`);
|
|
18
|
+
}
|
|
19
|
+
catch (_b) {
|
|
20
|
+
// console.log()
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/web`);
|
|
24
|
+
}
|
|
25
|
+
catch (_c) {
|
|
26
|
+
// console.log()
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/features`);
|
|
30
|
+
}
|
|
31
|
+
catch (_d) {
|
|
32
|
+
// console.log()
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
fs_1.default.mkdirSync(`${process.cwd()}/${config.outdir}/ts`);
|
|
36
|
+
}
|
|
37
|
+
catch (_e) {
|
|
38
|
+
// console.log()
|
|
39
|
+
}
|
|
10
40
|
};
|
package/dist/common/src/Node.js
CHANGED
|
@@ -9,14 +9,16 @@ const index_js_1 = require("./lib/index.js");
|
|
|
9
9
|
const node_js_1 = require("./PM/node.js");
|
|
10
10
|
class NodeTesteranto extends core_js_1.default {
|
|
11
11
|
constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
|
|
12
|
-
super(input, testSpecification, testImplementation, testResourceRequirement, testInterface)
|
|
12
|
+
super(input, testSpecification, testImplementation, testResourceRequirement, testInterface, () => {
|
|
13
|
+
// no-op
|
|
14
|
+
});
|
|
13
15
|
}
|
|
14
16
|
async receiveTestResourceConfig(partialTestResource) {
|
|
15
17
|
const t = JSON.parse(partialTestResource);
|
|
16
18
|
const pm = new node_js_1.PM_Node(t);
|
|
17
19
|
const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
18
|
-
pm.customclose();
|
|
19
|
-
return features;
|
|
20
|
+
// pm.customclose();
|
|
21
|
+
return { features, failed };
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
exports.NodeTesteranto = NodeTesteranto;
|
|
@@ -33,8 +33,8 @@ const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
|
33
33
|
const crypto_1 = __importDefault(require("crypto"));
|
|
34
34
|
const index_js_1 = require("./index.js");
|
|
35
35
|
const utils_js_1 = require("../utils.js");
|
|
36
|
-
const fPaths = [];
|
|
37
36
|
const fileStreams3 = [];
|
|
37
|
+
const fPaths = [];
|
|
38
38
|
const files = {};
|
|
39
39
|
const screenshots = {};
|
|
40
40
|
class PM_Main extends index_js_1.PM {
|
|
@@ -110,9 +110,12 @@ class PM_Main extends index_js_1.PM {
|
|
|
110
110
|
process.exit(-1);
|
|
111
111
|
}
|
|
112
112
|
const builtfile = dest + ".mjs";
|
|
113
|
-
|
|
113
|
+
const webSideCares = [];
|
|
114
|
+
await Promise.all(testConfig[3].map(async (sidecar) => {
|
|
114
115
|
if (sidecar[1] === "web") {
|
|
115
|
-
|
|
116
|
+
const s = await this.launchWebSideCar(sidecar[0], (0, utils_js_1.destinationOfRuntime)(sidecar[0], "web", this.configs), sidecar);
|
|
117
|
+
webSideCares.push(s);
|
|
118
|
+
return s;
|
|
116
119
|
}
|
|
117
120
|
if (sidecar[1] === "node") {
|
|
118
121
|
return this.launchNodeSideCar(sidecar[0], (0, utils_js_1.destinationOfRuntime)(sidecar[0], "node", this.configs), sidecar);
|
|
@@ -122,13 +125,15 @@ class PM_Main extends index_js_1.PM {
|
|
|
122
125
|
return module.default.then((defaultModule) => {
|
|
123
126
|
defaultModule
|
|
124
127
|
.receiveTestResourceConfig(argz)
|
|
125
|
-
.then(async (features) => {
|
|
128
|
+
.then(async ({ features, failed }) => {
|
|
126
129
|
this.receiveFeatures(features, destFolder);
|
|
130
|
+
console.log(`${src} completed with ${failed} errors`);
|
|
127
131
|
})
|
|
128
132
|
.catch((e) => {
|
|
129
|
-
console.log(
|
|
133
|
+
console.log(`${src} errored with`, e);
|
|
130
134
|
})
|
|
131
135
|
.finally(() => {
|
|
136
|
+
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
132
137
|
this.deregister(src);
|
|
133
138
|
});
|
|
134
139
|
});
|
|
@@ -144,17 +149,12 @@ class PM_Main extends index_js_1.PM {
|
|
|
144
149
|
const d = dest + ".mjs";
|
|
145
150
|
console.log("launchWebSideCar", src, dest, d);
|
|
146
151
|
const destFolder = dest.replace(".mjs", "");
|
|
147
|
-
const webArgz = JSON.stringify({
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
// const evaluation = `
|
|
154
|
-
// console.log("importing ${dest}.mjs");
|
|
155
|
-
// import('${dest}.mjs').then(async (x) => {
|
|
156
|
-
// console.log("imported", x.default);
|
|
157
|
-
// })`;
|
|
152
|
+
// const webArgz = JSON.stringify({
|
|
153
|
+
// name: dest,
|
|
154
|
+
// ports: [].toString(),
|
|
155
|
+
// fs: destFolder,
|
|
156
|
+
// browserWSEndpoint: this.browser.wsEndpoint(),
|
|
157
|
+
// });
|
|
158
158
|
const fileStreams2 = [];
|
|
159
159
|
const doneFileStream2 = [];
|
|
160
160
|
return new Promise((res, rej) => {
|
|
@@ -213,9 +213,9 @@ class PM_Main extends index_js_1.PM {
|
|
|
213
213
|
});
|
|
214
214
|
page.exposeFunction("createWriteStream", (fp, testName) => {
|
|
215
215
|
const f = fs_1.default.createWriteStream(fp);
|
|
216
|
-
if (!files[testName]) {
|
|
217
|
-
|
|
218
|
-
}
|
|
216
|
+
// if (!files[testName]) {
|
|
217
|
+
// files[testName] = new Set();
|
|
218
|
+
// }
|
|
219
219
|
files[testName].add(fp);
|
|
220
220
|
const p = new Promise((res, rej) => {
|
|
221
221
|
res(fp);
|
|
@@ -233,14 +233,17 @@ class PM_Main extends index_js_1.PM {
|
|
|
233
233
|
page.exposeFunction("end", async (uid) => {
|
|
234
234
|
return fileStreams2[uid].end();
|
|
235
235
|
});
|
|
236
|
-
page.exposeFunction("customclose", (p, testName) => {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
236
|
+
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
237
|
+
// fs.writeFileSync(
|
|
238
|
+
// p + "/manifest.json",
|
|
239
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
240
|
+
// );
|
|
241
|
+
// delete files[testName];
|
|
242
|
+
// Promise.all(screenshots[testName] || []).then(() => {
|
|
243
|
+
// delete screenshots[testName];
|
|
244
|
+
// // page.close();
|
|
245
|
+
// });
|
|
246
|
+
// });
|
|
244
247
|
return page;
|
|
245
248
|
})
|
|
246
249
|
.then(async (page) => {
|
|
@@ -347,6 +350,8 @@ class PM_Main extends index_js_1.PM {
|
|
|
347
350
|
})`;
|
|
348
351
|
const fileStreams2 = [];
|
|
349
352
|
const doneFileStream2 = [];
|
|
353
|
+
const stdoutStream = fs_1.default.createWriteStream(`${dest}/stdout.log`);
|
|
354
|
+
const stderrStream = fs_1.default.createWriteStream(`${dest}/stderr.log`);
|
|
350
355
|
this.browser
|
|
351
356
|
.newPage()
|
|
352
357
|
.then((page) => {
|
|
@@ -394,20 +399,21 @@ class PM_Main extends index_js_1.PM {
|
|
|
394
399
|
// page.evaluate(`window["screenshot done"]`);
|
|
395
400
|
});
|
|
396
401
|
page.exposeFunction("writeFileSync", (fp, contents, testName) => {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
402
|
+
return globalThis["writeFileSync"](fp, contents, testName);
|
|
403
|
+
// const dir = path.dirname(fp);
|
|
404
|
+
// fs.mkdirSync(dir, {
|
|
405
|
+
// recursive: true,
|
|
406
|
+
// });
|
|
407
|
+
// const p = new Promise<string>(async (res, rej) => {
|
|
408
|
+
// fs.writeFileSync(fp, contents);
|
|
409
|
+
// res(fp);
|
|
410
|
+
// });
|
|
411
|
+
// doneFileStream2.push(p);
|
|
412
|
+
// if (!files[testName]) {
|
|
413
|
+
// files[testName] = new Set();
|
|
414
|
+
// }
|
|
415
|
+
// files[testName].add(fp);
|
|
416
|
+
// return p;
|
|
411
417
|
});
|
|
412
418
|
page.exposeFunction("existsSync", (fp, contents) => {
|
|
413
419
|
return fs_1.default.existsSync(fp);
|
|
@@ -442,36 +448,37 @@ class PM_Main extends index_js_1.PM {
|
|
|
442
448
|
page.exposeFunction("end", async (uid) => {
|
|
443
449
|
return fileStreams2[uid].end();
|
|
444
450
|
});
|
|
445
|
-
page.exposeFunction("customclose", (p, testName) => {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
451
|
+
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
452
|
+
// // console.log("closing", p);
|
|
453
|
+
// console.log("\t GOODBYE customclose");
|
|
454
|
+
// fs.writeFileSync(
|
|
455
|
+
// p + "/manifest.json",
|
|
456
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
457
|
+
// );
|
|
458
|
+
// delete files[testName];
|
|
459
|
+
// // console.log("screenshots[testName]", screenshots[testName]);
|
|
460
|
+
// Promise.all(screenshots[testName] || []).then(() => {
|
|
461
|
+
// delete screenshots[testName];
|
|
462
|
+
// });
|
|
463
|
+
// // globalThis["writeFileSync"](
|
|
464
|
+
// // p + "/manifest.json",
|
|
465
|
+
// // // files.entries()
|
|
466
|
+
// // JSON.stringify(Array.from(files[testName]))
|
|
467
|
+
// // );
|
|
468
|
+
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
469
|
+
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
470
|
+
// // Promise.all([...doneFileStream2, ...screenshots2]).then(() => {
|
|
471
|
+
// // page.close();
|
|
472
|
+
// // });
|
|
473
|
+
// // Promise.all(screenshots).then(() => {
|
|
474
|
+
// // page.close();
|
|
475
|
+
// // });
|
|
476
|
+
// // setTimeout(() => {
|
|
477
|
+
// // console.log("Delayed for 1 second.");
|
|
478
|
+
// // page.close();
|
|
479
|
+
// // }, 5000);
|
|
480
|
+
// // return page.close();
|
|
481
|
+
// });
|
|
475
482
|
page.exposeFunction("page", () => {
|
|
476
483
|
return page.mainFrame()._id;
|
|
477
484
|
});
|
|
@@ -503,29 +510,63 @@ class PM_Main extends index_js_1.PM {
|
|
|
503
510
|
return page;
|
|
504
511
|
})
|
|
505
512
|
.then(async (page) => {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
513
|
+
const close = () => {
|
|
514
|
+
if (!files[t]) {
|
|
515
|
+
files[t] = new Set();
|
|
516
|
+
}
|
|
517
|
+
// files[t].add(filepath);
|
|
518
|
+
fs_1.default.writeFileSync(dest + "/manifest.json", JSON.stringify(Array.from(files[t])));
|
|
519
|
+
delete files[t];
|
|
520
|
+
Promise.all(screenshots[t] || []).then(() => {
|
|
521
|
+
delete screenshots[t];
|
|
522
|
+
page.close();
|
|
523
|
+
this.deregister(t);
|
|
524
|
+
stderrStream.close();
|
|
525
|
+
stdoutStream.close();
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
page.on("pageerror", (err) => {
|
|
529
|
+
console.debug(`Error from ${t}: [${err.name}] `);
|
|
530
|
+
stderrStream.write(err.name);
|
|
531
|
+
if (err.cause) {
|
|
532
|
+
console.debug(`Error from ${t} cause: [${err.cause}] `);
|
|
533
|
+
stderrStream.write(err.cause);
|
|
534
|
+
}
|
|
535
|
+
if (err.stack) {
|
|
536
|
+
console.debug(`Error from stack ${t}: [${err.stack}] `);
|
|
537
|
+
stderrStream.write(err.stack);
|
|
538
|
+
}
|
|
539
|
+
console.debug(`Error from message ${t}: [${err.message}] `);
|
|
540
|
+
stderrStream.write(err.message);
|
|
541
|
+
// close();
|
|
542
|
+
});
|
|
543
|
+
page.on("console", (log) => {
|
|
544
|
+
// console.debug(`Log from ${t}: [${log.text()}] `);
|
|
545
|
+
// console.debug(`Log from ${t}: [${JSON.stringify(log.location())}] `);
|
|
546
|
+
// console.debug(
|
|
547
|
+
// `Log from ${t}: [${JSON.stringify(log.stackTrace())}] `
|
|
548
|
+
// );
|
|
549
|
+
stdoutStream.write(log.text());
|
|
550
|
+
stdoutStream.write(JSON.stringify(log.location()));
|
|
551
|
+
stdoutStream.write(JSON.stringify(log.stackTrace()));
|
|
552
|
+
});
|
|
509
553
|
await page.goto(`file://${`${dest}.html`}`, {});
|
|
510
554
|
await page
|
|
511
555
|
.evaluate(evaluation)
|
|
512
|
-
.then(async (features) => {
|
|
556
|
+
.then(async ({ failed, features }) => {
|
|
513
557
|
this.receiveFeatures(features, destFolder);
|
|
558
|
+
console.log(`${t} completed with ${failed} errors`);
|
|
514
559
|
})
|
|
515
560
|
.catch((e) => {
|
|
516
|
-
console.log(
|
|
517
|
-
console.log(e);
|
|
561
|
+
console.log(`${t} errored with`, e);
|
|
518
562
|
})
|
|
519
563
|
.finally(() => {
|
|
520
|
-
|
|
521
|
-
// page.close();
|
|
522
|
-
this.deregister(t);
|
|
564
|
+
close();
|
|
523
565
|
});
|
|
524
566
|
return page;
|
|
525
567
|
});
|
|
526
568
|
};
|
|
527
569
|
this.receiveFeatures = (features, destFolder) => {
|
|
528
|
-
console.log("this.receiveFeatures", features);
|
|
529
570
|
features
|
|
530
571
|
.reduce(async (mm, featureStringKey) => {
|
|
531
572
|
const accum = await mm;
|
|
@@ -592,12 +633,14 @@ class PM_Main extends index_js_1.PM {
|
|
|
592
633
|
return false;
|
|
593
634
|
};
|
|
594
635
|
globalThis["writeFileSync"] = (filepath, contents, testName) => {
|
|
595
|
-
// console.log("
|
|
636
|
+
// console.log(testName, "writeFileSync", filepath, testName);
|
|
596
637
|
// Create directories if they don't exist
|
|
597
|
-
const dir = path_1.default.dirname(filepath
|
|
638
|
+
const dir = path_1.default.dirname(filepath);
|
|
639
|
+
// console.log(testName, "mkdirSync", dir);
|
|
598
640
|
fs_1.default.mkdirSync(dir, {
|
|
599
641
|
recursive: true,
|
|
600
642
|
});
|
|
643
|
+
// console.log(testName, "mkdirSync2");
|
|
601
644
|
if (!files[testName]) {
|
|
602
645
|
files[testName] = new Set();
|
|
603
646
|
}
|
|
@@ -638,13 +681,16 @@ class PM_Main extends index_js_1.PM {
|
|
|
638
681
|
await sPromise;
|
|
639
682
|
return sPromise;
|
|
640
683
|
};
|
|
641
|
-
globalThis["customclose"] = (p, testName) => {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
684
|
+
// globalThis["customclose"] = (p: string, testName: string) => {
|
|
685
|
+
// if (!files[testName]) {
|
|
686
|
+
// files[testName] = new Set();
|
|
687
|
+
// }
|
|
688
|
+
// fs.writeFileSync(
|
|
689
|
+
// p + "/manifest.json",
|
|
690
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
691
|
+
// );
|
|
692
|
+
// delete files[testName];
|
|
693
|
+
// };
|
|
648
694
|
}
|
|
649
695
|
$(selector) {
|
|
650
696
|
throw new Error("Method not implemented.");
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ITProject = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
7
8
|
const esbuild_1 = __importDefault(require("esbuild"));
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const path_1 = __importDefault(require("path"));
|
|
@@ -15,6 +16,86 @@ const web_html_js_1 = __importDefault(require("./web.html.js"));
|
|
|
15
16
|
readline_1.default.emitKeypressEvents(process.stdin);
|
|
16
17
|
if (process.stdin.isTTY)
|
|
17
18
|
process.stdin.setRawMode(true);
|
|
19
|
+
const logContent = [];
|
|
20
|
+
function parseTsErrors() {
|
|
21
|
+
try {
|
|
22
|
+
// const logContent = fs.readFileSync(logPath, "utf-8").split("\n");
|
|
23
|
+
const regex = /(^src(.*?))\(\d*,\d*\): error/gm;
|
|
24
|
+
const brokenFilesToLines = {};
|
|
25
|
+
for (let i = 0; i < logContent.length - 1; i++) {
|
|
26
|
+
let m;
|
|
27
|
+
while ((m = regex.exec(logContent[i])) !== null) {
|
|
28
|
+
// This is necessary to avoid infinite loops with zero-width matches
|
|
29
|
+
if (m.index === regex.lastIndex) {
|
|
30
|
+
regex.lastIndex++;
|
|
31
|
+
}
|
|
32
|
+
if (!brokenFilesToLines[m[1]]) {
|
|
33
|
+
brokenFilesToLines[m[1]] = new Set();
|
|
34
|
+
}
|
|
35
|
+
brokenFilesToLines[m[1]].add(i);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
|
|
39
|
+
mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
|
|
40
|
+
const a = Array.from(brokenFilesToLines[lm]);
|
|
41
|
+
return Object.keys(a).reduce((mm2, lm2, ndx2) => {
|
|
42
|
+
const acc = [];
|
|
43
|
+
let j = a[lm2] + 1;
|
|
44
|
+
let working = true;
|
|
45
|
+
while (j < logContent.length - 1 && working) {
|
|
46
|
+
if (!logContent[j].match(regex) &&
|
|
47
|
+
working &&
|
|
48
|
+
!logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)) {
|
|
49
|
+
acc.push(logContent[j]);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
working = false;
|
|
53
|
+
}
|
|
54
|
+
j++;
|
|
55
|
+
}
|
|
56
|
+
mm2[lm] = [logContent[l], ...acc];
|
|
57
|
+
return mm2;
|
|
58
|
+
}, {})[lm];
|
|
59
|
+
});
|
|
60
|
+
return mm;
|
|
61
|
+
}, {});
|
|
62
|
+
Object.keys(final).forEach((k) => {
|
|
63
|
+
fs_1.default.mkdirSync(`./docs/types/${k.split("/").slice(0, -1).join("/")}`, {
|
|
64
|
+
recursive: true,
|
|
65
|
+
});
|
|
66
|
+
fs_1.default.writeFileSync(`./docs/types/${k}.type_errors.txt`, final[k].flat().flat().join("\r\n"));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error("Error reading or parsing the log file:", error);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const compile = () => {
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
const tsc = (0, child_process_1.spawn)("tsc", ["-noEmit"]);
|
|
77
|
+
tsc.stdout.on("data", (data) => {
|
|
78
|
+
// console.log(`tsc stdout: ${data}`);
|
|
79
|
+
const lines = data.toString().split("\n");
|
|
80
|
+
logContent.push(...lines);
|
|
81
|
+
});
|
|
82
|
+
tsc.stderr.on("data", (data) => {
|
|
83
|
+
console.error(`stderr: ${data}`);
|
|
84
|
+
process.exit(-1);
|
|
85
|
+
});
|
|
86
|
+
tsc.on("close", (code) => {
|
|
87
|
+
parseTsErrors();
|
|
88
|
+
console.log("tsc done");
|
|
89
|
+
resolve(`tsc process exited with code ${code}`);
|
|
90
|
+
// if (code !== 0) {
|
|
91
|
+
// resolve(`tsc process exited with code ${code}`);
|
|
92
|
+
// // reject(`tsc process exited with code ${code}`);
|
|
93
|
+
// } else {
|
|
94
|
+
// resolve({});
|
|
95
|
+
// }
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
18
99
|
class ITProject {
|
|
19
100
|
constructor(configs) {
|
|
20
101
|
this.nodeDone = false;
|
|
@@ -81,6 +162,7 @@ class ITProject {
|
|
|
81
162
|
});
|
|
82
163
|
});
|
|
83
164
|
Promise.all([
|
|
165
|
+
compile(),
|
|
84
166
|
esbuild_1.default
|
|
85
167
|
.context((0, node_js_1.default)(this.config, nodeEntryPoints))
|
|
86
168
|
.then(async (nodeContext) => {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const Node_js_1 = __importDefault(require("../Node.js"));
|
|
8
8
|
exports.default = (testInput, testSpecifications, testImplementations, testInterface) => {
|
|
9
|
-
return (0, Node_js_1.default)(testInput, testSpecifications, testImplementations, Object.assign({ beforeAll(x) {
|
|
9
|
+
return (0, Node_js_1.default)(testInput, testSpecifications, testImplementations, Object.assign({ beforeAll: (x) => {
|
|
10
10
|
// process.parentPort.postMessage(
|
|
11
11
|
// `/docs/web/src/ClassicalComponent/test.html`
|
|
12
12
|
// );
|