testeranto 0.199.0 → 0.200.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 (157) hide show
  1. package/bin/test_runner +0 -0
  2. package/bin/testeranto +0 -0
  3. package/bundle.js +2 -2
  4. package/cmd/test_runner/main.go +65 -0
  5. package/cmd/testeranto/main.go +37 -0
  6. package/dist/common/src/PM/main.js +126 -11
  7. package/dist/common/src/PM/pitonoRunner.js +54 -0
  8. package/dist/common/src/components/pure/TestPageView.js +180 -65
  9. package/dist/common/src/components/stateful/TestPage.js +50 -11
  10. package/dist/common/src/lib/abstractBase.test/index.js +1 -0
  11. package/dist/common/src/run.js +48 -82
  12. package/dist/common/src/{build.js → testeranto.js} +107 -55
  13. package/dist/common/src/utils/golingvuMetafile.js +116 -0
  14. package/dist/common/src/utils/logFiles.js +2 -1
  15. package/dist/common/src/utils/pitonoMetafile.js +67 -0
  16. package/dist/common/src/utils.js +40 -1
  17. package/dist/common/testeranto.config.js +23 -21
  18. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  19. package/dist/module/src/PM/main.js +126 -11
  20. package/dist/module/src/PM/pitonoRunner.js +47 -0
  21. package/dist/module/src/components/pure/TestPageView.js +180 -65
  22. package/dist/module/src/components/stateful/TestPage.js +50 -11
  23. package/dist/module/src/lib/abstractBase.test/index.js +1 -0
  24. package/dist/module/src/run.js +49 -45
  25. package/dist/module/src/{build.js → testeranto.js} +107 -55
  26. package/dist/module/src/utils/golingvuMetafile.js +109 -0
  27. package/dist/module/src/utils/logFiles.js +2 -1
  28. package/dist/module/src/utils/pitonoMetafile.js +60 -0
  29. package/dist/module/src/utils.js +40 -1
  30. package/dist/module/testeranto.config.js +23 -21
  31. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  32. package/dist/prebuild/App.js +81 -17
  33. package/dist/types/src/PM/main.d.ts +2 -0
  34. package/dist/types/src/PM/pitonoRunner.d.ts +7 -0
  35. package/dist/types/src/Types.d.ts +1 -1
  36. package/dist/types/src/run.d.ts +0 -1
  37. package/dist/types/src/utils/golingvuMetafile.d.ts +19 -0
  38. package/dist/types/src/utils/logFiles.d.ts +5 -1
  39. package/dist/types/src/utils/pitonoMetafile.d.ts +7 -0
  40. package/dist/types/src/utils.d.ts +5 -0
  41. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  42. package/docs/index.md +13 -13
  43. package/example/test_example.py +106 -0
  44. package/go.mod +3 -0
  45. package/package.json +2 -2
  46. package/pitono/__init__.py +54 -0
  47. package/pitono/base_given.py +131 -0
  48. package/pitono/base_suite.py +95 -0
  49. package/pitono/base_then.py +50 -0
  50. package/pitono/base_when.py +52 -0
  51. package/pitono/core_generator.py +110 -0
  52. package/pitono/pitono.egg-info/PKG-INFO +17 -0
  53. package/pitono/pitono.egg-info/SOURCES.txt +7 -0
  54. package/pitono/pitono.egg-info/dependency_links.txt +1 -0
  55. package/pitono/pitono.egg-info/entry_points.txt +2 -0
  56. package/pitono/pitono.egg-info/top_level.txt +1 -0
  57. package/pitono/pyproject.toml +26 -0
  58. package/pitono/setup.py +40 -0
  59. package/pitono/simple_adapter.py +24 -0
  60. package/pitono/types.py +78 -0
  61. package/sampleMetafile.json +56 -0
  62. package/src/PM/main.ts +146 -17
  63. package/src/PM/pitonoRunner.ts +49 -0
  64. package/src/Types.ts +1 -1
  65. package/src/components/pure/TestPageView.tsx +175 -8
  66. package/src/components/stateful/TestPage.tsx +57 -16
  67. package/src/core/types.go +36 -0
  68. package/src/golingvu/README.md +3 -0
  69. package/src/golingvu/base_given.go +76 -0
  70. package/src/golingvu/base_suite.go +39 -0
  71. package/src/golingvu/base_suite_test.go +197 -0
  72. package/src/golingvu/base_then.go +21 -0
  73. package/src/golingvu/base_when.go +21 -0
  74. package/src/golingvu/golingvu.go +179 -0
  75. package/src/golingvu/test_adapter.go +33 -0
  76. package/src/golingvu/types.go +86 -0
  77. package/src/lib/abstractBase.test/index.ts +1 -0
  78. package/src/pitono/README.md +3 -0
  79. package/src/run.ts +48 -48
  80. package/src/templates/frontpage.html +26 -17
  81. package/src/{build.ts → testeranto.ts} +128 -58
  82. package/src/utils/golingvuMetafile.ts +165 -0
  83. package/src/utils/logFiles.ts +2 -1
  84. package/src/utils/pitonoMetafile.ts +68 -0
  85. package/src/utils.ts +38 -1
  86. package/testeranto/App.js +81 -17
  87. package/testeranto/metafiles/golang/core.json +72 -0
  88. package/testeranto/metafiles/node/core.json +21 -459
  89. package/testeranto/metafiles/pure/core.json +18 -119
  90. package/testeranto/metafiles/web/core.json +37 -16797
  91. package/testeranto/reports/core/config.json +8 -40
  92. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/lint_errors.txt +6 -0
  93. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/prompt.txt +12 -1
  94. package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/lint_errors.txt +2 -0
  95. package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +11 -1
  96. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/lint_errors.txt +2 -0
  97. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/prompt.txt +13 -3
  98. package/testeranto/reports/core/summary.json +9 -45
  99. package/testeranto.config.ts +25 -21
  100. package/tsc.log +46 -7
  101. package/dist/common/src/lib/mocks.test.js +0 -11
  102. package/dist/module/src/lib/mocks.test.js +0 -11
  103. package/dist/prebuild/build.mjs +0 -578
  104. package/dist/prebuild/run.mjs +0 -2290
  105. package/dist/tsconfig.tsbuildinfo +0 -1
  106. package/dist/types/src/lib/mocks.test.d.ts +0 -0
  107. package/src/lib/mocks.test.ts +0 -11
  108. package/testeranto/reports/core/src/Pure.test/pure/exit.log +0 -0
  109. package/testeranto/reports/core/src/Pure.test/pure/lint_errors.txt +0 -0
  110. package/testeranto/reports/core/src/Pure.test/pure/message.txt +0 -17
  111. package/testeranto/reports/core/src/Pure.test/pure/prompt.txt +0 -14
  112. package/testeranto/reports/core/src/Pure.test/pure/type_errors.txt +0 -66
  113. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/debug.log +0 -0
  114. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/error.log +0 -67
  115. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/exit.log +0 -1
  116. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/info.log +0 -2
  117. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/lint_errors.txt +0 -0
  118. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/message.txt +0 -17
  119. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/prompt.txt +0 -16
  120. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/tests.json +0 -68
  121. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/type_errors.txt +0 -56
  122. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/warn.log +0 -0
  123. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/debug.log +0 -0
  124. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/error.log +0 -22
  125. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/exit.log +0 -1
  126. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/info.log +0 -2
  127. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +0 -13
  128. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/message.txt +0 -17
  129. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/prompt.txt +0 -16
  130. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/tests.json +0 -88
  131. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +0 -45
  132. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/warn.log +0 -0
  133. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/debug.log +0 -0
  134. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/error.log +0 -0
  135. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/exit.log +0 -1
  136. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/info.log +0 -2
  137. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/lint_errors.txt +0 -47
  138. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/message.txt +0 -17
  139. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/prompt.txt +0 -17
  140. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/tests.json +0 -57
  141. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/type_errors.txt +0 -99
  142. package/testeranto/reports/core/src/components/pure/TestPageView.test/index/web/warn.log +0 -0
  143. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/exit.log +0 -1
  144. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/lint_errors.txt +0 -0
  145. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/message.txt +0 -17
  146. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/prompt.txt +0 -17
  147. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stderr.log +0 -18
  148. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stdout.log +0 -0
  149. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/type_errors.txt +0 -32
  150. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/exit.log +0 -1
  151. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/lint_errors.txt +0 -15
  152. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/message.txt +0 -17
  153. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/prompt.txt +0 -17
  154. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stderr.log +0 -66
  155. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stdout.log +0 -10
  156. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/type_errors.txt +0 -47
  157. /package/dist/types/src/{build.d.ts → testeranto.d.ts} +0 -0
