testeranto 0.198.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 +14 -14
  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
@@ -0,0 +1,49 @@
1
+ import { execSync } from 'child_process';
2
+ import path from 'path';
3
+ import fs from 'fs';
4
+ import { ITestconfig } from '../lib';
5
+
6
+ export class PitonoRunner {
7
+ constructor(private config: ITestconfig, private testName: string) {}
8
+
9
+ async run(): Promise<void> {
10
+ const coreJsonPath = path.join(process.cwd(), 'testeranto', 'pitono', this.testName, 'core.json');
11
+
12
+ // Wait for the core.json file to be created with a timeout
13
+ const maxWaitTime = 10000; // 10 seconds
14
+ const startTime = Date.now();
15
+ while (!fs.existsSync(coreJsonPath) && (Date.now() - startTime) < maxWaitTime) {
16
+ await new Promise(resolve => setTimeout(resolve, 100));
17
+ }
18
+
19
+ if (!fs.existsSync(coreJsonPath)) {
20
+ console.error(`Pitono core.json not found at: ${coreJsonPath} after waiting ${maxWaitTime}ms`);
21
+ return;
22
+ }
23
+
24
+ try {
25
+ const coreData = JSON.parse(fs.readFileSync(coreJsonPath, 'utf-8'));
26
+ const entryPoints = coreData.entryPoints;
27
+
28
+ for (const entryPoint of entryPoints) {
29
+ try {
30
+ console.log(`Running pitono test: ${entryPoint}`);
31
+ // Use python to execute the test file
32
+ const absolutePath = path.resolve(entryPoint);
33
+ // Check if the file exists
34
+ if (!fs.existsSync(absolutePath)) {
35
+ console.error(`Pitono test file not found: ${absolutePath}`);
36
+ continue;
37
+ }
38
+ execSync(`python "${absolutePath}"`, { stdio: 'inherit' });
39
+ console.log(`Pitono test completed: ${entryPoint}`);
40
+ } catch (error) {
41
+ console.error(`Pitono test failed: ${entryPoint}`, error);
42
+ throw error;
43
+ }
44
+ }
45
+ } catch (error) {
46
+ console.error(`Error reading or parsing core.json: ${error}`);
47
+ }
48
+ }
49
+ }
package/src/Types.ts CHANGED
@@ -177,7 +177,7 @@ export type IPluginFactory = (
177
177
  entrypoints?: string[]
178
178
  ) => Plugin;
179
179
 
180
- export type IRunTime = `node` | `web` | "pure" | `spawn`;
180
+ export type IRunTime = `node` | `web` | "pure" | `golang` | `python`;
181
181
 
182
182
  export type ITestTypes = [string, IRunTime, { ports: number }, ITestTypes[]];
183
183
 
