testeranto 0.85.0 → 0.90.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.
Files changed (62) hide show
  1. package/README.md +1 -3
  2. package/bin/init-docs.js +24 -0
  3. package/bundle.js +53 -0
  4. package/dist/common/dist/module/src/Init.js +40 -0
  5. package/dist/common/src/Init.js +30 -0
  6. package/dist/common/src/PM/main.js +45 -9
  7. package/dist/common/src/Project.js +80 -0
  8. package/dist/common/src/Puppeteer.js +1 -1
  9. package/dist/common/{run-tests.js → src/build-tests.js} +10 -5
  10. package/dist/common/src/defaultConfig.js +19 -0
  11. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +27 -15
  12. package/dist/common/src/init-docs.js +43 -0
  13. package/dist/common/src/lib/abstractBase.js +0 -64
  14. package/dist/common/src/lib/core.js +5 -3
  15. package/dist/common/{build-tests.js → src/run-tests.js} +10 -9
  16. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  17. package/dist/module/src/Init.js +30 -0
  18. package/dist/module/src/PM/main.js +45 -9
  19. package/dist/module/src/Project.js +80 -0
  20. package/dist/module/src/Puppeteer.js +1 -1
  21. package/dist/module/src/build-tests.js +11 -0
  22. package/dist/module/src/defaultConfig.js +17 -0
  23. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +27 -15
  24. package/dist/module/src/init-docs.js +15 -0
  25. package/dist/module/src/lib/abstractBase.js +0 -64
  26. package/dist/module/src/lib/core.js +5 -3
  27. package/dist/module/src/run-tests.js +11 -0
  28. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  29. package/dist/prebuild/build-tests.mjs +552 -0
  30. package/dist/prebuild/init-docs.mjs +48 -0
  31. package/dist/prebuild/run-tests.mjs +907 -0
  32. package/dist/types/dist/module/src/Init.d.ts +2 -0
  33. package/dist/types/src/build-tests.d.ts +1 -0
  34. package/dist/types/src/defaultConfig.d.ts +3 -0
  35. package/dist/types/src/init-docs.d.ts +1 -0
  36. package/dist/types/src/run-tests.d.ts +1 -0
  37. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  38. package/package.json +9 -12
  39. package/src/Init.ts +28 -0
  40. package/src/PM/main.ts +58 -10
  41. package/src/Project.ts +102 -0
  42. package/src/Puppeteer.ts +1 -1
  43. package/src/build-tests.ts +12 -0
  44. package/src/defaultConfig.ts +20 -0
  45. package/src/esbuildConfigs/inputFilesPlugin.ts +48 -16
  46. package/src/init-docs.ts +19 -0
  47. package/src/lib/abstractBase.ts +0 -67
  48. package/src/lib/core.ts +3 -3
  49. package/src/run-tests.ts +12 -0
  50. package/tsconfig.json +1 -1
  51. package/build-tests.ts +0 -16
  52. package/dist/common/init-docs.js +0 -8
  53. package/dist/module/build-tests.js +0 -10
  54. package/dist/module/init-docs.js +0 -3
  55. package/dist/module/run-tests.js +0 -6
  56. package/dist/prebuild/Puppeteer.mjs +0 -82033
  57. package/dist/types/build-tests.d.ts +0 -3
  58. package/dist/types/init-docs.d.ts +0 -2
  59. package/dist/types/run-tests.d.ts +0 -2
  60. package/init-docs.ts +0 -5
  61. package/pupBuild.js +0 -18
  62. 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
- <div align="center">
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
 
@@ -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
+ };
@@ -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
  };
@@ -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 {
@@ -150,6 +150,7 @@ class PM_Main extends index_js_1.PM {
150
150
  fs: destFolder,
151
151
  browserWSEndpoint: this.browser.wsEndpoint(),
152
152
  });
153
+ // files[src] = new Set();
153
154
  // const evaluation = `
154
155
  // console.log("importing ${dest}.mjs");
155
156
  // import('${dest}.mjs').then(async (x) => {
@@ -213,9 +214,9 @@ class PM_Main extends index_js_1.PM {
213
214
  });
