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.
Files changed (98) 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/Node.js +5 -3
  7. package/dist/common/src/PM/main.js +136 -90
  8. package/dist/common/src/Project.js +82 -0
  9. package/dist/common/src/Puppeteer.js +0 -2
  10. package/dist/common/src/SubPackages/puppeteer.js +1 -1
  11. package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
  12. package/dist/common/src/SubPackages/react/jsx/node.js +7 -2
  13. package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
  14. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  15. package/dist/common/src/Web.js +25 -21
  16. package/dist/common/{run-tests.js → src/build-tests.js} +10 -5
  17. package/dist/common/src/defaultConfig.js +19 -0
  18. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +26 -16
  19. package/dist/common/src/init-docs.js +43 -0
  20. package/dist/common/src/lib/abstractBase.js +29 -248
  21. package/dist/common/src/lib/basebuilder.js +1 -11
  22. package/dist/common/src/lib/classBuilder.js +1 -1
  23. package/dist/common/src/lib/core.js +8 -26
  24. package/dist/common/{build-tests.js → src/run-tests.js} +10 -9
  25. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  26. package/dist/module/src/Init.js +30 -0
  27. package/dist/module/src/Node.js +5 -3
  28. package/dist/module/src/PM/main.js +136 -90
  29. package/dist/module/src/Project.js +82 -0
  30. package/dist/module/src/Puppeteer.js +0 -2
  31. package/dist/module/src/SubPackages/puppeteer.js +1 -1
  32. package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
  33. package/dist/module/src/SubPackages/react/jsx/node.js +7 -2
  34. package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
  35. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  36. package/dist/module/src/Web.js +25 -21
  37. package/dist/module/src/build-tests.js +11 -0
  38. package/dist/module/src/defaultConfig.js +17 -0
  39. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +26 -16
  40. package/dist/module/src/init-docs.js +15 -0
  41. package/dist/module/src/lib/abstractBase.js +29 -248
  42. package/dist/module/src/lib/basebuilder.js +1 -11
  43. package/dist/module/src/lib/classBuilder.js +1 -1
  44. package/dist/module/src/lib/core.js +8 -26
  45. package/dist/module/src/run-tests.js +11 -0
  46. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  47. package/dist/prebuild/build-tests.mjs +553 -0
  48. package/dist/prebuild/init-docs.mjs +48 -0
  49. package/dist/prebuild/run-tests.mjs +871 -0
  50. package/dist/types/dist/module/src/Init.d.ts +2 -0
  51. package/dist/types/src/Node.d.ts +4 -1
  52. package/dist/types/src/PM/main.d.ts +2 -1
  53. package/dist/types/src/SubPackages/react/jsx/node.d.ts +1 -1
  54. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
  55. package/dist/types/src/Web.d.ts +2 -2
  56. package/dist/types/src/build-tests.d.ts +1 -0
  57. package/dist/types/src/defaultConfig.d.ts +3 -0
  58. package/dist/types/src/init-docs.d.ts +1 -0
  59. package/dist/types/src/lib/abstractBase.d.ts +6 -2
  60. package/dist/types/src/lib/core.d.ts +3 -3
  61. package/dist/types/src/lib/types.d.ts +5 -1
  62. package/dist/types/src/run-tests.d.ts +1 -0
  63. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  64. package/package.json +21 -24
  65. package/src/Init.ts +28 -0
  66. package/src/Node.ts +6 -3
  67. package/src/PM/main.ts +168 -110
  68. package/src/Project.ts +103 -0
  69. package/src/Puppeteer.ts +0 -2
  70. package/src/SubPackages/puppeteer.ts +1 -1
  71. package/src/SubPackages/react/jsx/index.ts +15 -7
  72. package/src/SubPackages/react/jsx/node.ts +6 -5
  73. package/src/SubPackages/react-dom/component/web.ts +28 -51
  74. package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
  75. package/src/Web.ts +45 -23
  76. package/src/build-tests.ts +12 -0
  77. package/src/defaultConfig.ts +20 -0
  78. package/src/esbuildConfigs/inputFilesPlugin.ts +46 -17
  79. package/src/init-docs.ts +19 -0
  80. package/src/lib/abstractBase.ts +38 -255
  81. package/src/lib/basebuilder.ts +1 -12
  82. package/src/lib/classBuilder.ts +2 -1
  83. package/src/lib/core.ts +17 -29
  84. package/src/lib/types.ts +3 -1
  85. package/src/run-tests.ts +12 -0
  86. package/tsconfig.json +1 -1
  87. package/build-tests.ts +0 -16
  88. package/dist/common/init-docs.js +0 -8
  89. package/dist/module/build-tests.js +0 -10
  90. package/dist/module/init-docs.js +0 -3
  91. package/dist/module/run-tests.js +0 -6
  92. package/dist/prebuild/Puppeteer.mjs +0 -82033
  93. package/dist/types/build-tests.d.ts +0 -3
  94. package/dist/types/init-docs.d.ts +0 -2
  95. package/dist/types/run-tests.d.ts +0 -2
  96. package/init-docs.ts +0 -5
  97. package/pupBuild.js +0 -18
  98. package/run-tests.ts +0 -9
