testeranto 0.219.14 → 0.219.15

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 (237) hide show
  1. package/package.json +1 -1
  2. package/src/testeranto.ts +1 -1
  3. package/dist/common/allTestsUtils.js +0 -17
  4. package/dist/common/package.json +0 -3
  5. package/dist/common/scripts/build-example.js +0 -105
  6. package/dist/common/src/Init.js +0 -38
  7. package/dist/common/src/Types.js +0 -63
  8. package/dist/common/src/esbuildConfigs/consoleDetectorPlugin.js +0 -38
  9. package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -21
  10. package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
  11. package/dist/common/src/esbuildConfigs/index.js +0 -22
  12. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -30
  13. package/dist/common/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -24
  14. package/dist/common/src/esbuildConfigs/rebuildPlugin.js +0 -19
  15. package/dist/common/src/init-docs.js +0 -9
  16. package/dist/common/src/lib/tiposkripto/BaseGiven.js +0 -96
  17. package/dist/common/src/lib/tiposkripto/BaseSuite.js +0 -134
  18. package/dist/common/src/lib/tiposkripto/BaseThen.js +0 -65
  19. package/dist/common/src/lib/tiposkripto/BaseTiposkripto.js +0 -193
  20. package/dist/common/src/lib/tiposkripto/BaseWhen.js +0 -46
  21. package/dist/common/src/lib/tiposkripto/CoreTypes.js +0 -2
  22. package/dist/common/src/lib/tiposkripto/Node.js +0 -40
  23. package/dist/common/src/lib/tiposkripto/Tiposkripto.js +0 -49
  24. package/dist/common/src/lib/tiposkripto/Types.js +0 -2
  25. package/dist/common/src/lib/tiposkripto/Web.js +0 -70
  26. package/dist/common/src/lib/tiposkripto/abstractBase.test/MockGiven.js +0 -22
  27. package/dist/common/src/lib/tiposkripto/abstractBase.test/MockThen.js +0 -16
  28. package/dist/common/src/lib/tiposkripto/abstractBase.test/MockWhen.js +0 -18
  29. package/dist/common/src/lib/tiposkripto/abstractBase.test/adapter.js +0 -24
  30. package/dist/common/src/lib/tiposkripto/abstractBase.test/implementation.js +0 -38
  31. package/dist/common/src/lib/tiposkripto/abstractBase.test/index.js +0 -17
  32. package/dist/common/src/lib/tiposkripto/abstractBase.test/specification.js +0 -19
  33. package/dist/common/src/lib/tiposkripto/abstractBase.test/types.js +0 -2
  34. package/dist/common/src/lib/tiposkripto/index.js +0 -29
  35. package/dist/common/src/runtimes.js +0 -4
  36. package/dist/common/src/server/aider/configParser.js +0 -124
  37. package/dist/common/src/server/aider/docker.js +0 -30
  38. package/dist/common/src/server/getRunnables.js +0 -36
  39. package/dist/common/src/server/htmlTemplate.js +0 -44
  40. package/dist/common/src/server/nodeVersion.js +0 -5
  41. package/dist/common/src/server/runtimes/common.js +0 -136
  42. package/dist/common/src/server/runtimes/golang/docker.js +0 -62
  43. package/dist/common/src/server/runtimes/java/docker.js +0 -46
  44. package/dist/common/src/server/runtimes/node/docker.js +0 -42
  45. package/dist/common/src/server/runtimes/node/esbuild.js +0 -40
  46. package/dist/common/src/server/runtimes/node/node.js +0 -75
  47. package/dist/common/src/server/runtimes/python/docker.js +0 -31
  48. package/dist/common/src/server/runtimes/ruby/docker.js +0 -34
  49. package/dist/common/src/server/runtimes/rust/docker.js +0 -35
  50. package/dist/common/src/server/runtimes/web/docker.js +0 -42
  51. package/dist/common/src/server/runtimes/web/esbuild.js +0 -29
  52. package/dist/common/src/server/runtimes/web/hoist.js +0 -16
  53. package/dist/common/src/server/runtimes/web/web.js +0 -157
  54. package/dist/common/src/server/serverClasees/Server.js +0 -47
  55. package/dist/common/src/server/serverClasees/Server_Base.js +0 -18
  56. package/dist/common/src/server/serverClasees/Server_Docker.js +0 -904
  57. package/dist/common/src/server/serverClasees/Server_FS.js +0 -119
  58. package/dist/common/src/server/serverClasees/Server_HTTP.js +0 -189
  59. package/dist/common/src/server/serverClasees/Server_WS.js +0 -262
  60. package/dist/common/src/server/serverManagers/DockerManager.js +0 -28
  61. package/dist/common/src/server/serverManagers/HttpManager.js +0 -114
  62. package/dist/common/src/server/serverManagers/WsManager.js +0 -230
  63. package/dist/common/src/server/serverManagers/fs.js +0 -32
  64. package/dist/common/src/server/serverManagers/tcp.js +0 -51
  65. package/dist/common/src/server/types.js +0 -2
  66. package/dist/common/src/testeranto.js +0 -75
  67. package/dist/common/src/vscode/TerminalManager.js +0 -129
  68. package/dist/common/src/vscode/TestTreeItem.js +0 -77
  69. package/dist/common/src/vscode/extension.js +0 -185
  70. package/dist/common/src/vscode/providers/FeaturesTreeDataProvider.js +0 -445
  71. package/dist/common/src/vscode/providers/FileTreeDataProvider.js +0 -190
  72. package/dist/common/src/vscode/providers/ProcessesTreeDataProvider.js +0 -270
  73. package/dist/common/src/vscode/providers/ResultsTreeDataProvider.js +0 -87
  74. package/dist/common/src/vscode/providers/TestTreeDataProvider.js +0 -309
  75. package/dist/common/src/vscode/types.js +0 -9
  76. package/dist/common/testeranto/runtimes/node/node.js +0 -7
  77. package/dist/common/testeranto/runtimes/web/web.js +0 -6
  78. package/dist/common/testeranto/testeranto.js +0 -70
  79. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  80. package/dist/module/allTestsUtils.js +0 -13
  81. package/dist/module/package.json +0 -3
  82. package/dist/module/scripts/build-example.js +0 -100
  83. package/dist/module/src/Init.js +0 -33
  84. package/dist/module/src/Types.js +0 -62
  85. package/dist/module/src/esbuildConfigs/consoleDetectorPlugin.js +0 -32
  86. package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -18
  87. package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
  88. package/dist/module/src/esbuildConfigs/index.js +0 -20
  89. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -25
  90. package/dist/module/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -21
  91. package/dist/module/src/esbuildConfigs/rebuildPlugin.js +0 -14
  92. package/dist/module/src/init-docs.js +0 -4
  93. package/dist/module/src/lib/tiposkripto/BaseGiven.js +0 -92
  94. package/dist/module/src/lib/tiposkripto/BaseSuite.js +0 -130
  95. package/dist/module/src/lib/tiposkripto/BaseThen.js +0 -61
  96. package/dist/module/src/lib/tiposkripto/BaseTiposkripto.js +0 -190
  97. package/dist/module/src/lib/tiposkripto/BaseWhen.js +0 -42
  98. package/dist/module/src/lib/tiposkripto/CoreTypes.js +0 -1
  99. package/dist/module/src/lib/tiposkripto/Node.js +0 -33
  100. package/dist/module/src/lib/tiposkripto/Tiposkripto.js +0 -14
  101. package/dist/module/src/lib/tiposkripto/Types.js +0 -1
  102. package/dist/module/src/lib/tiposkripto/Web.js +0 -63
  103. package/dist/module/src/lib/tiposkripto/abstractBase.test/MockGiven.js +0 -18
  104. package/dist/module/src/lib/tiposkripto/abstractBase.test/MockThen.js +0 -12
  105. package/dist/module/src/lib/tiposkripto/abstractBase.test/MockWhen.js +0 -14
  106. package/dist/module/src/lib/tiposkripto/abstractBase.test/adapter.js +0 -21
  107. package/dist/module/src/lib/tiposkripto/abstractBase.test/implementation.js +0 -35
  108. package/dist/module/src/lib/tiposkripto/abstractBase.test/index.js +0 -12
  109. package/dist/module/src/lib/tiposkripto/abstractBase.test/specification.js +0 -15
  110. package/dist/module/src/lib/tiposkripto/abstractBase.test/types.js +0 -1
  111. package/dist/module/src/lib/tiposkripto/index.js +0 -24
  112. package/dist/module/src/runtimes.js +0 -1
  113. package/dist/module/src/server/aider/configParser.js +0 -116
  114. package/dist/module/src/server/aider/docker.js +0 -28
  115. package/dist/module/src/server/getRunnables.js +0 -29
  116. package/dist/module/src/server/htmlTemplate.js +0 -40
  117. package/dist/module/src/server/nodeVersion.js +0 -2
  118. package/dist/module/src/server/runtimes/common.js +0 -127
  119. package/dist/module/src/server/runtimes/golang/docker.js +0 -55
  120. package/dist/module/src/server/runtimes/java/docker.js +0 -40
  121. package/dist/module/src/server/runtimes/node/docker.js +0 -36
  122. package/dist/module/src/server/runtimes/node/esbuild.js +0 -35
  123. package/dist/module/src/server/runtimes/node/node.js +0 -37
  124. package/dist/module/src/server/runtimes/python/docker.js +0 -25
  125. package/dist/module/src/server/runtimes/ruby/docker.js +0 -28
  126. package/dist/module/src/server/runtimes/rust/docker.js +0 -29
  127. package/dist/module/src/server/runtimes/web/docker.js +0 -36
  128. package/dist/module/src/server/runtimes/web/esbuild.js +0 -24
  129. package/dist/module/src/server/runtimes/web/hoist.js +0 -11
  130. package/dist/module/src/server/runtimes/web/web.js +0 -119
  131. package/dist/module/src/server/serverClasees/Server.js +0 -40
  132. package/dist/module/src/server/serverClasees/Server_Base.js +0 -14
  133. package/dist/module/src/server/serverClasees/Server_Docker.js +0 -897
  134. package/dist/module/src/server/serverClasees/Server_FS.js +0 -119
  135. package/dist/module/src/server/serverClasees/Server_HTTP.js +0 -182
  136. package/dist/module/src/server/serverClasees/Server_WS.js +0 -258
  137. package/dist/module/src/server/serverManagers/DockerManager.js +0 -28
  138. package/dist/module/src/server/serverManagers/HttpManager.js +0 -110
  139. package/dist/module/src/server/serverManagers/WsManager.js +0 -226
  140. package/dist/module/src/server/serverManagers/fs.js +0 -32
  141. package/dist/module/src/server/serverManagers/tcp.js +0 -47
  142. package/dist/module/src/server/types.js +0 -1
  143. package/dist/module/src/testeranto.js +0 -40
  144. package/dist/module/src/vscode/TerminalManager.js +0 -92
  145. package/dist/module/src/vscode/TestTreeItem.js +0 -40
  146. package/dist/module/src/vscode/extension.js +0 -148
  147. package/dist/module/src/vscode/providers/FeaturesTreeDataProvider.js +0 -408
  148. package/dist/module/src/vscode/providers/FileTreeDataProvider.js +0 -153
  149. package/dist/module/src/vscode/providers/ProcessesTreeDataProvider.js +0 -233
  150. package/dist/module/src/vscode/providers/ResultsTreeDataProvider.js +0 -50
  151. package/dist/module/src/vscode/providers/TestTreeDataProvider.js +0 -272
  152. package/dist/module/src/vscode/types.js +0 -6
  153. package/dist/module/testeranto/runtimes/node/node.js +0 -5
  154. package/dist/module/testeranto/runtimes/web/web.js +0 -4
  155. package/dist/module/testeranto/testeranto.js +0 -68
  156. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  157. package/dist/prebuild/chunk-QLT7PNPK.mjs +0 -162
  158. package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +0 -20
  159. package/dist/prebuild/init-docs.mjs +0 -56
  160. package/dist/prebuild/server/runtimes/node/node.mjs +0 -80
  161. package/dist/prebuild/server/runtimes/web/hoist.mjs +0 -12
  162. package/dist/prebuild/server/runtimes/web/web.mjs +0 -162
  163. package/dist/prebuild/testeranto-6SAYRVSE.mjs +0 -72
  164. package/dist/prebuild/testeranto.mjs +0 -1692
  165. package/dist/types/src/Init.d.ts +0 -2
  166. package/dist/types/src/Types.d.ts +0 -87
  167. package/dist/types/src/esbuildConfigs/consoleDetectorPlugin.d.ts +0 -2
  168. package/dist/types/src/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
  169. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
  170. package/dist/types/src/esbuildConfigs/index.d.ts +0 -3
  171. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
  172. package/dist/types/src/esbuildConfigs/nativeImportDetectorPlugin.d.ts +0 -2
  173. package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +0 -6
  174. package/dist/types/src/init-docs.d.ts +0 -1
  175. package/dist/types/src/lib/tiposkripto/BaseGiven.d.ts +0 -42
  176. package/dist/types/src/lib/tiposkripto/BaseSuite.d.ts +0 -46
  177. package/dist/types/src/lib/tiposkripto/BaseThen.d.ts +0 -28
  178. package/dist/types/src/lib/tiposkripto/BaseTiposkripto.d.ts +0 -35
  179. package/dist/types/src/lib/tiposkripto/BaseWhen.d.ts +0 -27
  180. package/dist/types/src/lib/tiposkripto/CoreTypes.d.ts +0 -51
  181. package/dist/types/src/lib/tiposkripto/Node.d.ts +0 -9
  182. package/dist/types/src/lib/tiposkripto/Tiposkripto.d.ts +0 -5
  183. package/dist/types/src/lib/tiposkripto/Types.d.ts +0 -9
  184. package/dist/types/src/lib/tiposkripto/Web.d.ts +0 -9
  185. package/dist/types/src/lib/tiposkripto/abstractBase.test/MockGiven.d.ts +0 -9
  186. package/dist/types/src/lib/tiposkripto/abstractBase.test/MockThen.d.ts +0 -6
  187. package/dist/types/src/lib/tiposkripto/abstractBase.test/MockWhen.d.ts +0 -6
  188. package/dist/types/src/lib/tiposkripto/abstractBase.test/adapter.d.ts +0 -3
  189. package/dist/types/src/lib/tiposkripto/abstractBase.test/implementation.d.ts +0 -3
  190. package/dist/types/src/lib/tiposkripto/abstractBase.test/index.d.ts +0 -28
  191. package/dist/types/src/lib/tiposkripto/abstractBase.test/specification.d.ts +0 -3
  192. package/dist/types/src/lib/tiposkripto/abstractBase.test/types.d.ts +0 -39
  193. package/dist/types/src/lib/tiposkripto/index.d.ts +0 -56
  194. package/dist/types/src/runtimes.d.ts +0 -2
  195. package/dist/types/src/server/aider/configParser.d.ts +0 -11
  196. package/dist/types/src/server/aider/docker.d.ts +0 -2
  197. package/dist/types/src/server/getRunnables.d.ts +0 -3
  198. package/dist/types/src/server/htmlTemplate.d.ts +0 -2
  199. package/dist/types/src/server/nodeVersion.d.ts +0 -2
  200. package/dist/types/src/server/runtimes/common.d.ts +0 -12
  201. package/dist/types/src/server/runtimes/golang/docker.d.ts +0 -5
  202. package/dist/types/src/server/runtimes/java/docker.d.ts +0 -14
  203. package/dist/types/src/server/runtimes/node/docker.d.ts +0 -14
  204. package/dist/types/src/server/runtimes/node/esbuild.d.ts +0 -4
  205. package/dist/types/src/server/runtimes/node/node.d.ts +0 -1
  206. package/dist/types/src/server/runtimes/python/docker.d.ts +0 -14
  207. package/dist/types/src/server/runtimes/ruby/docker.d.ts +0 -14
  208. package/dist/types/src/server/runtimes/rust/docker.d.ts +0 -14
  209. package/dist/types/src/server/runtimes/web/docker.d.ts +0 -15
  210. package/dist/types/src/server/runtimes/web/esbuild.d.ts +0 -4
  211. package/dist/types/src/server/runtimes/web/hoist.d.ts +0 -1
  212. package/dist/types/src/server/runtimes/web/web.d.ts +0 -1
  213. package/dist/types/src/server/serverClasees/Server.d.ts +0 -8
  214. package/dist/types/src/server/serverClasees/Server_Base.d.ts +0 -9
  215. package/dist/types/src/server/serverClasees/Server_Docker.d.ts +0 -81
  216. package/dist/types/src/server/serverClasees/Server_FS.d.ts +0 -0
  217. package/dist/types/src/server/serverClasees/Server_HTTP.d.ts +0 -20
  218. package/dist/types/src/server/serverClasees/Server_WS.d.ts +0 -23
  219. package/dist/types/src/server/serverManagers/DockerManager.d.ts +0 -0
  220. package/dist/types/src/server/serverManagers/HttpManager.d.ts +0 -9
  221. package/dist/types/src/server/serverManagers/WsManager.d.ts +0 -10
  222. package/dist/types/src/server/serverManagers/fs.d.ts +0 -0
  223. package/dist/types/src/server/serverManagers/tcp.d.ts +0 -27
  224. package/dist/types/src/server/types.d.ts +0 -68
  225. package/dist/types/src/testeranto.d.ts +0 -1
  226. package/dist/types/src/vscode/TerminalManager.d.ts +0 -18
  227. package/dist/types/src/vscode/TestTreeItem.d.ts +0 -13
  228. package/dist/types/src/vscode/extension.d.ts +0 -3
  229. package/dist/types/src/vscode/providers/FeaturesTreeDataProvider.d.ts +0 -17
  230. package/dist/types/src/vscode/providers/FileTreeDataProvider.d.ts +0 -13
  231. package/dist/types/src/vscode/providers/ProcessesTreeDataProvider.d.ts +0 -23
  232. package/dist/types/src/vscode/providers/ResultsTreeDataProvider.d.ts +0 -10
  233. package/dist/types/src/vscode/providers/TestTreeDataProvider.d.ts +0 -16
  234. package/dist/types/src/vscode/types.d.ts +0 -14
  235. package/dist/types/testeranto/testeranto.d.ts +0 -3
  236. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  237. package/dist/vscode/extension.mjs +0 -5116
