@ai-dev-tools/csharp-copilot-core 0.0.31 → 0.0.32

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 (309) hide show
  1. package/out/analyze/cecil.d.ts +1 -0
  2. package/out/analyze/cecil.js +42 -0
  3. package/out/analyze/cecil.js.map +1 -0
  4. package/out/analyze/checkCodeSyntax.d.ts +7 -0
  5. package/out/analyze/checkCodeSyntax.js +67 -0
  6. package/out/analyze/checkCodeSyntax.js.map +1 -0
  7. package/out/analyze/generateCodeDependency.d.ts +6 -0
  8. package/out/analyze/generateCodeDependency.js +127 -0
  9. package/out/analyze/generateCodeDependency.js.map +1 -0
  10. package/out/analyze/installAnalyzerTool.d.ts +1 -0
  11. package/out/analyze/installAnalyzerTool.js +83 -0
  12. package/out/analyze/installAnalyzerTool.js.map +1 -0
  13. package/out/batch/generateCodeTests.d.ts +6 -0
  14. package/out/batch/generateCodeTests.js +163 -0
  15. package/out/batch/generateCodeTests.js.map +1 -0
  16. package/out/batch/getFolderCodeFile.d.ts +1 -0
  17. package/out/batch/getFolderCodeFile.js +19 -0
  18. package/out/batch/getFolderCodeFile.js.map +1 -0
  19. package/out/batch/getProjectCodeFile.d.ts +4 -0
  20. package/out/batch/getProjectCodeFile.js +86 -0
  21. package/out/batch/getProjectCodeFile.js.map +1 -0
  22. package/out/batch/getSolutionCodeFile.d.ts +8 -0
  23. package/out/batch/getSolutionCodeFile.js +70 -0
  24. package/out/batch/getSolutionCodeFile.js.map +1 -0
  25. package/out/benchmark/formatToMarkdown.d.ts +2 -0
  26. package/out/benchmark/formatToMarkdown.js +101 -0
  27. package/out/benchmark/formatToMarkdown.js.map +1 -0
  28. package/out/benchmark/generateBenchmarkReport.d.ts +1 -0
  29. package/out/benchmark/generateBenchmarkReport.js +82 -0
  30. package/out/benchmark/generateBenchmarkReport.js.map +1 -0
  31. package/out/codeCoverage/codeCoverage.d.ts +6 -0
  32. package/out/codeCoverage/codeCoverage.js +39 -0
  33. package/out/codeCoverage/codeCoverage.js.map +1 -0
  34. package/out/codeCoverage/codeCoverageReport.d.ts +6 -0
  35. package/out/codeCoverage/codeCoverageReport.js +76 -0
  36. package/out/codeCoverage/codeCoverageReport.js.map +1 -0
  37. package/out/codeCoverage/extractCodeCoverageInfo.d.ts +2 -0
  38. package/out/codeCoverage/extractCodeCoverageInfo.js +81 -0
  39. package/out/codeCoverage/extractCodeCoverageInfo.js.map +1 -0
  40. package/out/codeCoverage/extractCoverageReportPath.d.ts +1 -0
  41. package/out/codeCoverage/extractCoverageReportPath.js +25 -0
  42. package/out/codeCoverage/extractCoverageReportPath.js.map +1 -0
  43. package/out/codeCoverage/generateCodeCoverageReport.d.ts +1 -0
  44. package/out/codeCoverage/generateCodeCoverageReport.js +30 -0
  45. package/out/codeCoverage/generateCodeCoverageReport.js.map +1 -0
  46. package/out/codeCoverage/getCodeCoverageSetting.d.ts +1 -0
  47. package/out/codeCoverage/getCodeCoverageSetting.js +58 -0
  48. package/out/codeCoverage/getCodeCoverageSetting.js.map +1 -0
  49. package/out/codeCoverage/reportTool.d.ts +2 -0
  50. package/out/codeCoverage/reportTool.js +23 -0
  51. package/out/codeCoverage/reportTool.js.map +1 -0
  52. package/out/codeCoverage/simplifyCoverageXml.d.ts +2 -0
  53. package/out/codeCoverage/simplifyCoverageXml.js +117 -0
  54. package/out/codeCoverage/simplifyCoverageXml.js.map +1 -0
  55. package/out/codebk/250804prompt/buildAfGuidelines.liquid +15 -0
  56. package/out/codebk/250804prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
  57. package/out/codebk/250804prompt/general/generalUtGuidelines.liquid +18 -0
  58. package/out/codebk/250804prompt/generateUtAutoFix.liquid +19 -0
  59. package/out/codebk/250804prompt/generateUtGuidelines.liquid +13 -0
  60. package/out/codebk/250804prompt/generateUtSystem.liquid +5 -0
  61. package/out/codebk/250804prompt/generateUtUserInput.liquid +27 -0
  62. package/out/codebk/250804prompt/testAfGuidelines.liquid +6 -0
  63. package/out/codebk/250804prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
  64. package/out/codebk/250804prompt/xap/xapCodeCodeDependency.liquid +0 -0
  65. package/out/codebk/250804prompt/xap/xapCodeSample.liquid +38 -0
  66. package/out/codebk/250804prompt/xap/xapUtGuideline-240804.liquid +36 -0
  67. package/out/codebk/250804prompt/xap/xapUtGuideline.liquid +36 -0
  68. package/out/codebk/childProcessManager.d.ts +1 -0
  69. package/out/codebk/childProcessManager.js +50 -0
  70. package/out/codebk/childProcessManager.js.map +1 -0
  71. package/out/codebk/msBuidSpawn.d.ts +1 -0
  72. package/out/codebk/msBuidSpawn.js +58 -0
  73. package/out/codebk/msBuidSpawn.js.map +1 -0
  74. package/out/codebk/msBuild.d.ts +1 -0
  75. package/out/codebk/msBuild.js +123 -0
  76. package/out/codebk/msBuild.js.map +1 -0
  77. package/out/codebk/old/generateXapTestAutoFix.liquid +12 -0
  78. package/out/codebk/old/generateXapTestGuidelines-fm.liquid +68 -0
  79. package/out/codebk/old/generateXapTestGuidelines.liquid +28 -0
  80. package/out/codebk/old/xapGuideline-fm.liquid +149 -0
  81. package/out/codebk/old/xapGuideline.liquid +37 -0
  82. package/out/codebk/oldExec/checkCodeSyntax.d.ts +1 -0
  83. package/out/codebk/oldExec/checkCodeSyntax.js +81 -0
  84. package/out/codebk/oldExec/checkCodeSyntax.js.map +1 -0
  85. package/out/codebk/oldExec/codeCoverage.d.ts +1 -0
  86. package/out/codebk/oldExec/codeCoverage.js +54 -0
  87. package/out/codebk/oldExec/codeCoverage.js.map +1 -0
  88. package/out/codebk/oldExec/codeCoverageReport.d.ts +1 -0
  89. package/out/codebk/oldExec/codeCoverageReport.js +64 -0
  90. package/out/codebk/oldExec/codeCoverageReport.js.map +1 -0
  91. package/out/codebk/oldExec/containsMethods.d.ts +1 -0
  92. package/out/codebk/oldExec/containsMethods.js +74 -0
  93. package/out/codebk/oldExec/containsMethods.js.map +1 -0
  94. package/out/codebk/oldExec/generateCodeDependency.d.ts +1 -0
  95. package/out/codebk/oldExec/generateCodeDependency.js +95 -0
  96. package/out/codebk/oldExec/generateCodeDependency.js.map +1 -0
  97. package/out/codebk/oldExec/msBuild.d.ts +1 -0
  98. package/out/codebk/oldExec/msBuild.js +53 -0
  99. package/out/codebk/oldExec/msBuild.js.map +1 -0
  100. package/out/codebk/oldExec/vsTest.d.ts +1 -0
  101. package/out/codebk/oldExec/vsTest.js +71 -0
  102. package/out/codebk/oldExec/vsTest.js.map +1 -0
  103. package/out/codebk/prompts/general/generalUnitTestGuidelines-20250702.liquid +56 -0
  104. package/out/codebk/prompts/generateXapTestGuidelines-20250704.liquid +21 -0
  105. package/out/codebk/prompts/generateXapTestGuidelines-o.liquid +29 -0
  106. package/out/codebk/prompts/xap/xapGuideline-o.liquid +45 -0
  107. package/out/codebk/testbuildkill.d.ts +1 -0
  108. package/out/codebk/testbuildkill.js +37 -0
  109. package/out/codebk/testbuildkill.js.map +1 -0
  110. package/out/command/index.d.ts +2 -0
  111. package/out/command/index.js +90 -0
  112. package/out/command/index.js.map +1 -0
  113. package/out/command/utGenWrapper.d.ts +3 -0
  114. package/out/command/utGenWrapper.js +53 -0
  115. package/out/command/utGenWrapper.js.map +1 -0
  116. package/out/exit/childProcessManager.d.ts +2 -0
  117. package/out/exit/childProcessManager.js +43 -0
  118. package/out/exit/childProcessManager.js.map +1 -0
  119. package/out/exit/setupProcessSignalHandler.d.ts +1 -0
  120. package/out/exit/setupProcessSignalHandler.js +18 -0
  121. package/out/exit/setupProcessSignalHandler.js.map +1 -0
  122. package/out/gen/autoFix.d.ts +4 -0
  123. package/out/gen/autoFix.js +129 -0
  124. package/out/gen/autoFix.js.map +1 -0
  125. package/out/gen/csharpUtGen.d.ts +2 -0
  126. package/out/gen/csharpUtGen.js +125 -0
  127. package/out/gen/csharpUtGen.js.map +1 -0
  128. package/out/gen/ensureValidLLMResponse.d.ts +1 -0
  129. package/out/gen/ensureValidLLMResponse.js +19 -0
  130. package/out/gen/ensureValidLLMResponse.js.map +1 -0
  131. package/out/gen/postGen/addAiAnnotation.d.ts +1 -0
  132. package/out/gen/postGen/addAiAnnotation.js +57 -0
  133. package/out/gen/postGen/addAiAnnotation.js.map +1 -0
  134. package/out/gen/postGen/extractCodeFromResponse.d.ts +1 -0
  135. package/out/gen/postGen/extractCodeFromResponse.js +38 -0
  136. package/out/gen/postGen/extractCodeFromResponse.js.map +1 -0
  137. package/out/gen/postGen/postGenProcess.d.ts +1 -0
  138. package/out/gen/postGen/postGenProcess.js +39 -0
  139. package/out/gen/postGen/postGenProcess.js.map +1 -0
  140. package/out/gen/postGen/removeComments.d.ts +1 -0
  141. package/out/gen/postGen/removeComments.js +92 -0
  142. package/out/gen/postGen/removeComments.js.map +1 -0
  143. package/out/gen/postGen/removeSingleLines.d.ts +1 -0
  144. package/out/gen/postGen/removeSingleLines.js +29 -0
  145. package/out/gen/postGen/removeSingleLines.js.map +1 -0
  146. package/out/gen/postGen/repairRequiredNameSpaces.d.ts +2 -0
  147. package/out/gen/postGen/repairRequiredNameSpaces.js +142 -0
  148. package/out/gen/postGen/repairRequiredNameSpaces.js.map +1 -0
  149. package/out/gen/postGen/validateTestCode.d.ts +1 -0
  150. package/out/gen/postGen/validateTestCode.js +14 -0
  151. package/out/gen/postGen/validateTestCode.js.map +1 -0
  152. package/out/gen/preGen/excludeFileName.d.ts +1 -0
  153. package/out/gen/preGen/excludeFileName.js +49 -0
  154. package/out/gen/preGen/excludeFileName.js.map +1 -0
  155. package/out/gen/preGen/excludeSpecificTag.d.ts +1 -0
  156. package/out/gen/preGen/excludeSpecificTag.js +19 -0
  157. package/out/gen/preGen/excludeSpecificTag.js.map +1 -0
  158. package/out/gen/preGen/preGenProcess.d.ts +1 -0
  159. package/out/gen/preGen/preGenProcess.js +22 -0
  160. package/out/gen/preGen/preGenProcess.js.map +1 -0
  161. package/out/gen/preGen/validateCode.d.ts +3 -0
  162. package/out/gen/preGen/validateCode.js +63 -0
  163. package/out/gen/preGen/validateCode.js.map +1 -0
  164. package/out/index.d.ts +3 -0
  165. package/out/index.js +10 -0
  166. package/out/index.js.map +1 -0
  167. package/out/llm/model/Gpt.d.ts +1 -0
  168. package/out/llm/model/Gpt.js +93 -0
  169. package/out/llm/model/Gpt.js.map +1 -0
  170. package/out/llm/preparePrompt.d.ts +2 -0
  171. package/out/llm/preparePrompt.js +135 -0
  172. package/out/llm/preparePrompt.js.map +1 -0
  173. package/out/llm/prompt/buildAfGuidelines.liquid +15 -0
  174. package/out/llm/prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
  175. package/out/llm/prompt/general/generalUtGuidelines.liquid +16 -0
  176. package/out/llm/prompt/generateUtAutoFix.liquid +23 -0
  177. package/out/llm/prompt/generateUtDependency.liquid +3 -0
  178. package/out/llm/prompt/generateUtSystem.liquid +5 -0
  179. package/out/llm/prompt/generateUtTemplate.liquid +32 -0
  180. package/out/llm/prompt/generateUtUserInput.liquid +4 -0
  181. package/out/llm/prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
  182. package/out/llm/prompt/xap/xapCodeCodeDependency.liquid +0 -0
  183. package/out/llm/prompt/xap/xapCodeSample.liquid +38 -0
  184. package/out/llm/prompt/xap/xapUtGuideline.liquid +37 -0
  185. package/out/llm/sendRequestToLLM.d.ts +4 -0
  186. package/out/llm/sendRequestToLLM.js +9 -0
  187. package/out/llm/sendRequestToLLM.js.map +1 -0
  188. package/out/llm/sendRequestToSelfHostLLM.d.ts +4 -0
  189. package/out/llm/sendRequestToSelfHostLLM.js +41 -0
  190. package/out/llm/sendRequestToSelfHostLLM.js.map +1 -0
  191. package/out/metrics/appInsightTelemetry.d.ts +6 -0
  192. package/out/metrics/appInsightTelemetry.js +77 -0
  193. package/out/metrics/appInsightTelemetry.js.map +1 -0
  194. package/out/metrics/machineId.d.ts +11 -0
  195. package/out/metrics/machineId.js +85 -0
  196. package/out/metrics/machineId.js.map +1 -0
  197. package/out/setup/setup.d.ts +1 -0
  198. package/out/setup/setup.js +10 -0
  199. package/out/setup/setup.js.map +1 -0
  200. package/out/setup/setupConsole.d.ts +1 -0
  201. package/out/setup/setupConsole.js +23 -0
  202. package/out/setup/setupConsole.js.map +1 -0
  203. package/out/setup/setupLLMRequest.d.ts +2 -0
  204. package/out/setup/setupLLMRequest.js +10 -0
  205. package/out/setup/setupLLMRequest.js.map +1 -0
  206. package/out/tools/devenvcom.cmd +13 -0
  207. package/out/tools/devenvexe.cmd +13 -0
  208. package/out/tools/msbuildexe.cmd +13 -0
  209. package/out/tools/vstestexe.cmd +13 -0
  210. package/out/types/benchmark.d.ts +11 -0
  211. package/out/types/benchmark.js +3 -0
  212. package/out/types/benchmark.js.map +1 -0
  213. package/out/types/buildResult.d.ts +8 -0
  214. package/out/types/buildResult.js +3 -0
  215. package/out/types/buildResult.js.map +1 -0
  216. package/out/types/constants.d.ts +10 -0
  217. package/out/types/constants.js +14 -0
  218. package/out/types/constants.js.map +1 -0
  219. package/out/types/genResult.d.ts +10 -0
  220. package/out/types/genResult.js +3 -0
  221. package/out/types/genResult.js.map +1 -0
  222. package/out/types/testResult.d.ts +12 -0
  223. package/out/types/testResult.js +3 -0
  224. package/out/types/testResult.js.map +1 -0
  225. package/out/types/verifyResult.d.ts +8 -0
  226. package/out/types/verifyResult.js +3 -0
  227. package/out/types/verifyResult.js.map +1 -0
  228. package/out/utils/checkTestProject.d.ts +2 -0
  229. package/out/utils/checkTestProject.js +79 -0
  230. package/out/utils/checkTestProject.js.map +1 -0
  231. package/out/utils/checkXapCode.d.ts +2 -0
  232. package/out/utils/checkXapCode.js +59 -0
  233. package/out/utils/checkXapCode.js.map +1 -0
  234. package/out/utils/delay.d.ts +1 -0
  235. package/out/utils/delay.js +7 -0
  236. package/out/utils/delay.js.map +1 -0
  237. package/out/utils/detectTestFramework.d.ts +1 -0
  238. package/out/utils/detectTestFramework.js +33 -0
  239. package/out/utils/detectTestFramework.js.map +1 -0
  240. package/out/utils/fileUtils.d.ts +2 -0
  241. package/out/utils/fileUtils.js +42 -0
  242. package/out/utils/fileUtils.js.map +1 -0
  243. package/out/utils/generateCodeSha256.d.ts +1 -0
  244. package/out/utils/generateCodeSha256.js +46 -0
  245. package/out/utils/generateCodeSha256.js.map +1 -0
  246. package/out/utils/getCodeStructurePath.d.ts +5 -0
  247. package/out/utils/getCodeStructurePath.js +155 -0
  248. package/out/utils/getCodeStructurePath.js.map +1 -0
  249. package/out/utils/getOrCreateDir.d.ts +2 -0
  250. package/out/utils/getOrCreateDir.js +63 -0
  251. package/out/utils/getOrCreateDir.js.map +1 -0
  252. package/out/utils/getTestCodeInfo.d.ts +2 -0
  253. package/out/utils/getTestCodeInfo.js +121 -0
  254. package/out/utils/getTestCodeInfo.js.map +1 -0
  255. package/out/utils/getTestFile.d.ts +13 -0
  256. package/out/utils/getTestFile.js +297 -0
  257. package/out/utils/getTestFile.js.map +1 -0
  258. package/out/utils/parseBuildResult.d.ts +3 -0
  259. package/out/utils/parseBuildResult.js +45 -0
  260. package/out/utils/parseBuildResult.js.map +1 -0
  261. package/out/utils/parseSyntaxCheckResult.d.ts +2 -0
  262. package/out/utils/parseSyntaxCheckResult.js +39 -0
  263. package/out/utils/parseSyntaxCheckResult.js.map +1 -0
  264. package/out/utils/parseVstestResult.d.ts +3 -0
  265. package/out/utils/parseVstestResult.js +62 -0
  266. package/out/utils/parseVstestResult.js.map +1 -0
  267. package/out/utils/removeFailedTestMethods.d.ts +3 -0
  268. package/out/utils/removeFailedTestMethods.js +208 -0
  269. package/out/utils/removeFailedTestMethods.js.map +1 -0
  270. package/out/utils/runCommand.d.ts +1 -0
  271. package/out/utils/runCommand.js +14 -0
  272. package/out/utils/runCommand.js.map +1 -0
  273. package/out/utils/spawnExec.d.ts +1 -0
  274. package/out/utils/spawnExec.js +80 -0
  275. package/out/utils/spawnExec.js.map +1 -0
  276. package/out/utils/verifyBuildErrorCausedFile.d.ts +1 -0
  277. package/out/utils/verifyBuildErrorCausedFile.js +60 -0
  278. package/out/utils/verifyBuildErrorCausedFile.js.map +1 -0
  279. package/out/utils/verifyTestCode.d.ts +2 -0
  280. package/out/utils/verifyTestCode.js +25 -0
  281. package/out/utils/verifyTestCode.js.map +1 -0
  282. package/out/utils/writeFailedVerifyResult.d.ts +1 -0
  283. package/out/utils/writeFailedVerifyResult.js +67 -0
  284. package/out/utils/writeFailedVerifyResult.js.map +1 -0
  285. package/out/utils/writeGenCode.d.ts +1 -0
  286. package/out/utils/writeGenCode.js +63 -0
  287. package/out/utils/writeGenCode.js.map +1 -0
  288. package/out/vs/msBuild.d.ts +13 -0
  289. package/out/vs/msBuild.js +49 -0
  290. package/out/vs/msBuild.js.map +1 -0
  291. package/out/vs/vsTest.d.ts +15 -0
  292. package/out/vs/vsTest.js +75 -0
  293. package/out/vs/vsTest.js.map +1 -0
  294. package/out/vs/vsTools.d.ts +7 -0
  295. package/out/vs/vsTools.js +177 -0
  296. package/out/vs/vsTools.js.map +1 -0
  297. package/out/vsPlugin/getVsPluginVerifyResult.d.ts +2 -0
  298. package/out/vsPlugin/getVsPluginVerifyResult.js +41 -0
  299. package/out/vsPlugin/getVsPluginVerifyResult.js.map +1 -0
  300. package/out/vsPlugin/interactionConstants.d.ts +2 -0
  301. package/out/vsPlugin/interactionConstants.js +10 -0
  302. package/out/vsPlugin/interactionConstants.js.map +1 -0
  303. package/out/vsPlugin/sendStdToVsPlugin.d.ts +1 -0
  304. package/out/vsPlugin/sendStdToVsPlugin.js +12 -0
  305. package/out/vsPlugin/sendStdToVsPlugin.js.map +1 -0
  306. package/out/vsPlugin/stdListener.d.ts +3 -0
  307. package/out/vsPlugin/stdListener.js +57 -0
  308. package/out/vsPlugin/stdListener.js.map +1 -0
  309. package/package.json +1 -1
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getSourceFilesFromCsproj = getSourceFilesFromCsproj;
40
+ const fs = __importStar(require("fs"));
41
+ const path = __importStar(require("path"));
42
+ const fast_xml_parser_1 = require("fast-xml-parser");
43
+ const checkTestProject_1 = require("../utils/checkTestProject");
44
+ const fast_glob_1 = __importDefault(require("fast-glob"));
45
+ /**
46
+ * parse .csproj to extract all source files
47
+ */
48
+ async function getSourceFilesFromCsproj(csprojPath) {
49
+ if ((0, checkTestProject_1.checkTestProject)(csprojPath)) {
50
+ console.error(`This is a test project: ${csprojPath}, skip it...`);
51
+ return [];
52
+ }
53
+ const xml = fs.readFileSync(csprojPath, 'utf-8');
54
+ const parser = new fast_xml_parser_1.XMLParser({
55
+ ignoreAttributes: false,
56
+ attributeNamePrefix: '',
57
+ });
58
+ const result = parser.parse(xml);
59
+ const projectDir = path.dirname(csprojPath);
60
+ const files = [];
61
+ const itemGroups = result.Project?.ItemGroup ?? [];
62
+ const groups = Array.isArray(itemGroups) ? itemGroups : [itemGroups];
63
+ for (const group of groups) {
64
+ const compiles = group.Compile;
65
+ if (compiles) {
66
+ const compileArray = Array.isArray(compiles) ? compiles : [compiles];
67
+ for (const item of compileArray) {
68
+ if (item.Include) {
69
+ const filePath = path.resolve(projectDir, item.Include);
70
+ files.push(filePath);
71
+ }
72
+ }
73
+ }
74
+ }
75
+ // SDK-style project files contains all source files in the project directory as default
76
+ if (files.length === 0 && result.Project?.Sdk) {
77
+ const csFiles = await (0, fast_glob_1.default)(['**/*.cs'], {
78
+ cwd: projectDir,
79
+ absolute: true,
80
+ ignore: ['**/bin/**', '**/obj/**']
81
+ });
82
+ files.push(...csFiles);
83
+ }
84
+ return files;
85
+ }
86
+ //# sourceMappingURL=getProjectCodeFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getProjectCodeFile.js","sourceRoot":"","sources":["../../src/batch/getProjectCodeFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,4DA8CC;AAxDD,uCAAyB;AACzB,2CAA6B;AAE7B,qDAA4C;AAC5C,gEAA6D;AAC7D,0DAA2B;AAE3B;;GAEG;AACI,KAAK,UAAU,wBAAwB,CAAC,UAAkB;IAC7D,IAAI,IAAA,mCAAgB,EAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,KAAK,CAAC,2BAA2B,UAAU,cAAc,CAAC,CAAC;QACnE,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,IAAI,2BAAS,CAAC;QACzB,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,EA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K,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\nimport { XMLParser } from 'fast-xml-parser';\r\nimport { checkTestProject } from '../utils/checkTestProject';\r\nimport fg from 'fast-glob';\r\n\r\n/**\r\n * parse .csproj to extract all source files\r\n */\r\nexport async function getSourceFilesFromCsproj(csprojPath: string): Promise<string[]> {\r\n if (checkTestProject(csprojPath)) {\r\n console.error(`This is a test project: ${csprojPath}, skip it...`);\r\n return [];\r\n }\r\n\r\n const xml = fs.readFileSync(csprojPath, 'utf-8');\r\n const parser = new XMLParser({\r\n ignoreAttributes: false,\r\n attributeNamePrefix: '',\r\n });\r\n const result = parser.parse(xml);\r\n\r\n const projectDir = path.dirname(csprojPath);\r\n const files: string[] = [];\r\n\r\n const itemGroups = result.Project?.ItemGroup ?? [];\r\n\r\n const groups = Array.isArray(itemGroups) ? itemGroups : [itemGroups];\r\n\r\n for (const group of groups) {\r\n const compiles = group.Compile;\r\n\r\n if (compiles) {\r\n const compileArray = Array.isArray(compiles) ? compiles : [compiles];\r\n\r\n for (const item of compileArray) {\r\n if (item.Include) {\r\n const filePath = path.resolve(projectDir, item.Include);\r\n files.push(filePath);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // SDK-style project files contains all source files in the project directory as default\r\n if (files.length === 0 && result.Project?.Sdk) {\r\n const csFiles = await fg(['**/*.cs'], {\r\n cwd: projectDir,\r\n absolute: true,\r\n ignore: ['**/bin/**', '**/obj/**']\r\n });\r\n files.push(...csFiles);\r\n }\r\n\r\n return files;\r\n}\r\n\r\n\r\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * parse .sln file to get all .csproj paths
3
+ */
4
+ export declare function getProjectPathsFromSolution(slnPath: string): Promise<string[]>;
5
+ /**
6
+ * get project -> project source file by .sln
7
+ */
8
+ export declare function getSourceFilesFromSolution(slnPath: string): Promise<Record<string, string[]>>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.getProjectPathsFromSolution = getProjectPathsFromSolution;
37
+ exports.getSourceFilesFromSolution = getSourceFilesFromSolution;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const getProjectCodeFile_1 = require("./getProjectCodeFile");
41
+ /**
42
+ * parse .sln file to get all .csproj paths
43
+ */
44
+ async function getProjectPathsFromSolution(slnPath) {
45
+ const slnContent = fs.readFileSync(slnPath, 'utf-8');
46
+ const projectRegex = /Project\(".*"\)\s=\s".*?",\s*"(.*?)",/g;
47
+ const projectPaths = [];
48
+ let match;
49
+ while ((match = projectRegex.exec(slnContent)) !== null) {
50
+ const relativePath = match[1].replace(/\\/g, path.sep);
51
+ projectPaths.push(path.resolve(path.dirname(slnPath), relativePath));
52
+ }
53
+ return projectPaths.filter(p => p.endsWith('.csproj'));
54
+ }
55
+ /**
56
+ * get project -> project source file by .sln
57
+ */
58
+ async function getSourceFilesFromSolution(slnPath) {
59
+ const csprojPaths = await getProjectPathsFromSolution(slnPath);
60
+ const result = {};
61
+ for (const csprojPath of csprojPaths) {
62
+ const sourceFiles = await (0, getProjectCodeFile_1.getSourceFilesFromCsproj)(csprojPath);
63
+ result[csprojPath] = sourceFiles;
64
+ }
65
+ return result;
66
+ }
67
+ // getSolutionStructure('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln').then(structure => {
68
+ // console.log(JSON.stringify(structure, null, 2));
69
+ // });
70
+ //# sourceMappingURL=getSolutionCodeFile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSolutionCodeFile.js","sourceRoot":"","sources":["../../src/batch/getSolutionCodeFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,kEAYC;AAMD,gEAUC;AApCD,uCAAyB;AACzB,2CAA6B;AAE7B,6DAAgE;AAEhE;;GAEG;AACI,KAAK,UAAU,2BAA2B,CAAC,OAAe;IAC7D,MAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,YAAY,GAAG,wCAAwC,CAAC;IAE9D,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACtD,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACvD,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AAC3D,CAAC;AAGD;;GAEG;AACI,KAAK,UAAU,0BAA0B,CAAC,OAAe;IAC5D,MAAM,WAAW,GAAG,MAAM,2BAA2B,CAAC,OAAO,CAAC,CAAC;IAC/D,MAAM,MAAM,GAA6B,EAAE,CAAC;IAE5C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,MAAM,IAAA,6CAAwB,EAAC,UAAU,CAAC,CAAC;QAC/D,MAAM,CAAC,UAAU,CAAC,GAAG,WAAW,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,mHAAmH;AACnH,uDAAuD;AACvD,MAAM","sourcesContent":["import * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\nimport { getSourceFilesFromCsproj } from './getProjectCodeFile';\r\n\r\n/**\r\n * parse .sln file to get all .csproj paths\r\n */\r\nexport async function getProjectPathsFromSolution(slnPath: string): Promise<string[]> {\r\n const slnContent = fs.readFileSync(slnPath, 'utf-8');\r\n const projectRegex = /Project\\(\".*\"\\)\\s=\\s\".*?\",\\s*\"(.*?)\",/g;\r\n\r\n const projectPaths: string[] = [];\r\n let match: RegExpExecArray | null;\r\n while ((match = projectRegex.exec(slnContent)) !== null) {\r\n const relativePath = match[1].replace(/\\\\/g, path.sep);\r\n projectPaths.push(path.resolve(path.dirname(slnPath), relativePath));\r\n }\r\n\r\n return projectPaths.filter(p => p.endsWith('.csproj'));\r\n}\r\n\r\n\r\n/**\r\n * get project -> project source file by .sln\r\n */\r\nexport async function getSourceFilesFromSolution(slnPath: string): Promise<Record<string, string[]>> {\r\n const csprojPaths = await getProjectPathsFromSolution(slnPath);\r\n const result: Record<string, string[]> = {};\r\n\r\n for (const csprojPath of csprojPaths) {\r\n const sourceFiles = await getSourceFilesFromCsproj(csprojPath);\r\n result[csprojPath] = sourceFiles;\r\n }\r\n\r\n return result;\r\n}\r\n\r\n\r\n// getSolutionStructure('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments.sln').then(structure => {\r\n// console.log(JSON.stringify(structure, null, 2));\r\n// });"]}
@@ -0,0 +1,2 @@
1
+ import { BenchmarkRow } from "../types/benchmark";
2
+ export declare function toMarkdownTable(rows: BenchmarkRow[]): string;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toMarkdownTable = toMarkdownTable;
4
+ function toMarkdownTable(rows) {
5
+ if (!rows || rows.length === 0) {
6
+ return 'No data available toMarkdownTable';
7
+ }
8
+ const headers = [
9
+ 'solution path',
10
+ 'project path',
11
+ 'code file path',
12
+ 'state',
13
+ 'build success',
14
+ 'test success',
15
+ ];
16
+ const lines = [];
17
+ // header
18
+ lines.push(`| ${headers.join(' | ')} |`);
19
+ lines.push(`| ${headers.map(() => '---').join(' | ')} |`);
20
+ // statistic count
21
+ const totalCount = rows.length;
22
+ const successCount = rows.filter(r => r.success).length;
23
+ const buildSuccessCount = rows.filter(r => buildSuccessCondition(r)).length;
24
+ const testSuccessCount = rows.filter(r => testSuccessCondition(r)).length;
25
+ const statsRow = [
26
+ '**Count**',
27
+ '',
28
+ `${totalCount}`,
29
+ `${successCount}(${(successCount / totalCount * 100).toFixed(2)}%)`,
30
+ `${buildSuccessCount}(${(buildSuccessCount / totalCount * 100).toFixed(2)}%)`,
31
+ `${testSuccessCount}(${(testSuccessCount / totalCount * 100).toFixed(2)}%)`,
32
+ ];
33
+ lines.push(`| ${statsRow.join(' | ')} |`);
34
+ // table rows
35
+ for (const row of rows) {
36
+ lines.push(`| ${row.solutionPath} | ${row.projectPath} | ${row.codeFilePath} | ${getState(row)} | ${buildSuccessCondition(row) ? '✅' : '❌'} | ${testSuccessCondition(row) ? '✅' : '❌'} |`);
37
+ }
38
+ const markdownTable = lines.join('\n');
39
+ return markdownTable;
40
+ }
41
+ function getState(row) {
42
+ if (row.success) {
43
+ return 'Success';
44
+ }
45
+ else if (!row.testFilePath) {
46
+ return 'Skipped';
47
+ }
48
+ else {
49
+ return 'Failed';
50
+ }
51
+ }
52
+ function buildSuccessCondition(row) {
53
+ const state = getState(row);
54
+ return row.success || (state === 'Failed' && !row.buildResult);
55
+ }
56
+ function testSuccessCondition(row) {
57
+ const state = getState(row);
58
+ return row.success;
59
+ }
60
+ // // clear special characters from string that are not allowed in markdown
61
+ // function sanitize(value?: string): string {
62
+ // if (!value) return '';
63
+ // return value.replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
64
+ // }
65
+ // const testRows = [
66
+ // {
67
+ // solutionPath: '/path/to/solution',
68
+ // projectPath: '/path/to/project',
69
+ // codeFilePath: '/path/to/file.cs',
70
+ // success: true,
71
+ // buildResult: undefined,
72
+ // testResult: undefined,
73
+ // },
74
+ // {
75
+ // solutionPath: '/path/to/solution',
76
+ // projectPath: '/path/to/project',
77
+ // codeFilePath: '/path/to/file.cs',
78
+ // success: false,
79
+ // buildResult: {},
80
+ // testResult: undefined,
81
+ // },
82
+ // {
83
+ // solutionPath: '/path/to/solution',
84
+ // projectPath: '/path/to/project',
85
+ // codeFilePath: '/path/to/file.cs',
86
+ // success: false,
87
+ // buildResult: undefined,
88
+ // testResult: {},
89
+ // },
90
+ // {
91
+ // solutionPath: '/path/to/solution',
92
+ // projectPath: '/path/to/project',
93
+ // codeFilePath: '/path/to/file.cs',
94
+ // success: false,
95
+ // buildResult: undefined,
96
+ // testResult: {},
97
+ // },
98
+ // ];
99
+ // const markdownTable = toMarkdownTable(testRows);
100
+ // console.log(markdownTable);
101
+ //# sourceMappingURL=formatToMarkdown.js.map
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,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAiB;IAC3C,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,GAAG,CAAC,OAAO,CAAC;AACvB,CAAC;AAED,2EAA2E;AAC3E,8CAA8C;AAC9C,2BAA2B;AAC3B,+DAA+D;AAC/D,IAAI;AAEJ,qBAAqB;AACrB,QAAQ;AACR,6CAA6C;AAC7C,2CAA2C;AAC3C,4CAA4C;AAC5C,yBAAyB;AACzB,kCAAkC;AAClC,iCAAiC;AACjC,SAAS;AACT,YAAY;AACZ,6CAA6C;AAC7C,2CAA2C;AAC3C,4CAA4C;AAC5C,0BAA0B;AAC1B,2BAA2B;AAC3B,iCAAiC;AACjC,SAAS;AACT,YAAY;AACZ,6CAA6C;AAC7C,2CAA2C;AAC3C,4CAA4C;AAC5C,0BAA0B;AAC1B,kCAAkC;AAClC,0BAA0B;AAC1B,SAAS;AACT,YAAY;AACZ,6CAA6C;AAC7C,2CAA2C;AAC3C,4CAA4C;AAC5C,0BAA0B;AAC1B,kCAAkC;AAClC,0BAA0B;AAC1B,SAAS;AACT,KAAK;AAEL,mDAAmD;AACnD,8BAA8B","sourcesContent":["import { BenchmarkRow } from \"../types/benchmark\";\r\n\r\nexport function toMarkdownTable(rows: BenchmarkRow[]): string {\r\n if (!rows || rows.length === 0) {\r\n return 'No data available toMarkdownTable';\r\n }\r\n\r\n const headers = [\r\n 'solution path',\r\n 'project path',\r\n 'code file path',\r\n 'state',\r\n 'build success',\r\n 'test success',\r\n ];\r\n\r\n const lines: string[] = [];\r\n\r\n // header\r\n lines.push(`| ${headers.join(' | ')} |`);\r\n lines.push(`| ${headers.map(() => '---').join(' | ')} |`);\r\n\r\n // statistic count\r\n const totalCount = rows.length;\r\n const successCount = rows.filter(r => r.success).length;\r\n const buildSuccessCount = rows.filter(r => buildSuccessCondition(r)).length;\r\n const testSuccessCount = rows.filter(r => testSuccessCondition(r)).length;\r\n\r\n const statsRow = [\r\n '**Count**',\r\n '',\r\n `${totalCount}`,\r\n `${successCount}(${(successCount / totalCount * 100).toFixed(2)}%)`,\r\n `${buildSuccessCount}(${(buildSuccessCount / totalCount * 100).toFixed(2)}%)`,\r\n `${testSuccessCount}(${(testSuccessCount / totalCount * 100).toFixed(2)}%)`,\r\n ];\r\n\r\n lines.push(`| ${statsRow.join(' | ')} |`);\r\n\r\n // table rows\r\n for (const row of rows) {\r\n lines.push(\r\n `| ${row.solutionPath} | ${row.projectPath} | ${row.codeFilePath} | ${getState(row)} | ${buildSuccessCondition(row) ? '✅' : '❌'} | ${testSuccessCondition(row) ? '✅' : '❌'} |`\r\n );\r\n }\r\n\r\n const markdownTable = lines.join('\\n');\r\n return markdownTable;\r\n}\r\n\r\n\r\nfunction getState(row: BenchmarkRow): string {\r\n if (row.success) {\r\n return 'Success';\r\n } else if (!row.testFilePath) {\r\n return 'Skipped';\r\n } else {\r\n return 'Failed';\r\n }\r\n}\r\nfunction buildSuccessCondition(row: BenchmarkRow): boolean {\r\n const state = getState(row);\r\n return row.success || (state === 'Failed' && !row.buildResult);\r\n}\r\n\r\nfunction testSuccessCondition(row: BenchmarkRow): boolean {\r\n const state = getState(row);\r\n return row.success;\r\n}\r\n\r\n// // clear special characters from string that are not allowed in markdown\r\n// function sanitize(value?: string): string {\r\n// if (!value) return '';\r\n// return value.replace(/\\|/g, '\\\\|').replace(/\\r?\\n/g, ' ');\r\n// }\r\n\r\n// const testRows = [\r\n// {\r\n// solutionPath: '/path/to/solution',\r\n// projectPath: '/path/to/project',\r\n// codeFilePath: '/path/to/file.cs',\r\n// success: true,\r\n// buildResult: undefined,\r\n// testResult: undefined,\r\n// },\r\n// {\r\n// solutionPath: '/path/to/solution',\r\n// projectPath: '/path/to/project',\r\n// codeFilePath: '/path/to/file.cs',\r\n// success: false,\r\n// buildResult: {},\r\n// testResult: undefined,\r\n// },\r\n// {\r\n// solutionPath: '/path/to/solution',\r\n// projectPath: '/path/to/project',\r\n// codeFilePath: '/path/to/file.cs',\r\n// success: false,\r\n// buildResult: undefined,\r\n// testResult: {},\r\n// },\r\n// {\r\n// solutionPath: '/path/to/solution',\r\n// projectPath: '/path/to/project',\r\n// codeFilePath: '/path/to/file.cs',\r\n// success: false,\r\n// buildResult: undefined,\r\n// testResult: {},\r\n// },\r\n// ];\r\n\r\n// const markdownTable = toMarkdownTable(testRows);\r\n// console.log(markdownTable);"]}
@@ -0,0 +1 @@
1
+ export declare function generateBenchmarkReport(inputPath: any, enableAutoFix: boolean, keepFailedTests: boolean, source: string): Promise<void>;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.generateBenchmarkReport = generateBenchmarkReport;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const generateCodeTests_1 = require("../batch/generateCodeTests");
40
+ const formatToMarkdown_1 = require("./formatToMarkdown");
41
+ async function generateBenchmarkReport(inputPath, enableAutoFix, keepFailedTests, source) {
42
+ const benchmarkRows = await (0, generateCodeTests_1.generateBatchTests)(inputPath, enableAutoFix, keepFailedTests, true, source);
43
+ convertToMarkdown(benchmarkRows);
44
+ }
45
+ function formatCachedGenResults() {
46
+ const cachedBenchmarkRowsStr = fs.readFileSync(generateCodeTests_1.CACHEFile, 'utf-8');
47
+ const cacheBenchmarkRows = JSON.parse(cachedBenchmarkRowsStr);
48
+ convertToMarkdown(cacheBenchmarkRows);
49
+ }
50
+ function convertToMarkdown(benchmarkRows) {
51
+ const formattedReport = (0, formatToMarkdown_1.toMarkdownTable)(benchmarkRows);
52
+ const benchmarkReportPath = path.join(__dirname, `../benchmarkReport_${Date.now()}.md`);
53
+ fs.writeFileSync(benchmarkReportPath, formattedReport, 'utf-8');
54
+ console.log(`Benchmark report generated at: ${benchmarkReportPath}`);
55
+ }
56
+ // const codeFiles = [
57
+ // // "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\Teaser\\PostProcess\\AlertContentPostProcessor.cs",
58
+ // // "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantRankResponseBuilder.cs",
59
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\DataModel\\EplantRank.cs',
60
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\EplantConfigManager.cs',
61
+ // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\HttpRequestParser\\Utils\\SqmidHelper.cs',
62
+ // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\Conditions\\EplantRequestCategoryCondition.cs',
63
+ // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantMigrateResponseBuilder.cs',
64
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\HttpRequestParser\\Utils\\WeatherParamsHttpConverter.cs',
65
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\RequestBuilders\\EplantRankRequestBuilder.cs',
66
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\RequestBuilders\\EplantPlantRequestBuilder.cs',
67
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantMeResponseBuilder.cs',
68
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\LocationSearch\\GeoLocationIDFirstCondition.cs',
69
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\RequestBuilders\\EplantTreeRequestBuilder.cs',
70
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantTreeResponseBuilder.cs',
71
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\Conditions\\EplantUserUpdateCondition.cs',
72
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\RequestBuilders\\EplantUserUpdateRequestBuilder.cs',
73
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantUserUpdateResponseBuilder.cs',
74
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\LocationSearch\\LocationsResponseCombiner.cs',
75
+ // // 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\HttpRequestParser\\Utils\\WeatherParamsHttpConverter.cs'
76
+ // ];
77
+ // generateBenchmarkReport(codeFiles, true, true);
78
+ // formatCachedGenResults();
79
+ // generateBenchmarkReport("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\", true, true);
80
+ // generateBenchmarkReport("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\", true, true);
81
+ // generateBenchmarkReport("C:\\Users\\jixiongge\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\SharedSegments.Plugins.csproj", true, true);
82
+ //# sourceMappingURL=generateBenchmarkReport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateBenchmarkReport.js","sourceRoot":"","sources":["../../src/benchmark/generateBenchmarkReport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,0DAIC;AAXD,uCAAyB;AACzB,2CAA6B;AAE7B,kEAA2E;AAE3E,yDAAqD;AAE9C,KAAK,UAAU,uBAAuB,CAAC,SAAc,EAAE,aAAsB,EAAE,eAAwB,EAAE,MAAc;IAC1H,MAAM,aAAa,GAAG,MAAM,IAAA,sCAAkB,EAAC,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAExG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,sBAAsB;IAC3B,MAAM,sBAAsB,GAAG,EAAE,CAAC,YAAY,CAAC,6BAAS,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAC9D,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,iBAAiB,CAAC,aAAa;IACpC,MAAM,eAAe,GAAG,IAAA,kCAAe,EAAC,aAAa,CAAC,CAAC;IACvD,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxF,EAAE,CAAC,aAAa,CAAC,mBAAmB,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,kCAAkC,mBAAmB,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,sBAAsB;AACtB,6KAA6K;AAC7K,wKAAwK;AACxK,kJAAkJ;AAClJ,gJAAgJ;AAChJ,iKAAiK;AACjK,oKAAoK;AACpK,wKAAwK;AACxK,mLAAmL;AACnL,sKAAsK;AACtK,uKAAuK;AACvK,sKAAsK;AACtK,0KAA0K;AAC1K,sKAAsK;AACtK,wKAAwK;AACxK,kKAAkK;AAClK,4KAA4K;AAC5K,8KAA8K;AAC9K,wKAAwK;AACxK,kLAAkL;AAClL,KAAK;AAEL,kDAAkD;AAElD,4BAA4B;AAG5B,wJAAwJ;AACxJ,0JAA0J;AAC1J,oLAAoL","sourcesContent":["import * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\nimport { CACHEFile, generateBatchTests } from '../batch/generateCodeTests';\r\n\r\nimport { toMarkdownTable } from './formatToMarkdown';\r\n\r\nexport async function generateBenchmarkReport(inputPath: any, enableAutoFix: boolean, keepFailedTests: boolean, source: string) {\r\n const benchmarkRows = await generateBatchTests(inputPath, enableAutoFix, keepFailedTests, true, source);\r\n\r\n convertToMarkdown(benchmarkRows);\r\n}\r\n\r\nfunction formatCachedGenResults() {\r\n const cachedBenchmarkRowsStr = fs.readFileSync(CACHEFile, 'utf-8');\r\n const cacheBenchmarkRows = JSON.parse(cachedBenchmarkRowsStr);\r\n convertToMarkdown(cacheBenchmarkRows);\r\n}\r\n\r\nfunction convertToMarkdown(benchmarkRows) {\r\n const formattedReport = toMarkdownTable(benchmarkRows);\r\n const benchmarkReportPath = path.join(__dirname, `../benchmarkReport_${Date.now()}.md`);\r\n fs.writeFileSync(benchmarkReportPath, formattedReport, 'utf-8');\r\n console.log(`Benchmark report generated at: ${benchmarkReportPath}`);\r\n}\r\n\r\n// const codeFiles = [\r\n// // \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\Teaser\\\\PostProcess\\\\AlertContentPostProcessor.cs\",\r\n// // \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantRankResponseBuilder.cs\",\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\DataModel\\\\EplantRank.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\EplantConfigManager.cs',\r\n// 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\HttpRequestParser\\\\Utils\\\\SqmidHelper.cs',\r\n// 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\Conditions\\\\EplantRequestCategoryCondition.cs',\r\n// 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantMigrateResponseBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\HttpRequestParser\\\\Utils\\\\WeatherParamsHttpConverter.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\RequestBuilders\\\\EplantRankRequestBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\RequestBuilders\\\\EplantPlantRequestBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantMeResponseBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\LocationSearch\\\\GeoLocationIDFirstCondition.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\RequestBuilders\\\\EplantTreeRequestBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantTreeResponseBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\Conditions\\\\EplantUserUpdateCondition.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\RequestBuilders\\\\EplantUserUpdateRequestBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantUserUpdateResponseBuilder.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\LocationSearch\\\\LocationsResponseCombiner.cs',\r\n// // 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\HttpRequestParser\\\\Utils\\\\WeatherParamsHttpConverter.cs'\r\n// ];\r\n\r\n// generateBenchmarkReport(codeFiles, true, true);\r\n\r\n// formatCachedGenResults();\r\n\r\n\r\n// generateBenchmarkReport(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\\", true, true);\r\n// generateBenchmarkReport(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\\", true, true);\r\n// generateBenchmarkReport(\"C:\\\\Users\\\\jixiongge\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\SharedSegments.Plugins.csproj\", true, true);"]}
@@ -0,0 +1,6 @@
1
+ export declare function runCodeCoverage(testProjectDllPath: string, codeCoverageSettingPath: string): Promise<any>;
2
+ export declare function codeCoverageErrorHandler(error: any): boolean;
3
+ export declare function codeCoverageCloseHandler(code: any, stdout: any, stderr: any): {
4
+ success: boolean;
5
+ message: any;
6
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCodeCoverage = runCodeCoverage;
4
+ exports.codeCoverageErrorHandler = codeCoverageErrorHandler;
5
+ exports.codeCoverageCloseHandler = codeCoverageCloseHandler;
6
+ const extractCodeCoverageInfo_1 = require("./extractCodeCoverageInfo");
7
+ const getOrCreateDir_1 = require("../utils/getOrCreateDir");
8
+ const spawnExec_1 = require("../utils/spawnExec");
9
+ const vsTools_1 = require("../vs/vsTools");
10
+ const CODECOVERAGEDIR = './codecoverage';
11
+ function runCodeCoverage(testProjectDllPath, codeCoverageSettingPath) {
12
+ const workDir = (0, getOrCreateDir_1.getTmpCacheDir)(CODECOVERAGEDIR);
13
+ const args = [testProjectDllPath, '/TestCaseFilter:TestCategory!=FunctionalGate&TestCategory!=LocalAH', '/EnableCodeCoverage', '/collect:Code Coverage;Format=Cobertura'];
14
+ if (!!codeCoverageSettingPath) {
15
+ args.push(`/Settings:${codeCoverageSettingPath}`);
16
+ }
17
+ console.log(`Running Code coverage...`);
18
+ return (0, spawnExec_1.runSpawn)(vsTools_1.vstestPath, args, workDir, codeCoverageErrorHandler, codeCoverageCloseHandler);
19
+ }
20
+ function codeCoverageErrorHandler(error) {
21
+ console.error(`codeCoverageErrorHandler - failed: ${error.message}`);
22
+ return true;
23
+ }
24
+ function codeCoverageCloseHandler(code, stdout, stderr) {
25
+ const coberturaXmlPath = (0, extractCodeCoverageInfo_1.extractCoberturaXmlPath)(stdout);
26
+ if (code !== 0 && !coberturaXmlPath) {
27
+ console.error(`Code coverage generation failed with exit code ${code}`);
28
+ return { success: false, message: stdout };
29
+ }
30
+ if (stderr && !coberturaXmlPath) {
31
+ console.error(`Code coverage generation Warnings/Errors:\n${stdout}`);
32
+ return { success: false, message: stdout };
33
+ }
34
+ console.log(`Code coverage generation succeeded`);
35
+ return { success: true, message: coberturaXmlPath };
36
+ }
37
+ // runCodeCoverage("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll", "D:\\code\\CS.Service.Fundamental\\SharedSegments\\CodeCoverage.runsettings");
38
+ // runCodeCoverage("D:\\code\\AIUnitTestExample\\test\\ToListinator.Tests\\bin\\Debug\\net8.0\\ToListinator.Tests.dll", null);
39
+ //# sourceMappingURL=codeCoverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeCoverage.js","sourceRoot":"","sources":["../../src/codeCoverage/codeCoverage.ts"],"names":[],"mappings":";;AAMA,0CAQC;AAED,4DAGC;AAED,4DAeC;AApCD,uEAAoE;AACpE,4DAAyD;AACzD,kDAA8C;AAC9C,2CAA2C;AAE3C,MAAM,eAAe,GAAG,gBAAgB,CAAC;AACzC,SAAgB,eAAe,CAAC,kBAA0B,EAAE,uBAA+B;IACvF,MAAM,OAAO,GAAG,IAAA,+BAAc,EAAC,eAAe,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,CAAC,kBAAkB,EAAE,oEAAoE,EAAE,qBAAqB,EAAE,yCAAyC,CAAC,CAAC;IAC1K,IAAI,CAAC,CAAC,uBAAuB,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,aAAa,uBAAuB,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,OAAO,IAAA,oBAAQ,EAAC,oBAAU,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,CAAC,CAAC;AACnG,CAAC;AAED,SAAgB,wBAAwB,CAAC,KAAK;IAC1C,OAAO,CAAC,KAAK,CAAC,sCAAsC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACrE,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM;IACzD,MAAM,gBAAgB,GAAG,IAAA,iDAAuB,EAAC,MAAM,CAAC,CAAC;IAEzD,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,kDAAkD,IAAI,EAAE,CAAC,CAAC;QACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC/C,CAAC;IAED,IAAI,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9B,OAAO,CAAC,KAAK,CAAC,8CAA8C,MAAM,EAAE,CAAC,CAAC;QACtE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;AACxD,CAAC;AAED,iOAAiO;AACjO,8HAA8H","sourcesContent":["import { extractCoberturaXmlPath } from './extractCodeCoverageInfo';\r\nimport { getTmpCacheDir } from '../utils/getOrCreateDir';\r\nimport { runSpawn } from '../utils/spawnExec';\r\nimport { vstestPath } from '../vs/vsTools';\r\n\r\nconst CODECOVERAGEDIR = './codecoverage';\r\nexport function runCodeCoverage(testProjectDllPath: string, codeCoverageSettingPath: string): Promise<any> {\r\n const workDir = getTmpCacheDir(CODECOVERAGEDIR);\r\n const args = [testProjectDllPath, '/TestCaseFilter:TestCategory!=FunctionalGate&TestCategory!=LocalAH', '/EnableCodeCoverage', '/collect:Code Coverage;Format=Cobertura'];\r\n if (!!codeCoverageSettingPath) {\r\n args.push(`/Settings:${codeCoverageSettingPath}`);\r\n }\r\n console.log(`Running Code coverage...`);\r\n return runSpawn(vstestPath, args, workDir, codeCoverageErrorHandler, codeCoverageCloseHandler);\r\n}\r\n\r\nexport function codeCoverageErrorHandler(error) {\r\n console.error(`codeCoverageErrorHandler - failed: ${error.message}`);\r\n return true;\r\n}\r\n\r\nexport function codeCoverageCloseHandler(code, stdout, stderr) {\r\n const coberturaXmlPath = extractCoberturaXmlPath(stdout);\r\n \r\n if (code !== 0 && !coberturaXmlPath) {\r\n console.error(`Code coverage generation failed with exit code ${code}`);\r\n return { success: false, message: stdout };\r\n }\r\n\r\n if (stderr && !coberturaXmlPath) {\r\n console.error(`Code coverage generation Warnings/Errors:\\n${stdout}`);\r\n return { success: false, message: stdout };\r\n }\r\n\r\n console.log(`Code coverage generation succeeded`);\r\n return { success: true, message: coberturaXmlPath };\r\n}\r\n\r\n// runCodeCoverage(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\", \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\CodeCoverage.runsettings\");\r\n// runCodeCoverage(\"D:\\\\code\\\\AIUnitTestExample\\\\test\\\\ToListinator.Tests\\\\bin\\\\Debug\\\\net8.0\\\\ToListinator.Tests.dll\", null);"]}
@@ -0,0 +1,6 @@
1
+ export declare function runCodeCoverageReport(coverageXmlPath: string): Promise<any>;
2
+ export declare function coverageReportErrorHandler(error: any): boolean;
3
+ export declare function coverageReportCloseHandler(code: any, stdout: any, stderr: any): {
4
+ success: boolean;
5
+ message: any;
6
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.runCodeCoverageReport = runCodeCoverageReport;
37
+ exports.coverageReportErrorHandler = coverageReportErrorHandler;
38
+ exports.coverageReportCloseHandler = coverageReportCloseHandler;
39
+ const path = __importStar(require("path"));
40
+ const reportTool_1 = require("./reportTool");
41
+ const extractCoverageReportPath_1 = require("./extractCoverageReportPath");
42
+ const getOrCreateDir_1 = require("../utils/getOrCreateDir");
43
+ const spawnExec_1 = require("../utils/spawnExec");
44
+ const COVERAGEREPORT = "./coveragereport";
45
+ function runCodeCoverageReport(coverageXmlPath) {
46
+ if (!(0, reportTool_1.checkTestReportToolInstall)()) {
47
+ (0, reportTool_1.installTestReportTool)();
48
+ }
49
+ const coverageName = path.basename(coverageXmlPath, ".xml");
50
+ const coverageReportDir = `CoverageReport-${coverageName}`;
51
+ const args = [`-reports:"${coverageXmlPath}"`, `-targetdir:"${coverageReportDir}"`, '-reporttypes:Html'];
52
+ const workDir = (0, getOrCreateDir_1.getTmpCacheDir)(COVERAGEREPORT);
53
+ console.log(`Running Code coverage report...`);
54
+ return (0, spawnExec_1.runSpawn)("reportgenerator", args, workDir, coverageReportErrorHandler, coverageReportCloseHandler);
55
+ }
56
+ function coverageReportErrorHandler(error) {
57
+ console.error(`coverageReportErrorHandler - failed: ${error.message}`);
58
+ return true;
59
+ }
60
+ function coverageReportCloseHandler(code, stdout, stderr) {
61
+ if (code !== 0) {
62
+ console.error(`Code coverage report failed with exit code ${code}: \n ${stdout} \n ${stderr}`);
63
+ return { success: false, message: stdout };
64
+ }
65
+ if (stderr) {
66
+ console.error(`Code coverage report Warnings/Errors:\n${stdout}`);
67
+ return { success: false, message: stdout };
68
+ }
69
+ const reportRelativePath = (0, extractCoverageReportPath_1.extractCoverageReportPath)(stdout);
70
+ console.log(`Code coverage report succeeded, coverpage report path: ${(0, getOrCreateDir_1.getTmpCacheDir)(COVERAGEREPORT)}/${reportRelativePath}`);
71
+ return { success: true, message: stdout };
72
+ }
73
+ // runCodeCoverageReport("D:\\code\\ai-dev-tools\\csharp-ut-copilot\\csharp-ut-core\\out\\atmpCache\\codecoverage\\TestResults\\3a4c5e07-ddfd-42e8-9a91-8064a4baed1e\\jixiongge_VECTORWC_2025-07-19.00_51_24.cobertura.xml");
74
+ // runCodeCoverageReport("D:\\atmp\\TestResults\\90eff6a0-e7ea-43a1-91d6-2ccc0938bddd\\jixiongge_VECTORWC_2025-08-05.11_52_48.cobertura.xml");
75
+ // runCodeCoverageReport("D:\\code\\ai-dev-tools\\csharp-ut-copilot\\csharp-ut-core\\out\\atmpCache\\codecoverage\\TestResults\\9f76b29e-b496-4382-9edf-5d6c059e08c3\\jixiongge_VECTORWC_2025-08-05.12_14_23.cobertura.xml");
76
+ //# sourceMappingURL=codeCoverageReport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codeCoverageReport.js","sourceRoot":"","sources":["../../src/codeCoverage/codeCoverageReport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,sDAUC;AAED,gEAGC;AAED,gEAcC;AAxCD,2CAA6B;AAE7B,6CAAiF;AAEjF,2EAAwE;AACxE,4DAAyD;AAC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IAC/C,CAAC;IAED,MAAM,kBAAkB,GAAG,IAAA,qDAAyB,EAAC,MAAM,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,0DAA0D,IAAA,+BAAc,EAAC,cAAc,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;IAC9H,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC9C,CAAC;AAGD,6NAA6N;AAC7N,8IAA8I;AAC9I,6NAA6N","sourcesContent":["import * as path from 'path';\r\n\r\nimport { checkTestReportToolInstall, installTestReportTool } from './reportTool';\r\n\r\nimport { extractCoverageReportPath } from './extractCoverageReportPath';\r\nimport { getTmpCacheDir } from '../utils/getOrCreateDir';\r\nimport { runSpawn } from '../utils/spawnExec';\r\n\r\nconst COVERAGEREPORT = \"./coveragereport\";\r\nexport function runCodeCoverageReport(coverageXmlPath: string): Promise<any> {\r\n if (!checkTestReportToolInstall()) {\r\n installTestReportTool();\r\n }\r\n const coverageName = path.basename(coverageXmlPath, \".xml\")\r\n const coverageReportDir = `CoverageReport-${coverageName}`;\r\n const args = [`-reports:\"${coverageXmlPath}\"`, `-targetdir:\"${coverageReportDir}\"`, '-reporttypes:Html'];\r\n const workDir = getTmpCacheDir(COVERAGEREPORT);\r\n console.log(`Running Code coverage report...`);\r\n return runSpawn(\"reportgenerator\", args, workDir, coverageReportErrorHandler, coverageReportCloseHandler);\r\n}\r\n\r\nexport function coverageReportErrorHandler(error) {\r\n console.error(`coverageReportErrorHandler - failed: ${error.message}`);\r\n return true;\r\n}\r\n\r\nexport function coverageReportCloseHandler(code, stdout, stderr) {\r\n if (code !== 0) {\r\n console.error(`Code coverage report failed with exit code ${code}: \\n ${stdout} \\n ${stderr}`);\r\n return { success: false, message: stdout };\r\n }\r\n\r\n if (stderr) {\r\n console.error(`Code coverage report Warnings/Errors:\\n${stdout}`);\r\n return { success: false, message: stdout };\r\n }\r\n\r\n const reportRelativePath = extractCoverageReportPath(stdout);\r\n console.log(`Code coverage report succeeded, coverpage report path: ${getTmpCacheDir(COVERAGEREPORT)}/${reportRelativePath}`);\r\n return { success: true, message: stdout };\r\n}\r\n\r\n\r\n// runCodeCoverageReport(\"D:\\\\code\\\\ai-dev-tools\\\\csharp-ut-copilot\\\\csharp-ut-core\\\\out\\\\atmpCache\\\\codecoverage\\\\TestResults\\\\3a4c5e07-ddfd-42e8-9a91-8064a4baed1e\\\\jixiongge_VECTORWC_2025-07-19.00_51_24.cobertura.xml\");\r\n// runCodeCoverageReport(\"D:\\\\atmp\\\\TestResults\\\\90eff6a0-e7ea-43a1-91d6-2ccc0938bddd\\\\jixiongge_VECTORWC_2025-08-05.11_52_48.cobertura.xml\");\r\n// runCodeCoverageReport(\"D:\\\\code\\\\ai-dev-tools\\\\csharp-ut-copilot\\\\csharp-ut-core\\\\out\\\\atmpCache\\\\codecoverage\\\\TestResults\\\\9f76b29e-b496-4382-9edf-5d6c059e08c3\\\\jixiongge_VECTORWC_2025-08-05.12_14_23.cobertura.xml\");"]}
@@ -0,0 +1,2 @@
1
+ export declare function extractCoberturaXmlPath(log: string): string | null;
2
+ export declare function getLineCoverage(coverageXmlPath: string): void;