testeranto 0.146.1 → 0.146.4

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 (198) hide show
  1. package/README.md +3 -1
  2. package/dist/common/src/Node.js +9 -6
  3. package/dist/common/src/PM/PM_WithEslintAndTsc.js +75 -58
  4. package/dist/common/src/PM/main.js +131 -79
  5. package/dist/common/src/PM/node.js +1 -14
  6. package/dist/common/src/PM/nodeSidecar.js +0 -1
  7. package/dist/common/src/Pure.js +17 -1
  8. package/dist/common/src/Pure.test.js +172 -0
  9. package/dist/common/src/build.js +0 -1
  10. package/dist/common/src/esbuildConfigs/consoleDetectorPlugin.js +22 -11
  11. package/dist/common/src/esbuildConfigs/nativeImportDetectorPlugin.js +24 -0
  12. package/dist/common/src/esbuildConfigs/pure.js +2 -1
  13. package/dist/common/src/esbuildConfigs/rebuildPlugin.js +1 -4
  14. package/dist/common/src/lib/BaseSuite.js +89 -0
  15. package/dist/common/src/lib/BaseSuite.test/node.test.js +9 -0
  16. package/dist/common/src/lib/BaseSuite.test/pure.test.js +9 -0
  17. package/dist/common/src/lib/BaseSuite.test/test.js +232 -0
  18. package/dist/common/src/lib/BaseSuite.test/web.test.js +9 -0
  19. package/dist/common/src/lib/abstractBase.js +1 -90
  20. package/dist/common/src/lib/abstractBase.test/MockGiven.js +17 -0
  21. package/dist/common/src/lib/abstractBase.test/MockThen.js +13 -0
  22. package/dist/common/src/lib/abstractBase.test/MockWhen.js +13 -0
  23. package/dist/common/src/lib/abstractBase.test/implementation.js +42 -0
  24. package/dist/common/src/lib/abstractBase.test/index.js +17 -0
  25. package/dist/common/src/lib/abstractBase.test/interface.js +12 -0
  26. package/dist/common/src/lib/abstractBase.test/specification.js +19 -0
  27. package/dist/common/src/lib/abstractBase.test/types.js +2 -0
  28. package/dist/common/src/lib/baseBuilder.test/TestBaseBuilder.js +36 -0
  29. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.implementation.js +97 -0
  30. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.interface.js +17 -0
  31. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.node.js +11 -0
  32. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.pure.js +11 -0
  33. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.specification.js +13 -0
  34. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.types.js +2 -0
  35. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.web.js +11 -0
  36. package/dist/common/src/lib/basebuilder.js +2 -1
  37. package/dist/common/src/lib/classBuilder.test/TestClassBuilder.js +41 -0
  38. package/dist/common/src/lib/classBuilder.test/classBuilder.test.implementation.js +182 -0
  39. package/dist/common/src/lib/classBuilder.test/classBuilder.test.interface.js +17 -0
  40. package/dist/common/src/lib/classBuilder.test/classBuilder.test.js +11 -0
  41. package/dist/common/src/lib/classBuilder.test/classBuilder.test.specification.js +41 -0
  42. package/dist/common/src/lib/classBuilder.test/classBuilder.test.types.js +2 -0
  43. package/dist/common/src/lib/core.js +4 -13
  44. package/dist/common/src/lib/core.test/MockCore.js +25 -0
  45. package/dist/common/src/lib/core.test/core.test.implementation.js +102 -0
  46. package/dist/common/src/lib/core.test/core.test.interface.js +18 -0
  47. package/dist/common/src/lib/core.test/core.test.js +17 -0
  48. package/dist/common/src/lib/core.test/core.test.specification.js +33 -0
  49. package/dist/common/src/lib/core.test/core.test.types.js +2 -0
  50. package/dist/common/src/lib/pmProxy.js +9 -166
  51. package/dist/common/src/lib/pmProxy.test/implementation.js +76 -0
  52. package/dist/common/src/lib/pmProxy.test/index.js +15 -0
  53. package/dist/common/src/lib/pmProxy.test/interface.js +37 -0
  54. package/dist/common/src/lib/pmProxy.test/mockPM.js +34 -0
  55. package/dist/common/src/lib/pmProxy.test/mockPMBase.js +115 -0
  56. package/dist/common/src/lib/pmProxy.test/specification.js +39 -0
  57. package/dist/common/src/lib/pmProxy.test/types.js +2 -0
  58. package/dist/common/src/run.js +6 -6
  59. package/dist/common/testeranto.config.js +33 -18
  60. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  61. package/dist/module/src/Node.js +9 -6
  62. package/dist/module/src/PM/PM_WithEslintAndTsc.js +75 -58
  63. package/dist/module/src/PM/main.js +131 -79
  64. package/dist/module/src/PM/node.js +1 -14
  65. package/dist/module/src/PM/nodeSidecar.js +0 -1
  66. package/dist/module/src/Pure.js +17 -1
  67. package/dist/module/src/Pure.test.js +167 -0
  68. package/dist/module/src/build.js +0 -1
  69. package/dist/module/src/esbuildConfigs/consoleDetectorPlugin.js +19 -11
  70. package/dist/module/src/esbuildConfigs/nativeImportDetectorPlugin.js +21 -0
  71. package/dist/module/src/esbuildConfigs/pure.js +2 -1
  72. package/dist/module/src/esbuildConfigs/rebuildPlugin.js +1 -4
  73. package/dist/module/src/lib/BaseSuite.js +85 -0
  74. package/dist/module/src/lib/BaseSuite.test/node.test.js +4 -0
  75. package/dist/module/src/lib/BaseSuite.test/pure.test.js +4 -0
  76. package/dist/module/src/lib/BaseSuite.test/test.js +227 -0
  77. package/dist/module/src/lib/BaseSuite.test/web.test.js +4 -0
  78. package/dist/module/src/lib/abstractBase.js +1 -89
  79. package/dist/module/src/lib/abstractBase.test/MockGiven.js +13 -0
  80. package/dist/module/src/lib/abstractBase.test/MockThen.js +9 -0
  81. package/dist/module/src/lib/abstractBase.test/MockWhen.js +9 -0
  82. package/dist/module/src/lib/abstractBase.test/implementation.js +39 -0
  83. package/dist/module/src/lib/abstractBase.test/index.js +12 -0
  84. package/dist/module/src/lib/abstractBase.test/interface.js +9 -0
  85. package/dist/module/src/lib/abstractBase.test/specification.js +15 -0
  86. package/dist/module/src/lib/abstractBase.test/types.js +1 -0
  87. package/dist/module/src/lib/baseBuilder.test/TestBaseBuilder.js +32 -0
  88. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.implementation.js +94 -0
  89. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.interface.js +14 -0
  90. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.node.js +6 -0
  91. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.pure.js +6 -0
  92. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.specification.js +9 -0
  93. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.types.js +1 -0
  94. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.web.js +6 -0
  95. package/dist/module/src/lib/basebuilder.js +2 -1
  96. package/dist/module/src/lib/classBuilder.test/TestClassBuilder.js +37 -0
  97. package/dist/module/src/lib/classBuilder.test/classBuilder.test.implementation.js +179 -0
  98. package/dist/module/src/lib/classBuilder.test/classBuilder.test.interface.js +14 -0
  99. package/dist/module/src/lib/classBuilder.test/classBuilder.test.js +6 -0
  100. package/dist/module/src/lib/classBuilder.test/classBuilder.test.specification.js +37 -0
  101. package/dist/module/src/lib/classBuilder.test/classBuilder.test.types.js +1 -0
  102. package/dist/module/src/lib/core.js +3 -12
  103. package/dist/module/src/lib/core.test/MockCore.js +18 -0
  104. package/dist/module/src/lib/core.test/core.test.implementation.js +99 -0
  105. package/dist/module/src/lib/core.test/core.test.interface.js +15 -0
  106. package/dist/module/src/lib/core.test/core.test.js +12 -0
  107. package/dist/module/src/lib/core.test/core.test.specification.js +29 -0
  108. package/dist/module/src/lib/core.test/core.test.types.js +1 -0
  109. package/dist/module/src/lib/pmProxy.js +9 -166
  110. package/dist/module/src/lib/pmProxy.test/implementation.js +73 -0
  111. package/dist/module/src/lib/pmProxy.test/index.js +10 -0
  112. package/dist/module/src/lib/pmProxy.test/interface.js +34 -0
  113. package/dist/module/src/lib/pmProxy.test/mockPM.js +30 -0
  114. package/dist/module/src/lib/pmProxy.test/mockPMBase.js +111 -0
  115. package/dist/module/src/lib/pmProxy.test/specification.js +35 -0
  116. package/dist/module/src/lib/pmProxy.test/types.js +1 -0
  117. package/dist/module/src/run.js +6 -6
  118. package/dist/module/testeranto.config.js +33 -18
  119. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  120. package/dist/prebuild/Project.js +16 -15
  121. package/dist/prebuild/TestReport.js +14 -12
  122. package/dist/prebuild/build.mjs +34 -34
  123. package/dist/prebuild/run.mjs +259 -173
  124. package/dist/tsconfig.tsbuildinfo +1 -1
  125. package/dist/types/src/PM/PM_WithEslintAndTsc.d.ts +2 -1
  126. package/dist/types/src/PM/main.d.ts +5 -2
  127. package/dist/types/src/Pure.d.ts +2 -2
  128. package/dist/types/src/Pure.test.d.ts +36 -0
  129. package/dist/types/src/Types.d.ts +7 -6
  130. package/dist/types/src/Web.d.ts +1 -1
  131. package/dist/types/src/esbuildConfigs/consoleDetectorPlugin.d.ts +1 -1
  132. package/dist/types/src/esbuildConfigs/nativeImportDetectorPlugin.d.ts +2 -0
  133. package/dist/types/src/lib/BaseSuite.d.ts +39 -0
  134. package/dist/types/src/lib/BaseSuite.test/node.test.d.ts +3 -0
  135. package/dist/types/src/lib/BaseSuite.test/pure.test.d.ts +3 -0
  136. package/dist/types/src/lib/BaseSuite.test/test.d.ts +42 -0
  137. package/dist/types/src/lib/BaseSuite.test/web.test.d.ts +3 -0
  138. package/dist/types/src/lib/abstractBase.d.ts +1 -36
  139. package/dist/types/src/lib/abstractBase.test/MockGiven.d.ts +7 -0
  140. package/dist/types/src/lib/abstractBase.test/MockThen.d.ts +6 -0
  141. package/dist/types/src/lib/abstractBase.test/MockWhen.d.ts +6 -0
  142. package/dist/types/src/lib/abstractBase.test/implementation.d.ts +3 -0
  143. package/dist/types/src/lib/abstractBase.test/index.d.ts +3 -0
  144. package/dist/types/src/lib/abstractBase.test/interface.d.ts +3 -0
  145. package/dist/types/src/lib/abstractBase.test/specification.d.ts +3 -0
  146. package/dist/types/src/lib/abstractBase.test/types.d.ts +39 -0
  147. package/dist/types/src/lib/baseBuilder.test/TestBaseBuilder.d.ts +15 -0
  148. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.implementation.d.ts +3 -0
  149. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.interface.d.ts +3 -0
  150. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.node.d.ts +3 -0
  151. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.pure.d.ts +3 -0
  152. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.specification.d.ts +3 -0
  153. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.types.d.ts +20 -0
  154. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.web.d.ts +3 -0
  155. package/dist/types/src/lib/classBuilder.test/TestClassBuilder.d.ts +21 -0
  156. package/dist/types/src/lib/classBuilder.test/classBuilder.test.d.ts +3 -0
  157. package/dist/types/src/lib/classBuilder.test/classBuilder.test.implementation.d.ts +3 -0
  158. package/dist/types/src/lib/classBuilder.test/classBuilder.test.interface.d.ts +3 -0
  159. package/dist/types/src/lib/classBuilder.test/classBuilder.test.specification.d.ts +3 -0
  160. package/dist/types/src/lib/classBuilder.test/classBuilder.test.types.d.ts +56 -0
  161. package/dist/types/src/lib/core.d.ts +1 -1
  162. package/dist/types/src/lib/core.test/MockCore.d.ts +10 -0
  163. package/dist/types/src/lib/core.test/core.test.d.ts +3 -0
  164. package/dist/types/src/lib/core.test/core.test.implementation.d.ts +3 -0
  165. package/dist/types/src/lib/core.test/core.test.interface.d.ts +3 -0
  166. package/dist/types/src/lib/core.test/core.test.specification.d.ts +3 -0
  167. package/dist/types/src/lib/core.test/core.test.types.d.ts +46 -0
  168. package/dist/types/src/lib/index.d.ts +2 -1
  169. package/dist/types/src/lib/pmProxy.d.ts +11 -6
  170. package/dist/types/src/lib/pmProxy.test/implementation.d.ts +3 -0
  171. package/dist/types/src/lib/pmProxy.test/index.d.ts +7 -0
  172. package/dist/types/src/lib/pmProxy.test/interface.d.ts +3 -0
  173. package/dist/types/src/lib/pmProxy.test/mockPM.d.ts +10 -0
  174. package/dist/types/src/lib/pmProxy.test/mockPMBase.d.ts +39 -0
  175. package/dist/types/src/lib/pmProxy.test/specification.d.ts +3 -0
  176. package/dist/types/src/lib/pmProxy.test/types.d.ts +42 -0
  177. package/dist/types/src/lib/types.d.ts +2 -1
  178. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  179. package/docs.html +35 -33
  180. package/index.html +23 -30
  181. package/package.json +3 -2
  182. package/testeranto/index.html +1 -1
  183. package/testeranto/reports/allTests/index.html +1 -1
  184. package/testeranto/reports/allTests/src/Pure.test/pure/index.html +1 -1
  185. package/testeranto/reports/allTests/src/Pure.test/pure/logs.txt +2 -2
  186. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/index.html +1 -1
  187. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/index.html +1 -1
  188. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/logs.txt +2 -2
  189. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/index.html +1 -1
  190. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/index.html +1 -1
  191. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/index.html +1 -1
  192. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/index.html +1 -1
  193. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/index.html +1 -1
  194. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/index.html +1 -1
  195. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/index.html +1 -1
  196. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +3 -3
  197. package/testeranto.config.ts +1 -1
  198. package/tsc.log +36 -38