@@ -1,32 +0,0 @@
1
- import fs from "fs";
2
- export const consoleDetectorPlugin = {
3
- name: "console-detector",
4
- setup(build) {
5
- build.onLoad({ filter: /\.(js|ts)$/ }, async (args) => {
6
- const contents = await fs.promises.readFile(args.path, "utf8");
7
- 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;
8
- const matches = contents.match(consolePattern);
9
- if (matches) {
10
- const uniqueMethods = [...new Set(matches)];
11
- return {
12
- warnings: uniqueMethods.map((method) => ({
13
- text: `call of "${method}" was detected, which is not supported in the pure runtime.`,
14
- // location: {
15
- // file: args.path,
16
- // line:
17
- // contents
18
- // .split("\n")
19
- // .findIndex((line) => line.includes(method)) + 1,
20
- // column: 0,
21
- // },
22
- })),
23
- };
24
- }
25
- return null;
26
- });
27
- build.onEnd((buildResult) => {
28
- if (buildResult.warnings.find((br) => br.pluginName === "console-detector"))
29
- 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.`);
30
- });
31
- },
32
- };
@@ -1,18 +0,0 @@
1
- export default function (results) {
2
- return results
3
- .filter((r) => r.messages.length)
4
- .map((r) => {
5
- const path = r.filePath.replace(process.cwd() + "/", "");
6
- return [
7
- path,
8
- ...r.messages.map((m) => {
9
- var _a;
10
- return [
11
- `${m.line}:${m.column} ${m.message} (${m.ruleId || ""})`,
12
- ...(((_a = m.suggestions) === null || _a === void 0 ? void 0 : _a.map((s) => `- ${s.message}${s.fix ? " (fix)" : ""}`)) || []),
13
- ].join("\n");
14
- }),
15
- ].join("\n");
16
- })
17
- .join("\n\n");
18
- }
@@ -1,34 +0,0 @@
1
- import path from "path";
2
- export default {
3
- name: "feature-markdown",
4
- setup(build) {
5
- build.onResolve({ filter: /\.md$/ }, (args) => {
6
- if (args.resolveDir === "")
7
- return;
8
- return {
9
- path: path.isAbsolute(args.path)
10
- ? args.path
11
- : path.join(args.resolveDir, args.path),
12
- namespace: "feature-markdown",
13
- };
14
- });
15
- build.onLoad({ filter: /.*/, namespace: "feature-markdown" }, async (args) => {
16
- // const markdownContent = new TextDecoder().decode(
17
- // await fs.readFileSync(args.path)
18
- // );
19
- // markdownHTML = marked(markdownContent, options?.markedOptions);
20
- return {
21
- contents: `file://${args.path}`,
22
- loader: "text",
23
- // contents: JSON.stringify({ path: args.path }),
24
- // loader: "json",
25
- // contents: JSON.stringify({
26
- // // html: markdownHTML,
27
- // raw: markdownContent,
28
- // filename: args.path, //path.basename(args.path),
29
- // }),
30
- // loader: "json",
31
- };
32
- });
33
- },
34
- };
@@ -1,20 +0,0 @@
1
- // import { ITestconfig } from "../Types";
2
- export default (config) => {
3
- return {
4
- // packages: "external",
5
- target: "esnext",
6
- format: "esm",
7
- splitting: true,
8
- outExtension: { ".js": ".mjs" },
9
- outbase: ".",
10
- jsx: "transform",
11
- bundle: true,
12
- // minify: config.minify === true,
13
- write: true,
14
- loader: {
15
- ".js": "jsx",
16
- ".png": "binary",
17
- ".jpg": "binary",
18
- },
19
- };
20
- };
@@ -1,25 +0,0 @@
1
- import fs from "fs";
2
- const otherInputs = {};
3
- const register = (entrypoint, sources) => {
4
- if (!otherInputs[entrypoint]) {
5
- otherInputs[entrypoint] = new Set();
6
- }
7
- sources.forEach((s) => otherInputs[entrypoint].add(s));
8
- };
9
- export default (platform, testName) => {
10
- const f = `${testName}`;
11
- // if (!fs.existsSync(``)) {
12
- // fs.mkdirSync(``, { recursive: true });
13
- // }
14
- return {
15
- register,
16
- inputFilesPluginFactory: {
17
- name: "metafileWriter",
18
- setup(build) {
19
- build.onEnd((result) => {
20
- fs.writeFileSync(f, JSON.stringify(result, null, 2));
21
- });
22
- },
23
- },
24
- };
25
- };
@@ -1,21 +0,0 @@
1
- import { isBuiltin } from "node:module";
2
- export const nativeImportDetectorPlugin = {
3
- name: "native-node-import-filter",
4
- setup(build) {
5
- build.onResolve({ filter: /fs/ }, (args) => {
6
- if (isBuiltin(args.path)) {
7
- return {
8
- warnings: [
9
- {
10
- 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"`,
11
- },
12
- ],
13
- };
14
- // throw new Error(
15
- // `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"`
16
- // );
17
- }
18
- return { path: args.path };
19
- });
20
- },
21
- };
@@ -1,14 +0,0 @@
1
- import fs from "fs";
2
- export default (r) => {
3
- return {
4
- name: "rebuild-notify",
5
- setup: (build) => {
6
- build.onEnd((result) => {
7
- console.log(`${r} > build ended with ${result.errors.length} errors`);
8
- if (result.errors.length > 0) {
9
- fs.writeFileSync(`./testeranto/reports${r}_build_errors`, JSON.stringify(result, null, 2));
10
- }
11
- });
12
- },
13
- };
14
- };
@@ -1,4 +0,0 @@
1
- import Init from "./Init";
2
- console.log("Initializing a testeranto project");
3
- Init();
4
- console.log("testeranto project initialized");
@@ -1,92 +0,0 @@
1
- export class BaseGiven {
2
- addArtifact(path) {
3
- if (typeof path !== "string") {
4
- throw new Error(`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(path)}`);
5
- }
6
- const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
7
- this.artifacts.push(normalizedPath);
8
- }
9
- constructor(features, whens, thens, givenCB, initialValues) {
10
- this.artifacts = [];
11
- this.features = features;
12
- this.whens = whens;
13
- this.thens = thens;
14
- this.givenCB = givenCB;
15
- this.initialValues = initialValues;
16
- this.fails = 0; // Initialize fail count
17
- }
18
- beforeAll(store) {
19
- return store;
20
- }
21
- toObj() {
22
- return {
23
- key: this.key,
24
- whens: (this.whens || []).map((w) => {
25
- if (w && w.toObj)
26
- return w.toObj();
27
- console.error("When step is not as expected!", JSON.stringify(w));
28
- return {};
29
- }),
30
- thens: (this.thens || []).map((t) => (t && t.toObj ? t.toObj() : {})),
31
- error: this.error ? [this.error, this.error.stack] : null,
32
- failed: this.failed,
33
- features: this.features || [],
34
- artifacts: this.artifacts,
35
- status: this.status,
36
- };
37
- }
38
- async afterEach(store, key, artifactory) {
39
- return store;
40
- }
41
- async give(subject, key, testResourceConfiguration, tester, artifactory, suiteNdx) {
42
- this.key = key;
43
- this.fails = 0; // Initialize fail count for this given
44
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
45
- try {
46
- // Ensure addArtifact is properly bound to 'this'
47
- const addArtifact = this.addArtifact.bind(this);
48
- this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, this.initialValues);
49
- this.status = true;
50
- }
51
- catch (e) {
52
- this.status = false;
53
- this.failed = true;
54
- this.fails++; // Increment fail count
55
- this.error = e.stack;
56
- }
57
- try {
58
- const whens = this.whens || [];
59
- for (const [thenNdx, thenStep] of this.thens.entries()) {
60
- try {
61
- const t = await thenStep.test(this.store, testResourceConfiguration, `suite-${suiteNdx}/given-${key}/then-${thenNdx}`);
62
- // If the test doesn't throw, it passed
63
- tester(t);
64
- }
65
- catch (e) {
66
- // Mark the given as failed if any then step fails
67
- this.failed = true;
68
- this.fails++; // Increment fail count
69
- // Re-throw to propagate the error
70
- throw e;
71
- }
72
- }
73
- }
74
- catch (e) {
75
- this.error = e.stack;
76
- this.failed = true;
77
- }
78
- finally {
79
- try {
80
- const addArtifact = this.addArtifact.bind(this);
81
- await this.afterEach(this.store, this.key);
82
- }
83
- catch (e) {
84
- this.failed = true;
85
- this.fails++; // Increment fail count
86
- throw e;
87
- // this.error = e.message;
88
- }
89
- }
90
- return this.store;
91
- }
92
- }
@@ -1,130 +0,0 @@
1
- export class BaseSuite {
2
- addArtifact(path) {
3
- if (typeof path !== "string") {
4
- throw new Error(`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(path)}`);
5
- }
6
- const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
7
- this.artifacts.push(normalizedPath);
8
- }
9
- constructor(name, index, givens = {}) {
10
- this.artifacts = [];
11
- const suiteName = name || "testSuite"; // Ensure name is never undefined
12
- if (!suiteName) {
13
- throw new Error("BaseSuite requires a non-empty name");
14
- }
15
- this.name = suiteName;
16
- this.index = index;
17
- this.givens = givens;
18
- this.fails = 0;
19
- }
20
- features() {
21
- try {
22
- const features = Object.keys(this.givens)
23
- .map((k) => this.givens[k].features)
24
- .flat()
25
- .filter((value, index, array) => {
26
- return array.indexOf(value) === index;
27
- });
28
- // Convert all features to strings
29
- const stringFeatures = features.map((feature) => {
30
- if (typeof feature === "string") {
31
- return feature;
32
- }
33
- else if (feature && typeof feature === "object") {
34
- return feature.name || JSON.stringify(feature);
35
- }
36
- else {
37
- return String(feature);
38
- }
39
- });
40
- return stringFeatures || [];
41
- }
42
- catch (e) {
43
- console.error("[ERROR] Failed to extract features:", JSON.stringify(e));
44
- return [];
45
- }
46
- }
47
- toObj() {
48
- const givens = Object.keys(this.givens).map((k) => {
49
- const givenObj = this.givens[k].toObj();
50
- // Ensure given features are strings
51
- // if (givenObj.features) {
52
- // givenObj.features = givenObj.features.map(feature => {
53
- // return feature;
54
- // // if (typeof feature === 'string') {
55
- // // return feature;
56
- // // } else if (feature && typeof feature === 'object') {
57
- // // return feature.name || JSON.stringify(feature);
58
- // // } else {
59
- // // return String(feature);
60
- // // }
61
- // });
62
- // }
63
- return givenObj;
64
- });
65
- return {
66
- name: this.name,
67
- givens,
68
- fails: this.fails,
69
- failed: this.failed,
70
- features: this.features(),
71
- artifacts: this.artifacts
72
- ? this.artifacts.filter((art) => typeof art === "string")
73
- : [],
74
- };
75
- }
76
- setup(s, artifactory, tr
77
- // pm: IPM
78
- ) {
79
- console.log("mark9");
80
- return new Promise((res) => res(s));
81
- }
82
- assertThat(t) {
83
- return !!t;
84
- }
85
- afterAll(store, artifactory) {
86
- return store;
87
- }
88
- async run(input, testResourceConfiguration) {
89
- this.testResourceConfiguration = testResourceConfiguration;
90
- const sNdx = this.index;
91
- const subject = await this.setup(input,
92
- // suiteArtifactory,
93
- testResourceConfiguration
94
- // proxiedPm
95
- );
96
- for (const [gKey, g] of Object.entries(this.givens)) {
97
- const giver = this.givens[gKey];
98
- try {
99
- this.store = await giver.give(subject, gKey, testResourceConfiguration, this.assertThat, sNdx);
100
- // Add the number of failures from this given to the suite's total
101
- this.fails += giver.fails || 0;
102
- }
103
- catch (e) {
104
- this.failed = true;
105
- // Add 1 to fails for the caught error
106
- this.fails += 1;
107
- // Also add any failures from the given itself
108
- if (giver.fails) {
109
- this.fails += giver.fails;
110
- }
111
- console.error(`Error in given ${gKey}:`, e);
112
- // Don't re-throw to continue with other givens
113
- }
114
- }
115
- // Mark the suite as failed if there are any failures
116
- if (this.fails > 0) {
117
- this.failed = true;
118
- }
119
- try {
120
- // Ensure addArtifact is properly bound to 'this'
121
- this.afterAll(this.store);
122
- }
123
- catch (e) {
124
- console.error(JSON.stringify(e));
125
- // this.fails.push(this);
126
- // return this;
127
- }
128
- return this;
129
- }
130
- }
@@ -1,61 +0,0 @@
1
- export class BaseThen {
2
- constructor(name, thenCB) {
3
- this.artifacts = [];
4
- this.name = name;
5
- this.thenCB = thenCB;
6
- this.error = false;
7
- this.artifacts = [];
8
- }
9
- addArtifact(path) {
10
- if (typeof path !== "string") {
11
- throw new Error(`[ARTIFACT ERROR] Expected string, got ${typeof path}: ${JSON.stringify(path)}`);
12
- }
13
- const normalizedPath = path.replace(/\\/g, "/"); // Normalize path separators
14
- this.artifacts.push(normalizedPath);
15
- }
16
- toObj() {
17
- const obj = {
18
- name: this.name,
19
- error: this.error,
20
- artifacts: this.artifacts,
21
- status: this.status,
22
- };
23
- return obj;
24
- }
25
- async test(store, testResourceConfiguration,
26
- // tLog: ITLog,
27
- // pm: IPM,
28
- filepath) {
29
- // Ensure addArtifact is properly bound to 'this'
30
- const addArtifact = this.addArtifact.bind(this);
31
- // const proxiedPm = butThenProxy(pm, filepath, addArtifact);
32
- try {
33
- const x = await this.butThen(store, async (s) => {
34
- try {
35
- if (typeof this.thenCB === "function") {
36
- const result = await this.thenCB(s);
37
- return result;
38
- }
39
- else {
40
- return this.thenCB;
41
- }
42
- }
43
- catch (e) {
44
- // Mark this then step as failed
45
- this.error = true;
46
- // Re-throw to be caught by the outer catch block
47
- throw e;
48
- }
49
- }, testResourceConfiguration
50
- // proxiedPm
51
- );
52
- this.status = true;
53
- return x;
54
- }
55
- catch (e) {
56
- this.status = false;
57
- this.error = true;
58
- throw e;
59
- }
60
- }
61
- }
@@ -1,190 +0,0 @@
1
- import { BaseGiven } from "./BaseGiven";
2
- import { BaseSuite } from "./BaseSuite";
3
- import { BaseThen } from "./BaseThen.js";
4
- import { BaseWhen } from "./BaseWhen.js";
5
- import { DefaultAdapter, defaultTestResourceRequirement, } from "./index.js";
6
- export default class BaseTiposkripto {
7
- constructor(webOrNode, input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter = {}, testResourceConfiguration, wsPort = "3456", wsHost = "localhost") {
8
- this.totalTests = 0;
9
- this.artifacts = [];
10
- this.testResourceConfiguration = testResourceConfiguration;
11
- const fullAdapter = DefaultAdapter(testAdapter);
12
- if (!testImplementation.suites ||
13
- typeof testImplementation.suites !== "object") {
14
- throw new Error(`testImplementation.suites must be an object, got ${typeof testImplementation.suites}: ${JSON.stringify(testImplementation.suites)}`);
15
- }
16
- const classySuites = Object.entries(testImplementation.suites).reduce((a, [key], index) => {
17
- a[key] = (somestring, givens) => {
18
- return new (class extends BaseSuite {
19
- afterAll(store) {
20
- return fullAdapter.afterAll(store);
21
- }
22
- assertThat(t) {
23
- return fullAdapter.assertThis(t);
24
- }
25
- async setup(s, tr) {
26
- var _a, _b;
27
- return ((_b = (_a = fullAdapter.beforeAll) === null || _a === void 0 ? void 0 : _a.call(fullAdapter, s, tr)) !== null && _b !== void 0 ? _b : s);
28
- }
29
- })(somestring, index, givens);
30
- };
31
- return a;
32
- }, {});
33
- const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, g]) => {
34
- a[key] = (features, whens, thens, gcb, initialValues) => {
35
- // WTF
36
- // Ensure parameters are arrays and create copies to avoid reference issues
37
- const safeFeatures = Array.isArray(features) ? [...features] : [];
38
- const safeWhens = Array.isArray(whens) ? [...whens] : [];
39
- const safeThens = Array.isArray(thens) ? [...thens] : [];
40
- return new (class extends BaseGiven {
41
- async givenThat(subject, testResource, initializer, initialValues) {
42
- return fullAdapter.beforeEach(subject, initializer, testResource, initialValues);
43
- }
44
- afterEach(store, key) {
45
- return Promise.resolve(fullAdapter.afterEach(store, key));
46
- }
47
- })(safeFeatures, safeWhens, safeThens, testImplementation.givens[key], initialValues);
48
- };
49
- return a;
50
- }, {});
51
- const classyWhens = Object.entries(testImplementation.whens).reduce((a, [key, whEn]) => {
52
- a[key] = (...payload) => {
53
- const whenInstance = new (class extends BaseWhen {
54
- async andWhen(store, whenCB, testResource) {
55
- return await fullAdapter.andWhen(store, whenCB, testResource);
56
- }
57
- })(`${key}: ${payload && payload.toString()}`, whEn(...payload));
58
- return whenInstance;
59
- };
60
- return a;
61
- }, {});
62
- const classyThens = Object.entries(testImplementation.thens).reduce((a, [key, thEn]) => {
63
- a[key] = (...args) => {
64
- const thenInstance = new (class extends BaseThen {
65
- async butThen(store, thenCB, testResource) {
66
- return await fullAdapter.butThen(store, thenCB, testResource);
67
- }
68
- })(`${key}: ${args && args.toString()}`, thEn(...args));
69
- return thenInstance;
70
- };
71
- return a;
72
- }, {});
73
- this.suitesOverrides = classySuites;
74
- this.givenOverrides = classyGivens;
75
- this.whenOverrides = classyWhens;
76
- this.thenOverrides = classyThens;
77
- this.testResourceRequirement = testResourceRequirement;
78
- this.testSpecification = testSpecification;
79
- this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then());
80
- this.totalTests = this.calculateTotalTests();
81
- this.testJobs = this.specs.map((suite) => {
82
- const suiteRunner = (suite) => async (testResourceConfiguration) => {
83
- try {
84
- const x = await suite.run(input, testResourceConfiguration || {
85
- name: suite.name,
86
- fs: process.cwd(),
87
- ports: [],
88
- timeout: 30000,
89
- retries: 3,
90
- environment: {},
91
- });
92
- return x;
93
- }
94
- catch (e) {
95
- console.error(e.stack);
96
- throw e;
97
- }
98
- };
99
- const runner = suiteRunner(suite);
100
- const totalTests = this.totalTests;
101
- const testJob = {
102
- test: suite,
103
- toObj: () => {
104
- return suite.toObj();
105
- },
106
- runner,
107
- receiveTestResourceConfig: async (testResourceConfiguration) => {
108
- try {
109
- const suiteDone = await runner(testResourceConfiguration);
110
- const fails = suiteDone.fails;
111
- return {
112
- failed: fails > 0,
113
- fails,
114
- artifacts: [], // this.artifacts is not accessible here
115
- features: suiteDone.features(),
116
- tests: 0,
117
- runTimeTests: totalTests,
118
- testJob: testJob.toObj(),
119
- };
120
- }
121
- catch (e) {
122
- console.error(e.stack);
123
- return {
124
- failed: true,
125
- fails: -1,
126
- artifacts: [],
127
- features: [],
128
- tests: 0,
129
- runTimeTests: -1,
130
- testJob: testJob.toObj(),
131
- };
132
- }
133
- },
134
- };
135
- return testJob;
136
- });
137
- this.testJobs[0].receiveTestResourceConfig(testResourceConfiguration).then((results) => {
138
- // The actual path is determined by the concrete implementation (Node.ts or Web.ts)
139
- // They will write to the correct pattern: testeranto/reports/allTests/example/${runtime}.Calculator.test.ts.json
140
- // We just pass a placeholder filename webOrNode
141
- this.writeFileSync(`testeranto/reports/allTests/example/${webOrNode}/Calculator.test.ts.json`, JSON.stringify(results));
142
- });
143
- }
144
- async receiveTestResourceConfig(testResourceConfig) {
145
- if (this.testJobs && this.testJobs.length > 0) {
146
- return this.testJobs[0].receiveTestResourceConfig(testResourceConfig);
147
- }
148
- else {
149
- throw new Error("No test jobs available");
150
- }
151
- }
152
- Specs() {
153
- return this.specs;
154
- }
155
- Suites() {
156
- if (!this.suitesOverrides) {
157
- throw new Error(`suitesOverrides is undefined. classySuites: ${JSON.stringify(Object.keys(this.suitesOverrides || {}))}`);
158
- }
159
- return this.suitesOverrides;
160
- }
161
- Given() {
162
- return this.givenOverrides;
163
- }
164
- When() {
165
- return this.whenOverrides;
166
- }
167
- Then() {
168
- return this.thenOverrides;
169
- }
170
- // Add a method to access test jobs which can be used by receiveTestResourceConfig
171
- getTestJobs() {
172
- return this.testJobs;
173
- }
174
- calculateTotalTests() {
175
- let total = 0;
176
- for (const suite of this.specs) {
177
- if (suite && typeof suite === "object") {
178
- // Access the givens property which should be a record of test names to BaseGiven instances
179
- // The givens property is typically on the suite instance
180
- if ("givens" in suite) {
181
- const givens = suite.givens;
182
- if (givens && typeof givens === "object") {
183
- total += Object.keys(givens).length;
184
- }
185
- }
186
- }
187
- }
188
- return total;
189
- }
190
- }