testeranto 0.173.0 → 0.177.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 (145) hide show
  1. package/dist/common/src/PM/base.js +5 -5
  2. package/dist/common/src/PM/main.js +48 -52
  3. package/dist/common/src/PM/node.js +4 -1
  4. package/dist/common/src/PM/pure.js +4 -1
  5. package/dist/common/src/PM/web.js +4 -1
  6. package/dist/common/src/Pure.js +0 -4
  7. package/dist/common/src/Pure.test.js +1 -1
  8. package/dist/common/src/ReportServerLib.js +11 -5
  9. package/dist/common/src/esbuildConfigs/node.js +1 -3
  10. package/dist/common/src/lib/BaseSuite.js +13 -11
  11. package/dist/common/src/lib/abstractBase.js +39 -42
  12. package/dist/common/src/lib/basebuilder.js +5 -0
  13. package/dist/common/src/lib/core.js +1 -0
  14. package/dist/common/src/lib/pmProxy.js +210 -100
  15. package/dist/common/src/lib/pmProxy.test/adapter.js +2 -2
  16. package/dist/common/src/lib/pmProxy.test/implementation.js +1 -1
  17. package/dist/common/testeranto.config.js +39 -39
  18. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  19. package/dist/module/src/PM/base.js +5 -5
  20. package/dist/module/src/PM/main.js +13 -17
  21. package/dist/module/src/PM/node.js +4 -1
  22. package/dist/module/src/PM/pure.js +4 -1
  23. package/dist/module/src/PM/web.js +4 -1
  24. package/dist/module/src/Pure.js +0 -4
  25. package/dist/module/src/Pure.test.js +1 -1
  26. package/dist/module/src/ReportServerLib.js +11 -5
  27. package/dist/module/src/esbuildConfigs/node.js +1 -3
  28. package/dist/module/src/lib/BaseSuite.js +13 -11
  29. package/dist/module/src/lib/abstractBase.js +39 -42
  30. package/dist/module/src/lib/basebuilder.js +5 -0
  31. package/dist/module/src/lib/core.js +1 -0
  32. package/dist/module/src/lib/pmProxy.js +210 -100
  33. package/dist/module/src/lib/pmProxy.test/adapter.js +2 -2
  34. package/dist/module/src/lib/pmProxy.test/implementation.js +1 -1
  35. package/dist/module/testeranto.config.js +39 -39
  36. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  37. package/dist/prebuild/ReportServer.mjs +10 -4
  38. package/dist/prebuild/build.mjs +1 -1
  39. package/dist/prebuild/run.mjs +19 -22
  40. package/dist/types/src/PM/base.d.ts +1 -1
  41. package/dist/types/src/PM/node.d.ts +1 -1
  42. package/dist/types/src/PM/pure.d.ts +1 -1
  43. package/dist/types/src/PM/web.d.ts +1 -1
  44. package/dist/types/src/ReportServerLib.d.ts +1 -2
  45. package/dist/types/src/lib/BaseSuite.d.ts +2 -0
  46. package/dist/types/src/lib/abstractBase.d.ts +4 -6
  47. package/dist/types/src/lib/pmProxy.d.ts +3 -3
  48. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  49. package/package.json +2 -2
  50. package/src/PM/base.ts +6 -9
  51. package/src/PM/main.ts +17 -20
  52. package/src/PM/node.ts +6 -1
  53. package/src/PM/pure.ts +6 -1
  54. package/src/PM/web.ts +5 -1
  55. package/src/Pure.test.ts +6 -6
  56. package/src/Pure.ts +0 -8
  57. package/src/ReportServerLib.ts +10 -7
  58. package/src/esbuildConfigs/node.ts +1 -1
  59. package/src/lib/BaseSuite.ts +16 -21
  60. package/src/lib/abstractBase.ts +57 -49
  61. package/src/lib/basebuilder.ts +6 -0
  62. package/src/lib/core.ts +1 -0
  63. package/src/lib/pmProxy.test/adapter.ts +2 -2
  64. package/src/lib/pmProxy.test/implementation.ts +3 -3
  65. package/src/lib/pmProxy.test/types.ts +0 -2
  66. package/src/lib/pmProxy.ts +224 -92
  67. package/testeranto/bundles/node/core/metafile.json +2 -480
  68. package/testeranto/bundles/pure/core/metafile.json +3 -621
  69. package/testeranto/bundles/web/core/metafile.json +14384 -78
  70. package/testeranto/bundles/web/core/src/{lib/baseBuilder.test/baseBuilder.test.web.html → components/pure/ProjectPageView.test/index.html} +2 -2
  71. package/testeranto/bundles/web/core/src/components/pure/ProjectPageView.test/index.mjs +39991 -0
  72. package/testeranto/projects.json +0 -1
  73. package/testeranto/reports/core/config.json +5 -5
  74. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +18 -0
  75. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/logs.txt +59 -0
  76. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/message.txt +2 -0
  77. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/prompt.txt +27 -0
  78. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/suite-0/given-basicRender/then-0/butThen/happyPath.png +0 -0
  79. package/testeranto/reports/{staticSite/src/ReportServer.test.ts/index/node → core/src/components/pure/ProjectPageView.test/index/web}/type_errors.txt +20 -22
  80. package/testeranto/reports/core/summary.json +5 -19
  81. package/testeranto.config.ts +39 -39
  82. package/tsc.log +78 -92
  83. package/testeranto/bundles/node/allTests/metafile.json +0 -486
  84. package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +0 -1182
  85. package/testeranto/bundles/node/core/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +0 -1182
  86. package/testeranto/bundles/node/staticSite/metafile.json +0 -593
  87. package/testeranto/bundles/node/staticSite/src/ReportServer.test.ts/index.mjs +0 -1594
  88. package/testeranto/bundles/pure/allTests/metafile.json +0 -626
  89. package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +0 -1094
  90. package/testeranto/bundles/pure/core/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +0 -1094
  91. package/testeranto/bundles/pure/staticSite/metafile.json +0 -8
  92. package/testeranto/bundles/web/allTests/metafile.json +0 -780
  93. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.html +0 -19
  94. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +0 -1092
  95. package/testeranto/bundles/web/core/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +0 -1092
  96. package/testeranto/bundles/web/staticSite/metafile.json +0 -8
  97. package/testeranto/reports/allTests/config.json +0 -40
  98. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/bdd_errors.txt +0 -1
  99. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +0 -2
  100. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +0 -33
  101. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/message.txt +0 -2
  102. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +0 -26
  103. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
  104. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +0 -69
  105. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +0 -74
  106. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +0 -2
  107. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message.txt +0 -2
  108. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +0 -26
  109. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +0 -74
  110. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/bdd_errors.txt +0 -1
  111. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +0 -2
  112. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +0 -63
  113. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/message.txt +0 -2
  114. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +0 -26
  115. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
  116. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +0 -69
  117. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +0 -74
  118. package/testeranto/reports/allTests/summary.json +0 -23
  119. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/bdd_errors.txt +0 -1
  120. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +0 -2
  121. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +0 -32
  122. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/message.txt +0 -2
  123. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +0 -26
  124. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
  125. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +0 -69
  126. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +0 -74
  127. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +0 -2
  128. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message.txt +0 -2
  129. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +0 -26
  130. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +0 -74
  131. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/bdd_errors.txt +0 -1
  132. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +0 -2
  133. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +0 -61
  134. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/message.txt +0 -2
  135. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +0 -26
  136. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +0 -1
  137. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +0 -69
  138. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +0 -74
  139. package/testeranto/reports/staticSite/config.json +0 -24
  140. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/lint_errors.txt +0 -5
  141. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/logs.txt +0 -44
  142. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/message.txt +0 -2
  143. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/prompt.txt +0 -23
  144. package/testeranto/reports/staticSite/summary.json +0 -9
  145. package/testeranto/reportsnode_build_errors +0 -17
