testeranto 0.125.3 → 0.128.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/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 +75 -20
- 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 +75 -20
- 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 +82 -18
- 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 +112 -23
- 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/common/src/Node.js
CHANGED
|
@@ -26,7 +26,12 @@ class NodeTesteranto extends core_js_1.default {
|
|
|
26
26
|
exports.NodeTesteranto = NodeTesteranto;
|
|
27
27
|
const testeranto = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
|
|
28
28
|
const t = new NodeTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
|
|
29
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
30
|
+
console.error("Unhandled Rejection at:", promise, "reason:", reason);
|
|
31
|
+
// Optionally, terminate the process or perform cleanup
|
|
32
|
+
});
|
|
29
33
|
try {
|
|
34
|
+
console.log(process.argv);
|
|
30
35
|
const f = await t.receiveTestResourceConfig(process.argv[2]);
|
|
31
36
|
console.error("goodbye node error", f.fails);
|
|
32
37
|
process.exit(f.fails);
|
|
@@ -129,7 +129,13 @@ class PM_Base {
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
async createWriteStream(filepath, testName) {
|
|
132
|
+
const folder = filepath.split("/").slice(0, -1).join("/");
|
|
132
133
|
return new Promise((res) => {
|
|
134
|
+
if (!fs_1.default.existsSync(folder)) {
|
|
135
|
+
return fs_1.default.mkdirSync(folder, {
|
|
136
|
+
recursive: true,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
133
139
|
const f = fs_1.default.createWriteStream(filepath);
|
|
134
140
|
fileStreams3.push(f);
|
|
135
141
|
if (!files[testName]) {
|
|
@@ -135,7 +135,6 @@ class PM_Main extends base_js_1.PM_Base {
|
|
|
135
135
|
basePath: process.cwd(), // always required, used for relative paths
|
|
136
136
|
configFilePath: "tsconfig.json", // config to inherit from (optional)
|
|
137
137
|
compilerOptions: {
|
|
138
|
-
rootDir: "src",
|
|
139
138
|
outDir: (0, utils_1.tscPather)(entrypoint, platform, this.name),
|
|
140
139
|
// declaration: true,
|
|
141
140
|
// skipLibCheck: true,
|
|
@@ -345,24 +344,40 @@ ${addableFiles
|
|
|
345
344
|
// }
|
|
346
345
|
// })
|
|
347
346
|
// );
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
.
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
347
|
+
try {
|
|
348
|
+
await Promise.resolve(`${`${builtfile}?cacheBust=${Date.now()}`}`).then(s => __importStar(require(s))).then((module) => {
|
|
349
|
+
return module.default
|
|
350
|
+
.then((defaultModule) => {
|
|
351
|
+
defaultModule
|
|
352
|
+
.receiveTestResourceConfig(argz)
|
|
353
|
+
.then(async (results) => {
|
|
354
|
+
this.receiveFeatures(results.features, destFolder, src, "pure");
|
|
355
|
+
statusMessagePretty(results.fails, src);
|
|
356
|
+
this.bddTestIsNowDone(src, results.fails);
|
|
357
|
+
})
|
|
358
|
+
.catch((e) => {
|
|
359
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e}`)));
|
|
360
|
+
this.bddTestIsNowDone(src, -1);
|
|
361
|
+
})
|
|
362
|
+
.finally(() => {
|
|
363
|
+
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
364
|
+
});
|
|
356
365
|
})
|
|
357
366
|
.catch((e) => {
|
|
358
|
-
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e}`)));
|
|
367
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e}. Check ${reportDest}/error.txt for more info`)));
|
|
368
|
+
this.writeFileSync(`${reportDest}/error.txt`, e.stack, src);
|
|
359
369
|
this.bddTestIsNowDone(src, -1);
|
|
360
|
-
|
|
361
|
-
.
|
|
362
|
-
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
370
|
+
statusMessagePretty(-1, src);
|
|
371
|
+
// console.error(e);
|
|
363
372
|
});
|
|
364
373
|
});
|
|
365
|
-
}
|
|
374
|
+
}
|
|
375
|
+
catch (e) {
|
|
376
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e}. Check ${reportDest}/error.txt for more info`)));
|
|
377
|
+
this.writeFileSync(`${reportDest}/error.txt`, e.stack, src);
|
|
378
|
+
this.bddTestIsNowDone(src, -1);
|
|
379
|
+
statusMessagePretty(-1, src);
|
|
380
|
+
}
|
|
366
381
|
// console.log("portsToUse", portsToUse);
|
|
367
382
|
for (let i = 0; i <= portsToUse.length; i++) {
|
|
368
383
|
if (portsToUse[i]) {
|
|
@@ -386,7 +401,7 @@ ${addableFiles
|
|
|
386
401
|
return t[0] === src;
|
|
387
402
|
});
|
|
388
403
|
if (!testConfig) {
|
|
389
|
-
console.log(ansi_colors_1.default.inverse(
|
|
404
|
+
console.log(ansi_colors_1.default.inverse(`missing test config! Exiting ungracefully for '${src}'`));
|
|
390
405
|
process.exit(-1);
|
|
391
406
|
}
|
|
392
407
|
const testConfigResource = testConfig[2];
|
|
@@ -488,11 +503,34 @@ ${addableFiles
|
|
|
488
503
|
});
|
|
489
504
|
});
|
|
490
505
|
const oStream = fs_1.default.createWriteStream(`${reportDest}/console_log.txt`);
|
|
491
|
-
const child = (0, node_child_process_1.spawn)("node", [builtfile, testResources], {
|
|
506
|
+
const child = (0, node_child_process_1.spawn)("node", [builtfile, testResources, "--trace-warnings"], {
|
|
492
507
|
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
493
508
|
// silent: true
|
|
494
509
|
});
|
|
510
|
+
// const child = spawn(
|
|
511
|
+
// "node",
|
|
512
|
+
// ["inspect", builtfile, testResources, "--trace-warnings"],
|
|
513
|
+
// {
|
|
514
|
+
// stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
515
|
+
// env: {
|
|
516
|
+
// // NODE_INSPECT_RESUME_ON_START: "1",
|
|
517
|
+
// },
|
|
518
|
+
// // silent: true
|
|
519
|
+
// }
|
|
520
|
+
// );
|
|
521
|
+
// console.log(
|
|
522
|
+
// "spawning",
|
|
523
|
+
// "node",
|
|
524
|
+
// ["inspect", builtfile, testResources, "--trace-warnings"],
|
|
525
|
+
// {
|
|
526
|
+
// NODE_INSPECT_RESUME_ON_START: "1",
|
|
527
|
+
// }
|
|
528
|
+
// );
|
|
495
529
|
const p = destFolder + "/pipe";
|
|
530
|
+
const errFile = `${reportDest}/error.txt`;
|
|
531
|
+
if (fs_1.default.existsSync(errFile)) {
|
|
532
|
+
fs_1.default.rmSync(errFile);
|
|
533
|
+
}
|
|
496
534
|
server.listen(p, () => {
|
|
497
535
|
var _a, _b;
|
|
498
536
|
(_a = child.stderr) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
@@ -516,9 +554,26 @@ ${addableFiles
|
|
|
516
554
|
this.bddTestIsNowDone(src, code);
|
|
517
555
|
statusMessagePretty(code, src);
|
|
518
556
|
}
|
|
519
|
-
|
|
557
|
+
if (fs_1.default.existsSync(p)) {
|
|
558
|
+
fs_1.default.rmSync(p);
|
|
559
|
+
}
|
|
560
|
+
haltReturns = true;
|
|
561
|
+
});
|
|
562
|
+
child.on("exit", (code) => {
|
|
563
|
+
haltReturns = true;
|
|
564
|
+
});
|
|
565
|
+
child.on("error", (e) => {
|
|
566
|
+
haltReturns = true;
|
|
567
|
+
if (fs_1.default.existsSync(p)) {
|
|
568
|
+
fs_1.default.rmSync(p);
|
|
569
|
+
}
|
|
570
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`${src} errored with: ${e.name}. Check ${errFile}for more info`)));
|
|
571
|
+
this.writeFileSync(`${reportDest}/error.txt`, e.toString(), src);
|
|
572
|
+
this.bddTestIsNowDone(src, -1);
|
|
573
|
+
statusMessagePretty(-1, src);
|
|
574
|
+
// this.bddTestIsNowDone(src, -1);
|
|
575
|
+
// statusMessagePretty(-1, src);
|
|
520
576
|
});
|
|
521
|
-
child.on("exit", (code) => { });
|
|
522
577
|
});
|
|
523
578
|
child.send({ path: p });
|
|
524
579
|
for (let i = 0; i <= portsToUse.length; i++) {
|
|
@@ -960,7 +1015,7 @@ ${addableFiles
|
|
|
960
1015
|
const hash = await fileHash(outputFile);
|
|
961
1016
|
if (fileHashes[k] !== hash) {
|
|
962
1017
|
fileHashes[k] = hash;
|
|
963
|
-
console.log(ansi_colors_1.default.
|
|
1018
|
+
console.log(ansi_colors_1.default.yellow(ansi_colors_1.default.inverse(`< ${e} ${filename}`)));
|
|
964
1019
|
launcher(k, outputFile);
|
|
965
1020
|
}
|
|
966
1021
|
});
|
|
@@ -971,7 +1026,7 @@ ${addableFiles
|
|
|
971
1026
|
});
|
|
972
1027
|
this.metafileOutputs(runtime);
|
|
973
1028
|
watcher((0, fs_1.watch)(metafile, async (e, filename) => {
|
|
974
|
-
console.log(ansi_colors_1.default.
|
|
1029
|
+
console.log(ansi_colors_1.default.yellow(ansi_colors_1.default.inverse(`< ${e} ${filename} (${runtime})`)));
|
|
975
1030
|
this.metafileOutputs(runtime);
|
|
976
1031
|
}));
|
|
977
1032
|
});
|
|
@@ -36,7 +36,7 @@ class PM_Web {
|
|
|
36
36
|
return window["isDisabled"](selector);
|
|
37
37
|
}
|
|
38
38
|
getAttribute(selector, attribute) {
|
|
39
|
-
return window["
|
|
39
|
+
return window["getAttribute"](selector, attribute);
|
|
40
40
|
}
|
|
41
41
|
getValue(selector) {
|
|
42
42
|
return window["getValue"](selector);
|
|
@@ -5,9 +5,46 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const node_static_1 = __importDefault(require("node-static"));
|
|
7
7
|
const http_1 = __importDefault(require("http"));
|
|
8
|
+
// import esbuild from "esbuild";
|
|
8
9
|
const main = async () => {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
// esbuild
|
|
11
|
+
// .context(configer(config, Object.keys(entryPoints), testName))
|
|
12
|
+
// .then(async (ctx) => {
|
|
13
|
+
// if (mode === "dev") {
|
|
14
|
+
// await ctx.watch().then((v) => {
|
|
15
|
+
// done();
|
|
16
|
+
// });
|
|
17
|
+
// } else {
|
|
18
|
+
// ctx.rebuild().then((v) => {
|
|
19
|
+
// done();
|
|
20
|
+
// });
|
|
21
|
+
// }
|
|
22
|
+
// return ctx;
|
|
23
|
+
// });
|
|
24
|
+
// }),
|
|
25
|
+
// await esbuild
|
|
26
|
+
// .context({
|
|
27
|
+
// entryPoints: [
|
|
28
|
+
// "node_modules/testeranto/src/ReportClient.tsx",
|
|
29
|
+
// "node_modules/testeranto/src/TestReport.tsx",
|
|
30
|
+
// "node_modules/testeranto/src/Project.tsx",
|
|
31
|
+
// ],
|
|
32
|
+
// bundle: true,
|
|
33
|
+
// format: "iife",
|
|
34
|
+
// platform: "browser",
|
|
35
|
+
// outdir: "./testeranto",
|
|
36
|
+
// define: {
|
|
37
|
+
// REPORT_ROOT: "localhost:8765",
|
|
38
|
+
// },
|
|
39
|
+
// })
|
|
40
|
+
// .then(async (ctx) => {
|
|
41
|
+
// await ctx.watch();
|
|
42
|
+
// let { host, port } = await ctx.serve({
|
|
43
|
+
// servedir: ".",
|
|
44
|
+
// });
|
|
45
|
+
// });
|
|
46
|
+
// process.chdir("../"); // Navigate one level up
|
|
47
|
+
const fileServer = new node_static_1.default.Server("./testeranto", {});
|
|
11
48
|
http_1.default
|
|
12
49
|
.createServer(function (request, response) {
|
|
13
50
|
request
|
package/dist/common/src/build.js
CHANGED
|
@@ -57,6 +57,7 @@ if (mode !== "once" && mode !== "dev") {
|
|
|
57
57
|
}
|
|
58
58
|
console.log("testeranto is building", testName, mode);
|
|
59
59
|
Promise.resolve(`${process.cwd() + "/" + "testeranto.config.ts"}`).then(s => __importStar(require(s))).then(async (module) => {
|
|
60
|
+
const pckge = (await Promise.resolve(`${`${process.cwd()}/package.json`}`).then(s => __importStar(require(s)))).default;
|
|
60
61
|
const bigConfig = module.default;
|
|
61
62
|
const project = bigConfig.projects[testName];
|
|
62
63
|
if (!project) {
|
|
@@ -130,12 +131,12 @@ Promise.resolve(`${process.cwd() + "/" + "testeranto.config.ts"}`).then(s => __i
|
|
|
130
131
|
<head>
|
|
131
132
|
<meta name="description" content="Webpage description goes here" />
|
|
132
133
|
<meta charset="utf-8" />
|
|
133
|
-
<title
|
|
134
|
+
<title>${pckge.name} - testeranto</title>
|
|
134
135
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
135
136
|
<meta name="author" content="" />
|
|
136
137
|
|
|
137
|
-
<link rel="stylesheet" href="
|
|
138
|
-
<script type="module" src="
|
|
138
|
+
<link rel="stylesheet" href="../ReportClient.css" />
|
|
139
|
+
<script type="module" src="../ReportClient.js"></script>
|
|
139
140
|
|
|
140
141
|
</head>
|
|
141
142
|
|
|
@@ -155,7 +156,7 @@ Promise.resolve(`${process.cwd() + "/" + "testeranto.config.ts"}`).then(s => __i
|
|
|
155
156
|
<head>
|
|
156
157
|
<meta name="description" content="Webpage description goes here" />
|
|
157
158
|
<meta charset="utf-8" />
|
|
158
|
-
<title
|
|
159
|
+
<title>${pckge.name} - testeranto</title>
|
|
159
160
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
160
161
|
<meta name="author" content="" />
|
|
161
162
|
|
|
@@ -163,8 +164,8 @@ Promise.resolve(`${process.cwd() + "/" + "testeranto.config.ts"}`).then(s => __i
|
|
|
163
164
|
${JSON.stringify(Object.keys(bigConfig.projects))}
|
|
164
165
|
</script>
|
|
165
166
|
|
|
166
|
-
<link rel="stylesheet" href="
|
|
167
|
-
<script type="module" src="
|
|
167
|
+
<link rel="stylesheet" href="Project.css" />
|
|
168
|
+
<script type="module" src="Project.js"></script>
|
|
168
169
|
|
|
169
170
|
</head>
|
|
170
171
|
|
|
@@ -197,6 +198,40 @@ Promise.resolve(`${process.cwd() + "/" + "testeranto.config.ts"}`).then(s => __i
|
|
|
197
198
|
// fs.unlinkSync(chunk);
|
|
198
199
|
// });
|
|
199
200
|
// });
|
|
201
|
+
const x = [
|
|
202
|
+
["pure", Object.keys(importEntryPoints)],
|
|
203
|
+
["node", Object.keys(nodeEntryPoints)],
|
|
204
|
+
["web", Object.keys(webEntryPoints)],
|
|
205
|
+
];
|
|
206
|
+
x.forEach(async ([runtime, keys]) => {
|
|
207
|
+
keys.forEach(async (k) => {
|
|
208
|
+
const folder = `testeranto/reports/${testName}/${k
|
|
209
|
+
.split(".")
|
|
210
|
+
.slice(0, -1)
|
|
211
|
+
.join(".")}/${runtime}`;
|
|
212
|
+
await fs_1.default.mkdirSync(folder, { recursive: true });
|
|
213
|
+
fs_1.default.writeFileSync(`${folder}/index.html`, `
|
|
214
|
+
<!DOCTYPE html>
|
|
215
|
+
<html lang="en">
|
|
216
|
+
|
|
217
|
+
<head>
|
|
218
|
+
<meta name="description" content="Webpage description goes here" />
|
|
219
|
+
<meta charset="utf-8" />
|
|
220
|
+
<title>${testName} - testeranto</title>
|
|
221
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
222
|
+
<meta name="author" content="" />
|
|
223
|
+
|
|
224
|
+
<link rel="stylesheet" href="../../../../../TestReport.css" />
|
|
225
|
+
<script src="../../../../../TestReport.js"></script>
|
|
226
|
+
|
|
227
|
+
</head>
|
|
228
|
+
|
|
229
|
+
<body>
|
|
230
|
+
<div id="root"/>
|
|
231
|
+
</body>
|
|
232
|
+
`);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
200
235
|
await Promise.all([
|
|
201
236
|
...[
|
|
202
237
|
[pure_js_1.default, importEntryPoints, onImportDone],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseCheck = exports.BaseThen = exports.BaseWhen = exports.BaseGiven = exports.BaseSuite = void 0;
|
|
4
|
+
const pmProxy_js_1 = require("./pmProxy.js");
|
|
4
5
|
class BaseSuite {
|
|
5
6
|
constructor(name, index, givens = {}, checks = []) {
|
|
6
7
|
this.name = name;
|
|
@@ -46,22 +47,8 @@ class BaseSuite {
|
|
|
46
47
|
// console.log("\nSuite:", this.index, this.name);
|
|
47
48
|
tLog("\nSuite:", this.index, this.name);
|
|
48
49
|
const sNdx = this.index;
|
|
49
|
-
const sName = this.name;
|
|
50
|
-
const
|
|
51
|
-
get(target, prop, receiver) {
|
|
52
|
-
if (prop === "customScreenShot") {
|
|
53
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), {
|
|
54
|
-
// path: `${filepath}/${opts.path}`,
|
|
55
|
-
path: `suite-${sNdx}/beforeAll/${opts.path}` }), p);
|
|
56
|
-
}
|
|
57
|
-
if (prop === "writeFileSync") {
|
|
58
|
-
return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
|
|
59
|
-
}
|
|
60
|
-
/* @ts-ignore:next-line */
|
|
61
|
-
return Reflect.get(...arguments);
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
|
|
50
|
+
// const sName = this.name;
|
|
51
|
+
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, (0, pmProxy_js_1.beforeAllProxy)(pm, sNdx.toString()));
|
|
65
52
|
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
66
53
|
const giver = this.givens[gKey];
|
|
67
54
|
try {
|
|
@@ -79,9 +66,7 @@ class BaseSuite {
|
|
|
79
66
|
await thater.check(subject, thater.name, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm);
|
|
80
67
|
}
|
|
81
68
|
try {
|
|
82
|
-
this.afterAll(this.store, artifactory,
|
|
83
|
-
// afterAllProxy
|
|
84
|
-
pm);
|
|
69
|
+
this.afterAll(this.store, artifactory, (0, pmProxy_js_1.afterAllProxy)(pm, sNdx.toString()));
|
|
85
70
|
}
|
|
86
71
|
catch (e) {
|
|
87
72
|
console.error(e);
|
|
@@ -135,30 +120,16 @@ class BaseGiven {
|
|
|
135
120
|
tLog(`\n ${this.key}`);
|
|
136
121
|
tLog(`\n Given: ${this.name}`);
|
|
137
122
|
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
138
|
-
const beforeEachProxy = new Proxy(pm, {
|
|
139
|
-
get(target, prop, receiver) {
|
|
140
|
-
if (prop === "writeFileSync") {
|
|
141
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
|
|
142
|
-
}
|
|
143
|
-
if (prop === "customScreenShot") {
|
|
144
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
145
|
-
}
|
|
146
|
-
if (prop === "screencast") {
|
|
147
|
-
return (opts, p) => target.screencast(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }), p);
|
|
148
|
-
}
|
|
149
|
-
/* @ts-ignore:next-line */
|
|
150
|
-
return Reflect.get(...arguments);
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
123
|
this.uberCatcher((e) => {
|
|
154
124
|
console.error(e);
|
|
155
125
|
this.error = e.error;
|
|
156
126
|
tLog(e.stack);
|
|
157
127
|
});
|
|
158
128
|
try {
|
|
159
|
-
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, beforeEachProxy);
|
|
129
|
+
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, (0, pmProxy_js_1.beforeEachProxy)(pm, suiteNdx.toString()));
|
|
160
130
|
}
|
|
161
131
|
catch (e) {
|
|
132
|
+
console.error("failure 4 ", e);
|
|
162
133
|
this.error = e;
|
|
163
134
|
throw e;
|
|
164
135
|
}
|
|
@@ -169,37 +140,25 @@ class BaseGiven {
|
|
|
169
140
|
}
|
|
170
141
|
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
171
142
|
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
|
|
172
|
-
tester(t);
|
|
143
|
+
return tester(t);
|
|
144
|
+
// ((t) => {
|
|
145
|
+
// return tester(t);
|
|
146
|
+
// })();
|
|
173
147
|
}
|
|
174
148
|
}
|
|
175
149
|
catch (e) {
|
|
176
|
-
// this.error = e;
|
|
177
150
|
this.failed = true;
|
|
178
151
|
tLog(e.stack);
|
|
179
152
|
throw e;
|
|
180
153
|
}
|
|
181
154
|
finally {
|
|
182
155
|
try {
|
|
183
|
-
|
|
184
|
-
get(target, prop, receiver) {
|
|
185
|
-
if (prop === "customScreenShot") {
|
|
186
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/afterEach/${opts.path}` }), p);
|
|
187
|
-
}
|
|
188
|
-
if (prop === "writeFileSync") {
|
|
189
|
-
return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterEach/${fp}`, contents);
|
|
190
|
-
}
|
|
191
|
-
/* @ts-ignore:next-line */
|
|
192
|
-
return Reflect.get(...arguments);
|
|
193
|
-
},
|
|
194
|
-
});
|
|
195
|
-
await this.afterEach(this.store, this.key, givenArtifactory,
|
|
196
|
-
// pm
|
|
197
|
-
afterEachProxy);
|
|
156
|
+
await this.afterEach(this.store, this.key, givenArtifactory, (0, pmProxy_js_1.afterEachProxy)(pm, suiteNdx.toString(), key));
|
|
198
157
|
}
|
|
199
158
|
catch (e) {
|
|
159
|
+
console.error("afterEach failed!", e);
|
|
200
160
|
this.failed = e;
|
|
201
161
|
throw e;
|
|
202
|
-
// console.error("afterEach failed!", e);
|
|
203
162
|
// this.error = e.message;
|
|
204
163
|
}
|
|
205
164
|
}
|
|
@@ -220,33 +179,10 @@ class BaseWhen {
|
|
|
220
179
|
}
|
|
221
180
|
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
222
181
|
tLog(" When:", this.name);
|
|
223
|
-
|
|
224
|
-
get(target, prop, receiver) {
|
|
225
|
-
if (prop === "customScreenShot") {
|
|
226
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
227
|
-
}
|
|
228
|
-
if (prop === "writeFileSync") {
|
|
229
|
-
return (fp, contents) => target[prop](`${filepath}/andWhen/${fp}`, contents);
|
|
230
|
-
}
|
|
231
|
-
/* @ts-ignore:next-line */
|
|
232
|
-
return Reflect.get(...arguments);
|
|
233
|
-
},
|
|
234
|
-
});
|
|
235
|
-
return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy).catch((e) => {
|
|
182
|
+
return await this.andWhen(store, this.whenCB, testResourceConfiguration, (0, pmProxy_js_1.andWhenProxy)(pm, filepath)).catch((e) => {
|
|
236
183
|
this.error = true;
|
|
237
184
|
// throw e;
|
|
238
185
|
});
|
|
239
|
-
// try {
|
|
240
|
-
// return await this.andWhen(
|
|
241
|
-
// store,
|
|
242
|
-
// this.whenCB,
|
|
243
|
-
// testResourceConfiguration,
|
|
244
|
-
// andWhenProxy
|
|
245
|
-
// );
|
|
246
|
-
// } catch (e) {
|
|
247
|
-
// this.error = true;
|
|
248
|
-
// throw e;
|
|
249
|
-
// }
|
|
250
186
|
}
|
|
251
187
|
}
|
|
252
188
|
exports.BaseWhen = BaseWhen;
|
|
@@ -263,40 +199,19 @@ class BaseThen {
|
|
|
263
199
|
};
|
|
264
200
|
}
|
|
265
201
|
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
266
|
-
this.
|
|
202
|
+
return this.butThen(store, async (s) => {
|
|
267
203
|
tLog(" Then!!!:", this.name);
|
|
268
|
-
|
|
269
|
-
await this.thenCB(s);
|
|
204
|
+
if (typeof this.thenCB === "function") {
|
|
205
|
+
return await this.thenCB(s);
|
|
270
206
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this.error = e;
|
|
274
|
-
throw e;
|
|
207
|
+
else {
|
|
208
|
+
return this.thenCB;
|
|
275
209
|
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
const butThenProxy = new Proxy(pm, {
|
|
279
|
-
get(target, prop, receiver) {
|
|
280
|
-
if (prop === "customScreenShot") {
|
|
281
|
-
return (opts, p) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `${filepath}/${opts.path}` }), p);
|
|
282
|
-
}
|
|
283
|
-
if (prop === "writeFileSync") {
|
|
284
|
-
return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
|
|
285
|
-
}
|
|
286
|
-
/* @ts-ignore:next-line */
|
|
287
|
-
return Reflect.get(...arguments);
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
return this.butThen(store, this.go, testResourceConfiguration, butThenProxy).catch((e) => {
|
|
291
|
-
this.error = e;
|
|
292
|
-
throw e;
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
catch (e) {
|
|
296
|
-
console.log("test failed 2", e);
|
|
210
|
+
}, testResourceConfiguration, (0, pmProxy_js_1.butThenProxy)(pm, filepath)).catch((e) => {
|
|
211
|
+
console.log("test failed 3", e);
|
|
297
212
|
this.error = e;
|
|
298
213
|
throw e;
|
|
299
|
-
}
|
|
214
|
+
});
|
|
300
215
|
}
|
|
301
216
|
check() { }
|
|
302
217
|
}
|
|
@@ -312,7 +227,7 @@ class BaseCheck {
|
|
|
312
227
|
return {
|
|
313
228
|
key: this.key,
|
|
314
229
|
name: this.name,
|
|
315
|
-
functionAsString: this.checkCB.toString(),
|
|
230
|
+
// functionAsString: this.checkCB.toString(),
|
|
316
231
|
features: this.features,
|
|
317
232
|
};
|
|
318
233
|
}
|
|
@@ -41,27 +41,26 @@ class BaseBuilder {
|
|
|
41
41
|
res(true);
|
|
42
42
|
});
|
|
43
43
|
const fails = suiteDone.fails;
|
|
44
|
-
|
|
45
|
-
await puppetMaster.writeFileSync(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
`);
|
|
44
|
+
await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
|
|
45
|
+
// await puppetMaster.writeFileSync(
|
|
46
|
+
// `index.html`,
|
|
47
|
+
// `
|
|
48
|
+
// <!DOCTYPE html>
|
|
49
|
+
// <html lang="en">
|
|
50
|
+
// <head>
|
|
51
|
+
// <meta name="description" content="Webpage description goes here" />
|
|
52
|
+
// <meta charset="utf-8" />
|
|
53
|
+
// <title>kokomoBay - testeranto</title>
|
|
54
|
+
// <meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
55
|
+
// <meta name="author" content="" />
|
|
56
|
+
// <link rel="stylesheet" href="/kokomoBay/testeranto/TestReport.css" />
|
|
57
|
+
// <script src="/kokomoBay/testeranto/TestReport.js"></script>
|
|
58
|
+
// </head>
|
|
59
|
+
// <body>
|
|
60
|
+
// <div id="root"/>
|
|
61
|
+
// </body>
|
|
62
|
+
// `
|
|
63
|
+
// );
|
|
65
64
|
await puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
|
|
66
65
|
return {
|
|
67
66
|
failed: fails > 0,
|
|
@@ -27,7 +27,18 @@ class ClassBuilder extends basebuilder_js_1.BaseBuilder {
|
|
|
27
27
|
}, {});
|
|
28
28
|
const classyThens = Object.entries(testImplementation.thens).reduce((a, [key, thEn]) => {
|
|
29
29
|
a[key] = (expected, x) => {
|
|
30
|
-
return new thenKlasser.prototype.constructor(`${thEn.name}: ${expected && expected.toString()}`,
|
|
30
|
+
return new thenKlasser.prototype.constructor(`${thEn.name}: ${expected && expected.toString()}`,
|
|
31
|
+
// () => {
|
|
32
|
+
// thEn(expected);
|
|
33
|
+
// // return new Promise((res), rej) => {
|
|
34
|
+
// // }
|
|
35
|
+
// // try {
|
|
36
|
+
// // thEn(expected);
|
|
37
|
+
// // } catch (c) {
|
|
38
|
+
// // console.log("mark99");
|
|
39
|
+
// // }
|
|
40
|
+
// },
|
|
41
|
+
thEn(expected));
|
|
31
42
|
};
|
|
32
43
|
return a;
|
|
33
44
|
}, {});
|
|
@@ -41,14 +41,7 @@ class Testeranto extends classBuilder_js_1.ClassBuilder {
|
|
|
41
41
|
}
|
|
42
42
|
}, class Then extends abstractBase_js_1.BaseThen {
|
|
43
43
|
async butThen(store, thenCB, testResource, pm) {
|
|
44
|
-
return await fullTestInterface
|
|
45
|
-
.butThen(store, thenCB, testResource, pm)
|
|
46
|
-
.then((v) => {
|
|
47
|
-
return v;
|
|
48
|
-
}, (e) => {
|
|
49
|
-
console.log(" ERROR ", e);
|
|
50
|
-
throw e;
|
|
51
|
-
});
|
|
44
|
+
return await fullTestInterface.butThen(store, thenCB, testResource, pm);
|
|
52
45
|
}
|
|
53
46
|
}, class Check extends abstractBase_js_1.BaseCheck {
|
|
54
47
|
constructor(name, features, checkCallback, x, i, c) {
|
|
@@ -9,13 +9,10 @@ exports.BaseTestInterface = {
|
|
|
9
9
|
afterEach: async (s) => s,
|
|
10
10
|
afterAll: (store) => undefined,
|
|
11
11
|
butThen: async (store, thenCb) => {
|
|
12
|
-
|
|
13
|
-
thenCb(store);
|
|
14
|
-
}
|
|
15
|
-
catch (e) { }
|
|
12
|
+
return thenCb(store);
|
|
16
13
|
},
|
|
17
14
|
andWhen: async (a) => a,
|
|
18
|
-
assertThis: () => null,
|
|
15
|
+
assertThis: (x) => null,
|
|
19
16
|
};
|
|
20
17
|
const DefaultTestInterface = (p) => {
|
|
21
18
|
return Object.assign(Object.assign({}, exports.BaseTestInterface), p);
|