@@ -0,0 +1,172 @@
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 Pure_1 = __importDefault(require("./Pure"));
7
+ const mockPMBase_1 = require("./lib/pmProxy.test/mockPMBase");
8
+ // Implementation for PureTesteranto tests
9
+ const implementation = {
10
+ suites: {
11
+ Default: "PureTesteranto Test Suite",
12
+ },
13
+ givens: {
14
+ Default: () => ({
15
+ pm: new mockPMBase_1.MockPMBase(),
16
+ config: {},
17
+ proxies: {
18
+ butThenProxy: (pm, path) => (Object.assign(Object.assign({}, pm), { writeFileSync: (p, c) => pm.writeFileSync(`${path}/butThen/${p}`, c) })),
19
+ andWhenProxy: (pm, path) => (Object.assign(Object.assign({}, pm), { writeFileSync: (p, c) => pm.writeFileSync(`${path}/andWhen/${p}`, c) })),
20
+ beforeEachProxy: (pm, suite) => (Object.assign(Object.assign({}, pm), { writeFileSync: (p, c) => pm.writeFileSync(`suite-${suite}/beforeEach/${p}`, c) }))
21
+ }
22
+ }),
23
+ },
24
+ whens: {
25
+ applyProxy: (proxyType) => (store) => {
26
+ switch (proxyType) {
27
+ case "invalidConfig":
28
+ throw new Error("Invalid configuration");
29
+ case "missingProxy":
30
+ return Object.assign(Object.assign({}, store), { pm: {} }); // Break proxy chain
31
+ case "largePayload":
32
+ return Object.assign(Object.assign({}, store), { largePayload: true, pm: Object.assign(Object.assign({}, store.pm), { writeFileSync: (p, c) => {
33
+ if (c.length > 1e6) {
34
+ return true;
35
+ }
36
+ throw new Error("Payload too small");
37
+ } }) });
38
+ default:
39
+ return store;
40
+ }
41
+ },
42
+ },
43
+ thens: {
44
+ verifyProxy: (expectedPath) => (store) => {
45
+ var _a;
46
+ const testPath = "expected";
47
+ const result = store.pm.writeFileSync(testPath, "content");
48
+ const actualPath = (_a = store.pm.getLastCall("writeFileSync")) === null || _a === void 0 ? void 0 : _a.path;
49
+ if (actualPath !== expectedPath) {
50
+ throw new Error(`Expected path ${expectedPath}, got ${actualPath}`);
51
+ }
52
+ return store;
53
+ },
54
+ verifyNoProxy: () => (store) => {
55
+ if (store.pm.getCallCount("writeFileSync") > 0) {
56
+ throw new Error("Proxy was unexpectedly applied");
57
+ }
58
+ return store;
59
+ },
60
+ verifyError: (expectedError) => (store) => {
61
+ try {
62
+ store.pm.writeFileSync("test", "content");
63
+ throw new Error("Expected error but none was thrown");
64
+ }
65
+ catch (error) {
66
+ if (!error.message.includes(expectedError)) {
67
+ throw new Error(`Expected error "${expectedError}", got "${error.message}"`);
68
+ }
69
+ }
70
+ return store;
71
+ },
72
+ verifyResourceConfig: () => (store) => {
73
+ if (!store.pm.testResourceConfiguration) {
74
+ throw new Error("Missing test resource configuration");
75
+ }
76
+ return store;
77
+ },
78
+ verifyLargePayload: () => (store) => {
79
+ const largeContent = "x".repeat(2e6); // 2MB payload
80
+ const result = store.pm.writeFileSync("large.txt", largeContent);
81
+ if (!result) {
82
+ throw new Error("Failed to handle large payload");
83
+ }
84
+ return store;
85
+ },
86
+ verifyTypeSafety: () => (store) => {
87
+ // TypeScript will catch these at compile time
88
+ return store;
89
+ },
90
+ },
91
+ checks: {
92
+ Default: () => ({}),
93
+ },
94
+ };
95
+ // Specification for PureTesteranto tests
96
+ const specification = (Suite, Given, When, Then, Check) => [
97
+ Suite.Default("Core Functionality", {
98
+ initializationTest: Given.Default(["Should initialize with default configuration"], [], [Then.verifyNoProxy()]),
99
+ resourceConfigTest: Given.Default(["Should handle test resource configuration"], [When.applyProxy("resourceConfig")], [Then.verifyResourceConfig()]),
100
+ }),
101
+ Suite.Default("Proxy Integration", {
102
+ butThenProxyTest: Given.Default(["Should integrate with butThenProxy"], [When.applyProxy("butThenProxy")], [Then.verifyProxy("test/path/butThen/expected")]),
103
+ andWhenProxyTest: Given.Default(["Should integrate with andWhenProxy"], [When.applyProxy("andWhenProxy")], [Then.verifyProxy("test/path/andWhen/expected")]),
104
+ beforeEachProxyTest: Given.Default(["Should integrate with beforeEachProxy"], [When.applyProxy("beforeEachProxy")], [Then.verifyProxy("suite-1/beforeEach/expected")]),
105
+ }),
106
+ Suite.Default("Error Handling", {
107
+ invalidConfigTest: Given.Default(["Should handle invalid configuration"], [When.applyProxy("invalidConfig")], [Then.verifyError("Invalid configuration")]),
108
+ missingProxyTest: Given.Default(["Should handle missing proxy"], [When.applyProxy("missingProxy")], [Then.verifyError("Proxy not found")]),
109
+ }),
110
+ Suite.Default("Performance", {
111
+ multipleProxiesTest: Given.Default(["Should handle multiple proxies efficiently"], [
112
+ When.applyProxy("butThenProxy"),
113
+ When.applyProxy("andWhenProxy"),
114
+ When.applyProxy("beforeEachProxy")
115
+ ], [
116
+ Then.verifyProxy("test/path/butThen/expected"),
117
+ Then.verifyProxy("test/path/andWhen/expected"),
118
+ Then.verifyProxy("suite-1/beforeEach/expected")
119
+ ]),
120
+ largePayloadTest: Given.Default(["Should handle large payloads"], [When.applyProxy("largePayload")], [Then.verifyLargePayload()]),
121
+ }),
122
+ Suite.Default("Cross-Component Verification", {
123
+ proxyChainTest: Given.Default(["Proxies should chain correctly"], [
124
+ When.applyProxy("butThenProxy"),
125
+ When.applyProxy("andWhenProxy")
126
+ ], [
127
+ Then.verifyProxy("test/path/andWhen/butThen/expected")
128
+ ]),
129
+ errorPropagationTest: Given.Default(["Errors should propagate across components"], [When.applyProxy("invalidConfig")], [Then.verifyError("Invalid configuration")]),
130
+ resourceSharingTest: Given.Default(["Resources should be shared correctly"], [When.applyProxy("resourceConfig")], [Then.verifyResourceConfig()])
131
+ }),
132
+ Suite.Default("Type Safety", {
133
+ strictTypeTest: Given.Default(["Should enforce type safety"], [When.applyProxy("typeSafe")], [Then.verifyTypeSafety()]),
134
+ invalidTypeTest: Given.Default(["Should reject invalid types"], [When.applyProxy("invalidType")], [Then.verifyError("Type mismatch")]),
135
+ }),
136
+ Suite.Default("Integration Tests", {
137
+ // Verify builders work together
138
+ builderIntegration: Given.Default(["BaseBuilder and ClassBuilder should integrate properly"], [], [
139
+ Then.initializedProperly(),
140
+ Then.specsGenerated(),
141
+ Then.jobsCreated(),
142
+ Then.artifactsTracked()
143
+ ]),
144
+ // Verify PM proxy integration
145
+ pmProxyIntegration: Given.Default(["PM proxies should work with test runners"], [When.applyProxy("butThenProxy")], [Then.verifyProxy("test/path/butThen/expected")]),
146
+ // Verify full test lifecycle
147
+ fullLifecycle: Given.Default(["Should complete full test lifecycle"], [
148
+ When.addArtifact(Promise.resolve("test")),
149
+ When.setTestJobs([]),
150
+ When.modifySpecs((specs) => [...specs])
151
+ ], [
152
+ Then.testRunSuccessful(),
153
+ Then.artifactsTracked(),
154
+ Then.specsModified(0)
155
+ ])
156
+ })
157
+ ];
158
+ // Test interface for PureTesteranto
159
+ const testInterface = {
160
+ beforeEach: async (subject, initializer) => {
161
+ return { pm: initializer() };
162
+ },
163
+ andWhen: async (store, whenCB) => whenCB(store),
164
+ butThen: async (store, thenCB) => thenCB(store),
165
+ afterEach: async (store) => store,
166
+ afterAll: async () => { },
167
+ beforeAll: async (input, testResource) => ({}),
168
+ assertThis: (x) => x,
169
+ };
170
+ // Export the test suite
171
+ exports.default = (0, Pure_1.default)(null, // No initial input
172
+ specification, implementation, testInterface);
@@ -189,7 +189,6 @@ Promise.resolve(`${process.cwd() + "/" + "testeranto.config.ts"}`).then(s => __i
189
189
  // ],
190
190
  ];
