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.
Files changed (99) hide show
  1. package/README.md +248 -6
  2. package/dist/common/src/Node.js +5 -0
  3. package/dist/common/src/PM/base.js +6 -0
  4. package/dist/common/src/PM/index.js +0 -1
  5. package/dist/common/src/PM/main.js +84 -22
  6. package/dist/common/src/PM/web.js +1 -1
  7. package/dist/common/src/ReportServer.js +39 -2
  8. package/dist/common/src/build.js +41 -6
  9. package/dist/common/src/lib/abstractBase.js +22 -107
  10. package/dist/common/src/lib/basebuilder.js +20 -21
  11. package/dist/common/src/lib/classBuilder.js +12 -1
  12. package/dist/common/src/lib/core.js +1 -8
  13. package/dist/common/src/lib/index.js +2 -5
  14. package/dist/common/src/lib/pmProxy.js +294 -0
  15. package/dist/common/testeranto.config.js +43 -34
  16. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  17. package/dist/module/src/Node.js +5 -0
  18. package/dist/module/src/PM/base.js +6 -0
  19. package/dist/module/src/PM/index.js +0 -1
  20. package/dist/module/src/PM/main.js +84 -22
  21. package/dist/module/src/PM/web.js +1 -1
  22. package/dist/module/src/Project.js +6 -6
  23. package/dist/module/src/ReportClient.js +3 -3
  24. package/dist/module/src/ReportServer.js +39 -2
  25. package/dist/module/src/build.js +41 -6
  26. package/dist/module/src/lib/abstractBase.js +22 -107
  27. package/dist/module/src/lib/basebuilder.js +20 -21
  28. package/dist/module/src/lib/classBuilder.js +12 -1
  29. package/dist/module/src/lib/core.js +1 -8
  30. package/dist/module/src/lib/index.js +2 -5
  31. package/dist/module/src/lib/pmProxy.js +285 -0
  32. package/dist/module/testeranto.config.js +40 -34
  33. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  34. package/dist/prebuild/Project.css +1 -26
  35. package/dist/prebuild/Project.js +4 -4
  36. package/dist/prebuild/ReportClient.css +1 -26
  37. package/dist/prebuild/ReportClient.js +3 -3
  38. package/dist/prebuild/ReportServer.mjs +1 -2
  39. package/dist/prebuild/TestReport.css +1 -26
  40. package/dist/prebuild/build.mjs +42 -7
  41. package/dist/prebuild/run.mjs +95 -20
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/dist/types/src/PM/web.d.ts +1 -1
  44. package/dist/types/src/Types.d.ts +2 -1
  45. package/dist/types/src/lib/abstractBase.d.ts +4 -6
  46. package/dist/types/src/lib/index.d.ts +1 -1
  47. package/dist/types/src/lib/pmProxy.d.ts +7 -0
  48. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  49. package/package.json +14 -7
  50. package/src/Init.ts +1 -0
  51. package/src/Node.ts +6 -0
  52. package/src/PM/base.ts +8 -0
  53. package/src/PM/index.ts +2 -7
  54. package/src/PM/main.ts +128 -26
  55. package/src/PM/web.ts +3 -3
  56. package/src/Project.tsx +6 -6
  57. package/src/ReportClient.tsx +3 -3
  58. package/src/ReportServer.ts +43 -2
  59. package/src/Types.ts +3 -2
  60. package/src/build.ts +47 -6
  61. package/src/lib/abstractBase.ts +45 -184
  62. package/src/lib/basebuilder.ts +25 -28
  63. package/src/lib/classBuilder.ts +13 -2
  64. package/src/lib/core.ts +10 -14
  65. package/src/lib/index.ts +6 -29
  66. package/src/lib/pmProxy.ts +366 -0
  67. package/testeranto/bundles/node/{react → redux}/metafile.json +186 -254
  68. package/testeranto/bundles/pure/redux/metafile.json +554 -0
  69. package/testeranto/bundles/web/redux/metafile.json +504 -0
  70. package/testeranto/bundles/web/{react/src/SubPackages/react-test-renderer/component → redux}/test/web.html +1 -1
  71. package/testeranto/index.html +1 -1
  72. package/testeranto/reports/{react → redux}/config.json +26 -10
  73. package/testeranto/reports/{react → redux}/index.html +5 -5
  74. package/testeranto/reports/redux/summary.json +20 -0
  75. package/testeranto.config.ts +46 -34
  76. package/tsc.log +3 -1
  77. package/testeranto/bundles/node/react/src/SubPackages/react-test-renderer/component/test/node.mjs +0 -24687
  78. package/testeranto/bundles/pure/react/metafile.json +0 -8
  79. package/testeranto/bundles/pure/react/src/SubPackages/react-test-renderer/component/test/pure.mjs +0 -24625
  80. package/testeranto/bundles/web/react/metafile.json +0 -8
  81. package/testeranto/bundles/web/react/src/SubPackages/react-test-renderer/component/test/web.mjs +0 -21290
  82. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/node/node/console_log.txt +0 -0
  83. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/bdd_errors.txt +0 -1
  84. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/featurePrompt.txt +0 -0
  85. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/lint_errors.json +0 -3381
  86. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/littleBoard.html +0 -20
  87. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/log.txt +0 -40
  88. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/prompt.txt +0 -24
  89. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/tests.json +0 -132
  90. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/type_errors.txt +0 -17
  91. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/bdd_errors.txt +0 -1
  92. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/console_log.txt +0 -1
  93. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/lint_errors.json +0 -2947
  94. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/littleBoard.html +0 -20
  95. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/log.txt +0 -40
  96. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/prompt.txt +0 -23
  97. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/tests.json +0 -132
  98. package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/type_errors.txt +0 -18
  99. package/testeranto/reports/react/summary.json +0 -8