@@ -6,10 +6,9 @@ exports.BaseThen = exports.BaseWhen = exports.BaseGiven = void 0;
6
6
  const pmProxy_js_1 = require("./pmProxy.js");
7
7
  class BaseGiven {
8
8
  addArtifact(path) {
9
- console.log(`[Artifact] Adding to ${this.constructor.name}:`, path);
10
- // console.log("mark111");
11
- // process.exit();
12
- this.artifacts.push(path);
9
+ console.log("Given addArtifact", path);
10
+ const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
11
+ this.artifacts.push(normalizedPath);
13
12
  }
14
13
  constructor(name, features, whens, thens, givenCB, initialValues) {
15
14
  this.artifacts = [];
@@ -30,7 +29,7 @@ class BaseGiven {
30
29
  whens: this.whens.map((w) => {
31
30
  if (w && w.toObj)
32
31
  return w.toObj();
33
- console.error("w is not as expected!", w.toString());
32
+ console.error("w is not as expected!", JSON.stringify(w));
34
33
  return {};
35
34
  }),
36
35
  thens: this.thens.map((t) => t.toObj()),
@@ -54,15 +53,13 @@ class BaseGiven {
54
53
  tLog(e.stack);
55
54
  });
56
55
  try {
57
- const proxiedPm = (0, pmProxy_js_1.beforeEachProxy)(pm, suiteNdx.toString());
58
- console.log(`[Given] Setting currentStep for beforeEach:`, this.name);
59
- proxiedPm.currentStep = this;
56
+ const proxiedPm = (0, pmProxy_js_1.beforeEachProxy)(pm, suiteNdx.toString(), this.addArtifact.bind(this));
60
57
  this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues, proxiedPm);
61
58
  }
62
59
  catch (e) {
63
- console.error("Given failure: ", e.toString());
64
- this.error = e;
65
- throw e;
60
+ // console.error("Given failure: ", e.stack);
61
+ this.error = e.stack;
62
+ // throw e;
66
63
  }
67
64
  try {
68
65
  // tLog(`\n Given this.store`, this.store);
@@ -72,9 +69,6 @@ class BaseGiven {
72
69
  for (const [thenNdx, thenStep] of this.thens.entries()) {
73
70
  const t = await thenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
74
71
  tester(t);
75
- // ((t) => {
76
- // return tester(t);
77
- // })();
78
72
  }
79
73
  }
80
74
  catch (e) {
@@ -84,10 +78,11 @@ class BaseGiven {
84
78
  }
85
79
  finally {
86
80
  try {
87
- await this.afterEach(this.store, this.key, givenArtifactory, (0, pmProxy_js_1.afterEachProxy)(pm, suiteNdx.toString(), key));
81
+ const proxiedPm = (0, pmProxy_js_1.afterEachProxy)(pm, suiteNdx.toString(), key, this.addArtifact.bind(this));
82
+ // (proxiedPm as any).currentStep = this;
83
+ await this.afterEach(this.store, this.key, givenArtifactory, proxiedPm);
88
84
  }
89
85
  catch (e) {
90
- console.error("afterEach failed!", e.toString());
91
86
  this.failed = e;
92
87
  throw e;
93
88
  // this.error = e.message;
@@ -98,36 +93,33 @@ class BaseGiven {
98
93
  }
99
94
  exports.BaseGiven = BaseGiven;
100
95
  class BaseWhen {
96
+ addArtifact(path) {
97
+ console.log("When addArtifact", path);
98
+ const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
99
+ this.artifacts.push(normalizedPath);
100
+ }
101
101
  constructor(name, whenCB) {
102
102
  this.artifacts = [];
103
103
  this.name = name;
104
104
  this.whenCB = whenCB;
105
105
  }
106
106
  toObj() {
107
- console.log("toObj error", this.error);
108
- if (this.error) {
109
- return {
110
- name: this.name,
111
- error: this.error && this.error.name + this.error.stack,
112
- artifacts: this.artifacts,
113
- };
114
- }
115
- else {
116
- return {
117
- name: this.name,
118
- artifacts: this.artifacts,
119
- };
120
- }
107
+ const obj = {
108
+ name: this.name,
109
+ error: this.error
110
+ ? `${this.error.name}: ${this.error.message}\n${this.error.stack}`
111
+ : null,
112
+ artifacts: this.artifacts || [],
113
+ };
114
+ console.log(`[TOOBJ] Serializing ${this.constructor.name} with artifacts:`, obj.artifacts);
115
+ return obj;
121
116
  }
122
117
  async test(store, testResourceConfiguration, tLog, pm, filepath) {
123
118
  try {
124
- tLog(" When:", this.name);
125
- console.debug("[DEBUG] Executing When step:", this.name.toString());
126
- const proxiedPm = (0, pmProxy_js_1.andWhenProxy)(pm, filepath);
127
- console.log(`[When] Setting currentStep for andWhen:`, this.name);
128
- proxiedPm.currentStep = this;
119
+ // tLog(" When:", this.name);
120
+ const proxiedPm = (0, pmProxy_js_1.andWhenProxy)(pm, filepath, this.addArtifact.bind(this));
121
+ // (proxiedPm as any).currentStep = this;
129
122
  const result = await this.andWhen(store, this.whenCB, testResourceConfiguration, proxiedPm);
130
- console.debug("[DEBUG] When step completed:", this.name.toString());
131
123
  return result;
132
124
  }
133
125
  catch (e) {
@@ -144,18 +136,23 @@ class BaseThen {
144
136
  this.name = name;
145
137
  this.thenCB = thenCB;
146
138
  this.error = false;
139
+ this.artifacts = [];
140
+ }
141
+ addArtifact(path) {
142
+ console.log("Then addArtifact", path);
143
+ const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
144
+ this.artifacts.push(normalizedPath);
147
145
  }
148
146
  toObj() {
149
- return {
147
+ const obj = {
150
148
  name: this.name,
151
149
  error: this.error,
152
150
  artifacts: this.artifacts,
153
151
  };
152
+ return obj;
154
153
  }
155
154
  async test(store, testResourceConfiguration, tLog, pm, filepath) {
156
- const proxiedPm = (0, pmProxy_js_1.butThenProxy)(pm, filepath);
157
- console.log(`[Then] Setting currentStep for butThen:`, this.name);
158
- proxiedPm.currentStep = this;
155
+ const proxiedPm = (0, pmProxy_js_1.butThenProxy)(pm, filepath, this.addArtifact.bind(this));
159
156
  return this.butThen(store, async (s) => {
160
157
  if (typeof this.thenCB === "function") {
161
158
  return await this.thenCB(s, proxiedPm);
@@ -163,8 +160,8 @@ class BaseThen {
163
160
  else {
164
161
  return this.thenCB;
165
162
  }
166
- }, testResourceConfiguration, (0, pmProxy_js_1.butThenProxy)(pm, filepath)).catch((e) => {
167
- this.error = e.toString();
163
+ }, testResourceConfiguration, proxiedPm).catch((e) => {
164
+ this.error = e.stack;
168
165
  // throw e;
169
166
  });
170
167
  }
@@ -18,9 +18,11 @@ class BaseBuilder {
18
18
  this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then());
19
19
  this.testJobs = this.specs.map((suite) => {
20
20
  const suiteRunner = (suite) => async (puppetMaster, tLog) => {
21
+ console.log("mark17");
21
22
  const x = await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
22
23
  this.artifacts.push(p);
23
24
  })(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
25
+ console.log("mark18");
24
26
  return x;
25
27
  };
26
28
  const runner = suiteRunner(suite);
@@ -39,7 +41,9 @@ class BaseBuilder {
39
41
  const tLog = async (...l) => {
40
42
  //
41
43
  };
44
+ console.log("mark14");
42
45
  const suiteDone = await runner(puppetMaster, tLog);
46
+ console.log("mark15");
43
47
  // const logPromise = new Promise(async (res) => {
44
48
  // await puppetMaster.end(access);
45
49
  // res(true);
@@ -53,6 +57,7 @@ class BaseBuilder {
53
57
  `tests.json`,
54
58
  JSON.stringify(this.toObj(), null, 2),
55
59
  ]);
60
+ console.log("mark13");
56
61
  return {
57
62
  failed: fails > 0,
58
63
  fails,
@@ -28,6 +28,7 @@ class TesterantoCore extends classBuilder_js_1.ClassBuilder {
28
28
  this.uberCatcher = uberCatcher;
29
29
  }
30
30
  async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
31
+ console.log("mark800");
31
32
  return fullAdapter.beforeEach(subject, initializer, testResource, initialValues, pm);
32
33
  }
33
34
  afterEach(store, key, artifactory, pm) {
@@ -17,14 +17,26 @@ const baseProxy = function (pm, mappings) {
17
17
  },
18
18
  });
19
19
  };
20
- const butThenProxy = (pm, filepath) => {
20
+ const butThenProxy = (pm, filepath, addArtifact) => {
21
21
  return baseProxy(pm, [
22
22
  [
23
23
  "screencast",
24
24
  (opts, p) => {
25
- var _a, _b;
26
25
  const path = `${filepath}/butThen/${opts.path}`;
27
- (_b = (_a = pm.currentStep) === null || _a === void 0 ? void 0 : _a.artifacts) === null || _b === void 0 ? void 0 : _b.push(path);
26
+ addArtifact(path);
27
+ // console.log(
28
+ // `[ARTIFACT] Preparing to add to ${step.constructor.name}:`,
29
+ // path
30
+ // );
31
+ // try {
32
+ // console.log(
33
+ // `[ARTIFACT] Successfully added to ${step.constructor.name}`
34
+ // );
35
+ // console.log(`[ARTIFACT] Current artifacts:`, JSON.stringify(step.artifacts));
36
+ // } catch (e) {
37
+ // console.error(`[ARTIFACT] Failed to add ${path}:`, e);
38
+ // throw e;
39
+ // }
28
40
  return [
29
41
  Object.assign(Object.assign({}, opts), { path }),
30
42
  p,
@@ -34,27 +46,24 @@ const butThenProxy = (pm, filepath) => {
34
46
  [
35
47
  "createWriteStream",
36
48
  (fp) => {
37
- var _a, _b;
38
49
  const path = `${filepath}/butThen/${fp}`;
39
- (_b = (_a = pm.currentStep) === null || _a === void 0 ? void 0 : _a.artifacts) === null || _b === void 0 ? void 0 : _b.push(path);
50
+ addArtifact(path);
40
51
  return [path];
41
52
  },
42
53
  ],
43
54
  [
44
55
  "writeFileSync",
45
56
  (fp, contents) => {
46
- var _a, _b;
47
57
  const path = `${filepath}/butThen/${fp}`;
48
- (_b = (_a = pm.currentStep) === null || _a === void 0 ? void 0 : _a.artifacts) === null || _b === void 0 ? void 0 : _b.push(path);
58
+ addArtifact(path);
49
59
  return [path, contents];
50
60
  },
51
61
  ],
52
62
  [
53
63
  "customScreenShot",
54
64
  (opts, p) => {
55
- var _a, _b;
56
65
  const path = `${filepath}/butThen/${opts.path}`;
57
- (_b = (_a = pm.currentStep) === null || _a === void 0 ? void 0 : _a.artifacts) === null || _b === void 0 ? void 0 : _b.push(path);
66
+ addArtifact(path);
58
67
  return [
59
68
  Object.assign(Object.assign({}, opts), { path }),
60
69
  p,
@@ -64,99 +73,200 @@ const butThenProxy = (pm, filepath) => {
64
73
  ]);
65
74
  };
66
75
  exports.butThenProxy = butThenProxy;
67
- const andWhenProxy = (pm, filepath) => baseProxy(pm, [
68
- [
69
- "screencast",
70
- (opts, p) => [
71
- Object.assign(Object.assign({}, opts), { path: `${filepath}/andWhen/${opts.path}` }),
72
- p,
73
- ],
74
- ],
75
- ["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
76
- ["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
77
- [
78
- "customScreenShot",
79
- (opts, p) => [
80
- Object.assign(Object.assign({}, opts), { path: `${filepath}/andWhen${opts.path}` }),
81
- p,
82
- ],
83
- ],
84
- ]);
76
+ const andWhenProxy = (pm, filepath, addArtifact) => {
77
+ return baseProxy(pm, [
78
+ [
79
+ "screencast",
80
+ (opts, p) => {
81
+ const path = `${filepath}/andWhen/${opts.path}`;
82
+ addArtifact(path);
83
+ return [
84
+ Object.assign(Object.assign({}, opts), { path }),
85
+ p,
86
+ ];
87
+ },
88
+ ],
89
+ [
90
+ "createWriteStream",
91
+ (fp) => {
92
+ const path = `${filepath}/andWhen/${fp}`;
93
+ addArtifact(path);
94
+ return [path];
95
+ },
96
+ ],
97
+ [
98
+ "writeFileSync",
99
+ (fp, contents) => {
100
+ const path = `${filepath}/andWhen/${fp}`;
101
+ addArtifact(path);
102
+ return [path, contents];
103
+ },
104
+ ],
105
+ [
106
+ "customScreenShot",
107
+ (opts, p) => {
108
+ const path = `${filepath}/andWhen/${opts.path}`;
109
+ // console.log("STEP2", JSON.stringify(step));
110
+ addArtifact(path);
111
+ return [
112
+ Object.assign(Object.assign({}, opts), { path }),
113
+ p,
114
+ ];
115
+ },
116
+ ],
117
+ ]);
118
+ };
85
119
  exports.andWhenProxy = andWhenProxy;
86
- const afterEachProxy = (pm, suite, given) => baseProxy(pm, [
87
- [
88
- "screencast",
89
- (opts, p) => [
90
- Object.assign(Object.assign({}, opts), { path: `suite-${suite}/given-${given}/afterEach/${opts.path}` }),
91
- p,
92
- ],
93
- ],
94
- ["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
95
- [
96
- "writeFileSync",
97
- (fp, contents) => [
98
- `suite-${suite}/given-${given}/afterEach/${fp}`,
99
- contents,
100
- ],
101
- ],
102
- [
103
- "customScreenShot",
104
- (opts, p) => [
105
- Object.assign(Object.assign({}, opts), { path: `suite-${suite}/given-${given}/afterEach/${opts.path}` }),
106
- p,
107
- ],
108
- ],
109
- ]);
120
+ const afterEachProxy = (pm, suite, given, addArtifact) => {
121
+ return baseProxy(pm, [
122
+ [
123
+ "screencast",
124
+ (opts, p) => {
125
+ const path = `suite-${suite}/given-${given}/afterEach/${opts.path}`;
126
+ addArtifact(path);
127
+ return [
128
+ Object.assign(Object.assign({}, opts), { path }),
129
+ p,
130
+ ];
131
+ },
132
+ ],
133
+ [
134
+ "createWriteStream",
135
+ (fp) => {
136
+ const path = `suite-${suite}/afterEach/${fp}`;
137
+ addArtifact(path);
138
+ return [path];
139
+ },
140
+ ],
141
+ [
142
+ "writeFileSync",
143
+ (fp, contents) => {
144
+ const path = `suite-${suite}/given-${given}/afterEach/${fp}`;
145
+ addArtifact(path);
146
+ return [path, contents];
147
+ },
148
+ ],
149
+ [
150
+ "customScreenShot",
151
+ (opts, p) => {
152
+ const path = `suite-${suite}/given-${given}/afterEach/${opts.path}`;
153
+ addArtifact(path);
154
+ // console.log("STEP3", JSON.stringify(step));
155
+ return [
156
+ Object.assign(Object.assign({}, opts), { path }),
157
+ p,
158
+ ];
159
+ },
160
+ ],
161
+ ]);
162
+ };
110
163
  exports.afterEachProxy = afterEachProxy;
111
- const beforeEachProxy = (pm, suite) => baseProxy(pm, [
112
- [
113
- "screencast",
114
- (opts, p) => [
115
- Object.assign(Object.assign({}, opts), { path: `suite-${suite}/beforeEach/${opts.path}` }),
116
- p,
117
- ],
118
- ],
119
- [
120
- "writeFileSync",
121
- (fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents],
122
- ],
123
- [
124
- "customScreenShot",
125
- (opts, p) => [
126
- Object.assign(Object.assign({}, opts), { path: `suite-${suite}/beforeEach/${opts.path}` }),
127
- p,
128
- ],
129
- ],
130
- ["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]],
131
- ]);
164
+ const beforeEachProxy = (pm, suite, addArtifact) => {
165
+ return baseProxy(pm, [
166
+ [
167
+ "screencast",
168
+ (opts, p) => {
169
+ const path = `suite-${suite}/beforeEach/${opts.path}`;
170
+ addArtifact(path);
171
+ return [
172
+ Object.assign(Object.assign({}, opts), { path }),
173
+ p,
174
+ ];
175
+ },
176
+ ],
177
+ [
178
+ "writeFileSync",
179
+ (fp, contents) => {
180
+ const path = `suite-${suite}/beforeEach/${fp}`;
181
+ addArtifact(path);
182
+ return [path, contents];
183
+ },
184
+ ],
185
+ [
186
+ "customScreenShot",
187
+ (opts, p) => {
188
+ const path = `suite-${suite}/beforeEach/${opts.path}`;
189
+ addArtifact(path);
190
+ return [
191
+ Object.assign(Object.assign({}, opts), { path }),
192
+ p,
193
+ ];
194
+ },
195
+ ],
196
+ [
197
+ "createWriteStream",
198
+ (fp) => {
199
+ const path = `suite-${suite}/beforeEach/${fp}`;
200
+ addArtifact(path);
201
+ return [path];
202
+ },
203
+ ],
204
+ ]);
205
+ };
132
206
  exports.beforeEachProxy = beforeEachProxy;
133
- const beforeAllProxy = (pm, suite) => baseProxy(pm, [
134
- [
135
- "writeFileSync",
136
- (fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents],
137
- ],
138
- [
139
- "customScreenShot",
140
- (opts, p) => [
141
- Object.assign(Object.assign({}, opts), { path: `suite-${suite}/beforeAll/${opts.path}` }),
142
- p,
143
- ],
144
- ],
145
- ["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]],
146
- ]);
207
+ const beforeAllProxy = (pm, suite, addArtifact) => {
208
+ return baseProxy(pm, [
209
+ [
210
+ "writeFileSync",
211
+ (fp, contents) => {
212
+ const path = `suite-${suite}/beforeAll/${fp}`;
213
+ addArtifact(path);
214
+ return [path, contents];
215
+ },
216
+ ],
217
+ [
218
+ "customScreenShot",
219
+ (opts, p) => {
220
+ const path = `suite-${suite}/beforeAll/${opts.path}`;
221
+ addArtifact(path);
222
+ return [
223
+ Object.assign(Object.assign({}, opts), { path }),
224
+ p,
225
+ ];
226
+ },
227
+ ],
228
+ [
229
+ "createWriteStream",
230
+ (fp) => {
231
+ const path = `suite-${suite}/beforeAll/${fp}`;
232
+ addArtifact(path);
233
+ return [path];
234
+ },
235
+ ],
236
+ ]);
237
+ };
147
238
  exports.beforeAllProxy = beforeAllProxy;
148
- const afterAllProxy = (pm, suite) => baseProxy(pm, [
149
- ["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
150
- [
151
- "writeFileSync",
152
- (fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents],
153
- ],
154
- [
155
- "customScreenShot",
156
- (opts, p) => [
157
- Object.assign(Object.assign({}, opts), { path: `suite-${suite}/afterAll/${opts.path}` }),
158
- p,
159
- ],
160
- ],
161
- ]);
239
+ const afterAllProxy = (pm, suite, addArtifact) => {
240
+ return baseProxy(pm, [
241
+ [
242
+ "createWriteStream",
243
+ (fp) => {
244
+ const path = `suite-${suite}/afterAll/${fp}`;
245
+ addArtifact(path);
246
+ return [path];
247
+ },
248
+ ],
249
+ [
250
+ "writeFileSync",
251
+ (fp, contents) => {
252
+ const path = `suite-${suite}/afterAll/${fp}`;
253
+ console.log("MARK10");
254
+ addArtifact(path);
255
+ return [path, contents];
256
+ },
257
+ ],
258
+ [
259
+ "customScreenShot",
260
+ (opts, p) => {
261
+ const path = `suite-${suite}/afterAll/${opts.path}`;
262
+ addArtifact(path);
263
+ console.log("MARK9");
264
+ return [
265
+ Object.assign(Object.assign({}, opts), { path }),
266
+ p,
267
+ ];
268
+ },
269
+ ],
270
+ ]);
271
+ };
162
272
  exports.afterAllProxy = afterAllProxy;
@@ -18,11 +18,11 @@ exports.testAdapter = {
18
18
  // };
19
19
  },
20
20
  andWhen: async (store, whenCB, testResource, pm) => {
21
- const proxiedPM = (0, pmProxy_1.andWhenProxy)(pm, "some/path");
21
+ const proxiedPM = (0, pmProxy_1.andWhenProxy)(pm, "some/path", store);
22
22
  return whenCB(store, proxiedPM);
23
23
  },
24
24
  butThen: async (store, thenCB, testResource, pm) => {
25
- const proxiedPM = (0, pmProxy_1.butThenProxy)(pm, "some/path");
25
+ const proxiedPM = (0, pmProxy_1.butThenProxy)(pm, "some/path", store);
26
26
  return thenCB(store, proxiedPM);
27
27
  },
28
28
  afterEach: async (store, key, pm) => store,
@@ -17,7 +17,7 @@ exports.implementation = {
17
17
  var _a, _b, _c, _d, _e, _f, _g, _h;
18
18
  const mockPm = new mockPMBase_1.MockPMBase();
19
19
  const filepath = "test/path";
20
- const proxiedPm = store.butThenProxy(mockPm, filepath);
20
+ const rewritePath = createPathRewriter(`${filepath}/butThen`);
21
21
  let actualPath;
22
22
  let actualContent;
23
23
  try {