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/dist/module/src/Init.js
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
export default async (partialConfig) => {
|
|
3
3
|
const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
|
|
4
|
+
try {
|
|
5
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}`);
|
|
6
|
+
}
|
|
7
|
+
catch (_a) {
|
|
8
|
+
// console.log()
|
|
9
|
+
}
|
|
4
10
|
fs.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
|
|
11
|
+
try {
|
|
12
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/node`);
|
|
13
|
+
}
|
|
14
|
+
catch (_b) {
|
|
15
|
+
// console.log()
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/web`);
|
|
19
|
+
}
|
|
20
|
+
catch (_c) {
|
|
21
|
+
// console.log()
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/features`);
|
|
25
|
+
}
|
|
26
|
+
catch (_d) {
|
|
27
|
+
// console.log()
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/ts`);
|
|
31
|
+
}
|
|
32
|
+
catch (_e) {
|
|
33
|
+
// console.log()
|
|
34
|
+
}
|
|
5
35
|
};
|
package/dist/module/src/Node.js
CHANGED
|
@@ -3,14 +3,16 @@ import { defaultTestResourceRequirement, } from "./lib/index.js";
|
|
|
3
3
|
import { PM_Node } from "./PM/node.js";
|
|
4
4
|
export class NodeTesteranto extends Testeranto {
|
|
5
5
|
constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
|
|
6
|
-
super(input, testSpecification, testImplementation, testResourceRequirement, testInterface)
|
|
6
|
+
super(input, testSpecification, testImplementation, testResourceRequirement, testInterface, () => {
|
|
7
|
+
// no-op
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
10
|
async receiveTestResourceConfig(partialTestResource) {
|
|
9
11
|
const t = JSON.parse(partialTestResource);
|
|
10
12
|
const pm = new PM_Node(t);
|
|
11
13
|
const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
12
|
-
pm.customclose();
|
|
13
|
-
return features;
|
|
14
|
+
// pm.customclose();
|
|
15
|
+
return { features, failed };
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
export default async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
@@ -4,8 +4,8 @@ import puppeteer from "puppeteer-core";
|
|
|
4
4
|
import crypto from "crypto";
|
|
5
5
|
import { PM } from "./index.js";
|
|
6
6
|
import { destinationOfRuntime } from "../utils.js";
|
|
7
|
-
const fPaths = [];
|
|
8
7
|
const fileStreams3 = [];
|
|
8
|
+
const fPaths = [];
|
|
9
9
|
const files = {};
|
|
10
10
|
const screenshots = {};
|
|
11
11
|
export class PM_Main extends PM {
|
|
@@ -81,9 +81,12 @@ export class PM_Main extends PM {
|
|
|
81
81
|
process.exit(-1);
|
|
82
82
|
}
|
|
83
83
|
const builtfile = dest + ".mjs";
|
|
84
|
-
|
|
84
|
+
const webSideCares = [];
|
|
85
|
+
await Promise.all(testConfig[3].map(async (sidecar) => {
|
|
85
86
|
if (sidecar[1] === "web") {
|
|
86
|
-
|
|
87
|
+
const s = await this.launchWebSideCar(sidecar[0], destinationOfRuntime(sidecar[0], "web", this.configs), sidecar);
|
|
88
|
+
webSideCares.push(s);
|
|
89
|
+
return s;
|
|
87
90
|
}
|
|
88
91
|
if (sidecar[1] === "node") {
|
|
89
92
|
return this.launchNodeSideCar(sidecar[0], destinationOfRuntime(sidecar[0], "node", this.configs), sidecar);
|
|
@@ -93,13 +96,15 @@ export class PM_Main extends PM {
|
|
|
93
96
|
return module.default.then((defaultModule) => {
|
|
94
97
|
defaultModule
|
|
95
98
|
.receiveTestResourceConfig(argz)
|
|
96
|
-
.then(async (features) => {
|
|
99
|
+
.then(async ({ features, failed }) => {
|
|
97
100
|
this.receiveFeatures(features, destFolder);
|
|
101
|
+
console.log(`${src} completed with ${failed} errors`);
|
|
98
102
|
})
|
|
99
103
|
.catch((e) => {
|
|
100
|
-
console.log(
|
|
104
|
+
console.log(`${src} errored with`, e);
|
|
101
105
|
})
|
|
102
106
|
.finally(() => {
|
|
107
|
+
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
103
108
|
this.deregister(src);
|
|
104
109
|
});
|
|
105
110
|
});
|
|
@@ -115,17 +120,12 @@ export class PM_Main extends PM {
|
|
|
115
120
|
const d = dest + ".mjs";
|
|
116
121
|
console.log("launchWebSideCar", src, dest, d);
|
|
117
122
|
const destFolder = dest.replace(".mjs", "");
|
|
118
|
-
const webArgz = JSON.stringify({
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
124
|
-
// const evaluation = `
|
|
125
|
-
// console.log("importing ${dest}.mjs");
|
|
126
|
-
// import('${dest}.mjs').then(async (x) => {
|
|
127
|
-
// console.log("imported", x.default);
|
|
128
|
-
// })`;
|
|
123
|
+
// const webArgz = JSON.stringify({
|
|
124
|
+
// name: dest,
|
|
125
|
+
// ports: [].toString(),
|
|
126
|
+
// fs: destFolder,
|
|
127
|
+
// browserWSEndpoint: this.browser.wsEndpoint(),
|
|
128
|
+
// });
|
|
129
129
|
const fileStreams2 = [];
|
|
130
130
|
const doneFileStream2 = [];
|
|
131
131
|
return new Promise((res, rej) => {
|
|
@@ -184,9 +184,9 @@ export class PM_Main extends PM {
|
|
|
184
184
|
});
|
|
185
185
|
page.exposeFunction("createWriteStream", (fp, testName) => {
|
|
186
186
|
const f = fs.createWriteStream(fp);
|
|
187
|
-
if (!files[testName]) {
|
|
188
|
-
|
|
189
|
-
}
|
|
187
|
+
// if (!files[testName]) {
|
|
188
|
+
// files[testName] = new Set();
|
|
189
|
+
// }
|
|
190
190
|
files[testName].add(fp);
|
|
191
191
|
const p = new Promise((res, rej) => {
|
|
192
192
|
res(fp);
|
|
@@ -204,14 +204,17 @@ export class PM_Main extends PM {
|
|
|
204
204
|
page.exposeFunction("end", async (uid) => {
|
|
205
205
|
return fileStreams2[uid].end();
|
|
206
206
|
});
|
|
207
|
-
page.exposeFunction("customclose", (p, testName) => {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
207
|
+
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
208
|
+
// fs.writeFileSync(
|
|
209
|
+
// p + "/manifest.json",
|
|
210
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
211
|
+
// );
|
|
212
|
+
// delete files[testName];
|
|
213
|
+
// Promise.all(screenshots[testName] || []).then(() => {
|
|
214
|
+
// delete screenshots[testName];
|
|
215
|
+
// // page.close();
|
|
216
|
+
// });
|
|
217
|
+
// });
|
|
215
218
|
return page;
|
|
216
219
|
})
|
|
217
220
|
.then(async (page) => {
|
|
@@ -318,6 +321,8 @@ export class PM_Main extends PM {
|
|
|
318
321
|
})`;
|
|
319
322
|
const fileStreams2 = [];
|
|
320
323
|
const doneFileStream2 = [];
|
|
324
|
+
const stdoutStream = fs.createWriteStream(`${dest}/stdout.log`);
|
|
325
|
+
const stderrStream = fs.createWriteStream(`${dest}/stderr.log`);
|
|
321
326
|
this.browser
|
|
322
327
|
.newPage()
|
|
323
328
|
.then((page) => {
|
|
@@ -365,20 +370,21 @@ export class PM_Main extends PM {
|
|
|
365
370
|
// page.evaluate(`window["screenshot done"]`);
|
|
366
371
|
});
|
|
367
372
|
page.exposeFunction("writeFileSync", (fp, contents, testName) => {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
373
|
+
return globalThis["writeFileSync"](fp, contents, testName);
|
|
374
|
+
// const dir = path.dirname(fp);
|
|
375
|
+
// fs.mkdirSync(dir, {
|
|
376
|
+
// recursive: true,
|
|
377
|
+
// });
|
|
378
|
+
// const p = new Promise<string>(async (res, rej) => {
|
|
379
|
+
// fs.writeFileSync(fp, contents);
|
|
380
|
+
// res(fp);
|
|
381
|
+
// });
|
|
382
|
+
// doneFileStream2.push(p);
|
|
383
|
+
// if (!files[testName]) {
|
|
384
|
+
// files[testName] = new Set();
|
|
385
|
+
// }
|
|
386
|
+
// files[testName].add(fp);
|
|
387
|
+
// return p;
|
|
382
388
|
});
|
|
383
389
|
page.exposeFunction("existsSync", (fp, contents) => {
|
|
384
390
|
return fs.existsSync(fp);
|
|
@@ -413,36 +419,37 @@ export class PM_Main extends PM {
|
|
|
413
419
|
page.exposeFunction("end", async (uid) => {
|
|
414
420
|
return fileStreams2[uid].end();
|
|
415
421
|
});
|
|
416
|
-
page.exposeFunction("customclose", (p, testName) => {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
422
|
+
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
423
|
+
// // console.log("closing", p);
|
|
424
|
+
// console.log("\t GOODBYE customclose");
|
|
425
|
+
// fs.writeFileSync(
|
|
426
|
+
// p + "/manifest.json",
|
|
427
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
428
|
+
// );
|
|
429
|
+
// delete files[testName];
|
|
430
|
+
// // console.log("screenshots[testName]", screenshots[testName]);
|
|
431
|
+
// Promise.all(screenshots[testName] || []).then(() => {
|
|
432
|
+
// delete screenshots[testName];
|
|
433
|
+
// });
|
|
434
|
+
// // globalThis["writeFileSync"](
|
|
435
|
+
// // p + "/manifest.json",
|
|
436
|
+
// // // files.entries()
|
|
437
|
+
// // JSON.stringify(Array.from(files[testName]))
|
|
438
|
+
// // );
|
|
439
|
+
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
440
|
+
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
441
|
+
// // Promise.all([...doneFileStream2, ...screenshots2]).then(() => {
|
|
442
|
+
// // page.close();
|
|
443
|
+
// // });
|
|
444
|
+
// // Promise.all(screenshots).then(() => {
|
|
445
|
+
// // page.close();
|
|
446
|
+
// // });
|
|
447
|
+
// // setTimeout(() => {
|
|
448
|
+
// // console.log("Delayed for 1 second.");
|
|
449
|
+
// // page.close();
|
|
450
|
+
// // }, 5000);
|
|
451
|
+
// // return page.close();
|
|
452
|
+
// });
|
|
446
453
|
page.exposeFunction("page", () => {
|
|
447
454
|
return page.mainFrame()._id;
|
|
448
455
|
});
|
|
@@ -474,29 +481,63 @@ export class PM_Main extends PM {
|
|
|
474
481
|
return page;
|
|
475
482
|
})
|
|
476
483
|
.then(async (page) => {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
484
|
+
const close = () => {
|
|
485
|
+
if (!files[t]) {
|
|
486
|
+
files[t] = new Set();
|
|
487
|
+
}
|
|
488
|
+
// files[t].add(filepath);
|
|
489
|
+
fs.writeFileSync(dest + "/manifest.json", JSON.stringify(Array.from(files[t])));
|
|
490
|
+
delete files[t];
|
|
491
|
+
Promise.all(screenshots[t] || []).then(() => {
|
|
492
|
+
delete screenshots[t];
|
|
493
|
+
page.close();
|
|
494
|
+
this.deregister(t);
|
|
495
|
+
stderrStream.close();
|
|
496
|
+
stdoutStream.close();
|
|
497
|
+
});
|
|
498
|
+
};
|
|
499
|
+
page.on("pageerror", (err) => {
|
|
500
|
+
console.debug(`Error from ${t}: [${err.name}] `);
|
|
501
|
+
stderrStream.write(err.name);
|
|
502
|
+
if (err.cause) {
|
|
503
|
+
console.debug(`Error from ${t} cause: [${err.cause}] `);
|
|
504
|
+
stderrStream.write(err.cause);
|
|
505
|
+
}
|
|
506
|
+
if (err.stack) {
|
|
507
|
+
console.debug(`Error from stack ${t}: [${err.stack}] `);
|
|
508
|
+
stderrStream.write(err.stack);
|
|
509
|
+
}
|
|
510
|
+
console.debug(`Error from message ${t}: [${err.message}] `);
|
|
511
|
+
stderrStream.write(err.message);
|
|
512
|
+
// close();
|
|
513
|
+
});
|
|
514
|
+
page.on("console", (log) => {
|
|
515
|
+
// console.debug(`Log from ${t}: [${log.text()}] `);
|
|
516
|
+
// console.debug(`Log from ${t}: [${JSON.stringify(log.location())}] `);
|
|
517
|
+
// console.debug(
|
|
518
|
+
// `Log from ${t}: [${JSON.stringify(log.stackTrace())}] `
|
|
519
|
+
// );
|
|
520
|
+
stdoutStream.write(log.text());
|
|
521
|
+
stdoutStream.write(JSON.stringify(log.location()));
|
|
522
|
+
stdoutStream.write(JSON.stringify(log.stackTrace()));
|
|
523
|
+
});
|
|
480
524
|
await page.goto(`file://${`${dest}.html`}`, {});
|
|
481
525
|
await page
|
|
482
526
|
.evaluate(evaluation)
|
|
483
|
-
.then(async (features) => {
|
|
527
|
+
.then(async ({ failed, features }) => {
|
|
484
528
|
this.receiveFeatures(features, destFolder);
|
|
529
|
+
console.log(`${t} completed with ${failed} errors`);
|
|
485
530
|
})
|
|
486
531
|
.catch((e) => {
|
|
487
|
-
console.log(
|
|
488
|
-
console.log(e);
|
|
532
|
+
console.log(`${t} errored with`, e);
|
|
489
533
|
})
|
|
490
534
|
.finally(() => {
|
|
491
|
-
|
|
492
|
-
// page.close();
|
|
493
|
-
this.deregister(t);
|
|
535
|
+
close();
|
|
494
536
|
});
|
|
495
537
|
return page;
|
|
496
538
|
});
|
|
497
539
|
};
|
|
498
540
|
this.receiveFeatures = (features, destFolder) => {
|
|
499
|
-
console.log("this.receiveFeatures", features);
|
|
500
541
|
features
|
|
501
542
|
.reduce(async (mm, featureStringKey) => {
|
|
502
543
|
const accum = await mm;
|
|
@@ -563,12 +604,14 @@ export class PM_Main extends PM {
|
|
|
563
604
|
return false;
|
|
564
605
|
};
|
|
565
606
|
globalThis["writeFileSync"] = (filepath, contents, testName) => {
|
|
566
|
-
// console.log("
|
|
607
|
+
// console.log(testName, "writeFileSync", filepath, testName);
|
|
567
608
|
// Create directories if they don't exist
|
|
568
|
-
const dir = path.dirname(filepath
|
|
609
|
+
const dir = path.dirname(filepath);
|
|
610
|
+
// console.log(testName, "mkdirSync", dir);
|
|
569
611
|
fs.mkdirSync(dir, {
|
|
570
612
|
recursive: true,
|
|
571
613
|
});
|
|
614
|
+
// console.log(testName, "mkdirSync2");
|
|
572
615
|
if (!files[testName]) {
|
|
573
616
|
files[testName] = new Set();
|
|
574
617
|
}
|
|
@@ -609,13 +652,16 @@ export class PM_Main extends PM {
|
|
|
609
652
|
await sPromise;
|
|
610
653
|
return sPromise;
|
|
611
654
|
};
|
|
612
|
-
globalThis["customclose"] = (p, testName) => {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
655
|
+
// globalThis["customclose"] = (p: string, testName: string) => {
|
|
656
|
+
// if (!files[testName]) {
|
|
657
|
+
// files[testName] = new Set();
|
|
658
|
+
// }
|
|
659
|
+
// fs.writeFileSync(
|
|
660
|
+
// p + "/manifest.json",
|
|
661
|
+
// JSON.stringify(Array.from(files[testName]))
|
|
662
|
+
// );
|
|
663
|
+
// delete files[testName];
|
|
664
|
+
// };
|
|
619
665
|
}
|
|
620
666
|
$(selector) {
|
|
621
667
|
throw new Error("Method not implemented.");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
1
2
|
import esbuild from "esbuild";
|
|
2
3
|
import fs from "fs";
|
|
3
4
|
import path from "path";
|
|
@@ -9,6 +10,86 @@ import webHtmlFrame from "./web.html.js";
|
|
|
9
10
|
readline.emitKeypressEvents(process.stdin);
|
|
10
11
|
if (process.stdin.isTTY)
|
|
11
12
|
process.stdin.setRawMode(true);
|
|
13
|
+
const logContent = [];
|
|
14
|
+
function parseTsErrors() {
|
|
15
|
+
try {
|
|
16
|
+
// const logContent = fs.readFileSync(logPath, "utf-8").split("\n");
|
|
17
|
+
const regex = /(^src(.*?))\(\d*,\d*\): error/gm;
|
|
18
|
+
const brokenFilesToLines = {};
|
|
19
|
+
for (let i = 0; i < logContent.length - 1; i++) {
|
|
20
|
+
let m;
|
|
21
|
+
while ((m = regex.exec(logContent[i])) !== null) {
|
|
22
|
+
// This is necessary to avoid infinite loops with zero-width matches
|
|
23
|
+
if (m.index === regex.lastIndex) {
|
|
24
|
+
regex.lastIndex++;
|
|
25
|
+
}
|
|
26
|
+
if (!brokenFilesToLines[m[1]]) {
|
|
27
|
+
brokenFilesToLines[m[1]] = new Set();
|
|
28
|
+
}
|
|
29
|
+
brokenFilesToLines[m[1]].add(i);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
|
|
33
|
+
mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
|
|
34
|
+
const a = Array.from(brokenFilesToLines[lm]);
|
|
35
|
+
return Object.keys(a).reduce((mm2, lm2, ndx2) => {
|
|
36
|
+
const acc = [];
|
|
37
|
+
let j = a[lm2] + 1;
|
|
38
|
+
let working = true;
|
|
39
|
+
while (j < logContent.length - 1 && working) {
|
|
40
|
+
if (!logContent[j].match(regex) &&
|
|
41
|
+
working &&
|
|
42
|
+
!logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)) {
|
|
43
|
+
acc.push(logContent[j]);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
working = false;
|
|
47
|
+
}
|
|
48
|
+
j++;
|
|
49
|
+
}
|
|
50
|
+
mm2[lm] = [logContent[l], ...acc];
|
|
51
|
+
return mm2;
|
|
52
|
+
}, {})[lm];
|
|
53
|
+
});
|
|
54
|
+
return mm;
|
|
55
|
+
}, {});
|
|
56
|
+
Object.keys(final).forEach((k) => {
|
|
57
|
+
fs.mkdirSync(`./docs/types/${k.split("/").slice(0, -1).join("/")}`, {
|
|
58
|
+
recursive: true,
|
|
59
|
+
});
|
|
60
|
+
fs.writeFileSync(`./docs/types/${k}.type_errors.txt`, final[k].flat().flat().join("\r\n"));
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.error("Error reading or parsing the log file:", error);
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const compile = () => {
|
|
69
|
+
return new Promise((resolve, reject) => {
|
|
70
|
+
const tsc = spawn("tsc", ["-noEmit"]);
|
|
71
|
+
tsc.stdout.on("data", (data) => {
|
|
72
|
+
// console.log(`tsc stdout: ${data}`);
|
|
73
|
+
const lines = data.toString().split("\n");
|
|
74
|
+
logContent.push(...lines);
|
|
75
|
+
});
|
|
76
|
+
tsc.stderr.on("data", (data) => {
|
|
77
|
+
console.error(`stderr: ${data}`);
|
|
78
|
+
process.exit(-1);
|
|
79
|
+
});
|
|
80
|
+
tsc.on("close", (code) => {
|
|
81
|
+
parseTsErrors();
|
|
82
|
+
console.log("tsc done");
|
|
83
|
+
resolve(`tsc process exited with code ${code}`);
|
|
84
|
+
// if (code !== 0) {
|
|
85
|
+
// resolve(`tsc process exited with code ${code}`);
|
|
86
|
+
// // reject(`tsc process exited with code ${code}`);
|
|
87
|
+
// } else {
|
|
88
|
+
// resolve({});
|
|
89
|
+
// }
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
12
93
|
export class ITProject {
|
|
13
94
|
constructor(configs) {
|
|
14
95
|
this.nodeDone = false;
|
|
@@ -75,6 +156,7 @@ export class ITProject {
|
|
|
75
156
|
});
|
|
76
157
|
});
|
|
77
158
|
Promise.all([
|
|
159
|
+
compile(),
|
|
78
160
|
esbuild
|
|
79
161
|
.context(esbuildNodeConfiger(this.config, nodeEntryPoints))
|
|
80
162
|
.then(async (nodeContext) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Testeranto from "../Node.js";
|
|
3
3
|
export default (testInput, testSpecifications, testImplementations, testInterface) => {
|
|
4
|
-
return Testeranto(testInput, testSpecifications, testImplementations, Object.assign({ beforeAll(x) {
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, Object.assign({ beforeAll: (x) => {
|
|
5
5
|
// process.parentPort.postMessage(
|
|
6
6
|
// `/docs/web/src/ClassicalComponent/test.html`
|
|
7
7
|
// );
|
|
@@ -6,14 +6,22 @@ export const testInterface = {
|
|
|
6
6
|
// // resolve(x());
|
|
7
7
|
// // });
|
|
8
8
|
// },
|
|
9
|
-
beforeEach: async (subject, initializer, artificer) => {
|
|
9
|
+
// beforeEach: async (subject, initializer, artificer): Promise<IStore> => {
|
|
10
|
+
// return new Promise((resolve, rej) => {
|
|
11
|
+
// resolve(React.createElement(subject));
|
|
12
|
+
// });
|
|
13
|
+
// },
|
|
14
|
+
andWhen: async (s, whenCB) => {
|
|
15
|
+
await whenCB(s());
|
|
10
16
|
return new Promise((resolve, rej) => {
|
|
11
|
-
|
|
12
|
-
console.log("react-element", x);
|
|
13
|
-
resolve(x);
|
|
17
|
+
resolve(React.createElement(s));
|
|
14
18
|
});
|
|
19
|
+
// return whenCB(s);
|
|
15
20
|
},
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
butThen: async (subject, thenCB) => {
|
|
22
|
+
await thenCB(subject());
|
|
23
|
+
return new Promise((resolve, rej) => {
|
|
24
|
+
resolve(React.createElement(subject));
|
|
25
|
+
});
|
|
18
26
|
},
|
|
19
27
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import Testeranto from "../../../Node.js";
|
|
2
2
|
import { testInterface as baseInterface, } from "./index.js";
|
|
3
|
-
export default (testImplementations, testSpecifications, testInput, testInterface) => {
|
|
4
|
-
return Testeranto(testInput, testSpecifications, testImplementations,
|
|
3
|
+
export default (testImplementations, testSpecifications, testInput, testInterface = baseInterface) => {
|
|
4
|
+
return Testeranto(testInput, testSpecifications, testImplementations, testInterface
|
|
5
|
+
// {
|
|
6
|
+
// ...baseInterface,
|
|
7
|
+
// ...testInterface,
|
|
8
|
+
// }
|
|
9
|
+
);
|
|
5
10
|
};
|
|
@@ -13,52 +13,26 @@ export default (testInput, testSpecifications, testImplementations, testInterfac
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
const t = Testeranto(testInput, testSpecifications, testImplementations, {
|
|
16
|
-
beforeAll: async (
|
|
16
|
+
beforeAll: async (subject, artificer) => {
|
|
17
17
|
return await new Promise((resolve, rej) => {
|
|
18
18
|
const htmlElement = document.getElementById("root");
|
|
19
19
|
if (htmlElement) {
|
|
20
20
|
const domRoot = ReactDom.createRoot(htmlElement);
|
|
21
|
-
|
|
22
|
-
domRoot.render(createElement(TesterantoComponent, Object.assign(Object.assign({}, initialProps), { done: (reactElement) => {
|
|
23
|
-
resolve({
|
|
24
|
-
htmlElement,
|
|
25
|
-
reactElement,
|
|
26
|
-
domRoot,
|
|
27
|
-
});
|
|
28
|
-
} }), []));
|
|
29
|
-
// resolve({ htmlElement });
|
|
21
|
+
resolve({ domRoot, htmlElement });
|
|
30
22
|
}
|
|
31
23
|
});
|
|
32
24
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// // domRoot.render(
|
|
45
|
-
// // createElement(
|
|
46
|
-
// // TesterantoComponent,
|
|
47
|
-
// // {
|
|
48
|
-
// // ...initializer,
|
|
49
|
-
// // done: (reactElement) => {
|
|
50
|
-
// // resolve({
|
|
51
|
-
// // htmlElement,
|
|
52
|
-
// // reactElement,
|
|
53
|
-
// // domRoot,
|
|
54
|
-
// // });
|
|
55
|
-
// // },
|
|
56
|
-
// // },
|
|
57
|
-
// // []
|
|
58
|
-
// // )
|
|
59
|
-
// // );
|
|
60
|
-
// });
|
|
61
|
-
// },
|
|
25
|
+
beforeEach: async ({ domRoot, htmlElement }, initialValues, testResource, artificer) => {
|
|
26
|
+
return new Promise(async (resolve, rej) => {
|
|
27
|
+
domRoot.render(createElement(TesterantoComponent, Object.assign(Object.assign({}, initialValues), { done: (reactElement) => {
|
|
28
|
+
resolve({
|
|
29
|
+
htmlElement,
|
|
30
|
+
reactElement,
|
|
31
|
+
domRoot,
|
|
32
|
+
});
|
|
33
|
+
} }), []));
|
|
34
|
+
});
|
|
35
|
+
},
|
|
62
36
|
andWhen: function (s, whenCB) {
|
|
63
37
|
return whenCB(s);
|
|
64
38
|
},
|