214
215
  page.exposeFunction("createWriteStream", (fp, testName) => {
215
216
  const f = fs_1.default.createWriteStream(fp);
216
- if (!files[testName]) {
217
- files[testName] = new Set();
218
- }
217
+ // if (!files[testName]) {
218
+ // files[testName] = new Set();
219
+ // }
219
220
  files[testName].add(fp);
220
221
  const p = new Promise((res, rej) => {
221
222
  res(fp);
@@ -347,6 +348,8 @@ class PM_Main extends index_js_1.PM {
347
348
  })`;
348
349
  const fileStreams2 = [];
349
350
  const doneFileStream2 = [];
351
+ const stdoutStream = fs_1.default.createWriteStream(`${dest}/stdout.log`);
352
+ const stderrStream = fs_1.default.createWriteStream(`${dest}/stderr.log`);
350
353
  this.browser
351
354
  .newPage()
352
355
  .then((page) => {
@@ -503,9 +506,39 @@ class PM_Main extends index_js_1.PM {
503
506
  return page;
504
507
  })
505
508
  .then(async (page) => {
506
- // page.on("console", (log) =>
507
- // console.debug(`Log from client: [${log.text()}] `)
508
- // );
509
+ const close = () => {
510
+ console.log("evaluation complete.", dest);
511
+ page.off("pageerror");
512
+ page.close();
513
+ this.deregister(t);
514
+ stderrStream.close();
515
+ stdoutStream.close();
516
+ };
517
+ page.on("pageerror", (err) => {
518
+ console.debug(`Error from ${t}: [${err.name}] `);
519
+ stderrStream.write(err.name);
520
+ if (err.cause) {
521
+ console.debug(`Error from ${t} cause: [${err.cause}] `);
522
+ stderrStream.write(err.cause);
523
+ }
524
+ if (err.stack) {
525
+ console.debug(`Error from stack ${t}: [${err.stack}] `);
526
+ stderrStream.write(err.stack);
527
+ }
528
+ console.debug(`Error from message ${t}: [${err.message}] `);
529
+ stderrStream.write(err.message);
530
+ // close();
531
+ });
532
+ page.on("console", (log) => {
533
+ // console.debug(`Log from ${t}: [${log.text()}] `);
534
+ // console.debug(`Log from ${t}: [${JSON.stringify(log.location())}] `);
535
+ // console.debug(
536
+ // `Log from ${t}: [${JSON.stringify(log.stackTrace())}] `
537
+ // );
538
+ stdoutStream.write(log.text());
539
+ stdoutStream.write(JSON.stringify(log.location()));
540
+ stdoutStream.write(JSON.stringify(log.stackTrace()));
541
+ });
509
542
  await page.goto(`file://${`${dest}.html`}`, {});
510
543
  await page
511
544
  .evaluate(evaluation)
@@ -517,9 +550,12 @@ class PM_Main extends index_js_1.PM {
517
550
  console.log(e);
518
551
  })
519
552
  .finally(() => {
520
- console.log("evaluation complete.", dest);
553
+ close();
554
+ // console.log("evaluation complete.", dest);
521
555
  // page.close();
522
- this.deregister(t);
556
+ // this.deregister(t);
557
+ // stderrStream.close();
558
+ // stdoutStream.close();
523
559
  });
524
560
  return page;
525
561
  });
@@ -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,84 @@ 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(`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
+ });
85
+ tsc.on("close", (code) => {
86
+ parseTsErrors();
87
+ resolve(`tsc process exited with code ${code}`);
88
+ // if (code !== 0) {
89
+ // resolve(`tsc process exited with code ${code}`);
90
+ // // reject(`tsc process exited with code ${code}`);
91
+ // } else {
92
+ // resolve({});
93
+ // }
94
+ });
95
+ });
96
+ };
18
97
  class ITProject {
19
98
  constructor(configs) {
20
99
  this.nodeDone = false;
@@ -58,6 +137,7 @@ class ITProject {
58
137
  }
59
138
  });
60
139
  fs_1.default.writeFileSync(`${this.config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, this.config), { buildDir: process.cwd() + "/" + this.config.outdir }), null, 2));