@@ -125,10 +125,46 @@ export const TestPageView = ({
125
125
  const [expandedSections, setExpandedSections] = useState({
126
126
  standardLogs: true,
127
127
  runtimeLogs: true,
128
- sourceFiles: true
128
+ sourceFiles: true,
129
+ buildErrors: true,
129
130
  });
130
131
  const [isNavbarCollapsed, setIsNavbarCollapsed] = useState(false);
131
132
 
133
+ // Extract build errors and warnings relevant to this test
134
+ const [buildErrors, setBuildErrors] = useState<{ errors: any[]; warnings: any[] }>({ errors: [], warnings: [] });
135
+
136
+ useEffect(() => {
137
+ const metafile = logs.build_logs?.metafile;
138
+ if (!metafile) {
139
+ setBuildErrors({ errors: [], warnings: [] });
140
+ return;
141
+ }
142
+ const sourceFilesSet = new Set<string>();
143
+ // Collect all input files from metafile outputs related to this test
144
+ Object.entries(metafile.outputs || {}).forEach(([outputPath, output]) => {
145
+ // Normalize paths for comparison
146
+ const normalizedTestName = testName.replace(/\\/g, '/');
147
+ const normalizedEntryPoint = output.entryPoint ? output.entryPoint.replace(/\\/g, '/') : '';
148
+ if (normalizedEntryPoint.includes(normalizedTestName)) {
149
+ Object.keys(output.inputs || {}).forEach((inputPath) => {
150
+ sourceFilesSet.add(inputPath.replace(/\\/g, '/'));
151
+ });
152
+ }
153
+ });
154
+
155
+ // Filter errors and warnings to those originating from source files of this test
156
+ const filteredErrors = (logs.build_logs?.errors || []).filter((err: any) => {
157
+ if (!err.location || !err.location.file) return false;
158
+ return sourceFilesSet.has(err.location.file.replace(/\\/g, '/'));
159
+ });
160
+ const filteredWarnings = (logs.build_logs?.warnings || []).filter((warn: any) => {
161
+ if (!warn.location || !warn.location.file) return false;
162
+ return sourceFilesSet.has(warn.location.file.replace(/\\/g, '/'));
163
+ });
164
+
165
+ setBuildErrors({ errors: filteredErrors, warnings: filteredWarnings });
166
+ }, [logs, testName]);
167
+
132
168
  // Update customMessage when logs change
133
169
  useEffect(() => {
134
170
  if (typeof logs['message.txt'] === 'string' && logs['message.txt'].trim()) {
@@ -370,6 +406,50 @@ export const TestPageView = ({
370
406
  </div>
371
407
  </div>
372
408
  ))}
409
+ {/* Render build errors and warnings */}
410
+ {(buildErrors.errors.length > 0 || buildErrors.warnings.length > 0) && (
411
+ <div className="mb-4 card border-danger">
412
+ <div className="card-header bg-danger text-white">
413
+ <h4>Build Errors and Warnings</h4>
414
+ </div>
415
+ <div className="card-body">
416
+ {buildErrors.errors.length > 0 && (
417
+ <>
418
+ <h5>Errors</h5>
419
+ <ul>
420
+ {buildErrors.errors.map((error, idx) => (
421
+ <li key={`build-error-${idx}`}>
422
+ <strong>{error.text}</strong>
423
+ {error.location && (
424
+ <div>
425
+ File: {error.location.file} Line: {error.location.line} Column: {error.location.column}
426
+ </div>
427
+ )}
428
+ </li>
429
+ ))}
430
+ </ul>
431
+ </>
432
+ )}
433
+ {buildErrors.warnings.length > 0 && (
434
+ <>
435
+ <h5>Warnings</h5>
436
+ <ul>
437
+ {buildErrors.warnings.map((warning, idx) => (
438
+ <li key={`build-warning-${idx}`}>
439
+ <strong>{warning.text}</strong>
440
+ {warning.location && (
441
+ <div>
442
+ File: {warning.location.file} Line: {warning.location.line} Column: {warning.location.column}
443
+ </div>
444
+ )}
445
+ </li>
446
+ ))}
447
+ </ul>
448
+ </>
449
+ )}
450
+ </div>
451
+ </div>
452
+ )}
373
453
  </div>
374
454
  );
375
455
  };
@@ -552,10 +632,10 @@ export const TestPageView = ({
552
632
  {expandedSections.standardLogs && (
553
633
  <div>
554
634
  {Object.values(STANDARD_LOGS).map((logName) => {
555
- const logContent = logs[logName];
635
+ const logContent = logs ? logs[logName] : undefined;
556
636
  const exists = logContent !== undefined &&
557
637
  ((typeof logContent === "string" && logContent.trim() !== "") ||
558
- (typeof logContent === "object" && Object.keys(logContent).length > 0));
638
+ (typeof logContent === "object" && logContent !== null && Object.keys(logContent).length > 0));
559
639
 
560
640
  return (
561
641
  <FileTreeItem
@@ -590,7 +670,8 @@ export const TestPageView = ({
590
670
  </div>
591
671
 
592
672
  {/* Runtime Logs Section */}
593
- {Object.values(RUNTIME_SPECIFIC_LOGS[runtime as RuntimeName]).length > 0 && (
673
+ {runtime && RUNTIME_SPECIFIC_LOGS[runtime as RuntimeName] &&
674
+ Object.values(RUNTIME_SPECIFIC_LOGS[runtime as RuntimeName]).length > 0 && (
594
675
  <div className="p-2">
595
676
  <div
596
677
  className="d-flex align-items-center text-muted mb-1"
@@ -603,10 +684,10 @@ export const TestPageView = ({
603
684
  {expandedSections.runtimeLogs && (
604
685
  <div>
605
686
  {Object.values(RUNTIME_SPECIFIC_LOGS[runtime as RuntimeName]).map((logName) => {
606
- const logContent = logs[logName];
687
+ const logContent = logs ? logs[logName] : undefined;
607
688
  const exists = logContent !== undefined &&
608
689
  ((typeof logContent === "string" && logContent.trim() !== "") ||
609
- (typeof logContent === "object" && Object.keys(logContent).length > 0));
690
+ (typeof logContent === "object" && logContent !== null && Object.keys(logContent).length > 0));
610
691
 
611
692
  return (
612
693
  <FileTreeItem
@@ -642,7 +723,7 @@ export const TestPageView = ({
642
723
  )}
643
724
 
644
725
  {/* Source Files Section */}
645
- {logs.source_files && (
726
+ {logs && logs.source_files && (
646
727
  <div className="p-2">
647
728
  <div
648
729
  className="d-flex align-items-center text-muted mb-1"
@@ -725,7 +806,93 @@ export const TestPageView = ({
725
806
  </div>
726
807
  </div>
727
808
  )}
728
- {selectedFile?.path.endsWith(".json") && !selectedFile.path.endsWith("tests.json") && (
809
+ {selectedFile?.path.endsWith("build.json") && (
810
+ <div>
811
+ <h5>Build Information</h5>
812
+ {(() => {
813
+ try {
814
+ const buildData = JSON.parse(selectedFile.content);
815
+ return (
816
+ <>
817
+ {buildData.errors?.length > 0 && (
818
+ <div className="mb-3">
819
+ <h6 className="text-danger">Errors ({buildData.errors.length})</h6>
820
+ <ul className="list-unstyled">
821
+ {buildData.errors.map((error: any, index: number) => (
822
+ <li key={index} className="mb-2 p-2 bg-light rounded">
823
+ <div className="text-danger fw-bold">{error.text}</div>
824
+ {error.location && (
825
+ <div className="small text-muted">
826
+ File: {error.location.file}
827
+ Line: {error.location.line}
828
+ Column: {error.location.column}
829
+ </div>
830
+ )}
831
+ {error.notes && error.notes.length > 0 && (
832
+ <div className="small">
833
+ Notes:
834
+ <ul>
835
+ {error.notes.map((note: any, noteIndex: number) => (
836
+ <li key={noteIndex}>{note.text}</li>
837
+ ))}
838
+ </ul>
839
+ </div>
840
+ )}
841
+ </li>
842
+ ))}
843
+ </ul>
844
+ </div>
845
+ )}
846
+ {buildData.warnings?.length > 0 && (
847
+ <div className="mb-3">
848
+ <h6 className="text-warning">Warnings ({buildData.warnings.length})</h6>
849
+ <ul className="list-unstyled">
850
+ {buildData.warnings.map((warning: any, index: number) => (
851
+ <li key={index} className="mb-2 p-2 bg-light rounded">
852
+ <div className="text-warning fw-bold">{warning.text}</div>
853
+ {warning.location && (
854
+ <div className="small text-muted">
855
+ File: {warning.location.file}
856
+ Line: {warning.location.line}
857
+ Column: {warning.location.column}
858
+ </div>
859
+ )}
860
+ {warning.notes && warning.notes.length > 0 && (
861
+ <div className="small">
862
+ Notes:
863
+ <ul>
864
+ {warning.notes.map((note: any, noteIndex: number) => (
865
+ <li key={noteIndex}>{note.text}</li>
866
+ ))}
867
+ </ul>
868
+ </div>
869
+ )}
870
+ </li>
871
+ ))}
872
+ </ul>
873
+ </div>
874
+ )}
875
+ {(!buildData.errors || buildData.errors.length === 0) &&
876
+ (!buildData.warnings || buildData.warnings.length === 0) && (
877
+ <div className="alert alert-success">
878
+ No build errors or warnings
879
+ </div>
880
+ )}
881
+ </>
882
+ );
883
+ } catch (e) {
884
+ return (
885
+ <div className="alert alert-danger">
886
+ Error parsing build.json: {e.message}
887
+ </div>
888
+ );
889
+ }
890
+ })()}
891
+ </div>
892
+ )}
893
+ {selectedFile?.path.endsWith(".json") &&
894
+ !selectedFile.path.endsWith("tests.json") &&
895
+ !selectedFile.path.endsWith("build.json") && (
729
896
  <pre className="bg-light p-2 small">
730
897
  <code>{selectedFile.content}</code>
731
898
  </pre>
@@ -58,6 +58,7 @@ export const TestPage = () => {
58
58
  const receivedLogs = await testResponse.logs;
59
59
  console.log('Received logs:', Object.keys(receivedLogs));
60
60
  let sourceFiles = {};
61
+ let buildLogs = {};
61
62
 
62
63
  if (metafileRes.ok) {
63
64
  const metafile = await metafileRes.json();
@@ -65,42 +66,49 @@ export const TestPage = () => {
65
66
  // Find input files only for this test's entry point
66
67
  const tsSources = new Set<string>();
67
68
  const testEntryPoint = `src/${testPath}`;
68
-
69
+
69
70
  // First find all outputs that match this test
70
71
  const matchingOutputs = Object.entries(metafile.metafile.outputs)
71
72
  .filter(([outputPath, output]) => {
72
73
  const normalizedTestPath = testPath.replace(/\./g, '_');
73
74
  const testFileName = testPath.split('/').pop();
74
75
  const testBaseName = testFileName?.split('.').slice(0, -1).join('.');
75
-
76
+
77
+ // Also check outputPath normalized for slashes replaced by underscores
78
+ const normalizedOutputPath = outputPath.replace(/\//g, '_');
79
+
76
80
  return output.entryPoint === testEntryPoint ||
77
81
  outputPath.includes(normalizedTestPath) ||
82
+ normalizedOutputPath.includes(normalizedTestPath) ||
78
83
  (testBaseName && outputPath.includes(testBaseName));
79
84
  });
80
85
 
81
86
  // Then collect all inputs from matching outputs
82
87
  matchingOutputs.forEach(([_, output]) => {
83
88
  Object.keys(output.inputs).forEach(inputPath => {
84
- // Check if this input is a TypeScript file and not in node_modules
85
- if ((inputPath.endsWith('.ts') || inputPath.endsWith('.tsx')) &&
89
+ // Check if this input is a source file (TypeScript or Go) and not in node_modules
90
+ if ((inputPath.endsWith('.ts') || inputPath.endsWith('.tsx') || inputPath.endsWith('.go')) &&
86
91
  !inputPath.includes('node_modules')) {
87
92
  // Get the full input details from metafile.inputs
88
93
  const inputDetails = metafile.metafile.inputs[inputPath];
89
94
  if (inputDetails) {
90
95
  tsSources.add(inputPath);
91
- // Also include any imported TypeScript files
92
- inputDetails.imports.forEach(imp => {
93
- if ((imp.path.endsWith('.ts') || imp.path.endsWith('.tsx')) &&
94
- !imp.path.includes('node_modules') &&
95
- !imp.external) {
96
- tsSources.add(imp.path);
97
- }
98
- });
96
+ // Also include any imported source files (for TypeScript)
97
+ // Go files don't have imports in the same way, so we'll only process for TypeScript
98
+ if (inputPath.endsWith('.ts') || inputPath.endsWith('.tsx')) {
99
+ inputDetails.imports.forEach(imp => {
100
+ if ((imp.path.endsWith('.ts') || imp.path.endsWith('.tsx')) &&
101
+ !imp.path.includes('node_modules') &&
102
+ !imp.external) {
103
+ tsSources.add(imp.path);
104
+ }
105
+ });
106
+ }
99
107
  }
100
108
  }
101
109
  });
102
110
  });
103
-
111
+
104
112
  // Organize source files into directory tree structure
105
113
  const fileTree = {};
106
114
  const filesList = await Promise.all(
@@ -126,10 +134,10 @@ export const TestPage = () => {
126
134
 
127
135
  filesList.forEach(file => {
128
136
  if (!file) return;
129
-
137
+
130
138
  const parts = file.path.split('/');
131
139
  let currentLevel = fileTree;
132
-
140
+
133
141
  parts.forEach((part, index) => {
134
142
  if (!currentLevel[part]) {
135
143
  if (index === parts.length - 1) {
@@ -146,12 +154,15 @@ export const TestPage = () => {
146
154
  });
147
155
 
148
156
  sourceFiles = fileTree;
157
+ buildLogs = metafile;
149
158
  }
150
159
  }
151
160
 
152
- // Add source files to logs
161
+ // Add source files and build logs to logs
153
162
  receivedLogs['source_files'] = sourceFiles;
163
+ receivedLogs['build_logs'] = buildLogs;
154
164
  console.log('Source files structure:', sourceFiles);
165
+ console.log('Build logs:', buildLogs);
155
166
 
156
167
  // Ensure tests.json is properly formatted
157
168
  if (receivedLogs['tests.json']) {
@@ -191,6 +202,36 @@ export const TestPage = () => {
191
202
  } catch (err) {
192
203
  console.error('Failed to load summary:', err);
193
204
  }
205
+
206
+ // Fetch build.json to get build errors and warnings
207
+ try {
208
+ // The build.json is in the runtime directory directly under the test path
209
+ // testPath is "src/lib/pmProxy.test/index.ts"
210
+ // We need to use the directory path without the filename
211
+ const pathParts = testPath.split('/');
212
+ const fileName = pathParts.pop();
213
+ const directoryPath = pathParts.join('/');
214
+
215
+ // Construct the path without the filename without extension
216
+ const buildUrl = `/reports/${projectName}/${directoryPath}/${runtime}/build.json`;
217
+ console.log(`Fetching build.json from: ${buildUrl}`);
218
+
219
+ const buildResponse = await fetch(buildUrl);
220
+ if (buildResponse.ok) {
221
+ const buildData = await buildResponse.json();
222
+ console.log('Build data received:', buildData);
223
+ // Add build errors and warnings to logs
224
+ receivedLogs['build.json'] = buildData;
225
+ } else {
226
+ console.log('Build.json not found or not accessible, status:', buildResponse.status);
227
+ // Add an empty build.json to logs to prevent errors
228
+ receivedLogs['build.json'] = { errors: [], warnings: [] };
229
+ }
230
+ } catch (err) {
231
+ console.log('No build.json found or error fetching it:', err);
232
+ // Add an empty build.json to logs to prevent errors
233
+ receivedLogs['build.json'] = { errors: [], warnings: [] };
234
+ }
194
235
  } catch (err) {
195
236
  setError(err instanceof Error ? err.message : 'Unknown error');
196
237
  setTestsExist(false);
@@ -0,0 +1,36 @@
1
+ package core
2
+
3
+ // Ibdd_in_any represents the input types for BDD
4
+ type Ibdd_in_any interface {
5
+ Iinput() interface{}
6
+ Isubject() interface{}
7
+ Istore() interface{}
8
+ Iselection() interface{}
9
+ Then() interface{}
10
+ Given() interface{}
11
+ }
12
+
13
+ // Ibdd_out_any represents the output types for BDD
14
+ type Ibdd_out_any interface{}
15
+
16
+ // ITestSpecification defines the test specification function
17
+ type ITestSpecification func(suites, givens, whens, thens interface{}) interface{}
18
+
19
+ // ITestImplementation defines the test implementation structure
20
+ type ITestImplementation struct {
21
+ Suites map[string]interface{}
22
+ Givens map[string]interface{}
23
+ Whens map[string]interface{}
24
+ Thens map[string]interface{}
25
+ }
26
+
27
+ // ITestAdapter defines the adapter interface
28
+ type ITestAdapter interface {
29
+ BeforeAll(input interface{}, tr ITTestResourceConfiguration, pm interface{}) interface{}
30
+ AfterAll(store interface{}, pm interface{}) interface{}
31
+ BeforeEach(subject, initializer interface{}, testResource ITTestResourceConfiguration, initialValues interface{}, pm interface{}) interface{}
32
+ AfterEach(store interface{}, key string, pm interface{}) interface{}
33
+ AndWhen(store, whenCB interface{}, testResource interface{}, pm interface{}) interface{}
34
+ ButThen(store, thenCB interface{}, testResource interface{}, pm interface{}) interface{}
35
+ AssertThis(t interface{}) bool
36
+ }
@@ -0,0 +1,3 @@
1
+ # Golingvu
2
+
3
+ ## implementation of testeranto in "go"
@@ -0,0 +1,76 @@
1
+ package golingvu
2
+
3
+ // BaseGiven represents a base Given condition
4
+ type BaseGiven struct {
5
+ Name string
6
+ Features []string
7
+ Whens []*BaseWhen
8
+ Thens []*BaseThen
9
+ Error error
10
+ Fail interface{}
11
+ Store interface{}
12
+ RecommendedFsPath string
13
+ GivenCB interface{}
14
+ InitialValues interface{}
15
+ Key string
16
+ Failed bool
17
+ Artifacts []string
18
+ GivenThatFunc func(subject, testResource, artifactory, initializer, initialValues, pm interface{}) (interface{}, error)
19
+ AfterEachFunc func(store interface{}, key string, artifactory, pm interface{}) (interface{}, error)
20
+ UberCatcherFunc func(func())
21
+ }
22
+
23
+ // AddArtifact adds an artifact path
24
+ func (bg *BaseGiven) AddArtifact(path string) {
25
+ // Normalize path separators
26
+ // For simplicity, we'll assume paths are already normalized
27
+ bg.Artifacts = append(bg.Artifacts, path)
28
+ }
29
+
30
+ // NewBaseGiven creates a new BaseGiven instance
31
+ func NewBaseGiven(name string, features []string, whens []*BaseWhen, thens []*BaseThen, givenCB, initialValues interface{}) *BaseGiven {
32
+ return &BaseGiven{
33
+ Name: name,
34
+ Features: features,
35
+ Whens: whens,
36
+ Thens: thens,
37
+ GivenCB: givenCB,
38
+ InitialValues: initialValues,
39
+ Artifacts: make([]string, 0),
40
+ }
41
+ }
42
+
43
+ // BeforeAll is called before all tests
44
+ func (bg *BaseGiven) BeforeAll(store interface{}) interface{} {
45
+ return store
46
+ }
47
+
48
+ // ToObj converts the instance to a map for serialization
49
+ func (bg *BaseGiven) ToObj() map[string]interface{} {
50
+ return map[string]interface{}{
51
+ "key": bg.Key,
52
+ "name": bg.Name,
53
+ "whens": bg.Whens,
54
+ "thens": bg.Thens,
55
+ "error": bg.Error,
56
+ "failed": bg.Failed,
57
+ "features": bg.Features,
58
+ "artifacts": bg.Artifacts,
59
+ }
60
+ }
61
+
62
+ // GivenThat is an abstract method to be implemented
63
+ func (bg *BaseGiven) GivenThat(subject, testResourceConfiguration, artifactory, givenCB, initialValues, pm interface{}) (interface{}, error) {
64
+ // To be implemented by concrete types
65
+ return nil, nil
66
+ }
67
+
68
+ // AfterEach is called after each test
69
+ func (bg *BaseGiven) AfterEach(store interface{}, key string, artifactory, pm interface{}) (interface{}, error) {
70
+ return store, nil
71
+ }
72
+
73
+ // UberCatcher handles errors
74
+ func (bg *BaseGiven) UberCatcher(e error) {
75
+ bg.Error = e
76
+ }
@@ -0,0 +1,39 @@
1
+ package golingvu
2
+
3
+ // BaseSuite represents a test suite
4
+ type BaseSuite struct {
5
+ Name string
6
+ Givens map[string]*BaseGiven
7
+ AfterAllFunc func(store interface{}, artifactory func(string, interface{}), pm interface{}) interface{}
8
+ AssertThatFunc func(t interface{}) bool
9
+ SetupFunc func(s interface{}, artifactory func(string, interface{}), tr ITTestResourceConfiguration, pm interface{}) interface{}
10
+ }
11
+
12
+ // Run executes the test suite
13
+ func (bs *BaseSuite) Run(input interface{}, testResourceConfiguration ITTestResourceConfiguration, artifactory func(string, interface{}), tLog func(...string), pm interface{}) (*BaseSuite, error) {
14
+ // Implementation would go here
15
+ return bs, nil
16
+ }
17
+
18
+ // ToObj converts the suite to a serializable object
19
+ func (bs *BaseSuite) ToObj() map[string]interface{} {
20
+ return map[string]interface{}{
21
+ "name": bs.Name,
22
+ }
23
+ }
24
+
25
+ // Features returns the features covered by this suite
26
+ func (bs *BaseSuite) Features() []string {
27
+ features := make([]string, 0)
28
+ seen := make(map[string]bool)
29
+
30
+ for _, given := range bs.Givens {
31
+ for _, feature := range given.Features {
32
+ if !seen[feature] {
33
+ features = append(features, feature)
34
+ seen[feature] = true
35
+ }
36
+ }
37
+ }
38
+ return features
39
+ }