@@ -2,22 +2,17 @@ import React from "react";
2
2
  import renderer, { act } from "react-test-renderer";
3
3
  export const testInterface = {
4
4
  beforeEach: function (CComponent, propsAndChildren) {
5
- function Link(props) {
6
- const p = props.props;
7
- const c = props.children;
8
- return React.createElement(CComponent, p, c);
5
+ function Link(proper) {
6
+ return React.createElement(CComponent, proper(), []);
9
7
  }
10
8
  return new Promise((res, rej) => {
11
9
  act(async () => {
12
- const p = propsAndChildren;
13
- const y = new CComponent(p.props);
14
10
  const testRenderer = await renderer.create(Link(propsAndChildren));
15
11
  res(testRenderer);
16
12
  });
17
13
  });
18
14
  },
19
15
  andWhen: async function (renderer, whenCB) {
20
- // console.log("andWhen", whenCB)
21
16
  await act(() => whenCB(renderer));
22
17
  return renderer;
23
18
  },
@@ -25,15 +20,12 @@ export const testInterface = {
25
20
  // return whenCB()(s);
26
21
  // },
27
22
  butThen: async function (s, thenCB, tr) {
28
- console.log("butThen", thenCB.toString());
29
23
  return thenCB(s);
30
24
  },
31
25
  afterEach: async function (store, ndx, artificer) {
32
- // console.log("afterEach", store);
33
26
  return {};
34
27
  },
35
28
  afterAll: (store, artificer) => {
36
- // console.log("afterAll", store);
37
29
  return;
38
30
  },
39
31
  };
@@ -1,36 +1,40 @@
1
1
  import { PM_Web } from "./PM/web";
2
2
  import Testeranto from "./lib/core.js";
3
3
  import { defaultTestResourceRequirement, } from "./lib/index.js";
4
+ let errorCallback = (e) => { };
5
+ let unhandledrejectionCallback = (event) => {
6
+ console.log("window.addEventListener unhandledrejection", event);
7
+ // cb({ error: event.reason.message });
8
+ // throw event;
9
+ };
4
10
  export class WebTesteranto extends Testeranto {
5
11
  constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
6
- super(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
12
+ super(input, testSpecification, testImplementation, testResourceRequirement, testInterface, (cb) => {
13
+ window.removeEventListener("error", errorCallback);
14
+ errorCallback = (e) => {
15
+ console.log("window.addEventListener error", e);
16
+ cb(e);
17
+ // throw e;
18
+ };
19
+ window.addEventListener("error", errorCallback);
20
+ window.removeEventListener("unhandledrejection", unhandledrejectionCallback);
21
+ /////////////////////
22
+ window.removeEventListener("unhandledrejection", unhandledrejectionCallback);
23
+ unhandledrejectionCallback = (event) => {
24
+ console.log("window.addEventListener unhandledrejection", event);
25
+ cb({ error: event.reason.message });
26
+ // throw event;
27
+ };
28
+ window.addEventListener("unhandledrejection", unhandledrejectionCallback);
29
+ });
7
30
  }
8
31
  async receiveTestResourceConfig(partialTestResource) {
9
32
  const t = partialTestResource; //JSON.parse(partialTestResource);
10
33
  const pm = new PM_Web(t);
11
34
  const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
12
- pm.customclose();
13
35
  return new Promise((res, rej) => {
14
- res(features);
36
+ res({ features, failed });
15
37
  });
16
- // return features;
17
- // Promise.all([...artifacts, logPromise]).then(async () => {
18
- // console.log("hello world");
19
- // pm.customclose();
20
- // // we can't close the window becuase we might be taking a screenshot
21
- // // window.close();
22
- // // console.log(
23
- // // "(window as any).browser",
24
- // // JSON.stringify(await (window as any).browser)
25
- // // );
26
- // // var currentWindow = (await (window as any).browser).getCurrentWindow();
27
- // // window.close();
28
- // // var customWindow = window.open("", "_blank", "");
29
- // // customWindow.close();
30
- // // this.puppetMaster.browser.page
31
- // // window["customclose"]();
32
- // // console.log("goodbye", window["customclose"]());
33
- // });
34
38
  }
35
39
  }
36
40
  export default async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = defaultTestResourceRequirement) => {
@@ -0,0 +1,11 @@
1
+ import process from "process";
2
+ import { ITProject } from "./Project";
3
+ if (!process.argv[2]) {
4
+ console.log("You didn't pass a config file");
5
+ process.exit(-1);
6
+ }
7
+ else {
8
+ import(process.cwd() + "/" + process.argv[2]).then((module) => {
9
+ new ITProject(module.default);
10
+ });
11
+ }
@@ -0,0 +1,17 @@
1
+ const config = {
2
+ outdir: "docs",
3
+ tests: [],
4
+ debugger: true,
5
+ clearScreen: false,
6
+ devMode: true,
7
+ minify: false,
8
+ outbase: ".",
9
+ ports: ["3001"],
10
+ externals: [],
11
+ nodePlugins: [],
12
+ webPlugins: [],
13
+ featureIngestor: function (s) {
14
+ throw new Error("Function not implemented.");
15
+ },
16
+ };
17
+ export default config;
@@ -2,20 +2,20 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  const otherInputs = {};
4
4
  const register = (entrypoint, sources) => {
5
- console.log("register", entrypoint, sources);
6
5
  if (!otherInputs[entrypoint]) {
7
6
  otherInputs[entrypoint] = new Set();
8
7
  }
9
8
  sources.forEach((s) => otherInputs[entrypoint].add(s));
10
9
  };
11
10
  function tree(meta, key) {
12
- return [
13
- key,
14
- ...meta.inputs[key].imports
15
- .filter((x) => x.external !== true)
16
- .filter((x) => x.path.split("/")[0] !== "node_modules")
17
- .map((f) => f.path),
18
- ];
11
+ const outputKey = Object.keys(meta.outputs).find((k) => {
12
+ return meta.outputs[k].entryPoint === key;
13
+ });
14
+ if (!outputKey) {
15
+ console.error("No outputkey found");
16
+ process.exit(-1);
17
+ }
18
+ return Object.keys(meta.outputs[outputKey].inputs).filter((k) => k.startsWith("src"));
19
19
  }
20
20
  export default (platform, entryPoints) => {
21
21
  return {
@@ -34,7 +34,9 @@ export default (platform, entryPoints) => {
34
34
  }
35
35
  const promptPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
36
36
  const testPaths = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
37
- const featuresPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`); // /read ${featuresPath}
37
+ const featuresPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
38
+ const stderrPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stderr.log`);
39
+ const stdoutPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `stdout.log`);
38
40
  if (result.metafile) {
39
41
  const addableFiles = tree(result.metafile, entryPoint.split("/").slice(1).join("/"))
40
42
  .map((y) => {
@@ -44,23 +46,31 @@ export default (platform, entryPoints) => {
44
46
  return y;
45
47
  })
46
48
  .flat();
49
+ const typeErrorFiles = addableFiles.map((t) => `docs/types/${t}.type_errors.txt`);
47
50
  fs.writeFileSync(promptPath, `
48
- ${[...addableFiles]
51
+ ${addableFiles
49
52
  .map((x) => {
50
53
  return `/add ${x}`;
51
54
  })
52
55
  .join("\n")}
53
- ${[...addableFiles]
56
+
57
+ ${typeErrorFiles
54
58
  .map((x) => {
55
- const f = `docs/ts/${x}.type_errors.txt`;
56
- if (fs.existsSync(f)) {
57
- return `/read ${f}`;
58
- }
59
+ // const f = `docs/types/${x}.type_errors.txt`;
60
+ return `/read ${x}`;
61
+ // if (fs.existsSync(f)) {
62
+ // return `/read ${f}`;
63
+ // }
59
64
  })
60
65
  .join("\n")}
66
+
61
67
  /read ${testPaths}
68
+ /read ${stdoutPath}
69
+ /read ${stderrPath}
70
+
62
71
  /load ${featuresPath}
63
- /code Fix the failing tests described in ${testPaths}. Correct any type signature errors. Implement any method which throws "Function not implemented."
72
+
73
+ /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."
64
74
  `);
65
75
  }
66
76
  });
@@ -0,0 +1,15 @@
1
+ import fs from "fs";
2
+ import Init from "../dist/module/src/Init";
3
+ console.log("Initializing a testeranto project");
4
+ if (!process.argv[2]) {
5
+ console.log("You didn't pass a config file, so I will create one for you.");
6
+ fs.writeFileSync("testeranto.mts", fs.readFileSync("node_modules/testeranto/src/defaultConfig.ts"));
7
+ import(process.cwd() + "/" + "testeranto.mts").then((module) => {
8
+ Init(module.default);
9
+ });
10
+ }
11
+ else {
12
+ import(process.cwd() + "/" + process.argv[2]).then((module) => {
13
+ Init(module.default);
14
+ });
15
+ }
@@ -41,11 +41,12 @@ export class BaseSuite {
41
41
  this.testResourceConfiguration = testResourceConfiguration;
42
42
  tLog("test resources: ", JSON.stringify(testResourceConfiguration));
43
43
  const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
44
- console.log("\nSuite:", this.index, this.name);
44
+ // console.log("\nSuite:", this.index, this.name);
45
45
  tLog("\nSuite:", this.index, this.name);
46
46
  const sNdx = this.index;
47
47
  const sName = this.name;
48
- for (const [gNdx, g] of Object.entries(this.givens)) {
48
+ for (const [gKey, g] of Object.entries(this.givens)) {
49
+ // console.log("gKey", gKey);
49
50
  const beforeAllProxy = new Proxy(pm, {
50
51
  get(target, prop, receiver) {
51
52
  if (prop === "customScreenShot") {
@@ -56,65 +57,13 @@ export class BaseSuite {
56
57
  if (prop === "writeFileSync") {
57
58
  return (fp, contents) => target[prop](`suite-${sNdx}/beforeAll/${fp}`, contents);
58
59
  }
59
- // if (prop === "browser") {
60
- // return new Proxy(target[prop], {
61
- // get(bTarget, bProp, bReceiver) {
62
- // if (bProp === "pages") {
63
- // return async () => {
64
- // return bTarget.pages().then((pages) => {
65
- // return pages.map((page) => {
66
- // return new Proxy(page, {
67
- // get(pTarget, pProp, pReciever) {
68
- // if (pProp === "screenshot") {
69
- // return async (x) => {
70
- // return pm.customScreenShot(
71
- // {
72
- // ...x,
73
- // path:
74
- // `${testResourceConfiguration.fs}/suite-${sNdx}/beforeAll` +
75
- // "/" +
76
- // x.path,
77
- // },
78
- // page
79
- // );
80
- // // return await window["custom-screenshot"]({
81
- // // ...x,
82
- // // path:
83
- // // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
84
- // // "/" +
85
- // // x.path,
86
- // // });
87
- // };
88
- // } else if (pProp === "mainFrame") {
89
- // return () => pTarget[pProp]();
90
- // } else if (pProp === "close") {
91
- // return () => pTarget[pProp]();
92
- // }
93
- // // else if (pProp === "mainFrame") {
94
- // // return () => target[pProp](...arguments);
95
- // // }
96
- // else {
97
- // return Reflect.get(...arguments);
98
- // }
99
- // },
100
- // });
101
- // });
102
- // });
103
- // // return (await target.pages()).map((page) => {
104
- // // return new Proxy(page, handler2);
105
- // // });
106
- // };
107
- // }
108
- // },
109
- // });
110
- // }
111
60
  return Reflect.get(...arguments);
112
61
  },
113
62
  });
114
63
  const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, beforeAllProxy);
115
- const giver = this.givens[gNdx];
64
+ const giver = this.givens[gKey];
116
65
  try {
117
- this.store = await giver.give(subject, gNdx, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
66
+ this.store = await giver.give(subject, gKey, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx);
118
67
  }
119
68
  catch (e) {
120
69
  console.error(e);
@@ -122,64 +71,6 @@ export class BaseSuite {
122
71
  // return this;
123
72
  }
124
73
  }
125
- // const afterAllProxy = new Proxy(pm, {
126
- // get(target, prop, receiver) {
127
- // if (prop === "writeFileSync") {
128
- // return (fp, contents) =>
129
- // target[prop](`suite-${sNdx}/afterAll/${fp}`, contents);
130
- // }
131
- // if (prop === "browser") {
132
- // return new Proxy(target[prop], {
133
- // get(bTarget, bProp, bReceiver) {
134
- // if (bProp === "pages") {
135
- // return async () => {
136
- // return bTarget.pages().then((pages) => {
137
- // return pages.map((page) => {
138
- // return new Proxy(page, {
139
- // get(pTarget, pProp, pReciever) {
140
- // if (pProp === "screenshot") {
141
- // return async (x) => {
142
- // return pm.customScreenShot({
143
- // ...x,
144
- // path:
145
- // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
146
- // "/" +
147
- // x.path,
148
- // });
149
- // // return await window["custom-screenshot"]({
150
- // // ...x,
151
- // // path:
152
- // // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
153
- // // "/" +
154
- // // x.path,
155
- // // });
156
- // };
157
- // } else if (pProp === "mainFrame") {
158
- // return () => pTarget[pProp]();
159
- // } else if (pProp === "close") {
160
- // return () => pTarget[pProp]();
161
- // }
162
- // // else if (pProp === "mainFrame") {
163
- // // return () => target[pProp](...arguments);
164
- // // }
165
- // else {
166
- // return Reflect.get(...arguments);
167
- // }
168
- // },
169
- // });
170
- // });
171
- // });
172
- // // return (await target.pages()).map((page) => {
173
- // // return new Proxy(page, handler2);
174
- // // });
175
- // };
176
- // }
177
- // },
178
- // });
179
- // }
180
- // return Reflect.get(...arguments);
181
- // },
182
- // });
183
74
  try {
184
75
  this.afterAll(this.store, artifactory,
185
76
  // afterAllProxy
@@ -217,7 +108,9 @@ export class BaseSuite {
217
108
  }
218
109
  }
219
110
  export class BaseGiven {
220
- constructor(name, features, whens, thens, givenCB, initialValues) {
111
+ constructor(name, features, whens, thens, givenCB, initialValues
112
+ // key: string
113
+ ) {
221
114
  this.name = name;
222
115
  this.features = features;
223
116
  this.whens = whens;
@@ -225,11 +118,15 @@ export class BaseGiven {
225
118
  this.givenCB = givenCB;
226
119
  this.initialValues = initialValues;
227
120
  }
228
- beforeAll(store, artifactory) {
121
+ beforeAll(store,
122
+ // artifactory: ITestArtifactory
123
+ // subject,
124
+ initializer, artifactory, testResource, initialValues, pm) {
229
125
  return store;
230
126
  }
231
127
  toObj() {
232
128
  return {
129
+ key: this.key,
233
130
  name: this.name,
234
131
  whens: this.whens.map((w) => w.toObj()),
235
132
  thens: this.thens.map((t) => t.toObj()),
@@ -242,30 +139,34 @@ export class BaseGiven {
242
139
  return store;
243
140
  }
244
141
  async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
142
+ this.key = key;
143
+ tLog(`\n ${this.key}`);
245
144
  tLog(`\n Given: ${this.name}`);
246
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
145
+ const givenArtifactory = (fPath, value) => artifactory(`given-${this.key}/${fPath}`, value);
247
146
  try {
248
147
  // tLog(`\n Given this.store`, this.store);
249
148
  const beforeEachProxy = new Proxy(pm, {
250
149
  get(target, prop, receiver) {
251
150
  if (prop === "writeFileSync") {
252
- return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`, contents);
151
+ return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${this.key}/when/beforeEach/${fp}`, contents);
253
152
  }
254
153
  if (prop === "customScreenShot") {
255
- return (opts) => target.customScreenShot(Object.assign(Object.assign({}, opts), {
256
- // path: `${filepath}/${opts.path}`,
257
- path: `suite-${suiteNdx}/given-${key}/when/beforeEach/${opts.path}` }));
154
+ return (opts) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${this.key}/when/beforeEach/${opts.path}` }));
258
155
  }
259
156
  return Reflect.get(...arguments);
260
157
  },
261
158
  });
262
- this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, beforeEachProxy);
263
- // console.log("mark6", this.store);
159
+ this.uberCatcher((e) => {
160
+ console.error(e);
161
+ this.error = e.error;
162
+ tLog(e.stack);
163
+ });
164
+ this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, beforeEachProxy);
264
165
  for (const [whenNdx, whenStep] of this.whens.entries()) {
265
- await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
166
+ await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${this.key}/when/${whenNdx}`);
266
167
  }
267
168
  for (const [thenNdx, thenStep] of this.thens.entries()) {
268
- const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
169
+ const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${this.key}/then-${thenNdx}`);
269
170
  tester(t);
270
171
  }
271
172
  }
@@ -281,79 +182,15 @@ export class BaseGiven {
281
182
  const afterEachProxy = new Proxy(pm, {
282
183
  get(target, prop, receiver) {
283
184
  if (prop === "customScreenShot") {
284
- return (opts) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${key}/afterEach/${opts.path}` }));
185
+ return (opts) => target.customScreenShot(Object.assign(Object.assign({}, opts), { path: `suite-${suiteNdx}/given-${this.key}/afterEach/${opts.path}` }));
285
186
  }
286
187
  if (prop === "writeFileSync") {
287
- return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${key}/afterEach/${fp}`, contents);
188
+ return (fp, contents) => target[prop](`suite-${suiteNdx}/given-${this.key}/afterEach/${fp}`, contents);
288
189
  }
289
- // if (prop === "browser") {
290
- // return new Proxy(target[prop], {
291
- // get(bTarget, bProp, bReceiver) {
292
- // if (bProp === "pages") {
293
- // return async () => {
294
- // return bTarget.pages().then((pages) => {
295
- // return pages.map((page) => {
296
- // return new Proxy(page, {
297
- // get(pTarget, pProp, pReciever) {
298
- // if (pProp === "screenshot") {
299
- // return async (x) => {
300
- // // console.log(
301
- // // "custom-screenshot-MARK-afterEachProxy",
302
- // // window["custom-screenshot"].toString()
303
- // // );
304
- // return pm.customScreenShot(
305
- // {
306
- // ...x,
307
- // path:
308
- // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
309
- // "/" +
310
- // x.path,
311
- // },
312
- // page
313
- // );
314
- // // return await pTarget[pProp]({
315
- // // ...x,
316
- // // path:
317
- // // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
318
- // // "/" +
319
- // // x.path,
320
- // // });
321
- // };
322
- // } else if (pProp === "mainFrame") {
323
- // return () => pTarget[pProp]();
324
- // // return target[pProp];
325
- // // return Reflect.get(...arguments);
326
- // } else if (pProp === "exposeFunction") {
327
- // // return Reflect.get(target, prop, receiver);
328
- // return (...a) => pTarget[pProp](...a);
329
- // // return target[pProp];
330
- // } else if (pProp === "removeExposedFunction") {
331
- // // return Reflect.get(target, prop, receiver);
332
- // return pTarget[pProp].bind(pTarget);
333
- // // return target[pProp];
334
- // }
335
- // // else if (pProp === "#frameManager") {
336
- // // return () => target[pProp](...arguments);
337
- // // }
338
- // else {
339
- // return Reflect.get(...arguments);
340
- // }
341
- // },
342
- // });
343
- // });
344
- // });
345
- // // return (await target.pages()).map((page) => {
346
- // // return new Proxy(page, handler2);
347
- // // });
348
- // };
349
- // }
350
- // },
351
- // });
352
- // }
353
190
  return Reflect.get(...arguments);
354
191
  },
355
192
  });
356
- await this.afterEach(this.store, key, givenArtifactory,
193
+ await this.afterEach(this.store, this.key, givenArtifactory,
357
194
  // pm
358
195
  afterEachProxy);
359
196
  }
@@ -509,62 +346,6 @@ export class BaseThen {
509
346
  if (prop === "writeFileSync") {
510
347
  return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
511
348
  }
512
- // if (prop === "browser") {
513
- // return new Proxy(target[prop], {
514
- // get(bTarget, bProp, bReceiver) {
515
- // if (bProp === "pages") {
516
- // return async () => {
517
- // return bTarget.pages().then((pages) => {
518
- // return pages.map((page) => {
519
- // return new Proxy(page, {
520
- // get(pTarget, pProp, pReciever) {
521
- // if (pProp === "screenshot") {
522
- // return async (x) => {
523
- // return pm.customScreenShot(
524
- // {
525
- // ...x,
526
- // path:
527
- // `${testResourceConfiguration.fs}/${filepath}/butThen` +
528
- // "/" +
529
- // x.path,
530
- // },
531
- // page
532
- // );
533
- // // return await window["custom-screenshot"]({
534
- // // ...x,
535
- // // path:
536
- // // `${testResourceConfiguration.fs}/suite-${sNdx}/afterAll` +
537
- // // "/" +
538
- // // x.path,
539
- // // });
540
- // };
541
- // } else if (pProp === "close") {
542
- // return () => pTarget[pProp]();
543
- // } else if (pProp === "mainFrame") {
544
- // return () => pTarget[pProp]();
545
- // } else if (pProp === "exposeFunction") {
546
- // // return Reflect.get(target, prop, receiver);
547
- // return (...a) => pTarget[pProp](...a);
548
- // // return target[pProp];
549
- // } else if (pProp === "removeExposedFunction") {
550
- // // return Reflect.get(target, prop, receiver);
551
- // return pTarget[pProp].bind(pTarget);
552
- // // return target[pProp];
553
- // } else {
554
- // return Reflect.get(...arguments);
555
- // }
556
- // },
557
- // });
558
- // });
559
- // });
560
- // // return (await target.pages()).map((page) => {
561
- // // return new Proxy(page, handler2);
562
- // // });
563
- // };
564
- // }
565
- // },
566
- // });
567
- // }
568
349
  return Reflect.get(...arguments);
569
350
  },
570
351
  });
@@ -11,21 +11,11 @@ export class BaseBuilder {
11
11
  this.checkOverides = checkOverides;
12
12
  this.testSpecification = testSpecification;
13
13
  this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
14
- // const f = this.specs[0].features;
15
14
  this.testJobs = this.specs.map((suite) => {
16
15
  const suiteRunner = (suite) => async (puppetMaster, tLog) => {
17
- // const puppeteerBrowser = await puppetMaster.startPuppeteer(
18
- // {
19
- // browserWSEndpoint:
20
- // puppetMaster.testResourceConfiguration.browserWSEndpoint,
21
- // },
22
- // puppetMaster.testResourceConfiguration.fs
23
- // );
24
16
  const x = await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
25
17
  this.artifacts.push(p);
26
18
  })(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
27
- // await puppetMaster.browser.disconnect();
28
- // puppeteerBrowser.close();
29
19
  return x;
30
20
  };
31
21
  const runner = suiteRunner(suite);
@@ -59,7 +49,7 @@ export class BaseBuilder {
59
49
  // );
60
50
  // }
61
51
  puppetMaster.writeFileSync(`tests.json`, JSON.stringify(this.toObj(), null, 2));
62
- console.log(`exiting gracefully with ${numberOfFailures} failures.`);
52
+ // console.log(`exiting gracefully with ${numberOfFailures} failures.`);
63
53
  return {
64
54
  failed: numberOfFailures,
65
55
  artifacts: this.artifacts || [],
@@ -7,7 +7,7 @@ export class ClassBuilder extends BaseBuilder {
7
7
  };
8
8
  return a;
9
9
  }, {});
10
- const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, givEn]) => {
10
+ const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, g]) => {
11
11
  a[key] = (features, whens, thens, givEn) => {
12
12
  return new givenKlasser.prototype.constructor(key, features, whens, thens, testImplementation.givens[key], givEn);
13
13
  };