140
+ compile();
61
141
  Promise.resolve(Promise.all([...this.getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
62
142
  const sourceFileSplit = sourceFilePath.split("/");
63
143
  const sourceDir = sourceFileSplit.slice(0, -1);
@@ -21,7 +21,7 @@ exports.default = async (partialConfig) => {
21
21
  executablePath:
22
22
  // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
23
23
  "/opt/homebrew/bin/chromium",
24
- headless: true,
24
+ headless: false,
25
25
  dumpio: true,
26
26
  // timeout: 0,
27
27
  devtools: true,
@@ -27,8 +27,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const process_1 = __importDefault(require("process"));
30
- process_1.default.chdir(__dirname);
31
- const Puppeteer_js_1 = __importDefault(require("./src/Puppeteer.js"));
32
- console.log(process_1.default.argv);
33
- const Project = await Promise.resolve().then(() => __importStar(require(process_1.default.argv[2])));
34
- exports.default = (0, Puppeteer_js_1.default)(Project);
30
+ const Project_1 = require("./Project");
31
+ if (!process_1.default.argv[2]) {
32
+ console.log("You didn't pass a config file");
33
+ process_1.default.exit(-1);
34
+ }
35
+ else {
36
+ Promise.resolve().then(() => __importStar(require(process_1.default.cwd() + "/" + process_1.default.argv[2]))).then((module) => {
37
+ new Project_1.ITProject(module.default);
38
+ });
39
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config = {
4
+ outdir: "docs",
5
+ tests: [],
6
+ debugger: true,
7
+ clearScreen: false,
8
+ devMode: true,
9
+ minify: false,
10
+ outbase: ".",
11
+ ports: ["3001"],
12
+ externals: [],
13
+ nodePlugins: [],
14
+ webPlugins: [],
15
+ featureIngestor: function (s) {
16
+ throw new Error("Function not implemented.");
17
+ },
18
+ };
19
+ exports.default = config;
@@ -14,13 +14,15 @@ const register = (entrypoint, sources) => {
14
14
  sources.forEach((s) => otherInputs[entrypoint].add(s));
15
15
  };
16
16
  function tree(meta, key) {
17
- return [
18
- key,
19
- ...meta.inputs[key].imports
20
- .filter((x) => x.external !== true)
21
- .filter((x) => x.path.split("/")[0] !== "node_modules")
22
- .map((f) => f.path),
23
- ];
17
+ console.log("searching metafile for", key);
18
+ const outputKey = Object.keys(meta.outputs).find((k) => {
19
+ return meta.outputs[k].entryPoint === key;
20
+ });
21
+ if (!outputKey) {
22
+ console.error("No outputkey found");
23
+ process.exit(-1);
24
+ }
25
+ return Object.keys(meta.outputs[outputKey].inputs).filter((k) => k.startsWith("src"));
24
26
  }
25
27
  exports.default = (platform, entryPoints) => {
26
28
  return {
@@ -39,7 +41,9 @@ exports.default = (platform, entryPoints) => {
39
41
  }
40
42
  const promptPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
41
43
  const testPaths = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
42
- const featuresPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`); // /read ${featuresPath}
44
+ const featuresPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
45
+ const stderrPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stderr.log`);
46
+ const stdoutPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stdout.log`);
43
47
  if (result.metafile) {
44
48
  const addableFiles = tree(result.metafile, entryPoint.split("/").slice(1).join("/"))
45
49
  .map((y) => {
@@ -49,23 +53,31 @@ exports.default = (platform, entryPoints) => {
49
53
  return y;
50
54
  })
51
55
  .flat();
56
+ const typeErrorFiles = addableFiles.map((t) => `docs/types/${t}.type_errors.txt`);
52
57
  fs_1.default.writeFileSync(promptPath, `
53
- ${[...addableFiles]
58
+ ${addableFiles
54
59
  .map((x) => {
55
60
  return `/add ${x}`;
56
61
  })
57
62
  .join("\n")}
58
- ${[...addableFiles]
63
+
64
+ ${typeErrorFiles
59
65
  .map((x) => {
60
- const f = `docs/ts/${x}.type_errors.txt`;
61
- if (fs_1.default.existsSync(f)) {
62
- return `/read ${f}`;
63
- }
66
+ // const f = `docs/types/${x}.type_errors.txt`;
67
+ return `/read ${x}`;
68
+ // if (fs.existsSync(f)) {
69
+ // return `/read ${f}`;
70
+ // }
64
71
  })
65
72
  .join("\n")}
73
+
66
74
  /read ${testPaths}
75
+ /read ${stdoutPath}
76
+ /read ${stderrPath}
77
+
67
78
  /load ${featuresPath}
68
- /code Fix the failing tests described in ${testPaths}. Correct any type signature errors. Implement any method which throws "Function not implemented."
79
+
80
+ /code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files [${typeErrorFiles.join(", ")}]. Implement any method which throws "Function not implemented."
69
81
  `);
70
82
  }
71
83
  });
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const fs_1 = __importDefault(require("fs"));
30
+ const Init_1 = __importDefault(require("../dist/module/src/Init"));
31
+ console.log("Initializing a testeranto project");
32
+ if (!process.argv[2]) {
33
+ console.log("You didn't pass a config file, so I will create one for you.");
34
+ fs_1.default.writeFileSync("testeranto.mts", fs_1.default.readFileSync("node_modules/testeranto/src/defaultConfig.ts"));
35
+ Promise.resolve().then(() => __importStar(require(process.cwd() + "/" + "testeranto.mts"))).then((module) => {
36
+ (0, Init_1.default)(module.default);
37
+ });
38
+ }
39
+ else {
40
+ Promise.resolve().then(() => __importStar(require(process.cwd() + "/" + process.argv[2]))).then((module) => {
41
+ (0, Init_1.default)(module.default);
42
+ });
43
+ }
@@ -290,70 +290,6 @@ class BaseGiven {
290
290
  if (prop === "writeFileSync") {
291
291
  return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterEach/${fp}`, contents);
292
292
  }
293
- // if (prop === "browser") {
294
- // return new Proxy(target[prop], {
295
- // get(bTarget, bProp, bReceiver) {
296
- // if (bProp === "pages") {
297
- // return async () => {
298
- // return bTarget.pages().then((pages) => {
299
- // return pages.map((page) => {
300
- // return new Proxy(page, {
301
- // get(pTarget, pProp, pReciever) {
302
- // if (pProp === "screenshot") {
303
- // return async (x) => {
304
- // // console.log(
305
- // // "custom-screenshot-MARK-afterEachProxy",
306
- // // window["custom-screenshot"].toString()
307
- // // );
308
- // return pm.customScreenShot(
309
- // {
310
- // ...x,
311
- // path:
312
- // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
313
- // "/" +
314
- // x.path,
315
- // },
316
- // page
317
- // );
318
- // // return await pTarget[pProp]({
319
- // // ...x,
320
- // // path:
321
- // // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
322
- // // "/" +
323
- // // x.path,
324
- // // });
325
- // };
326
- // } else if (pProp === "mainFrame") {
327
- // return () => pTarget[pProp]();
328
- // // return target[pProp];
329
- // // return Reflect.get(...arguments);
330
- // } else if (pProp === "exposeFunction") {
331
- // // return Reflect.get(target, prop, receiver);
332
- // return (...a) => pTarget[pProp](...a);
333
- // // return target[pProp];
334
- // } else if (pProp === "removeExposedFunction") {
335
- // // return Reflect.get(target, prop, receiver);
336
- // return pTarget[pProp].bind(pTarget);
337
- // // return target[pProp];
338
- // }
339
- // // else if (pProp === "#frameManager") {
340
- // // return () => target[pProp](...arguments);
341
- // // }
342
- // else {
343
- // return Reflect.get(...arguments);
344
- // }
345
- // },
346
- // });
347
- // });
348
- // });
349
- // // return (await target.pages()).map((page) => {
350
- // // return new Proxy(page, handler2);
351
- // // });
352
- // };
353
- // }
354
- // },
355
- // });
356
- // }
357
293
  return Reflect.get(...arguments);
358
294
  },
359
295
  });
@@ -39,9 +39,11 @@ class Testeranto extends classBuilder_js_1.ClassBuilder {
39
39
  }
40
40
  }, class Given extends abstractBase_js_1.BaseGiven {
41
41
  async givenThat(subject, testResource, artifactory, initializer, pm) {
42
- return fullTestInterface.beforeEach(subject, initializer, (fPath, value) =>
43
- // TODO does not work?
44
- artifactory(`beforeEach/${fPath}`, value), testResource, this.initialValues, pm);
42
+ return fullTestInterface.beforeEach(subject, initializer,
43
+ // (fPath: string, value: unknown) =>
44
+ // // TODO does not work?
45
+ // artifactory(`beforeEach/${fPath}`, value),
46
+ testResource, this.initialValues, pm);
45
47
  }
46
48
  afterEach(store, key, artifactory, pm) {
47
49
  return new Promise((res) => res(fullTestInterface.afterEach(store, key, (fPath, value) => artifactory(`after/${fPath}`, value), pm)));
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // import { ITProject } from "./src/Project.js";
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
5
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -27,12 +26,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
27
  };
29
28
  Object.defineProperty(exports, "__esModule", { value: true });
30
- // import Project from "./testeranto.js";
29
+ const Puppeteer_js_1 = __importDefault(require("./Puppeteer.js"));
31
30
  const process_1 = __importDefault(require("process"));
32
- const Project_1 = require("./src/Project");
33
- // import { ITProject } from "testeranto/src/Project";
34
- // process.chdir(__dirname);
35
- // import Puppeteer from "./src/Puppeteer.js";
36
- console.log(process_1.default.argv);
37
- const Project = await Promise.resolve().then(() => __importStar(require(process_1.default.argv[2])));
38
- exports.default = new Project_1.ITProject(Project);
31
+ if (!process_1.default.argv[2]) {
32
+ console.log("You didn't pass a config file");
33
+ process_1.default.exit(-1);
34
+ }
35
+ else {
36
+ Promise.resolve().then(() => __importStar(require(process_1.default.cwd() + "/" + process_1.default.argv[2]))).then((module) => {
37
+ (0, Puppeteer_js_1.default)(module.default);
38
+ });
39
+ }