@@ -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 beforeAllProxy = new Proxy(pm, {
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
- const afterEachProxy = new Proxy(pm, {
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
- const andWhenProxy = new Proxy(pm, {
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.go = async (s) => {
202
+ return this.butThen(store, async (s) => {
267
203
  tLog(" Then!!!:", this.name);
268
- try {
269
- await this.thenCB(s);
204
+ if (typeof this.thenCB === "function") {
205
+ return await this.thenCB(s);
270
206
  }
271
- catch (e) {
272
- console.log("test failed 1", e);
273
- this.error = e;
274
- throw e;
207
+ else {
208
+ return this.thenCB;
275
209
  }
276
- };
277
- try {
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
- const b = await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
45
- await puppetMaster.writeFileSync(`littleBoard.html`, `
46
- <!DOCTYPE html>
47
- <html lang="en">
48
-
49
- <head>
50
- <meta name="description" content="Webpage description goes here" />
51
- <meta charset="utf-8" />
52
- <title>kokomoBay - testeranto</title>
53
- <meta name="viewport" content="width=device-width, initial-scale=1" />
54
- <meta name="author" content="" />
55
-
56
- <link rel="stylesheet" href="/kokomoBay/testeranto/TestReport.css" />
57
- <script src="/kokomoBay/testeranto/TestReport.js"></script>
58
-
59
- </head>
60
-
61
- <body>
62
- <div id="root"/>
63
- </body>
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()}`, thEn(expected));
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
- try {
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);
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.afterAllProxy = exports.beforeAllProxy = exports.beforeEachProxy = exports.afterEachProxy = exports.andWhenProxy = exports.butThenProxy = void 0;
4
+ const prxy = function (pm, mappings) {
5
+ return new Proxy(pm, {
6
+ get: (target, prop, receiver) => {
7
+ for (const mapping of mappings) {
8
+ const method = mapping[0];
9
+ const arger = mapping[1];
10
+ if (prop === method) {
11
+ return (x) => target[prop](arger(x));
12
+ }
13
+ }
14
+ return (...x) => target[prop](...x);
15
+ },
16
+ });
17
+ };
18
+ const butThenProxy = (pm, filepath) => prxy(pm, [
19
+ [
20
+ "screencast",
21
+ (opts, p) => [
22
+ Object.assign(Object.assign({}, opts), { path: `${filepath}/butThen/${opts.path}` }),
23
+ p,
24
+ ],
25
+ ],
26
+ ["createWriteStream", (fp) => [`${filepath}/butThen/${fp}`]],
27
+ [
28
+ "writeFileSync",
29
+ (fp, contents) => [`${filepath}/butThen/${fp}`, contents],
30
+ ],
31
+ [
32
+ "customScreenShot",
33
+ (opts, p) => [
34
+ Object.assign(Object.assign({}, opts), { path: `${filepath}/butThen/${opts.path}` }),
35
+ p,
36
+ ],
37
+ ],
38
+ ]);
39
+ exports.butThenProxy = butThenProxy;
40
+ const andWhenProxy = (pm, filepath) => prxy(pm, [
41
+ [
42
+ "screencast",
43
+ (opts, p) => [
44
+ Object.assign(Object.assign({}, opts), { path: `${filepath}/andWhen/${opts.path}` }),
45
+ p,
46
+ ],
47
+ ],
48
+ ["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
49
+ ["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
50
+ [
51
+ "customScreenShot",
52
+ (opts, p) => [
53
+ Object.assign(Object.assign({}, opts), { path: `${filepath}/andWhen${opts.path}` }),
54
+ p,
55
+ ],
56
+ ],
57
+ ]);
58
+ exports.andWhenProxy = andWhenProxy;
59
+ const afterEachProxy = (pm, suite, given) => prxy(pm, [
60
+ [
61
+ "screencast",
62
+ (opts, p) => [
63
+ Object.assign(Object.assign({}, opts), { path: `suite-${suite}/given-${given}/afterEach/${opts.path}` }),
64
+ p,
65
+ ],
66
+ ],
67
+ ["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
68
+ [
69
+ "writeFileSync",
70
+ (fp, contents) => [
71
+ `suite-${suite}/given-${given}/afterEach/${fp}`,
72
+ contents,
73
+ ],
74
+ ],
75
+ [
76
+ "customScreenShot",
77
+ (opts, p) => [
78
+ Object.assign(Object.assign({}, opts), { path: `suite-${suite}/given-${given}/afterEach/${opts.path}` }),
79
+ p,
80
+ ],
81
+ ],
82
+ ]);
83
+ exports.afterEachProxy = afterEachProxy;
84
+ const beforeEachProxy = (pm, suite) => prxy(pm, [
85
+ [
86
+ "screencast",
87
+ (opts, p) => [
88
+ Object.assign(Object.assign({}, opts), { path: `suite-${suite}/beforeEach/${opts.path}` }),
89
+ p,
90
+ ],
91
+ ],
92
+ [
93
+ "writeFileSync",
94
+ (fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents],
95
+ ],
96
+ [
97
+ "customScreenShot",
98
+ (opts, p) => [
99
+ Object.assign(Object.assign({}, opts), { path: `suite-${suite}/beforeEach/${opts.path}` }),
100
+ p,
101
+ ],
102
+ ],
103
+ ["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]],
104
+ ]);
105
+ exports.beforeEachProxy = beforeEachProxy;
106
+ const beforeAllProxy = (pm, suite) => prxy(pm, [
107
+ [
108
+ "writeFileSync",
109
+ (fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents],
110
+ ],
111
+ [
112
+ "customScreenShot",
113
+ (opts, p) => [
114
+ Object.assign(Object.assign({}, opts), { path: `suite-${suite}/beforeAll/${opts.path}` }),
115
+ p,
116
+ ],
117
+ ],
118
+ ["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]],
119
+ ]);
120
+ exports.beforeAllProxy = beforeAllProxy;
121
+ const afterAllProxy = (pm, suite) => prxy(pm, [
122
+ ["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
123
+ [
124
+ "writeFileSync",
125
+ (fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents],
126
+ ],
127
+ [
128
+ "customScreenShot",
129
+ (opts, p) => [
130
+ Object.assign(Object.assign({}, opts), { path: `suite-${suite}/afterAll/${opts.path}` }),
131
+ p,
132
+ ],
133
+ ],
134
+ ]);
135
+ exports.afterAllProxy = afterAllProxy;
136
+ /////////////////////////////////////////////////
137
+ // export const butThenProxy = (pm: IPM, filepath: string) => {
138
+ // return new Proxy(pm, {
139
+ // get: (target, prop, receiver) => {
140
+ // if (prop === "customScreenShot") {
141
+ // return (opts, p) =>
142
+ // target.customScreenShot(
143
+ // {
144
+ // ...opts,
145
+ // path: `${filepath}/${opts.path}`,
146
+ // },
147
+ // p
148
+ // );
149
+ // }
150
+ // if (prop === "writeFileSync") {
151
+ // return (fp, contents) => target[prop](`${filepath}/${fp}`, contents);
152
+ // }
153
+ // },
154
+ // });
155
+ // };
156
+ // export const andWhenProxy = (pm: IPM, filepath: string) => {
157
+ // return new Proxy(pm, {
158
+ // get(target, prop, receiver) {
159
+ // if (prop === "customScreenShot") {
160
+ // return (opts, p) =>
161
+ // target.customScreenShot(
162
+ // {
163
+ // ...opts,
164
+ // path: `${filepath}/${opts.path}`,
165
+ // },
166
+ // p
167
+ // );
168
+ // }
169
+ // if (prop === "writeFileSync") {
170
+ // return (fp, contents) =>
171
+ // target[prop](`${filepath}/andWhen/${fp}`, contents);
172
+ // }
173
+ // /* @ts-ignore:next-line */
174
+ // return Reflect.get(...arguments);
175
+ // },
176
+ // });
177
+ // };
178
+ // export const afterEachProxy = (pm: IPM, suite: string, given: string): IPM => {
179
+ // return new Proxy(pm, {
180
+ // get(target, prop, receiver) {
181
+ // if (prop === "customScreenShot") {
182
+ // return (opts, p) =>
183
+ // target.customScreenShot(
184
+ // {
185
+ // ...opts,
186
+ // path: `suite-${suite}/given-${given}/afterEach/${opts.path}`,
187
+ // },
188
+ // p
189
+ // );
190
+ // }
191
+ // if (prop === "writeFileSync") {
192
+ // return (fp, contents) =>
193
+ // target[prop](
194
+ // `suite-${suite}/given-${given}/afterEach/${fp}`,
195
+ // contents
196
+ // );
197
+ // }
198
+ // /* @ts-ignore:next-line */
199
+ // return Reflect.get(...arguments);
200
+ // },
201
+ // });
202
+ // };
203
+ // export const beforeAllProxy = (pm: IPM, suite: string): IPM => {
204
+ // return new Proxy(pm, {
205
+ // get(target, prop, receiver) {
206
+ // if (prop === "customScreenShot") {
207
+ // return (opts, p) =>
208
+ // target.customScreenShot(
209
+ // {
210
+ // ...opts,
211
+ // // path: `${filepath}/${opts.path}`,
212
+ // path: `suite-${suite}/beforeAll/${opts.path}`,
213
+ // },
214
+ // p
215
+ // );
216
+ // }
217
+ // if (prop === "writeFileSync") {
218
+ // return (fp, contents) =>
219
+ // target[prop](`suite-${suite}/beforeAll/${fp}`, contents);
220
+ // }
221
+ // /* @ts-ignore:next-line */
222
+ // return Reflect.get(...arguments);
223
+ // },
224
+ // });
225
+ // };
226
+ // export const beforeEachProxy = (pm: IPM, suite: string, given: string): IPM => {
227
+ // return new Proxy(pm, {
228
+ // get(target, prop, receiver) {
229
+ // // if (prop === "write") {
230
+ // // return (handle, contents) =>
231
+ // // target[prop](
232
+ // // `suite-${suiteNdx}/given-${key}/when/beforeEach/${fp}`,
233
+ // // contents
234
+ // // );
235
+ // // }
236
+ // if (prop === "createWriteStream") {
237
+ // return (fp) =>
238
+ // target[prop](`suite-${suite}/given-${given}/when/beforeEach/${fp}`);
239
+ // }
240
+ // if (prop === "writeFileSync") {
241
+ // return (fp, contents) =>
242
+ // target[prop](
243
+ // `suite-${suite}/given-${given}/when/beforeEach/${fp}`,
244
+ // contents
245
+ // );
246
+ // }
247
+ // if (prop === "customScreenShot") {
248
+ // return (opts, p) =>
249
+ // target.customScreenShot(
250
+ // {
251
+ // ...opts,
252
+ // path: `suite-${suite}/given-${given}/when/beforeEach/${opts.path}`,
253
+ // },
254
+ // p
255
+ // );
256
+ // }
257
+ // if (prop === "screencast") {
258
+ // return (opts, p) =>
259
+ // target.screencast(
260
+ // {
261
+ // ...opts,
262
+ // path: `suite-${suite}/given-${given}/when/beforeEach/${opts.path}`,
263
+ // },
264
+ // p
265
+ // );
266
+ // }
267
+ // /* @ts-ignore:next-line */
268
+ // return Reflect.get(...arguments);
269
+ // },
270
+ // });
271
+ // };
272
+ // export const afterAllProxy = (pm: IPM, suite: string): IPM => {
273
+ // return new Proxy(pm, {
274
+ // get(target, prop, receiver) {
275
+ // if (prop === "customScreenShot") {
276
+ // return (opts, p) =>
277
+ // target.customScreenShot(
278
+ // {
279
+ // ...opts,
280
+ // // path: `${filepath}/${opts.path}`,
281
+ // path: `suite-${suite}/afterAll/${opts.path}`,
282
+ // },
283
+ // p
284
+ // );
285
+ // }
286
+ // if (prop === "writeFileSync") {
287
+ // return (fp, contents) =>
288
+ // target[prop](`suite-${suite}/afterAll/${fp}`, contents);
289
+ // }
290
+ // /* @ts-ignore:next-line */
291
+ // return Reflect.get(...arguments);
292
+ // },
293
+ // });
294
+ // };