@@ -51,6 +51,7 @@ export const TestPage = () => {
51
51
  const receivedLogs = await testResponse.logs;
52
52
  console.log('Received logs:', Object.keys(receivedLogs));
53
53
  let sourceFiles = {};
54
+ let buildLogs = {};
54
55
  if (metafileRes.ok) {
55
56
  const metafile = await metafileRes.json();
56
57
  if ((_a = metafile === null || metafile === void 0 ? void 0 : metafile.metafile) === null || _a === void 0 ? void 0 : _a.outputs) {
@@ -63,28 +64,34 @@ export const TestPage = () => {
63
64
  const normalizedTestPath = testPath.replace(/\./g, '_');
64
65
  const testFileName = testPath.split('/').pop();
65
66
  const testBaseName = testFileName === null || testFileName === void 0 ? void 0 : testFileName.split('.').slice(0, -1).join('.');
67
+ // Also check outputPath normalized for slashes replaced by underscores
68
+ const normalizedOutputPath = outputPath.replace(/\//g, '_');
66
69
  return output.entryPoint === testEntryPoint ||
67
70
  outputPath.includes(normalizedTestPath) ||
71
+ normalizedOutputPath.includes(normalizedTestPath) ||
68
72
  (testBaseName && outputPath.includes(testBaseName));
69
73
  });
70
74
  // Then collect all inputs from matching outputs
71
75
  matchingOutputs.forEach(([_, output]) => {
72
76
  Object.keys(output.inputs).forEach(inputPath => {
73
- // Check if this input is a TypeScript file and not in node_modules
74
- if ((inputPath.endsWith('.ts') || inputPath.endsWith('.tsx')) &&
77
+ // Check if this input is a source file (TypeScript or Go) and not in node_modules
78
+ if ((inputPath.endsWith('.ts') || inputPath.endsWith('.tsx') || inputPath.endsWith('.go')) &&
75
79
  !inputPath.includes('node_modules')) {
76
80
  // Get the full input details from metafile.inputs
77
81
  const inputDetails = metafile.metafile.inputs[inputPath];
78
82
  if (inputDetails) {
79
83
  tsSources.add(inputPath);
80
- // Also include any imported TypeScript files
81
- inputDetails.imports.forEach(imp => {
82
- if ((imp.path.endsWith('.ts') || imp.path.endsWith('.tsx')) &&
83
- !imp.path.includes('node_modules') &&
84
- !imp.external) {
85
- tsSources.add(imp.path);
86
- }
87
- });
84
+ // Also include any imported source files (for TypeScript)
85
+ // Go files don't have imports in the same way, so we'll only process for TypeScript
86
+ if (inputPath.endsWith('.ts') || inputPath.endsWith('.tsx')) {
87
+ inputDetails.imports.forEach(imp => {
88
+ if ((imp.path.endsWith('.ts') || imp.path.endsWith('.tsx')) &&
89
+ !imp.path.includes('node_modules') &&
90
+ !imp.external) {
91
+ tsSources.add(imp.path);
92
+ }
93
+ });
94
+ }
88
95
  }
89
96
  }
90
97
  });
@@ -131,11 +138,14 @@ export const TestPage = () => {
131
138
  });
132
139
  });
133
140
  sourceFiles = fileTree;
141
+ buildLogs = metafile;
134
142
  }
135
143
  }
136
- // Add source files to logs
144
+ // Add source files and build logs to logs
137
145
  receivedLogs['source_files'] = sourceFiles;
146
+ receivedLogs['build_logs'] = buildLogs;
138
147
  console.log('Source files structure:', sourceFiles);
148
+ console.log('Build logs:', buildLogs);
139
149
  // Ensure tests.json is properly formatted
140
150
  if (receivedLogs['tests.json']) {
141
151
  console.log('tests.json content type:', typeof receivedLogs['tests.json']);
@@ -174,6 +184,35 @@ export const TestPage = () => {
174
184
  catch (err) {
175
185
  console.error('Failed to load summary:', err);
176
186
  }
187
+ // Fetch build.json to get build errors and warnings
188
+ try {
189
+ // The build.json is in the runtime directory directly under the test path
190
+ // testPath is "src/lib/pmProxy.test/index.ts"
191
+ // We need to use the directory path without the filename
192
+ const pathParts = testPath.split('/');
193
+ const fileName = pathParts.pop();
194
+ const directoryPath = pathParts.join('/');
195
+ // Construct the path without the filename without extension
196
+ const buildUrl = `/reports/${projectName}/${directoryPath}/${runtime}/build.json`;
197
+ console.log(`Fetching build.json from: ${buildUrl}`);
198
+ const buildResponse = await fetch(buildUrl);
199
+ if (buildResponse.ok) {
200
+ const buildData = await buildResponse.json();
201
+ console.log('Build data received:', buildData);
202
+ // Add build errors and warnings to logs
203
+ receivedLogs['build.json'] = buildData;
204
+ }
205
+ else {
206
+ console.log('Build.json not found or not accessible, status:', buildResponse.status);
207
+ // Add an empty build.json to logs to prevent errors
208
+ receivedLogs['build.json'] = { errors: [], warnings: [] };
209
+ }
210
+ }
211
+ catch (err) {
212
+ console.log('No build.json found or error fetching it:', err);
213
+ // Add an empty build.json to logs to prevent errors
214
+ receivedLogs['build.json'] = { errors: [], warnings: [] };
215
+ }
177
216
  }
178
217
  catch (err) {
179
218
  setError(err instanceof Error ? err.message : 'Unknown error');
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
1
2
  import Testeranto from "../../Node";
2
3
  import { specification } from "./specification";
3
4
  import { implementation } from "./implementation";
@@ -1,45 +1,49 @@
1
- import ansiC from "ansi-colors";
2
- import readline from "readline";
3
- import { PM_Main } from "./PM/main";
4
- readline.emitKeypressEvents(process.stdin);
5
- if (process.stdin.isTTY)
6
- process.stdin.setRawMode(true);
7
- console.log(ansiC.inverse("Press 'q' to initiate a graceful shutdown."));
8
- console.log(ansiC.inverse("Press 'x' to quit forcefully."));
9
- process.stdin.on("keypress", (str, key) => {
10
- if (key.name === "x") {
11
- console.log(ansiC.inverse("Shutting down forcefully..."));
12
- process.exit(-1);
13
- }
14
- });
15
- const projectName = process.argv[2];
16
- const mode = process.argv[3];
17
- if (mode !== "once" && mode !== "dev") {
18
- console.error("the 2nd argument should be 'dev' or 'once' ");
19
- process.exit(-1);
20
- }
21
- const f = process.cwd() + "/" + "testeranto.config.ts";
22
- console.log("config file:", f);
23
- import(f).then(async (module) => {
24
- const bigConfig = module.default || module;
25
- const rawConfig = bigConfig.projects[projectName];
26
- if (!rawConfig) {
27
- console.error(`Project "${projectName}" does not exist in the configuration.`);
28
- console.error("Available projects:", Object.keys(bigConfig.projects));
29
- process.exit(-1);
30
- }
31
- if (!rawConfig.tests) {
32
- console.error(projectName, "appears to have no tests: ", f);
33
- console.error(`here is the config:`);
34
- console.log(JSON.stringify(rawConfig));
35
- process.exit(-1);
36
- }
37
- const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/" + `testeranto/${projectName}.json` });
38
- const pm = new PM_Main(config, projectName, mode);
39
- pm.start();
40
- process.stdin.on("keypress", (str, key) => {
41
- if (key.name === "q") {
42
- pm.stop();
43
- }
44
- });
45
- });
1
+ "use strict";
2
+ // import ansiC from "ansi-colors";
3
+ // import readline from "readline";
4
+ // import { PM_Main } from "./PM/main";
5
+ // import { ITestconfig, IBuiltConfig, IProject } from "./Types";
6
+ // readline.emitKeypressEvents(process.stdin);
7
+ // if (process.stdin.isTTY) process.stdin.setRawMode(true);
8
+ // console.log(ansiC.inverse("Press 'q' to initiate a graceful shutdown."));
9
+ // console.log(ansiC.inverse("Press 'x' to quit forcefully."));
10
+ // process.stdin.on("keypress", (str, key) => {
11
+ // if (key.name === "x") {
12
+ // console.log(ansiC.inverse("Shutting down forcefully..."));
13
+ // process.exit(-1);
14
+ // }
15
+ // });
16
+ // const projectName = process.argv[2];
17
+ // const mode = process.argv[3] as "once" | "dev";
18
+ // if (mode !== "once" && mode !== "dev") {
19
+ // console.error("the 2nd argument should be 'dev' or 'once' ");
20
+ // process.exit(-1);
21
+ // }
22
+ // const f = process.cwd() + "/" + "testeranto.config.ts";
23
+ // console.log("config file:", f);
24
+ // import(f).then(async (module) => {
25
+ // const bigConfig: IProject = module.default || module;
26
+ // const rawConfig: ITestconfig = bigConfig.projects[projectName];
27
+ // if (!rawConfig) {
28
+ // console.error(`Project "${projectName}" does not exist in the configuration.`);
29
+ // console.error("Available projects:", Object.keys(bigConfig.projects));
30
+ // process.exit(-1);
31
+ // }
32
+ // if (!rawConfig.tests) {
33
+ // console.error(projectName, "appears to have no tests: ", f);
34
+ // console.error(`here is the config:`);
35
+ // console.log(JSON.stringify(rawConfig));
36
+ // process.exit(-1);
37
+ // }
38
+ // const config: IBuiltConfig = {
39
+ // ...rawConfig,
40
+ // buildDir: process.cwd() + "/" + `testeranto/${projectName}.json`,
41
+ // };
42
+ // const pm = new PM_Main(config, projectName, mode);
43
+ // pm.start();
44
+ // process.stdin.on("keypress", (str, key) => {
45
+ // if (key.name === "q") {
46
+ // pm.stop();
47
+ // }
48
+ // });
49
+ // });
@@ -15,12 +15,14 @@ readline.emitKeypressEvents(process.stdin);
15
15
  if (process.stdin.isTTY)
16
16
  process.stdin.setRawMode(true);
17
17
  const testName = process.argv[2];
18
- let mode = process.argv[3];
18
+ const mode = process.argv[3];
19
19
  if (mode !== "once" && mode !== "dev") {
20
- console.error(`The 4th argument should be 'dev' or 'once', not '${mode}'.`);
20
+ console.error(`The 3rd argument should be 'dev' or 'once', not '${mode}'.`);
21
21
  process.exit(-1);
22
22
  }
23
- import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
23
+ const f = process.cwd() + "/" + "testeranto.config.ts";
24
+ console.log("config file:", f);
25
+ import(f).then(async (module) => {
24
26
  const pckge = (await import(`${process.cwd()}/package.json`)).default;
25
27
  const bigConfig = module.default;
26
28
  const project = bigConfig.projects[testName];
@@ -30,56 +32,31 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
30
32
  }
31
33
  fs.writeFileSync(`${process.cwd()}/testeranto/projects.json`, JSON.stringify(Object.keys(bigConfig.projects), null, 2));
32
34
  const rawConfig = bigConfig.projects[testName];
33
- const getSecondaryEndpointsPoints = (runtime) => {
34
- const meta = (ts, st) => {
35
- ts.forEach((t) => {
36
- if (t[1] === runtime) {
37
- st.add(t[0]);
38
- }
39
- if (Array.isArray(t[3])) {
40
- meta(t[3], st);
41
- }
42
- });
43
- return st;
44
- };
45
- return Array.from(meta(config.tests, new Set()));
46
- };
47
- // const getSideCars = (runtime?: IRunTime): string[] => {
48
- // return Array.from(
49
- // new Set(
50
- // config.tests
51
- // .reduce((mm, t) => {
52
- // mm = mm.concat(t[3]);
53
- // return mm;
54
- // }, [] as ITestTypes[])
55
- // .filter((t) => {
56
- // return t[1] === runtime;
57
- // })
58
- // .map((t) => {
59
- // return t[0];
60
- // })
61
- // )
62
- // );
63
- // };
35
+ if (!rawConfig) {
36
+ console.error(`Project "${testName}" does not exist in the configuration.`);
37
+ console.error("Available projects:", Object.keys(bigConfig.projects));
38
+ process.exit(-1);
39
+ }
40
+ if (!rawConfig.tests) {
41
+ console.error(testName, "appears to have no tests: ", f);
42
+ console.error(`here is the config:`);
43
+ console.log(JSON.stringify(rawConfig));
44
+ process.exit(-1);
45
+ }
64
46
  const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/testeranto/bundles/" + testName });
65
- console.log(`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`);
47
+ console.log(ansiC.inverse("Press 'q' to initiate a graceful shutdown."));
48
+ console.log(ansiC.inverse("Press 'x' to quit forcefully."));
66
49
  process.stdin.on("keypress", (str, key) => {
67
- if (key.name === "q") {
68
- console.log("Testeranto-Build is shutting down...");
69
- mode = "once";
70
- onDone();
71
- }
72
- else if (key.name === "x") {
73
- console.log("Testeranto-Build is shutting down forcefully...");
50
+ if (key.name === "x") {
51
+ console.log(ansiC.inverse("Shutting down forcefully..."));
74
52
  process.exit(-1);
75
53
  }
76
- else {
77
- console.log(`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`);
78
- }
79
54
  });
80
55
  let nodeDone = false;
81
56
  let webDone = false;
82
57
  let importDone = false;
58
+ let golangDone = false;
59
+ let pitonoDone = false;
83
60
  let status = "build";
84
61
  const { nodeEntryPoints, nodeEntryPointSidecars, webEntryPoints, webEntryPointSidecars, pureEntryPoints, pureEntryPointSidecars, } = getRunnables(config.tests, testName);
85
62
  const onNodeDone = () => {
@@ -94,13 +71,35 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
94
71
  importDone = true;
95
72
  onDone();
96
73
  };
74
+ const onGolangDone = () => {
75
+ golangDone = true;
76
+ onDone();
77
+ };
78
+ const onPitonoDone = () => {
79
+ pitonoDone = true;
80
+ onDone();
81
+ };
82
+ let pm = null;
97
83
  const onDone = async () => {
98
- if (nodeDone && webDone && importDone) {
84
+ // Check which test types are present
85
+ const hasGolangTests = config.tests.some(test => test[1] === 'golang');
86
+ const hasPitonoTests = config.tests.some(test => test[1] === 'pitono');
87
+ // Wait for all relevant runtimes to be done
88
+ const allDone = nodeDone && webDone && importDone &&
89
+ (!hasGolangTests || golangDone) &&
90
+ (!hasPitonoTests || pitonoDone);
91
+ if (allDone) {
99
92
  status = "built";
93
+ // Start the PM_Main to run the tests after build
94
+ if (!pm) {
95
+ const { PM_Main } = await import("./PM/main");
96
+ pm = new PM_Main(config, testName, mode);
97
+ await pm.start();
98
+ }
100
99
  }
101
- if (nodeDone && webDone && importDone && mode === "once") {
100
+ if (allDone && mode === "once") {
102
101
  console.log(ansiC.inverse(`${testName} was built and the builder exited successfully.`));
103
- process.exit();
102
+ // Let PM_Main handle the exit after tests are complete
104
103
  }
105
104
  };
106
105
  fs.writeFileSync(`${process.cwd()}/testeranto/projects.html`, AppHtml());
@@ -111,6 +110,55 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
111
110
  }
112
111
  fs.writeFileSync(`testeranto/reports/${projectName}/config.json`, JSON.stringify(config, null, 2));
113
112
  });
113
+ const getSecondaryEndpointsPoints = (runtime) => {
114
+ const meta = (ts, st) => {
115
+ ts.forEach((t) => {
116
+ if (t[1] === runtime) {
117
+ st.add(t[0]);
118
+ }
119
+ if (Array.isArray(t[3])) {
120
+ meta(t[3], st);
121
+ }
122
+ });
123
+ return st;
124
+ };
125
+ return Array.from(meta(config.tests, new Set()));
126
+ };
127
+ // Also handle pitono endpoints for HTML generation if needed
128
+ [...getSecondaryEndpointsPoints("pitono")].forEach(async (sourceFilePath) => {
129
+ // You might want to generate specific files for pitono tests here
130
+ console.log(`Pitono test found: ${sourceFilePath}`);
131
+ });
132
+ // Handle golang tests by generating their metafiles
133
+ const golangTests = config.tests.filter(test => test[1] === 'golang');
134
+ const hasGolangTests = golangTests.length > 0;
135
+ if (hasGolangTests) {
136
+ // Import and use the golang metafile utilities
137
+ const { generateGolangMetafile, writeGolangMetafile } = await import('./utils/golingvuMetafile');
138
+ // Get the entry points (first element of each test tuple)
139
+ const golangEntryPoints = golangTests.map(test => test[0]);
140
+ const metafile = await generateGolangMetafile(testName, golangEntryPoints);
141
+ writeGolangMetafile(testName, metafile);
142
+ // Mark golang as done after writing the metafile
143
+ onGolangDone();
144
+ }
145
+ // Handle pitono (Python) tests by generating their metafiles
146
+ const pitonoTests = config.tests.filter(test => test[1] === 'pitono');
147
+ const hasPitonoTests = pitonoTests.length > 0;
148
+ if (hasPitonoTests) {
149
+ // Import and use the pitono metafile utilities
150
+ const { generatePitonoMetafile } = await import('./utils/pitonoMetafile');
151
+ // Get the entry points (first element of each test tuple)
152
+ const pitonoEntryPoints = pitonoTests.map(test => test[0]);
153
+ const metafile = await generatePitonoMetafile(testName, pitonoEntryPoints);
154
+ // Ensure the directory exists
155
+ const pitonoMetafilePath = `${process.cwd()}/testeranto/metafiles/python`;
156
+ await fs.promises.mkdir(pitonoMetafilePath, { recursive: true });
157
+ // Write the metafile to the specified path
158
+ fs.writeFileSync(`${pitonoMetafilePath}/core.json`, JSON.stringify(metafile, null, 2));
159
+ // Mark pitono as done after writing the metafile
160
+ onPitonoDone();
161
+ }
114
162
  Promise.resolve(Promise.all([...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
115
163
  const sourceFileSplit = sourceFilePath.split("/");
116
164
  const sourceDir = sourceFileSplit.slice(0, -1);
@@ -126,13 +174,6 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
126
174
  .mkdir(path.dirname(htmlFilePath), { recursive: true })
127
175
  .then((x) => fs.writeFileSync(htmlFilePath, webHtmlFrame(jsfilePath, htmlFilePath, cssFilePath)));
128
176
  })));
129
- // glob(`${process.cwd()}/testeranto/bundles/${testName}/chunk-*.mjs`, {
130
- // ignore: "node_modules/**",
131
- // }).then((chunks) => {
132
- // chunks.forEach((chunk) => {
133
- // fs.unlinkSync(chunk);
134
- // });
135
- // });
136
177
  const x = [
137
178
  ["pure", Object.keys(pureEntryPoints)],
138
179
  ["node", Object.keys(nodeEntryPoints)],
@@ -190,4 +231,15 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
190
231
  });
191
232
  }),
