testeranto 0.125.3 → 0.129.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 +248 -6
- package/dist/common/src/Node.js +5 -0
- package/dist/common/src/PM/base.js +6 -0
- package/dist/common/src/PM/index.js +0 -1
- package/dist/common/src/PM/main.js +84 -22
- package/dist/common/src/PM/web.js +1 -1
- package/dist/common/src/ReportServer.js +39 -2
- package/dist/common/src/build.js +41 -6
- package/dist/common/src/lib/abstractBase.js +22 -107
- package/dist/common/src/lib/basebuilder.js +20 -21
- package/dist/common/src/lib/classBuilder.js +12 -1
- package/dist/common/src/lib/core.js +1 -8
- package/dist/common/src/lib/index.js +2 -5
- package/dist/common/src/lib/pmProxy.js +294 -0
- package/dist/common/testeranto.config.js +43 -34
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Node.js +5 -0
- package/dist/module/src/PM/base.js +6 -0
- package/dist/module/src/PM/index.js +0 -1
- package/dist/module/src/PM/main.js +84 -22
- package/dist/module/src/PM/web.js +1 -1
- package/dist/module/src/Project.js +6 -6
- package/dist/module/src/ReportClient.js +3 -3
- package/dist/module/src/ReportServer.js +39 -2
- package/dist/module/src/build.js +41 -6
- package/dist/module/src/lib/abstractBase.js +22 -107
- package/dist/module/src/lib/basebuilder.js +20 -21
- package/dist/module/src/lib/classBuilder.js +12 -1
- package/dist/module/src/lib/core.js +1 -8
- package/dist/module/src/lib/index.js +2 -5
- package/dist/module/src/lib/pmProxy.js +285 -0
- package/dist/module/testeranto.config.js +40 -34
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Project.css +1 -26
- package/dist/prebuild/Project.js +4 -4
- package/dist/prebuild/ReportClient.css +1 -26
- package/dist/prebuild/ReportClient.js +3 -3
- package/dist/prebuild/ReportServer.mjs +1 -2
- package/dist/prebuild/TestReport.css +1 -26
- package/dist/prebuild/build.mjs +42 -7
- package/dist/prebuild/run.mjs +95 -20
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/PM/web.d.ts +1 -1
- package/dist/types/src/Types.d.ts +2 -1
- package/dist/types/src/lib/abstractBase.d.ts +4 -6
- package/dist/types/src/lib/index.d.ts +1 -1
- package/dist/types/src/lib/pmProxy.d.ts +7 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +14 -7
- package/src/Init.ts +1 -0
- package/src/Node.ts +6 -0
- package/src/PM/base.ts +8 -0
- package/src/PM/index.ts +2 -7
- package/src/PM/main.ts +128 -26
- package/src/PM/web.ts +3 -3
- package/src/Project.tsx +6 -6
- package/src/ReportClient.tsx +3 -3
- package/src/ReportServer.ts +43 -2
- package/src/Types.ts +3 -2
- package/src/build.ts +47 -6
- package/src/lib/abstractBase.ts +45 -184
- package/src/lib/basebuilder.ts +25 -28
- package/src/lib/classBuilder.ts +13 -2
- package/src/lib/core.ts +10 -14
- package/src/lib/index.ts +6 -29
- package/src/lib/pmProxy.ts +366 -0
- package/testeranto/bundles/node/{react → redux}/metafile.json +186 -254
- package/testeranto/bundles/pure/redux/metafile.json +554 -0
- package/testeranto/bundles/web/redux/metafile.json +504 -0
- package/testeranto/bundles/web/{react/src/SubPackages/react-test-renderer/component → redux}/test/web.html +1 -1
- package/testeranto/index.html +1 -1
- package/testeranto/reports/{react → redux}/config.json +26 -10
- package/testeranto/reports/{react → redux}/index.html +5 -5
- package/testeranto/reports/redux/summary.json +20 -0
- package/testeranto.config.ts +46 -34
- package/tsc.log +3 -1
- package/testeranto/bundles/node/react/src/SubPackages/react-test-renderer/component/test/node.mjs +0 -24687
- package/testeranto/bundles/pure/react/metafile.json +0 -8
- package/testeranto/bundles/pure/react/src/SubPackages/react-test-renderer/component/test/pure.mjs +0 -24625
- package/testeranto/bundles/web/react/metafile.json +0 -8
- package/testeranto/bundles/web/react/src/SubPackages/react-test-renderer/component/test/web.mjs +0 -21290
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/node/node/console_log.txt +0 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/bdd_errors.txt +0 -1
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/featurePrompt.txt +0 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/lint_errors.json +0 -3381
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/littleBoard.html +0 -20
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/log.txt +0 -40
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/prompt.txt +0 -24
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/tests.json +0 -132
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/type_errors.txt +0 -17
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/bdd_errors.txt +0 -1
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/console_log.txt +0 -1
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/lint_errors.json +0 -2947
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/littleBoard.html +0 -20
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/log.txt +0 -40
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/prompt.txt +0 -23
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/tests.json +0 -132
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/type_errors.txt +0 -18
- package/testeranto/reports/react/summary.json +0 -8
package/dist/module/src/Node.js
CHANGED
|
@@ -19,7 +19,12 @@ export class NodeTesteranto extends Testeranto {
|
|
|
19
19
|
}
|
|
20
20
|
const testeranto = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
21
21
|
const t = new NodeTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
22
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
23
|
+
console.error("Unhandled Rejection at:", promise, "reason:", reason);
|
|
24
|
+
// Optionally, terminate the process or perform cleanup
|
|
25
|
+
});
|
|
22
26
|
try {
|
|
27
|
+
console.log(process.argv);
|
|
23
28
|
const f = await t.receiveTestResourceConfig(process.argv[2]);
|
|
24
29
|
console.error("goodbye node error", f.fails);
|
|
25
30
|
process.exit(f.fails);
|
|
@@ -123,7 +123,13 @@ export class PM_Base {
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
async createWriteStream(filepath, testName) {
|
|
126
|
+
const folder = filepath.split("/").slice(0, -1).join("/");
|
|
126
127
|
return new Promise((res) => {
|
|
128
|
+
if (!fs.existsSync(folder)) {
|
|
129
|
+
return fs.mkdirSync(folder, {
|
|
130
|
+
recursive: true,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
127
133
|
const f = fs.createWriteStream(filepath);
|
|
128
134
|
fileStreams3.push(f);
|
|
129
135
|
if (!files[testName]) {
|
|
@@ -34,7 +34,7 @@ async function fileHash(filePath, algorithm = "md5") {
|
|
|
34
34
|
}
|
|
35
35
|
const statusMessagePretty = (failures, test) => {
|
|
36
36
|
if (failures === 0) {
|
|
37
|
-
console.log(ansiC.green(ansiC.inverse(`> ${test} completed successfully
|
|
37
|
+
console.log(ansiC.green(ansiC.inverse(`> ${test} completed successfully?!?`)));
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
40
|
console.log(ansiC.red(ansiC.inverse(`> ${test} failed ${failures} times`)));
|
|
@@ -96,7 +96,6 @@ export class PM_Main extends PM_Base {
|
|
|
96
96
|
basePath: process.cwd(), // always required, used for relative paths
|
|
97
97
|
configFilePath: "tsconfig.json", // config to inherit from (optional)
|
|
98
98
|
compilerOptions: {
|
|
99
|
-
rootDir: "src",
|
|
100
99
|
outDir: tscPather(entrypoint, platform, this.name),
|
|
101
100
|
// declaration: true,
|
|
102
101
|
// skipLibCheck: true,
|
|
@@ -306,24 +305,40 @@ ${addableFiles
|
|
|
306
305
|
// }
|
|
307
306
|
// })
|
|
308
307
|
// );
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
.
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
308
|
+
try {
|
|
309
|
+
await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
|
|
310
|
+
return module.default
|
|
311
|
+
.then((defaultModule) => {
|
|
312
|
+
defaultModule
|
|
313
|
+
.receiveTestResourceConfig(argz)
|
|
314
|
+
.then(async (results) => {
|
|
315
|
+
this.receiveFeatures(results.features, destFolder, src, "pure");
|
|
316
|
+
statusMessagePretty(results.fails, src);
|
|
317
|
+
this.bddTestIsNowDone(src, results.fails);
|
|
318
|
+
})
|
|
319
|
+
.catch((e) => {
|
|
320
|
+
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}`)));
|
|
321
|
+
this.bddTestIsNowDone(src, -1);
|
|
322
|
+
})
|
|
323
|
+
.finally(() => {
|
|
324
|
+
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
325
|
+
});
|
|
317
326
|
})
|
|
318
327
|
.catch((e) => {
|
|
319
|
-
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}`)));
|
|
328
|
+
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}. Check ${reportDest}/error.txt for more info`)));
|
|
329
|
+
this.writeFileSync(`${reportDest}/error.txt`, e.stack, src);
|
|
320
330
|
this.bddTestIsNowDone(src, -1);
|
|
321
|
-
|
|
322
|
-
.
|
|
323
|
-
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
331
|
+
statusMessagePretty(-1, src);
|
|
332
|
+
// console.error(e);
|
|
324
333
|
});
|
|
325
334
|
});
|
|
326
|
-
}
|
|
335
|
+
}
|
|
336
|
+
catch (e) {
|
|
337
|
+
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}. Check ${reportDest}/error.txt for more info`)));
|
|
338
|
+
this.writeFileSync(`${reportDest}/error.txt`, e.stack, src);
|
|
339
|
+
this.bddTestIsNowDone(src, -1);
|
|
340
|
+
statusMessagePretty(-1, src);
|
|
341
|
+
}
|
|
327
342
|
// console.log("portsToUse", portsToUse);
|
|
328
343
|
for (let i = 0; i <= portsToUse.length; i++) {
|
|
329
344
|
if (portsToUse[i]) {
|
|
@@ -347,7 +362,7 @@ ${addableFiles
|
|
|
347
362
|
return t[0] === src;
|
|
348
363
|
});
|
|
349
364
|
if (!testConfig) {
|
|
350
|
-
console.log(ansiC.inverse(
|
|
365
|
+
console.log(ansiC.inverse(`missing test config! Exiting ungracefully for '${src}'`));
|
|
351
366
|
process.exit(-1);
|
|
352
367
|
}
|
|
353
368
|
const testConfigResource = testConfig[2];
|
|
@@ -449,11 +464,32 @@ ${addableFiles
|
|
|
449
464
|
});
|
|
450
465
|
});
|
|
451
466
|
const oStream = fs.createWriteStream(`${reportDest}/console_log.txt`);
|
|
452
|
-
const child = spawn("node", [builtfile, testResources], {
|
|
467
|
+
const child = spawn("node", [builtfile, testResources, "--trace-warnings"], {
|
|
453
468
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
454
469
|
// silent: true
|
|
455
470
|
});
|
|
456
|
-
const p = destFolder + "/
|
|
471
|
+
const p = destFolder + "/tpipe";
|
|
472
|
+
// exec(`lsof`, (ec, out, err) => {
|
|
473
|
+
// console.log(ec, out, err);
|
|
474
|
+
// });
|
|
475
|
+
// if (fs.existsSync(p)) {
|
|
476
|
+
// fs.rmSync(p);
|
|
477
|
+
// }
|
|
478
|
+
const errFile = `${reportDest}/error.txt`;
|
|
479
|
+
if (fs.existsSync(errFile)) {
|
|
480
|
+
fs.rmSync(errFile);
|
|
481
|
+
}
|
|
482
|
+
// server.on("error", (e) => {
|
|
483
|
+
// if (e.code === "EADDRINUSE") {
|
|
484
|
+
// console.error(e);
|
|
485
|
+
// process.exit(-1);
|
|
486
|
+
// // console.error("Address in use, retrying...");
|
|
487
|
+
// // setTimeout(() => {
|
|
488
|
+
// // server.close();
|
|
489
|
+
// // server.listen(p);
|
|
490
|
+
// // }, 1000);
|
|
491
|
+
// }
|
|
492
|
+
// });
|
|
457
493
|
server.listen(p, () => {
|
|
458
494
|
var _a, _b;
|
|
459
495
|
(_a = child.stderr) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
@@ -463,6 +499,11 @@ ${addableFiles
|
|
|
463
499
|
oStream.write(`stdout data ${data}`);
|
|
464
500
|
});
|
|
465
501
|
child.on("close", (code) => {
|
|
502
|
+
console.log("close");
|
|
503
|
+
console.log("deleting", p);
|
|
504
|
+
if (fs.existsSync(p)) {
|
|
505
|
+
fs.rmSync(p);
|
|
506
|
+
}
|
|
466
507
|
oStream.close();
|
|
467
508
|
server.close();
|
|
468
509
|
if (code === null) {
|
|
@@ -477,9 +518,30 @@ ${addableFiles
|
|
|
477
518
|
this.bddTestIsNowDone(src, code);
|
|
478
519
|
statusMessagePretty(code, src);
|
|
479
520
|
}
|
|
480
|
-
|
|
521
|
+
haltReturns = true;
|
|
522
|
+
});
|
|
523
|
+
child.on("exit", (code) => {
|
|
524
|
+
console.log("exit");
|
|
525
|
+
console.log("deleting", p);
|
|
526
|
+
if (fs.existsSync(p)) {
|
|
527
|
+
fs.rmSync(p);
|
|
528
|
+
}
|
|
529
|
+
haltReturns = true;
|
|
530
|
+
});
|
|
531
|
+
child.on("error", (e) => {
|
|
532
|
+
console.log("error");
|
|
533
|
+
console.log("deleting", p);
|
|
534
|
+
if (fs.existsSync(p)) {
|
|
535
|
+
fs.rmSync(p);
|
|
536
|
+
}
|
|
537
|
+
haltReturns = true;
|
|
538
|
+
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e.name}. Check ${errFile}for more info`)));
|
|
539
|
+
this.writeFileSync(`${reportDest}/error.txt`, e.toString(), src);
|
|
540
|
+
this.bddTestIsNowDone(src, -1);
|
|
541
|
+
statusMessagePretty(-1, src);
|
|
542
|
+
// this.bddTestIsNowDone(src, -1);
|
|
543
|
+
// statusMessagePretty(-1, src);
|
|
481
544
|
});
|
|
482
|
-
child.on("exit", (code) => { });
|
|
483
545
|
});
|
|
484
546
|
child.send({ path: p });
|
|
485
547
|
for (let i = 0; i <= portsToUse.length; i++) {
|
|
@@ -921,7 +983,7 @@ ${addableFiles
|
|
|
921
983
|
const hash = await fileHash(outputFile);
|
|
922
984
|
if (fileHashes[k] !== hash) {
|
|
923
985
|
fileHashes[k] = hash;
|
|
924
|
-
console.log(ansiC.
|
|
986
|
+
console.log(ansiC.yellow(ansiC.inverse(`< ${e} ${filename}`)));
|
|
925
987
|
launcher(k, outputFile);
|
|
926
988
|
}
|
|
927
989
|
});
|
|
@@ -932,7 +994,7 @@ ${addableFiles
|
|
|
932
994
|
});
|
|
933
995
|
this.metafileOutputs(runtime);
|
|
934
996
|
watcher(watch(metafile, async (e, filename) => {
|
|
935
|
-
console.log(ansiC.
|
|
997
|
+
console.log(ansiC.yellow(ansiC.inverse(`< ${e} ${filename} (${runtime})`)));
|
|
936
998
|
this.metafileOutputs(runtime);
|
|
937
999
|
}));
|
|
938
1000
|
});
|
|
@@ -33,7 +33,7 @@ export class PM_Web {
|
|
|
33
33
|
return window["isDisabled"](selector);
|
|
34
34
|
}
|
|
35
35
|
getAttribute(selector, attribute) {
|
|
36
|
-
return window["
|
|
36
|
+
return window["getAttribute"](selector, attribute);
|
|
37
37
|
}
|
|
38
38
|
getValue(selector) {
|
|
39
39
|
return window["getValue"](selector);
|
|
@@ -38,8 +38,8 @@ const BigBoard = () => {
|
|
|
38
38
|
const x = projects.map(async (p) => {
|
|
39
39
|
return [
|
|
40
40
|
p,
|
|
41
|
-
(await (await fetch(
|
|
42
|
-
(await (await fetch(
|
|
41
|
+
(await (await fetch(`./reports/${p}/config.json`)).json()),
|
|
42
|
+
(await (await fetch(`./reports/${p}/summary.json`)).json())
|
|
43
43
|
];
|
|
44
44
|
});
|
|
45
45
|
Promise.all(x).then((v) => {
|
|
@@ -100,11 +100,11 @@ const BigBoard = () => {
|
|
|
100
100
|
React.createElement("td", null, t[0]),
|
|
101
101
|
React.createElement("td", null, t[1]),
|
|
102
102
|
React.createElement("td", null,
|
|
103
|
-
React.createElement("a", { href:
|
|
103
|
+
React.createElement("a", { href: `./reports/${x}/index.html` }, y.runTimeError)),
|
|
104
104
|
React.createElement("td", null,
|
|
105
|
-
React.createElement("a", { href:
|
|
105
|
+
React.createElement("a", { href: `./reports/${x}/lint_errors.json` }, y.staticErrors)),
|
|
106
106
|
React.createElement("td", null,
|
|
107
|
-
React.createElement("a", { href:
|
|
107
|
+
React.createElement("a", { href: `./reports/${x}/type_errors.txt` }, y.typeErrors)),
|
|
108
108
|
React.createElement("td", null,
|
|
109
109
|
React.createElement("pre", null, s[2][t[0]].prompt)));
|
|
110
110
|
}));
|
|
@@ -117,4 +117,4 @@ document.addEventListener("DOMContentLoaded", function () {
|
|
|
117
117
|
ReactDom.createRoot(elem).render(React.createElement(BigBoard, {}));
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
console.log("hello
|
|
120
|
+
console.log("hello Project!");
|
|
@@ -8,7 +8,7 @@ const BigBoard = () => {
|
|
|
8
8
|
const [configs, setConfigs] = useState();
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
(async () => {
|
|
11
|
-
fetch(
|
|
11
|
+
fetch(`./reports/${window.location.pathname.split('/').pop()}/config.json`)
|
|
12
12
|
.then(response => response.json())
|
|
13
13
|
.then(json => {
|
|
14
14
|
setConfigs(json);
|
|
@@ -19,7 +19,7 @@ const BigBoard = () => {
|
|
|
19
19
|
const [bigBoard, setBigBoard] = useState({});
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
(async () => {
|
|
22
|
-
fetch('
|
|
22
|
+
fetch('./docs/summary.json')
|
|
23
23
|
.then(response => response.json())
|
|
24
24
|
.then(json => {
|
|
25
25
|
setBigBoard(json);
|
|
@@ -94,4 +94,4 @@ document.addEventListener("DOMContentLoaded", function () {
|
|
|
94
94
|
ReactDom.createRoot(elem).render(React.createElement(BigBoard, {}, []));
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
|
-
console.log("hello
|
|
97
|
+
console.log("hello ReportClient!");
|
|
@@ -1,8 +1,45 @@
|
|
|
1
1
|
import staticServer from "node-static";
|
|
2
2
|
import http from "http";
|
|
3
|
+
// import esbuild from "esbuild";
|
|
3
4
|
const main = async () => {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
// esbuild
|
|
6
|
+
// .context(configer(config, Object.keys(entryPoints), testName))
|
|
7
|
+
// .then(async (ctx) => {
|
|
8
|
+
// if (mode === "dev") {
|
|
9
|
+
// await ctx.watch().then((v) => {
|
|
10
|
+
// done();
|
|
11
|
+
// });
|
|
12
|
+
// } else {
|
|
13
|
+
// ctx.rebuild().then((v) => {
|
|
14
|
+
// done();
|
|
15
|
+
// });
|
|
16
|
+
// }
|
|
17
|
+
// return ctx;
|
|
18
|
+
// });
|
|
19
|
+
// }),
|
|
20
|
+
// await esbuild
|
|
21
|
+
// .context({
|
|
22
|
+
// entryPoints: [
|
|
23
|
+
// "node_modules/testeranto/src/ReportClient.tsx",
|
|
24
|
+
// "node_modules/testeranto/src/TestReport.tsx",
|
|
25
|
+
// "node_modules/testeranto/src/Project.tsx",
|
|
26
|
+
// ],
|
|
27
|
+
// bundle: true,
|
|
28
|
+
// format: "iife",
|
|
29
|
+
// platform: "browser",
|
|
30
|
+
// outdir: "./testeranto",
|
|
31
|
+
// define: {
|
|
32
|
+
// REPORT_ROOT: "localhost:8765",
|
|
33
|
+
// },
|
|
34
|
+
// })
|
|
35
|
+
// .then(async (ctx) => {
|
|
36
|
+
// await ctx.watch();
|
|
37
|
+
// let { host, port } = await ctx.serve({
|
|
38
|
+
// servedir: ".",
|
|
39
|
+
// });
|
|
40
|
+
// });
|
|
41
|
+
// process.chdir("../"); // Navigate one level up
|
|
42
|
+
const fileServer = new staticServer.Server("./testeranto", {});
|
|
6
43
|
http
|
|
7
44
|
.createServer(function (request, response) {
|
|
8
45
|
request
|
package/dist/module/src/build.js
CHANGED
|
@@ -19,6 +19,7 @@ if (mode !== "once" && mode !== "dev") {
|
|
|
19
19
|
}
|
|
20
20
|
console.log("testeranto is building", testName, mode);
|
|
21
21
|
import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
22
|
+
const pckge = (await import(`${process.cwd()}/package.json`)).default;
|
|
22
23
|
const bigConfig = module.default;
|
|
23
24
|
const project = bigConfig.projects[testName];
|
|
24
25
|
if (!project) {
|
|
@@ -92,12 +93,12 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
|
92
93
|
<head>
|
|
93
94
|
<meta name="description" content="Webpage description goes here" />
|
|
94
95
|
<meta charset="utf-8" />
|
|
95
|
-
<title
|
|
96
|
+
<title>${pckge.name} - testeranto</title>
|
|
96
97
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
97
98
|
<meta name="author" content="" />
|
|
98
99
|
|
|
99
|
-
<link rel="stylesheet" href="
|
|
100
|
-
<script type="module" src="
|
|
100
|
+
<link rel="stylesheet" href="../ReportClient.css" />
|
|
101
|
+
<script type="module" src="../ReportClient.js"></script>
|
|
101
102
|
|
|
102
103
|
</head>
|
|
103
104
|
|
|
@@ -117,7 +118,7 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
|
117
118
|
<head>
|
|
118
119
|
<meta name="description" content="Webpage description goes here" />
|
|
119
120
|
<meta charset="utf-8" />
|
|
120
|
-
<title
|
|
121
|
+
<title>${pckge.name} - testeranto</title>
|
|
121
122
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
122
123
|
<meta name="author" content="" />
|
|
123
124
|
|
|
@@ -125,8 +126,8 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
|
125
126
|
${JSON.stringify(Object.keys(bigConfig.projects))}
|
|
126
127
|
</script>
|
|
127
128
|
|
|
128
|
-
<link rel="stylesheet" href="
|
|
129
|
-
<script type="module" src="
|
|
129
|
+
<link rel="stylesheet" href="Project.css" />
|
|
130
|
+
<script type="module" src="Project.js"></script>
|
|
130
131
|
|
|
131
132
|
</head>
|
|
132
133
|
|
|
@@ -159,6 +160,40 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
|
|
|
159
160
|
// fs.unlinkSync(chunk);
|
|
160
161
|
// });
|
|
161
162
|
// });
|
|
163
|
+
const x = [
|
|
164
|
+
["pure", Object.keys(importEntryPoints)],
|
|
165
|
+
["node", Object.keys(nodeEntryPoints)],
|
|
166
|
+
["web", Object.keys(webEntryPoints)],
|
|
167
|
+
];
|
|
168
|
+
x.forEach(async ([runtime, keys]) => {
|
|
169
|
+
keys.forEach(async (k) => {
|
|
170
|
+
const folder = `testeranto/reports/${testName}/${k
|
|
171
|
+
.split(".")
|
|
172
|
+
.slice(0, -1)
|
|
173
|
+
.join(".")}/${runtime}`;
|
|
174
|
+
await fs.mkdirSync(folder, { recursive: true });
|
|
175
|
+
fs.writeFileSync(`${folder}/index.html`, `
|
|
176
|
+
<!DOCTYPE html>
|
|
177
|
+
<html lang="en">
|
|
178
|
+
|
|
179
|
+
<head>
|
|
180
|
+
<meta name="description" content="Webpage description goes here" />
|
|
181
|
+
<meta charset="utf-8" />
|
|
182
|
+
<title>${testName} - testeranto</title>
|
|
183
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
184
|
+
<meta name="author" content="" />
|
|
185
|
+
|
|
186
|
+
<link rel="stylesheet" href="../../../../../TestReport.css" />
|
|
187
|
+
<script src="../../../../../TestReport.js"></script>
|
|
188
|
+
|
|
189
|
+
</head>
|
|
190
|
+
|
|
191
|
+
<body>
|
|
192
|
+
<div id="root"/>
|
|
193
|
+
</body>
|
|
194
|
+
`);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
162
197
|
await Promise.all([
|
|
163
198
|
...[
|
|
164
199
|
[esbuildImportConfiger, importEntryPoints, onImportDone],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { afterAllProxy, afterEachProxy, andWhenProxy, beforeAllProxy, beforeEachProxy, butThenProxy, } from "./pmProxy.js";
|
|
1
2
|
export class BaseSuite {
|
|
2
3
|
constructor(name, index, givens = {}, checks = []) {
|
|
3
4
|
this.name = name;
|
|
@@ -43,22 +44,8 @@ export class BaseSuite {
|
|
|
43
44
|
// console.log("\nSuite:", this.index, this.name);
|
|
44
45
|
tLog("\nSuite:", this.index, this.name);
|
|
45
46
|
const sNdx = this.index;
|
|
46
|
-
const sName = this.name;
|
|
47
|
-
const
|
|
48
|
-
get(target, prop, receiver) {
|
|
49
|
-
if (prop === "customScreenShot") {
|
|
50
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), {
|
|
51
|
-
// path: `${filepath}/${opts.path}`,
|
|
52
|
-
path: `suite-${sNdx}/beforeAll/${opts.path}` }), p);
|
|
53
|
-
}
|
|
54
|
-
if (prop === "writeFileSync") {
|
|
55
|
-
return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
56
|
-
}
|
|
57
|
-
/* @ts-ignore:next-line */
|
|
58
|
-
return Reflect.get(...arguments);
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
|
|
47
|
+
// const sName = this.name;
|
|
48
|
+
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy(pm, sNdx.toString()));
|
|
62
49
|
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
63
50
|
const giver = this.givens[gKey];
|
|
64
51
|
try {
|
|
@@ -76,9 +63,7 @@ export class BaseSuite {
|
|
|
76
63
|
await thater.check(subject, thater.name, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm);
|
|
77
64
|
}
|
|
78
65
|
try {
|
|
79
|
-
this.afterAll(this.store, artifactory,
|
|
80
|
-
// afterAllProxy
|
|
81
|
-
pm);
|
|
66
|
+
this.afterAll(this.store, artifactory, afterAllProxy(pm, sNdx.toString()));
|
|
82
67
|
}
|
|
83
68
|
catch (e) {
|
|
84
69
|
console.error(e);
|
|
@@ -131,30 +116,16 @@ export class BaseGiven {
|
|
|
131
116
|
tLog(`\n ${this.key}`);
|
|
132
117
|
tLog(`\n Given: ${this.name}`);
|
|
133
118
|
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
134
|
-
const beforeEachProxy = new Proxy(pm, {
|
|
135
|
-
get(target, prop, receiver) {
|
|
136
|
-
if (prop === "writeFileSync") {
|
|
137
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
|
|
138
|
-
}
|
|
139
|
-
if (prop === "customScreenShot") {
|
|
140
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
141
|
-
}
|
|
142
|
-
if (prop === "screencast") {
|
|
143
|
-
return (opts, p) => target.screencast(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
144
|
-
}
|
|
145
|
-
/* @ts-ignore:next-line */
|
|
146
|
-
return Reflect.get(...arguments);
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
119
|
this.uberCatcher((e) => {
|
|
150
120
|
console.error(e);
|
|
151
121
|
this.error = e.error;
|
|
152
122
|
tLog(e.stack);
|
|
153
123
|
});
|
|
154
124
|
try {
|
|
155
|
-
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, beforeEachProxy);
|
|
125
|
+
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, beforeEachProxy(pm, suiteNdx.toString()));
|
|
156
126
|
}
|
|
157
127
|
catch (e) {
|
|
128
|
+
console.error("failure 4 ", e);
|
|
158
129
|
this.error = e;
|
|
159
130
|
throw e;
|
|
160
131
|
}
|
|
@@ -165,37 +136,25 @@ export class BaseGiven {
|
|
|
165
136
|
}
|
|
166
137
|
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
167
138
|
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
|
|
168
|
-
tester(t);
|
|
139
|
+
return tester(t);
|
|
140
|
+
// ((t) => {
|
|
141
|
+
// return tester(t);
|
|
142
|
+
// })();
|
|
169
143
|
}
|
|
170
144
|
}
|
|
171
145
|
catch (e) {
|
|
172
|
-
// this.error = e;
|
|
173
146
|
this.failed = true;
|
|
174
147
|
tLog(e.stack);
|
|
175
148
|
throw e;
|
|
176
149
|
}
|
|
177
150
|
finally {
|
|
178
151
|
try {
|
|
179
|
-
|
|
180
|
-
get(target, prop, receiver) {
|
|
181
|
-
if (prop === "customScreenShot") {
|
|
182
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/afterEach/${opts.path}` }), p);
|
|
183
|
-
}
|
|
184
|
-
if (prop === "writeFileSync") {
|
|
185
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterEach/${fp}`, contents);
|
|
186
|
-
}
|
|
187
|
-
/* @ts-ignore:next-line */
|
|
188
|
-
return Reflect.get(...arguments);
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
await this.afterEach(this.store, this.key, givenArtifactory,
|
|
192
|
-
// pm
|
|
193
|
-
afterEachProxy);
|
|
152
|
+
await this.afterEach(this.store, this.key, givenArtifactory, afterEachProxy(pm, suiteNdx.toString(), key));
|
|
194
153
|
}
|
|
195
154
|
catch (e) {
|
|
155
|
+
console.error("afterEach failed!", e);
|
|
196
156
|
this.failed = e;
|
|
197
157
|
throw e;
|
|
198
|
-
// console.error("afterEach failed!", e);
|
|
199
158
|
// this.error = e.message;
|
|
200
159
|
}
|
|
201
160
|
}
|
|
@@ -215,33 +174,10 @@ export class BaseWhen {
|
|
|
215
174
|
}
|
|
216
175
|
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
217
176
|
tLog(" When:", this.name);
|
|
218
|
-
|
|
219
|
-
get(target, prop, receiver) {
|
|
220
|
-
if (prop === "customScreenShot") {
|
|
221
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
222
|
-
}
|
|
223
|
-
if (prop === "writeFileSync") {
|
|
224
|
-
return (fp, contents) => target[prop](`${filepath}/andWhen/${fp}`, contents);
|
|
225
|
-
}
|
|
226
|
-
/* @ts-ignore:next-line */
|
|
227
|
-
return Reflect.get(...arguments);
|
|
228
|
-
},
|
|
229
|
-
});
|
|
230
|
-
return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy).catch((e) => {
|
|
177
|
+
return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy(pm, filepath)).catch((e) => {
|
|
231
178
|
this.error = true;
|
|
232
179
|
// throw e;
|
|
233
180
|
});
|
|
234
|
-
// try {
|
|
235
|
-
// return await this.andWhen(
|
|
236
|
-
// store,
|
|
237
|
-
// this.whenCB,
|
|
238
|
-
// testResourceConfiguration,
|
|
239
|
-
// andWhenProxy
|
|
240
|
-
// );
|
|
241
|
-
// } catch (e) {
|
|
242
|
-
// this.error = true;
|
|
243
|
-
// throw e;
|
|
244
|
-
// }
|
|
245
181
|
}
|
|
246
182
|
}
|
|
247
183
|
export class BaseThen {
|
|
@@ -257,40 +193,19 @@ export class BaseThen {
|
|
|
257
193
|
};
|
|
258
194
|
}
|
|
259
195
|
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
260
|
-
this.
|
|
196
|
+
return this.butThen(store, async (s) => {
|
|
261
197
|
tLog(" Then!!!:", this.name);
|
|
262
|
-
|
|
263
|
-
await this.thenCB(s);
|
|
198
|
+
if (typeof this.thenCB === "function") {
|
|
199
|
+
return await this.thenCB(s);
|
|
264
200
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.error = e;
|
|
268
|
-
throw e;
|
|
201
|
+
else {
|
|
202
|
+
return this.thenCB;
|
|
269
203
|
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
const butThenProxy = new Proxy(pm, {
|
|
273
|
-
get(target, prop, receiver) {
|
|
274
|
-
if (prop === "customScreenShot") {
|
|
275
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
276
|
-
}
|
|
277
|
-
if (prop === "writeFileSync") {
|
|
278
|
-
return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
|
|
279
|
-
}
|
|
280
|
-
/* @ts-ignore:next-line */
|
|
281
|
-
return Reflect.get(...arguments);
|
|
282
|
-
},
|
|
283
|
-
});
|
|
284
|
-
return this.butThen(store, this.go, testResourceConfiguration, butThenProxy).catch((e) => {
|
|
285
|
-
this.error = e;
|
|
286
|
-
throw e;
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
catch (e) {
|
|
290
|
-
console.log("test failed 2", e);
|
|
204
|
+
}, testResourceConfiguration, butThenProxy(pm, filepath)).catch((e) => {
|
|
205
|
+
console.log("test failed 3", e);
|
|
291
206
|
this.error = e;
|
|
292
207
|
throw e;
|
|
293
|
-
}
|
|
208
|
+
});
|
|
294
209
|
}
|
|
295
210
|
check() { }
|
|
296
211
|
}
|
|
@@ -305,7 +220,7 @@ export class BaseCheck {
|
|
|
305
220
|
return {
|
|
306
221
|
key: this.key,
|
|
307
222
|
name: this.name,
|
|
308
|
-
functionAsString: this.checkCB.toString(),
|
|
223
|
+
// functionAsString: this.checkCB.toString(),
|
|
309
224
|
features: this.features,
|
|
310
225
|
};
|
|
311
226
|
}
|