191
191
  x.forEach(async ([runtime, keys]) => {
192
- console.log(runtime, keys);
193
192
  keys.forEach(async (k) => {
194
193
  const folder = `testeranto/reports/${testName}/${k
195
194
  .split(".")
@@ -1,27 +1,38 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.consoleDetectorPlugin = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
4
8
  exports.consoleDetectorPlugin = {
5
- name: 'console-detector',
9
+ name: "console-detector",
6
10
  setup(build) {
7
11
  build.onLoad({ filter: /\.(js|ts)$/ }, async (args) => {
8
- const contents = await require('fs').promises.readFile(args.path, 'utf8');
12
+ const contents = await fs_1.default.promises.readFile(args.path, "utf8");
9
13
  const consolePattern = /console\.(log|error|warn|info|debug|trace|dir|dirxml|table|group|groupEnd|clear|count|countReset|assert|profile|profileEnd|time|timeLog|timeEnd|timeStamp|context|memory)/g;
10
14
  const matches = contents.match(consolePattern);
11
15
  if (matches) {
12
16
  const uniqueMethods = [...new Set(matches)];
13
17
  return {
14
- warnings: uniqueMethods.map(method => ({
15
- text: `Detected ${method} call - Pure runtime does not allow IO operations. Use Node runtime instead.`,
16
- location: {
17
- file: args.path,
18
- line: contents.split('\n').findIndex(line => line.includes(method)) + 1,
19
- column: 0
20
- }
21
- }))
18
+ warnings: uniqueMethods.map((method) => ({
19
+ text: `call of "${method}" was detected, which is not supported in the pure runtime.`,
20
+ // location: {
21
+ // file: args.path,
22
+ // line:
23
+ // contents
24
+ // .split("\n")
25
+ // .findIndex((line) => line.includes(method)) + 1,
26
+ // column: 0,
27
+ // },
28
+ })),
22
29
  };
23
30
  }
24
31
  return null;
25
32
  });
26
- }
33
+ build.onEnd((buildResult) => {
34
+ if (buildResult.warnings.find((br) => br.pluginName === "console-detector"))
35
+ console.warn(`Warning: An unsupported method call was detected in a source file used to build for the pure runtime. It is possible that this method call is in a comment block. If you really want to use this function, change this test to the "node" runtime.`);
36
+ });
37
+ },
27
38
  };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nativeImportDetectorPlugin = void 0;
4
+ const node_module_1 = require("node:module");
5
+ exports.nativeImportDetectorPlugin = {
6
+ name: "native-node-import-filter",
7
+ setup(build) {
8
+ build.onResolve({ filter: /fs/ }, (args) => {
9
+ if ((0, node_module_1.isBuiltin)(args.path)) {
10
+ return {
11
+ warnings: [
12
+ {
13
+ text: `cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"`,
14
+ },
15
+ ],
16
+ };
17
+ // throw new Error(
18
+ // `cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"`
19
+ // );
20
+ }
21
+ return { path: args.path };
22
+ });
23
+ },
24
+ };
@@ -23,12 +23,13 @@ exports.default = (config, entryPoints, testName) => {
23
23
  featuresPlugin_js_1.default,
24
24
  inputFilesPluginFactory,
25
25
  consoleDetectorPlugin_js_1.consoleDetectorPlugin,
26
+ // nativeImportDetectorPlugin,
26
27
  {
27
28
  name: "native-node-import-filter",
28
29
  setup(build) {
29
30
  build.onResolve({ filter: /fs/ }, (args) => {
30
31
  if ((0, node_module_1.isBuiltin)(args.path)) {
31
- throw new Error(`cannot use native node package "${args.path}" in a "pure" test. If you really want to use this package, convert this test from "pure" to "node"`);
32
+ throw new Error(`You attempted to import a node module "${args.path}" into a "pure" test, which is not allowed. If you really want to use this package, convert this test from "pure" to "node"`);
32
33
  }
33
34
  return { path: args.path };
34
35
  });
@@ -8,11 +8,8 @@ exports.default = (r) => {
8
8
  return {
9
9
  name: "rebuild-notify",
10
10
  setup: (build) => {
11
- build.onStart(() => {
12
- console.log(`> web build starting...`);
13
- });
14
11
  build.onEnd((result) => {
15
- console.log(`> web build ended with ${result.errors.length} errors`);
12
+ console.log(`${r} > build ended with ${result.errors.length} errors`);
16
13
  if (result.errors.length > 0) {
17
14
  fs_1.default.writeFileSync(`./testeranto/reports${r}_build_errors`, JSON.stringify(result, null, 2));
18
15
  }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseSuite = void 0;
4
+ const pmProxy_1 = require("./pmProxy");
5
+ class BaseSuite {
6
+ constructor(name, index, givens = {}, checks = []) {
7
+ this.name = name;
8
+ this.index = index;
9
+ this.givens = givens;
10
+ this.checks = checks;
11
+ this.fails = 0;
12
+ }
13
+ features() {
14
+ const features = Object.keys(this.givens)
15
+ .map((k) => this.givens[k].features)
16
+ .flat()
17
+ .filter((value, index, array) => {
18
+ return array.indexOf(value) === index;
19
+ });
20
+ return features || [];
21
+ }
22
+ toObj() {
23
+ const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
24
+ const checks = Object.keys(this.checks).map((k) => this.checks[k].toObj());
25
+ return {
26
+ name: this.name,
27
+ givens,
28
+ checks,
29
+ fails: this.fails,
30
+ failed: this.failed,
31
+ features: this.features(),
32
+ };
33
+ }
34
+ setup(s, artifactory, tr, pm) {
35
+ return new Promise((res) => res(s));
36
+ }
37
+ assertThat(t) {
38
+ return !!t;
39
+ }
40
+ afterAll(store, artifactory, pm) {
41
+ return store;
42
+ }
43
+ async run(input, testResourceConfiguration, artifactory, tLog, pm) {
44
+ this.testResourceConfiguration = testResourceConfiguration;
45
+ // tLog("test resources: ", JSON.stringify(testResourceConfiguration));
46
+ const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
47
+ // console.log("\nSuite:", this.index, this.name);
48
+ tLog("\nSuite:", this.index, this.name);
49
+ const sNdx = this.index;
50
+ // const sName = this.name;
51
+ const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, (0, pmProxy_1.beforeAllProxy)(pm, sNdx.toString()));
52
+ for (const [gKey, g] of Object.entries(this.givens)) {
53
+ const giver = this.givens[gKey];
54
+ this.store = await giver
55
+ .give(subject, gKey, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm, sNdx)
56
+ .catch((e) => {
57
+ this.failed = true;
58
+ this.fails = this.fails + 1;
59
+ console.error("Given error 1:", e);
60
+ throw e;
61
+ });
62
+ }
63
+ for (const [ndx, thater] of this.checks.entries()) {
64
+ await thater.check(subject, thater.name, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, pm);
65
+ }
66
+ try {
67
+ this.afterAll(this.store, artifactory, (0, pmProxy_1.afterAllProxy)(pm, sNdx.toString()));
68
+ }
69
+ catch (e) {
70
+ console.error(e);
71
+ // this.fails.push(this);
72
+ // return this;
73
+ }
74
+ // @TODO fix me
75
+ // for (const k of Object.keys(this.givens)) {
76
+ // const giver = this.givens[k];
77
+ // try {
78
+ // giver.afterAll(this.store, artifactory, pm);
79
+ // } catch (e) {
80
+ // console.error(e);
81
+ // this.fails.push(giver);
82
+ // return this;
83
+ // }
84
+ // }
85
+ ////////////////
86
+ return this;
87
+ }
88
+ }
89
+ exports.BaseSuite = BaseSuite;
@@ -0,0 +1,9 @@
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 Node_1 = __importDefault(require("../../Node"));
7
+ const BaseSuite_1 = require("../BaseSuite");
8
+ const test_1 = require("./test");
9
+ exports.default = (0, Node_1.default)(BaseSuite_1.BaseSuite, test_1.specification, test_1.implementation, test_1.testInterface);
@@ -0,0 +1,9 @@
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 Pure_1 = __importDefault(require("../../Pure"));
7
+ const BaseSuite_1 = require("../BaseSuite");
8
+ const test_1 = require("./test");
9
+ exports.default = (0, Pure_1.default)(BaseSuite_1.BaseSuite, test_1.specification, test_1.implementation, test_1.testInterface);
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.testInterface = exports.implementation = exports.specification = exports.MockGiven = void 0;
4
+ const abstractBase_1 = require("../abstractBase");
5
+ const BaseSuite_1 = require("../BaseSuite");
6
+ // 2. Mock implementations with proper typing
7
+ class MockGiven extends abstractBase_1.BaseGiven {
8
+ constructor(name, features, whens, thens) {
9
+ super(name, features, whens, thens, async () => ({ testStore: true }), // givenCB
10
+ {} // initialValues
11
+ );
12
+ }
13
+ async givenThat(subject, testResourceConfiguration, artifactory, givenCB, initialValues, pm) {
14
+ return { testStore: true };
15
+ }
16
+ uberCatcher(e) {
17
+ console.error("Given error 2:", e);
18
+ }
19
+ }
20
+ exports.MockGiven = MockGiven;
21
+ class MockWhen extends abstractBase_1.BaseWhen {
22
+ async andWhen(store, whenCB, testResource, pm) {
23
+ return Object.assign(Object.assign({}, store), { testStore: true });
24
+ }
25
+ }
26
+ class MockThen extends abstractBase_1.BaseThen {
27
+ async butThen(store, thenCB, testResourceConfiguration, pm) {
28
+ return { testSelection: true };
29
+ }
30
+ }
31
+ class MockCheck extends abstractBase_1.BaseCheck {
32
+ async checkThat(subject, testResourceConfiguration, artifactory, initializer, initialValues, pm) {
33
+ return { testStore: true };
34
+ }
35
+ }
36
+ class TestableSuite extends BaseSuite_1.BaseSuite {
37
+ constructor(name, index) {
38
+ super(name, index, {
39
+ testGiven: new MockGiven("testGiven", ["testFeature"], [
40
+ new MockWhen("testWhen", () => Promise.resolve({ testStore: true })),
41
+ ], [
42
+ new MockThen("testThen", async () => Promise.resolve({ testSelection: true })),
43
+ ]),
44
+ }, [
45
+ new MockCheck("testCheck", ["testFeature"], () => Promise.resolve({ testStore: true }), null, () => { }),
46
+ ]);
47
+ }
48
+ }
49
+ // 3. Enhanced Test Specification with more test cases
50
+ const specification = (Suite, Given, When, Then, Check) => [
51
+ Suite.Default("BaseSuite Core Functionality Tests", {
52
+ // Test initialization and basic properties
53
+ initialization: Given.Default(["BaseSuite should initialize with correct name and index"], [], [
54
+ Then.SuiteNameMatches("testSuite"),
55
+ Then.SuiteIndexMatches(0),
56
+ Then.FeaturesIncludes("testFeature"),
57
+ ]),
58
+ // Test execution flow
59
+ execution: Given.Default(["BaseSuite should execute all phases successfully"], [When.RunSuite()], [Then.StoreValid(), Then.NoErrorsOccurred(), Then.AllChecksCompleted()]),
60
+ // Test multiple features
61
+ multipleFeatures: Given.Default(["BaseSuite should handle multiple features"], [When.AddFeature("additionalFeature")], [
62
+ Then.FeaturesIncludes("testFeature"),
63
+ Then.FeaturesIncludes("additionalFeature"),
64
+ Then.FeatureCountMatches(2),
65
+ ]),
66
+ // Test error handling
67
+ errorHandling: Given.Default(["BaseSuite should handle errors gracefully"], [When.RunSuiteWithError()], [
68
+ Then.ErrorCountMatches(1),
69
+ // Then.FailedFlagSet(),
70
+ ]),
71
+ }, [
72
+ // Additional validation checks
73
+ // Check.Default(
74
+ // ["Verify suite state after all tests"],
75
+ // [],
76
+ // [
77
+ // Then.AllTestsCompleted(),
78
+ // Then.CleanExit()
79
+ // ]
80
+ // )
81
+ ]),
82
+ Suite.Default("Comprehensive Integration", {
83
+ fullStackTest: Given.Default(["All components should work together"], [
84
+ When.addArtifact(Promise.resolve("test")),
85
+ When.modifySpecs((specs) => [...specs, "extra"]),
86
+ When.modifyJobs((jobs) => [...jobs, {}]),
87
+ ], [
88
+ Then.specsModified(1),
89
+ Then.jobsModified(1),
90
+ Then.artifactsTracked(),
91
+ Then.testRunSuccessful(),
92
+ ]),
93
+ }),
94
+ ];
95
+ exports.specification = specification;
96
+ // 4. Enhanced Test Implementation with more operations
97
+ exports.implementation = {
98
+ suites: {
99
+ Default: "BaseSuite Comprehensive Test Suite",
100
+ },
101
+ givens: {
102
+ Default: () => new TestableSuite("testSuite", 0),
103
+ },
104
+ whens: {
105
+ RunSuite: () => async (suite) => {
106
+ const mockConfig = {
107
+ name: "test",
108
+ fs: "/tmp",
109
+ ports: [3000],
110
+ environment: {},
111
+ timeout: 5000,
112
+ retries: 3,
113
+ };
114
+ const mockArtifactory = (key, value) => { };
115
+ const mockTLog = (...args) => { };
116
+ const mockPM = {
117
+ server: null,
118
+ testResourceConfiguration: mockConfig,
119
+ start: async () => { },
120
+ stop: async () => { },
121
+ testArtiFactoryfileWriter: () => { },
122
+ $: () => { },
123
+ click: () => { },
124
+ closePage: () => { },
125
+ createWriteStream: async () => "",
126
+ };
127
+ return await suite.run(null, mockConfig, mockArtifactory, mockTLog, mockPM);
128
+ },
129
+ RunSuiteWithError: () => async (suite) => {
130
+ // Force an error by passing invalid config
131
+ try {
132
+ await suite.run(null, {}, // Invalid config
133
+ () => { }, () => { }, {});
134
+ }
135
+ catch (e) {
136
+ // Error is caught and counted by BaseSuite
137
+ }
138
+ return suite;
139
+ },
140
+ AddFeature: (feature) => (suite) => {
141
+ // Add a feature to the first given
142
+ const firstGivenKey = Object.keys(suite.givens)[0];
143
+ if (firstGivenKey) {
144
+ suite.givens[firstGivenKey].features.push(feature);
145
+ }
146
+ return suite;
147
+ },
148
+ },
149
+ thens: {
150
+ SuiteNameMatches: (expectedName) => (suite) => {
151
+ if (suite.name !== expectedName) {
152
+ throw new Error(`Expected suite name '${expectedName}', got '${suite.name}'`);
153
+ }
154
+ return suite;
155
+ },
156
+ SuiteIndexMatches: (expectedIndex) => (suite) => {
157
+ if (suite.index !== expectedIndex) {
158
+ throw new Error(`Expected suite index ${expectedIndex}, got ${suite.index}`);
159
+ }
160
+ return suite;
161
+ },
162
+ FeaturesIncludes: (feature) => (suite) => {
163
+ if (!suite.features().includes(feature)) {
164
+ throw new Error(`Expected features to include ${feature}`);
165
+ }
166
+ return suite;
167
+ },
168
+ FeatureCountMatches: (expectedCount) => (suite) => {
169
+ const actualCount = suite.features().length;
170
+ if (actualCount !== expectedCount) {
171
+ throw new Error(`Expected ${expectedCount} features, got ${actualCount}`);
172
+ }
173
+ return suite;
174
+ },
175
+ StoreValid: () => (suite) => {
176
+ var _a;
177
+ if (!((_a = suite.store) === null || _a === void 0 ? void 0 : _a.testStore)) {
178
+ throw new Error("Expected valid store after execution");
179
+ }
180
+ return suite;
181
+ },
182
+ NoErrorsOccurred: () => (suite) => {
183
+ if (suite.failed || suite.fails > 0) {
184
+ throw new Error("Expected no errors to occur during execution");
185
+ }
186
+ return suite;
187
+ },
188
+ ErrorCountMatches: (expectedCount) => (suite) => {
189
+ if (suite.fails !== expectedCount) {
190
+ throw new Error(`Expected ${expectedCount} errors, got ${suite.fails}`);
191
+ }
192
+ return suite;
193
+ },
194
+ FailedFlagSet: () => (suite) => {
195
+ if (!suite.failed) {
196
+ throw new Error("Expected failed flag to be set after error");
197
+ }
198
+ return suite;
199
+ },
200
+ AllChecksCompleted: () => (suite) => {
201
+ if (suite.checks.some((check) => !check.key)) {
202
+ throw new Error("Expected all checks to be completed");
203
+ }
204
+ return suite;
205
+ },
206
+ AllTestsCompleted: () => (suite) => {
207
+ if (!suite.store) {
208
+ throw new Error("Expected all tests to be completed");
209
+ }
210
+ return suite;
211
+ },
212
+ CleanExit: () => (suite) => {
213
+ if (suite.failed && suite.fails === 0) {
214
+ throw new Error("Expected clean exit state");
215
+ }
216
+ return suite;
217
+ },
218
+ },
219
+ checks: {
220
+ Default: () => new TestableSuite("testCheck", 1),
221
+ },
222
+ };
223
+ // 5. Fully typed Test Interface
224
+ exports.testInterface = {
225
+ beforeEach: async (subject, initializer) => initializer(),
226
+ andWhen: async (store, whenCB, testResource, pm) => whenCB(store, pm),
227
+ butThen: async (store, thenCB, testResource, pm) => thenCB(store, pm),
228
+ afterEach: (store) => store,
229
+ afterAll: (store, pm) => { },
230
+ assertThis: (result) => !!result,
231
+ beforeAll: async (input, testResource, pm) => input,
232
+ };
@@ -0,0 +1,9 @@
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 Web_1 = __importDefault(require("../../Web"));
7
+ const BaseSuite_1 = require("../BaseSuite");
8
+ const test_1 = require("./test");
9
+ exports.default = (0, Web_1.default)(BaseSuite_1.BaseSuite, test_1.specification, test_1.implementation, test_1.testInterface);