192
233
  ]);
234
+ process.stdin.on("keypress", (str, key) => {
235
+ if (key.name === "q") {
236
+ console.log("Testeranto is shutting down gracefully...");
237
+ if (pm) {
238
+ pm.stop();
239
+ }
240
+ else {
241
+ process.exit();
242
+ }
243
+ }
244
+ });
193
245
  });
@@ -0,0 +1,109 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ export async function generateGolangMetafile(testName, entryPoints) {
4
+ const outputs = {};
5
+ // Process each Go entry point
6
+ for (const entryPoint of entryPoints) {
7
+ try {
8
+ // Get the package directory to find all Go files in the same package
9
+ const entryDir = path.dirname(entryPoint);
10
+ // Find all .go files in the same directory
11
+ const goFiles = fs.readdirSync(entryDir)
12
+ .filter(file => file.endsWith('.go'))
13
+ .map(file => path.join(entryDir, file));
14
+ // Create inputs record
15
+ const inputs = {};
16
+ let totalBytes = 0;
17
+ for (const file of goFiles) {
18
+ try {
19
+ const stats = fs.statSync(file);
20
+ inputs[file] = { bytesInOutput: stats.size };
21
+ totalBytes += stats.size;
22
+ }
23
+ catch (_a) {
24
+ inputs[file] = { bytesInOutput: 0 };
25
+ }
26
+ }
27
+ // Add the entry point itself if not already included
28
+ if (!inputs[entryPoint]) {
29
+ try {
30
+ const entryStats = fs.statSync(entryPoint);
31
+ inputs[entryPoint] = { bytesInOutput: entryStats.size };
32
+ totalBytes += entryStats.size;
33
+ }
34
+ catch (_b) {
35
+ inputs[entryPoint] = { bytesInOutput: 0 };
36
+ }
37
+ }
38
+ // The output path should match the Node.js structure - use a path in testeranto/bundles
39
+ // For Go, we don't have actual bundled outputs, so we'll use a placeholder
40
+ const outputPath = `testeranto/bundles/golang/${testName}/${entryPoint}`;
41
+ outputs[outputPath] = {
42
+ entryPoint: entryPoint, // Use the source file path, not the bundle path
43
+ inputs,
44
+ bytes: totalBytes
45
+ };
46
+ }
47
+ catch (error) {
48
+ console.error(`Error processing Go entry point ${entryPoint}:`, error);
49
+ }
50
+ }
51
+ // Create inputs record for the metafile - include all Go files
52
+ const allInputs = {};
53
+ // Collect all unique Go files from all entry points
54
+ const allGoFiles = new Set();
55
+ for (const entryPoint of entryPoints) {
56
+ try {
57
+ const entryDir = path.dirname(entryPoint);
58
+ // Find all .go files in the same directory
59
+ const goFiles = fs.readdirSync(entryDir)
60
+ .filter(file => file.endsWith('.go'))
61
+ .map(file => path.join(entryDir, file));
62
+ goFiles.forEach(file => allGoFiles.add(file));
63
+ // Add the entry point itself
64
+ allGoFiles.add(entryPoint);
65
+ }
66
+ catch (error) {
67
+ console.error(`Error processing Go entry point ${entryPoint} for source files:`, error);
68
+ }
69
+ }
70
+ // Add all Go files to inputs
71
+ for (const filePath of Array.from(allGoFiles)) {
72
+ try {
73
+ const stats = fs.statSync(filePath);
74
+ allInputs[filePath] = {
75
+ bytes: stats.size,
76
+ imports: [] // Go files don't have imports like JS
77
+ };
78
+ }
79
+ catch (_c) {
80
+ allInputs[filePath] = {
81
+ bytes: 0,
82
+ imports: []
83
+ };
84
+ }
85
+ }
86
+ // Reformat outputs to match esbuild structure
87
+ const esbuildOutputs = {};
88
+ for (const [outputPath, output] of Object.entries(outputs)) {
89
+ esbuildOutputs[outputPath] = {
90
+ bytes: output.bytes,
91
+ inputs: output.inputs,
92
+ entryPoint: output.entryPoint
93
+ };
94
+ }
95
+ return {
96
+ errors: [],
97
+ warnings: [],
98
+ metafile: {
99
+ inputs: allInputs,
100
+ outputs: esbuildOutputs
101
+ }
102
+ };
103
+ }
104
+ export function writeGolangMetafile(testName, metafile) {
105
+ const metafileDir = path.join(process.cwd(), "testeranto", "metafiles", "golang");
106
+ fs.mkdirSync(metafileDir, { recursive: true });
107
+ const metafilePath = path.join(metafileDir, `${testName}.json`);
108
+ fs.writeFileSync(metafilePath, JSON.stringify(metafile, null, 2));
109
+ }
@@ -18,7 +18,8 @@ export const STANDARD_LOGS = {
18
18
  LINT_ERRORS: 'lint_errors.txt',
19
19
  EXIT: 'exit.log',
20
20
  MESSAGE: 'message.txt',
21
- PROMPT: 'prompt.txt'
21
+ PROMPT: 'prompt.txt',
22
+ BUILD: 'build.json'
22
23
  };
23
24
  export const RUNTIME_SPECIFIC_LOGS = {
24
25
  node: {
@@ -0,0 +1,60 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { execSync } from 'child_process';
4
+ export async function generatePitonoMetafile(testName, entryPoints) {
5
+ return {
6
+ testName,
7
+ entryPoints,
8
+ timestamp: Date.now()
9
+ };
10
+ }
11
+ export function writePitonoMetafile(testName, metafile) {
12
+ const metafilePath = path.join(process.cwd(), 'testeranto', 'pitono', testName, 'metafile.json');
13
+ const metafileDir = path.dirname(metafilePath);
14
+ // Ensure directory exists
15
+ if (!fs.existsSync(metafileDir)) {
16
+ fs.mkdirSync(metafileDir, { recursive: true });
17
+ }
18
+ // Write the metafile
19
+ fs.writeFileSync(metafilePath, JSON.stringify(metafile, null, 2));
20
+ console.log(`Pitono metafile written to: ${metafilePath}`);
21
+ // Generate core.json using the Python script
22
+ try {
23
+ // First try using the installed command
24
+ const command = `pitono-core-generator ${testName} ${metafile.entryPoints.join(' ')}`;
25
+ execSync(command, { stdio: 'inherit' });
26
+ console.log(`Pitono core.json generated successfully for ${testName}`);
27
+ }
28
+ catch (error) {
29
+ console.error(`Failed to generate Pitono core.json with installed command: ${error}`);
30
+ // Fallback to direct Python execution
31
+ try {
32
+ const pythonCommand = `python ${process.cwd()}/pitono/core_generator.py ${testName} ${metafile.entryPoints.join(' ')}`;
33
+ execSync(pythonCommand, { stdio: 'inherit' });
34
+ console.log(`Pitono core.json generated successfully using direct Python execution`);
35
+ }
36
+ catch (fallbackError) {
37
+ console.error(`Direct Python execution also failed: ${fallbackError}`);
38
+ // Last resort: create the core.json manually
39
+ try {
40
+ const coreData = {
41
+ testName: testName,
42
+ entryPoints: metafile.entryPoints,
43
+ outputs: {},
44
+ metafile: {
45
+ inputs: {},
46
+ outputs: {}
47
+ },
48
+ timestamp: Date.now(),
49
+ runtime: "pitono"
50
+ };
51
+ const coreFilePath = path.join(process.cwd(), 'testeranto', 'pitono', testName, 'core.json');
52
+ fs.writeFileSync(coreFilePath, JSON.stringify(coreData, null, 2));
53
+ console.log(`Pitono core.json created manually as fallback`);
54
+ }
55
+ catch (manualError) {
56
+ console.error(`Even manual creation failed: ${manualError}`);
57
+ }
58
+ }
59
+ }
60
+ }