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

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 (303) hide show
  1. package/package.json +1 -1
  2. package/out/analyze/cecil.d.ts +0 -1
  3. package/out/analyze/cecil.js +0 -42
  4. package/out/analyze/cecil.js.map +0 -1
  5. package/out/analyze/checkCodeSyntax.d.ts +0 -7
  6. package/out/analyze/checkCodeSyntax.js +0 -67
  7. package/out/analyze/checkCodeSyntax.js.map +0 -1
  8. package/out/analyze/generateCodeDependency.d.ts +0 -6
  9. package/out/analyze/generateCodeDependency.js +0 -126
  10. package/out/analyze/generateCodeDependency.js.map +0 -1
  11. package/out/analyze/installAnalyzerTool.d.ts +0 -1
  12. package/out/analyze/installAnalyzerTool.js +0 -82
  13. package/out/analyze/installAnalyzerTool.js.map +0 -1
  14. package/out/batch/generateCodeTests.d.ts +0 -6
  15. package/out/batch/generateCodeTests.js +0 -147
  16. package/out/batch/generateCodeTests.js.map +0 -1
  17. package/out/batch/getFolderCodeFile.d.ts +0 -1
  18. package/out/batch/getFolderCodeFile.js +0 -19
  19. package/out/batch/getFolderCodeFile.js.map +0 -1
  20. package/out/batch/getProjectCodeFile.d.ts +0 -4
  21. package/out/batch/getProjectCodeFile.js +0 -86
  22. package/out/batch/getProjectCodeFile.js.map +0 -1
  23. package/out/batch/getSolutionCodeFile.d.ts +0 -8
  24. package/out/batch/getSolutionCodeFile.js +0 -70
  25. package/out/batch/getSolutionCodeFile.js.map +0 -1
  26. package/out/benchmark/formatToMarkdown.d.ts +0 -2
  27. package/out/benchmark/formatToMarkdown.js +0 -101
  28. package/out/benchmark/formatToMarkdown.js.map +0 -1
  29. package/out/benchmark/generateBenchmarkReport.d.ts +0 -1
  30. package/out/benchmark/generateBenchmarkReport.js +0 -82
  31. package/out/benchmark/generateBenchmarkReport.js.map +0 -1
  32. package/out/codeCoverage/codeCoverage.d.ts +0 -6
  33. package/out/codeCoverage/codeCoverage.js +0 -39
  34. package/out/codeCoverage/codeCoverage.js.map +0 -1
  35. package/out/codeCoverage/codeCoverageReport.d.ts +0 -6
  36. package/out/codeCoverage/codeCoverageReport.js +0 -76
  37. package/out/codeCoverage/codeCoverageReport.js.map +0 -1
  38. package/out/codeCoverage/extractCodeCoverageInfo.d.ts +0 -2
  39. package/out/codeCoverage/extractCodeCoverageInfo.js +0 -80
  40. package/out/codeCoverage/extractCodeCoverageInfo.js.map +0 -1
  41. package/out/codeCoverage/extractCoverageReportPath.d.ts +0 -1
  42. package/out/codeCoverage/extractCoverageReportPath.js +0 -24
  43. package/out/codeCoverage/extractCoverageReportPath.js.map +0 -1
  44. package/out/codeCoverage/generateCodeCoverageReport.d.ts +0 -1
  45. package/out/codeCoverage/generateCodeCoverageReport.js +0 -30
  46. package/out/codeCoverage/generateCodeCoverageReport.js.map +0 -1
  47. package/out/codeCoverage/getCodeCoverageSetting.d.ts +0 -1
  48. package/out/codeCoverage/getCodeCoverageSetting.js +0 -58
  49. package/out/codeCoverage/getCodeCoverageSetting.js.map +0 -1
  50. package/out/codeCoverage/reportTool.d.ts +0 -2
  51. package/out/codeCoverage/reportTool.js +0 -22
  52. package/out/codeCoverage/reportTool.js.map +0 -1
  53. package/out/codeCoverage/simplifyCoverageXml.d.ts +0 -2
  54. package/out/codeCoverage/simplifyCoverageXml.js +0 -117
  55. package/out/codeCoverage/simplifyCoverageXml.js.map +0 -1
  56. package/out/codebk/250804prompt/buildAfGuidelines.liquid +0 -15
  57. package/out/codebk/250804prompt/general/generalBuildAutofixGuidelines.liquid +0 -13
  58. package/out/codebk/250804prompt/general/generalUtGuidelines.liquid +0 -18
  59. package/out/codebk/250804prompt/generateUtAutoFix.liquid +0 -19
  60. package/out/codebk/250804prompt/generateUtGuidelines.liquid +0 -13
  61. package/out/codebk/250804prompt/generateUtSystem.liquid +0 -5
  62. package/out/codebk/250804prompt/generateUtUserInput.liquid +0 -27
  63. package/out/codebk/250804prompt/testAfGuidelines.liquid +0 -6
  64. package/out/codebk/250804prompt/xap/xapBuildAutofixGuidelines.liquid +0 -13
  65. package/out/codebk/250804prompt/xap/xapCodeCodeDependency.liquid +0 -0
  66. package/out/codebk/250804prompt/xap/xapCodeSample.liquid +0 -38
  67. package/out/codebk/250804prompt/xap/xapUtGuideline-240804.liquid +0 -36
  68. package/out/codebk/250804prompt/xap/xapUtGuideline.liquid +0 -36
  69. package/out/codebk/childProcessManager.d.ts +0 -1
  70. package/out/codebk/childProcessManager.js +0 -50
  71. package/out/codebk/childProcessManager.js.map +0 -1
  72. package/out/codebk/msBuidSpawn.d.ts +0 -1
  73. package/out/codebk/msBuidSpawn.js +0 -58
  74. package/out/codebk/msBuidSpawn.js.map +0 -1
  75. package/out/codebk/msBuild.d.ts +0 -1
  76. package/out/codebk/msBuild.js +0 -123
  77. package/out/codebk/msBuild.js.map +0 -1
  78. package/out/codebk/old/generateXapTestAutoFix.liquid +0 -12
  79. package/out/codebk/old/generateXapTestGuidelines-fm.liquid +0 -68
  80. package/out/codebk/old/generateXapTestGuidelines.liquid +0 -28
  81. package/out/codebk/old/xapGuideline-fm.liquid +0 -149
  82. package/out/codebk/old/xapGuideline.liquid +0 -37
  83. package/out/codebk/oldExec/checkCodeSyntax.d.ts +0 -1
  84. package/out/codebk/oldExec/checkCodeSyntax.js +0 -81
  85. package/out/codebk/oldExec/checkCodeSyntax.js.map +0 -1
  86. package/out/codebk/oldExec/codeCoverage.d.ts +0 -1
  87. package/out/codebk/oldExec/codeCoverage.js +0 -54
  88. package/out/codebk/oldExec/codeCoverage.js.map +0 -1
  89. package/out/codebk/oldExec/codeCoverageReport.d.ts +0 -1
  90. package/out/codebk/oldExec/codeCoverageReport.js +0 -64
  91. package/out/codebk/oldExec/codeCoverageReport.js.map +0 -1
  92. package/out/codebk/oldExec/containsMethods.d.ts +0 -1
  93. package/out/codebk/oldExec/containsMethods.js +0 -74
  94. package/out/codebk/oldExec/containsMethods.js.map +0 -1
  95. package/out/codebk/oldExec/generateCodeDependency.d.ts +0 -1
  96. package/out/codebk/oldExec/generateCodeDependency.js +0 -95
  97. package/out/codebk/oldExec/generateCodeDependency.js.map +0 -1
  98. package/out/codebk/oldExec/msBuild.d.ts +0 -1
  99. package/out/codebk/oldExec/msBuild.js +0 -53
  100. package/out/codebk/oldExec/msBuild.js.map +0 -1
  101. package/out/codebk/oldExec/vsTest.d.ts +0 -1
  102. package/out/codebk/oldExec/vsTest.js +0 -71
  103. package/out/codebk/oldExec/vsTest.js.map +0 -1
  104. package/out/codebk/prompts/general/generalUnitTestGuidelines-20250702.liquid +0 -56
  105. package/out/codebk/prompts/generateXapTestGuidelines-20250704.liquid +0 -21
  106. package/out/codebk/prompts/generateXapTestGuidelines-o.liquid +0 -29
  107. package/out/codebk/prompts/xap/xapGuideline-o.liquid +0 -45
  108. package/out/codebk/testbuildkill.d.ts +0 -1
  109. package/out/codebk/testbuildkill.js +0 -37
  110. package/out/codebk/testbuildkill.js.map +0 -1
  111. package/out/command/index.d.ts +0 -2
  112. package/out/command/index.js +0 -94
  113. package/out/command/index.js.map +0 -1
  114. package/out/command/utGenWrapper.d.ts +0 -4
  115. package/out/command/utGenWrapper.js +0 -46
  116. package/out/command/utGenWrapper.js.map +0 -1
  117. package/out/exit/childProcessManager.d.ts +0 -2
  118. package/out/exit/childProcessManager.js +0 -43
  119. package/out/exit/childProcessManager.js.map +0 -1
  120. package/out/exit/setupProcessSignalHandler.d.ts +0 -1
  121. package/out/exit/setupProcessSignalHandler.js +0 -18
  122. package/out/exit/setupProcessSignalHandler.js.map +0 -1
  123. package/out/gen/autoFix.d.ts +0 -4
  124. package/out/gen/autoFix.js +0 -125
  125. package/out/gen/autoFix.js.map +0 -1
  126. package/out/gen/csharpUtGen.d.ts +0 -2
  127. package/out/gen/csharpUtGen.js +0 -125
  128. package/out/gen/csharpUtGen.js.map +0 -1
  129. package/out/gen/ensureValidLLMResponse.d.ts +0 -1
  130. package/out/gen/ensureValidLLMResponse.js +0 -19
  131. package/out/gen/ensureValidLLMResponse.js.map +0 -1
  132. package/out/gen/postGen/extractCodeFromResponse.d.ts +0 -1
  133. package/out/gen/postGen/extractCodeFromResponse.js +0 -37
  134. package/out/gen/postGen/extractCodeFromResponse.js.map +0 -1
  135. package/out/gen/postGen/postGenProcess.d.ts +0 -1
  136. package/out/gen/postGen/postGenProcess.js +0 -37
  137. package/out/gen/postGen/postGenProcess.js.map +0 -1
  138. package/out/gen/postGen/removeComments.d.ts +0 -1
  139. package/out/gen/postGen/removeComments.js +0 -92
  140. package/out/gen/postGen/removeComments.js.map +0 -1
  141. package/out/gen/postGen/removeSingleLines.d.ts +0 -1
  142. package/out/gen/postGen/removeSingleLines.js +0 -28
  143. package/out/gen/postGen/removeSingleLines.js.map +0 -1
  144. package/out/gen/postGen/repairRequiredNameSpaces.d.ts +0 -2
  145. package/out/gen/postGen/repairRequiredNameSpaces.js +0 -141
  146. package/out/gen/postGen/repairRequiredNameSpaces.js.map +0 -1
  147. package/out/gen/postGen/validateTestCode.d.ts +0 -1
  148. package/out/gen/postGen/validateTestCode.js +0 -14
  149. package/out/gen/postGen/validateTestCode.js.map +0 -1
  150. package/out/gen/preGen/excludeFileName.d.ts +0 -1
  151. package/out/gen/preGen/excludeFileName.js +0 -49
  152. package/out/gen/preGen/excludeFileName.js.map +0 -1
  153. package/out/gen/preGen/excludeSpecificTag.d.ts +0 -1
  154. package/out/gen/preGen/excludeSpecificTag.js +0 -18
  155. package/out/gen/preGen/excludeSpecificTag.js.map +0 -1
  156. package/out/gen/preGen/preGenProcess.d.ts +0 -1
  157. package/out/gen/preGen/preGenProcess.js +0 -22
  158. package/out/gen/preGen/preGenProcess.js.map +0 -1
  159. package/out/gen/preGen/validateCode.d.ts +0 -3
  160. package/out/gen/preGen/validateCode.js +0 -62
  161. package/out/gen/preGen/validateCode.js.map +0 -1
  162. package/out/index.d.ts +0 -3
  163. package/out/index.js +0 -10
  164. package/out/index.js.map +0 -1
  165. package/out/llm/model/Gpt.d.ts +0 -1
  166. package/out/llm/model/Gpt.js +0 -93
  167. package/out/llm/model/Gpt.js.map +0 -1
  168. package/out/llm/preparePrompt.d.ts +0 -2
  169. package/out/llm/preparePrompt.js +0 -135
  170. package/out/llm/preparePrompt.js.map +0 -1
  171. package/out/llm/prompt/buildAfGuidelines.liquid +0 -15
  172. package/out/llm/prompt/general/generalBuildAutofixGuidelines.liquid +0 -13
  173. package/out/llm/prompt/general/generalUtGuidelines.liquid +0 -16
  174. package/out/llm/prompt/generateUtAutoFix.liquid +0 -23
  175. package/out/llm/prompt/generateUtDependency.liquid +0 -3
  176. package/out/llm/prompt/generateUtSystem.liquid +0 -5
  177. package/out/llm/prompt/generateUtTemplate.liquid +0 -32
  178. package/out/llm/prompt/generateUtUserInput.liquid +0 -4
  179. package/out/llm/prompt/xap/xapBuildAutofixGuidelines.liquid +0 -13
  180. package/out/llm/prompt/xap/xapCodeCodeDependency.liquid +0 -0
  181. package/out/llm/prompt/xap/xapCodeSample.liquid +0 -38
  182. package/out/llm/prompt/xap/xapUtGuideline.liquid +0 -37
  183. package/out/llm/sendRequestToLLM.d.ts +0 -4
  184. package/out/llm/sendRequestToLLM.js +0 -9
  185. package/out/llm/sendRequestToLLM.js.map +0 -1
  186. package/out/llm/sendRequestToSelfHostLLM.d.ts +0 -4
  187. package/out/llm/sendRequestToSelfHostLLM.js +0 -41
  188. package/out/llm/sendRequestToSelfHostLLM.js.map +0 -1
  189. package/out/metrics/appInsightTelemetry.d.ts +0 -6
  190. package/out/metrics/appInsightTelemetry.js +0 -77
  191. package/out/metrics/appInsightTelemetry.js.map +0 -1
  192. package/out/metrics/machineId.d.ts +0 -11
  193. package/out/metrics/machineId.js +0 -85
  194. package/out/metrics/machineId.js.map +0 -1
  195. package/out/setup/setup.d.ts +0 -1
  196. package/out/setup/setup.js +0 -10
  197. package/out/setup/setup.js.map +0 -1
  198. package/out/setup/setupConsole.d.ts +0 -1
  199. package/out/setup/setupConsole.js +0 -23
  200. package/out/setup/setupConsole.js.map +0 -1
  201. package/out/setup/setupLLMRequest.d.ts +0 -2
  202. package/out/setup/setupLLMRequest.js +0 -10
  203. package/out/setup/setupLLMRequest.js.map +0 -1
  204. package/out/tools/devenvcom.cmd +0 -13
  205. package/out/tools/devenvexe.cmd +0 -13
  206. package/out/tools/msbuildexe.cmd +0 -13
  207. package/out/tools/vstestexe.cmd +0 -13
  208. package/out/types/benchmark.d.ts +0 -11
  209. package/out/types/benchmark.js +0 -3
  210. package/out/types/benchmark.js.map +0 -1
  211. package/out/types/buildResult.d.ts +0 -8
  212. package/out/types/buildResult.js +0 -3
  213. package/out/types/buildResult.js.map +0 -1
  214. package/out/types/constants.d.ts +0 -6
  215. package/out/types/constants.js +0 -10
  216. package/out/types/constants.js.map +0 -1
  217. package/out/types/genResult.d.ts +0 -10
  218. package/out/types/genResult.js +0 -3
  219. package/out/types/genResult.js.map +0 -1
  220. package/out/types/testResult.d.ts +0 -12
  221. package/out/types/testResult.js +0 -3
  222. package/out/types/testResult.js.map +0 -1
  223. package/out/types/verifyResult.d.ts +0 -8
  224. package/out/types/verifyResult.js +0 -3
  225. package/out/types/verifyResult.js.map +0 -1
  226. package/out/utils/checkTestProject.d.ts +0 -2
  227. package/out/utils/checkTestProject.js +0 -79
  228. package/out/utils/checkTestProject.js.map +0 -1
  229. package/out/utils/checkXapCode.d.ts +0 -2
  230. package/out/utils/checkXapCode.js +0 -59
  231. package/out/utils/checkXapCode.js.map +0 -1
  232. package/out/utils/delay.d.ts +0 -1
  233. package/out/utils/delay.js +0 -7
  234. package/out/utils/delay.js.map +0 -1
  235. package/out/utils/detectTestFramework.d.ts +0 -1
  236. package/out/utils/detectTestFramework.js +0 -33
  237. package/out/utils/detectTestFramework.js.map +0 -1
  238. package/out/utils/fileUtils.d.ts +0 -2
  239. package/out/utils/fileUtils.js +0 -42
  240. package/out/utils/fileUtils.js.map +0 -1
  241. package/out/utils/generateCodeSha256.d.ts +0 -1
  242. package/out/utils/generateCodeSha256.js +0 -46
  243. package/out/utils/generateCodeSha256.js.map +0 -1
  244. package/out/utils/getCodeStructurePath.d.ts +0 -5
  245. package/out/utils/getCodeStructurePath.js +0 -155
  246. package/out/utils/getCodeStructurePath.js.map +0 -1
  247. package/out/utils/getOrCreateDir.d.ts +0 -2
  248. package/out/utils/getOrCreateDir.js +0 -63
  249. package/out/utils/getOrCreateDir.js.map +0 -1
  250. package/out/utils/getTestCodeInfo.d.ts +0 -2
  251. package/out/utils/getTestCodeInfo.js +0 -121
  252. package/out/utils/getTestCodeInfo.js.map +0 -1
  253. package/out/utils/getTestFile.d.ts +0 -13
  254. package/out/utils/getTestFile.js +0 -295
  255. package/out/utils/getTestFile.js.map +0 -1
  256. package/out/utils/parseBuildResult.d.ts +0 -3
  257. package/out/utils/parseBuildResult.js +0 -44
  258. package/out/utils/parseBuildResult.js.map +0 -1
  259. package/out/utils/parseSyntaxCheckResult.d.ts +0 -2
  260. package/out/utils/parseSyntaxCheckResult.js +0 -38
  261. package/out/utils/parseSyntaxCheckResult.js.map +0 -1
  262. package/out/utils/parseVstestResult.d.ts +0 -3
  263. package/out/utils/parseVstestResult.js +0 -61
  264. package/out/utils/parseVstestResult.js.map +0 -1
  265. package/out/utils/removeFailedTestMethods.d.ts +0 -3
  266. package/out/utils/removeFailedTestMethods.js +0 -207
  267. package/out/utils/removeFailedTestMethods.js.map +0 -1
  268. package/out/utils/runCommand.d.ts +0 -1
  269. package/out/utils/runCommand.js +0 -14
  270. package/out/utils/runCommand.js.map +0 -1
  271. package/out/utils/spawnExec.d.ts +0 -1
  272. package/out/utils/spawnExec.js +0 -80
  273. package/out/utils/spawnExec.js.map +0 -1
  274. package/out/utils/verifyBuildErrorCausedFile.d.ts +0 -1
  275. package/out/utils/verifyBuildErrorCausedFile.js +0 -60
  276. package/out/utils/verifyBuildErrorCausedFile.js.map +0 -1
  277. package/out/utils/verifyTestCode.d.ts +0 -2
  278. package/out/utils/verifyTestCode.js +0 -25
  279. package/out/utils/verifyTestCode.js.map +0 -1
  280. package/out/utils/writeGenCode.d.ts +0 -1
  281. package/out/utils/writeGenCode.js +0 -50
  282. package/out/utils/writeGenCode.js.map +0 -1
  283. package/out/vs/msBuild.d.ts +0 -13
  284. package/out/vs/msBuild.js +0 -49
  285. package/out/vs/msBuild.js.map +0 -1
  286. package/out/vs/vsTest.d.ts +0 -15
  287. package/out/vs/vsTest.js +0 -75
  288. package/out/vs/vsTest.js.map +0 -1
  289. package/out/vs/vsTools.d.ts +0 -7
  290. package/out/vs/vsTools.js +0 -177
  291. package/out/vs/vsTools.js.map +0 -1
  292. package/out/vsPlugin/getVsPluginVerifyResult.d.ts +0 -2
  293. package/out/vsPlugin/getVsPluginVerifyResult.js +0 -41
  294. package/out/vsPlugin/getVsPluginVerifyResult.js.map +0 -1
  295. package/out/vsPlugin/interactionConstants.d.ts +0 -2
  296. package/out/vsPlugin/interactionConstants.js +0 -10
  297. package/out/vsPlugin/interactionConstants.js.map +0 -1
  298. package/out/vsPlugin/sendStdToVsPlugin.d.ts +0 -1
  299. package/out/vsPlugin/sendStdToVsPlugin.js +0 -12
  300. package/out/vsPlugin/sendStdToVsPlugin.js.map +0 -1
  301. package/out/vsPlugin/stdListener.d.ts +0 -3
  302. package/out/vsPlugin/stdListener.js +0 -57
  303. package/out/vsPlugin/stdListener.js.map +0 -1
@@ -1,207 +0,0 @@
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.removeFailedTests = removeFailedTests;
37
- exports.removeFailedTestCasesInTestFile = removeFailedTestCasesInTestFile;
38
- const fs = __importStar(require("fs"));
39
- function removeFailedTests(filePath, failedTestNames) {
40
- try {
41
- if (!fs.existsSync(filePath)) {
42
- throw new Error(`File not exist ${filePath}`);
43
- }
44
- const content = fs.readFileSync(filePath, 'utf-8');
45
- const lines = content.split(/\r?\n/);
46
- // get all test methods in the file
47
- const testMethods = findTestMethods(lines);
48
- // filter out methods that match the failed test names
49
- const methodsToRemove = testMethods.filter(method => failedTestNames.includes(method.methodName));
50
- if (methodsToRemove.length === 0) {
51
- console.log('Can not find any failed test methods to remove.');
52
- return;
53
- }
54
- // sort methods by start line in descending order
55
- // to avoid index issues when removing lines
56
- methodsToRemove.sort((a, b) => b.startLine - a.startLine);
57
- // delete the test methods from the lines
58
- let modifiedLines = [...lines];
59
- for (const method of methodsToRemove) {
60
- modifiedLines = removeTestMethod(modifiedLines, method);
61
- }
62
- // cleanup empty lines
63
- modifiedLines = cleanupEmptyLines(modifiedLines);
64
- const modifiedContent = modifiedLines.join('\n');
65
- return modifiedContent;
66
- }
67
- catch (error) {
68
- console.error('Error removing failed tests:', error);
69
- throw error;
70
- }
71
- }
72
- /**
73
- * find all test methods in the file
74
- */
75
- function findTestMethods(lines) {
76
- const testMethods = [];
77
- for (let i = 0; i < lines.length; i++) {
78
- const line = lines[i].trim();
79
- // find [TestMethod] attribute
80
- if (line === '[TestMethod]' || line.startsWith('[TestMethod(')) {
81
- // find the method definition starting from this line
82
- const methodInfo = findMethodDefinition(lines, i);
83
- if (methodInfo) {
84
- testMethods.push(methodInfo);
85
- }
86
- }
87
- }
88
- return testMethods;
89
- }
90
- /**
91
- * find the method definition based on the line number of [TestMethod]
92
- */
93
- function findMethodDefinition(lines, testMethodLine) {
94
- let methodStartLine = testMethodLine;
95
- let methodName = '';
96
- let braceCount = 0;
97
- let methodFound = false;
98
- let methodEndLine = -1;
99
- // find the start of the method definition
100
- while (methodStartLine > 0 &&
101
- (lines[methodStartLine - 1].trim() === '' ||
102
- lines[methodStartLine - 1].trim().startsWith('['))) {
103
- methodStartLine--;
104
- }
105
- // find the method definition starting from the line after [TestMethod]
106
- for (let i = testMethodLine; i < lines.length; i++) {
107
- const line = lines[i].trim();
108
- // skip empty lines and section headers
109
- if (line === '' || line.startsWith('[')) {
110
- continue;
111
- }
112
- // find the method definition
113
- if (!methodFound && isMethodDefinition(line)) {
114
- methodName = extractMethodName(line);
115
- methodFound = true;
116
- // if the method is defined in a single line, we can directly set the end line
117
- const openBraces = (line.match(/{/g) || []).length;
118
- const closeBraces = (line.match(/}/g) || []).length;
119
- braceCount += openBraces - closeBraces;
120
- if (braceCount === 0 && openBraces > 0) {
121
- // single line method definition
122
- methodEndLine = i;
123
- break;
124
- }
125
- continue;
126
- }
127
- // if we have found the method definition, count braces
128
- if (methodFound) {
129
- const openBraces = (line.match(/{/g) || []).length;
130
- const closeBraces = (line.match(/}/g) || []).length;
131
- braceCount += openBraces - closeBraces;
132
- if (braceCount === 0) {
133
- methodEndLine = i;
134
- break;
135
- }
136
- }
137
- }
138
- if (methodFound && methodEndLine !== -1) {
139
- return {
140
- startLine: methodStartLine,
141
- endLine: methodEndLine,
142
- methodName: methodName
143
- };
144
- }
145
- return null;
146
- }
147
- /**
148
- * check if a line is a method definition
149
- */
150
- function isMethodDefinition(line) {
151
- // simple regex to match method definitions
152
- // supports public, protected, internal, static, async, and method name with parameters
153
- const methodPattern = /^\s*(public|function|protected|internal)?\s*(static\s+)?(async\s+)?\w+\s+\w+\s*\(/;
154
- return methodPattern.test(line);
155
- }
156
- /**
157
- * extract method name from a method definition line
158
- */
159
- function extractMethodName(line) {
160
- const match = line.match(/\b(\w+)\s*\(/);
161
- return match ? match[1] : '';
162
- }
163
- /**
164
- * delete specific testt method block from lines
165
- */
166
- function removeTestMethod(lines, method) {
167
- const newLines = [...lines];
168
- // delete methodn block(include [TestMethod] tag)
169
- newLines.splice(method.startLine, method.endLine - method.startLine + 1);
170
- return newLines;
171
- }
172
- /**
173
- * clean extra empty line, ensure only one empty line between methods
174
- */
175
- function cleanupEmptyLines(lines) {
176
- const result = [];
177
- let emptyLineCount = 0;
178
- for (let i = 0; i < lines.length; i++) {
179
- const line = lines[i];
180
- const isEmptyLine = line.trim() === '';
181
- if (isEmptyLine) {
182
- emptyLineCount++;
183
- // keep one empty line between methods
184
- if (emptyLineCount === 1) {
185
- result.push(line);
186
- }
187
- }
188
- else {
189
- emptyLineCount = 0;
190
- result.push(line);
191
- }
192
- }
193
- // remove trailing empty lines
194
- while (result.length > 0 && result[result.length - 1].trim() === '') {
195
- result.pop();
196
- }
197
- return result;
198
- }
199
- function removeFailedTestCasesInTestFile(vsTestRes, testFilePath) {
200
- const failedTestMethods = vsTestRes?.failedTests?.map(test => test.name) || [];
201
- const succeedTestCode = removeFailedTests(testFilePath, failedTestMethods);
202
- fs.writeFileSync(testFilePath, succeedTestCode, 'utf-8');
203
- console.log(`Removed failed test cases from file: ${testFilePath}`);
204
- }
205
- // const testCode = removeFailedTests("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\Workflows\\Overview\\HttpRequestParser\\Utils\\SqmidHelperTests.cs", ["GetSqmidFromCookie_InvalidBlisIdFormat_ReturnsEmptyString", "GetSqmidFromCookie_MissingUsrLocCookie_ReturnsEmptyString"]);
206
- // console.log(testCode);
207
- //# sourceMappingURL=removeFailedTestMethods.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"removeFailedTestMethods.js","sourceRoot":"","sources":["../../src/utils/removeFailedTestMethods.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,8CA2CC;AA0JD,0EAKC;AApND,uCAAyB;AAUzB,SAAgB,iBAAiB,CAAC,QAAgB,EAAE,eAAyB;IACzE,IAAI,CAAC;QACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC;QAClD,CAAC;QAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAErC,mCAAmC;QACnC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QAE3C,sDAAsD;QACtD,MAAM,eAAe,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAChD,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAC9C,CAAC;QAEF,IAAI,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;YAC/D,OAAO;QACX,CAAC;QAED,iDAAiD;QACjD,4CAA4C;QAC5C,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;QAE1D,yCAAyC;QACzC,IAAI,aAAa,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;QAC/B,KAAK,MAAM,MA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C,YAAY,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,gUAAgU;AAChU,yBAAyB","sourcesContent":["import * as fs from 'fs';\r\n\r\nimport { TestResult } from '../types/testResult';\r\n\r\ninterface TestMethodInfo {\r\n startLine: number;\r\n endLine: number;\r\n methodName: string;\r\n}\r\n\r\nexport function removeFailedTests(filePath: string, failedTestNames: string[]) {\r\n try {\r\n if (!fs.existsSync(filePath)) {\r\n throw new Error(`File not exist ${filePath}`);\r\n }\r\n\r\n const content = fs.readFileSync(filePath, 'utf-8');\r\n const lines = content.split(/\\r?\\n/);\r\n\r\n // get all test methods in the file\r\n const testMethods = findTestMethods(lines);\r\n\r\n // filter out methods that match the failed test names\r\n const methodsToRemove = testMethods.filter(method =>\r\n failedTestNames.includes(method.methodName)\r\n );\r\n\r\n if (methodsToRemove.length === 0) {\r\n console.log('Can not find any failed test methods to remove.');\r\n return;\r\n }\r\n\r\n // sort methods by start line in descending order\r\n // to avoid index issues when removing lines\r\n methodsToRemove.sort((a, b) => b.startLine - a.startLine);\r\n\r\n // delete the test methods from the lines\r\n let modifiedLines = [...lines];\r\n for (const method of methodsToRemove) {\r\n modifiedLines = removeTestMethod(modifiedLines, method);\r\n }\r\n\r\n // cleanup empty lines\r\n modifiedLines = cleanupEmptyLines(modifiedLines);\r\n\r\n\r\n const modifiedContent = modifiedLines.join('\\n');\r\n return modifiedContent;\r\n\r\n } catch (error) {\r\n console.error('Error removing failed tests:', error);\r\n throw error;\r\n }\r\n}\r\n\r\n/**\r\n * find all test methods in the file\r\n */\r\nfunction findTestMethods(lines: string[]): TestMethodInfo[] {\r\n const testMethods: TestMethodInfo[] = [];\r\n\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i].trim();\r\n\r\n // find [TestMethod] attribute\r\n if (line === '[TestMethod]' || line.startsWith('[TestMethod(')) {\r\n // find the method definition starting from this line\r\n const methodInfo = findMethodDefinition(lines, i);\r\n if (methodInfo) {\r\n testMethods.push(methodInfo);\r\n }\r\n }\r\n }\r\n\r\n return testMethods;\r\n}\r\n\r\n/**\r\n * find the method definition based on the line number of [TestMethod]\r\n */\r\nfunction findMethodDefinition(lines: string[], testMethodLine: number): TestMethodInfo | null {\r\n let methodStartLine = testMethodLine;\r\n let methodName = '';\r\n let braceCount = 0;\r\n let methodFound = false;\r\n let methodEndLine = -1;\r\n\r\n // find the start of the method definition\r\n while (methodStartLine > 0 &&\r\n (lines[methodStartLine - 1].trim() === '' ||\r\n lines[methodStartLine - 1].trim().startsWith('['))) {\r\n methodStartLine--;\r\n }\r\n\r\n // find the method definition starting from the line after [TestMethod]\r\n for (let i = testMethodLine; i < lines.length; i++) {\r\n const line = lines[i].trim();\r\n\r\n // skip empty lines and section headers\r\n if (line === '' || line.startsWith('[')) {\r\n continue;\r\n }\r\n\r\n // find the method definition\r\n if (!methodFound && isMethodDefinition(line)) {\r\n methodName = extractMethodName(line);\r\n methodFound = true;\r\n\r\n // if the method is defined in a single line, we can directly set the end line\r\n const openBraces = (line.match(/{/g) || []).length;\r\n const closeBraces = (line.match(/}/g) || []).length;\r\n braceCount += openBraces - closeBraces;\r\n\r\n if (braceCount === 0 && openBraces > 0) {\r\n // single line method definition\r\n methodEndLine = i;\r\n break;\r\n }\r\n continue;\r\n }\r\n\r\n // if we have found the method definition, count braces\r\n if (methodFound) {\r\n const openBraces = (line.match(/{/g) || []).length;\r\n const closeBraces = (line.match(/}/g) || []).length;\r\n braceCount += openBraces - closeBraces;\r\n\r\n if (braceCount === 0) {\r\n methodEndLine = i;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n if (methodFound && methodEndLine !== -1) {\r\n return {\r\n startLine: methodStartLine,\r\n endLine: methodEndLine,\r\n methodName: methodName\r\n };\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * check if a line is a method definition\r\n */\r\nfunction isMethodDefinition(line: string): boolean {\r\n // simple regex to match method definitions\r\n // supports public, protected, internal, static, async, and method name with parameters\r\n const methodPattern = /^\\s*(public|function|protected|internal)?\\s*(static\\s+)?(async\\s+)?\\w+\\s+\\w+\\s*\\(/;\r\n return methodPattern.test(line);\r\n}\r\n\r\n/**\r\n * extract method name from a method definition line\r\n */\r\nfunction extractMethodName(line: string): string {\r\n const match = line.match(/\\b(\\w+)\\s*\\(/);\r\n return match ? match[1] : '';\r\n}\r\n\r\n/**\r\n * delete specific testt method block from lines\r\n */\r\nfunction removeTestMethod(lines: string[], method: TestMethodInfo): string[] {\r\n const newLines = [...lines];\r\n\r\n // delete methodn block(include [TestMethod] tag)\r\n newLines.splice(method.startLine, method.endLine - method.startLine + 1);\r\n\r\n return newLines;\r\n}\r\n\r\n/**\r\n * clean extra empty line, ensure only one empty line between methods\r\n */\r\nfunction cleanupEmptyLines(lines: string[]): string[] {\r\n const result: string[] = [];\r\n let emptyLineCount = 0;\r\n\r\n for (let i = 0; i < lines.length; i++) {\r\n const line = lines[i];\r\n const isEmptyLine = line.trim() === '';\r\n\r\n if (isEmptyLine) {\r\n emptyLineCount++;\r\n // keep one empty line between methods\r\n if (emptyLineCount === 1) {\r\n result.push(line);\r\n }\r\n } else {\r\n emptyLineCount = 0;\r\n result.push(line);\r\n }\r\n }\r\n\r\n // remove trailing empty lines\r\n while (result.length > 0 && result[result.length - 1].trim() === '') {\r\n result.pop();\r\n }\r\n\r\n return result;\r\n}\r\n\r\n\r\nexport function removeFailedTestCasesInTestFile(vsTestRes: TestResult, testFilePath: string): void {\r\n const failedTestMethods = vsTestRes?.failedTests?.map(test => test.name) || [];\r\n const succeedTestCode = removeFailedTests(testFilePath, failedTestMethods);\r\n fs.writeFileSync(testFilePath, succeedTestCode, 'utf-8');\r\n console.log(`Removed failed test cases from file: ${testFilePath}`);\r\n}\r\n\r\n// const testCode = removeFailedTests(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\Workflows\\\\Overview\\\\HttpRequestParser\\\\Utils\\\\SqmidHelperTests.cs\", [\"GetSqmidFromCookie_InvalidBlisIdFormat_ReturnsEmptyString\", \"GetSqmidFromCookie_MissingUsrLocCookie_ReturnsEmptyString\"]);\r\n// console.log(testCode);"]}
@@ -1 +0,0 @@
1
- export declare function runCommand(command: string): string;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runCommand = runCommand;
4
- const child_process_1 = require("child_process");
5
- function runCommand(command) {
6
- try {
7
- return (0, child_process_1.execSync)(command, { encoding: 'utf8' });
8
- }
9
- catch (error) {
10
- console.error(`Command failed: ${command}`);
11
- return '';
12
- }
13
- }
14
- //# sourceMappingURL=runCommand.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runCommand.js","sourceRoot":"","sources":["../../src/utils/runCommand.ts"],"names":[],"mappings":";;AAEA,gCAOC;AATD,iDAAyC;AAEzC,SAAgB,UAAU,CAAC,OAAe;IACtC,IAAI,CAAC;QACD,OAAO,IAAA,wBAAQ,EAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,mBAAmB,OAAO,EAAE,CAAC,CAAC;QAC5C,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC","sourcesContent":["import { execSync } from \"child_process\";\r\n\r\nexport function runCommand(command: string): string {\r\n try {\r\n return execSync(command, { encoding: 'utf8' });\r\n } catch (error) {\r\n console.error(`Command failed: ${command}`);\r\n return '';\r\n }\r\n}\r\n"]}
@@ -1 +0,0 @@
1
- export declare function runSpawn(execCmd: string, args: string[], workDir: string, errorHandler: any, closeHandler: any): Promise<any>;
@@ -1,80 +0,0 @@
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.runSpawn = runSpawn;
37
- const path = __importStar(require("path"));
38
- const childProcessManager_1 = require("../exit/childProcessManager");
39
- const child_process_1 = require("child_process");
40
- function runSpawn(execCmd, args, workDir, errorHandler, closeHandler) {
41
- return new Promise((resolve) => {
42
- const normalizedCommand = path.normalize(execCmd);
43
- console.log(`Running ${path.basename(normalizedCommand)}:\n ${normalizedCommand} ${args.join(' ')} ...`);
44
- const startTime = Date.now();
45
- // Split command into executable and arguments for spawn
46
- // const childProcess = spawn(`"${normalizedCommand}"`, args, {
47
- const childProcess = (0, child_process_1.spawn)(normalizedCommand, args, {
48
- cwd: workDir,
49
- detached: true,
50
- windowsHide: true, // Hide the console window on Windows
51
- stdio: ['inherit', 'pipe', 'pipe'], // Pipe stdout and stderr for streaming
52
- // shell: true // Required to handle quoted paths and command-line arguments
53
- });
54
- let stdout = '';
55
- let stderr = '';
56
- // Collect stdout data
57
- childProcess.stdout.on('data', (data) => {
58
- stdout += data.toString();
59
- });
60
- // Collect stderr data
61
- childProcess.stderr.on('data', (data) => {
62
- stderr += data.toString();
63
- });
64
- // Handle process errors, case: the cmd can't be executed, like path not found...
65
- childProcess.on('error', (error) => {
66
- console.log(`exec error cost time: ${(Date.now() - startTime) / 1000} seconds`);
67
- const result = errorHandler(error);
68
- resolve(result);
69
- });
70
- // Handle process exit, case: the cmd executed but failed with error, or succeeded
71
- childProcess.on('close', (code) => {
72
- console.log(`exec complete cost time: ${(Date.now() - startTime) / 1000} seconds`);
73
- const result = closeHandler(code, stdout, stderr);
74
- resolve(result);
75
- });
76
- childProcessManager_1.childProcessSet.add(childProcess.pid);
77
- console.log(`Running spawnExec with PID: ${childProcess.pid}`);
78
- });
79
- }
80
- //# sourceMappingURL=spawnExec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spawnExec.js","sourceRoot":"","sources":["../../src/utils/spawnExec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,4BA+CC;AApDD,2CAA6B;AAE7B,qEAA8D;AAC9D,iDAAsC;AAEtC,SAAgB,QAAQ,CAAC,OAAe,EAAE,IAAc,EAAE,OAAe,EAAE,YAAY,EAAE,YAAY;IACjG,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAElD,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,OAAO,iBAAiB,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEzG,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,wDAAwD;QACxD,+DAA+D;QAC/D,MAAM,YAAY,GAAG,IAAA,qBAAK,EAAC,iBAAiB,EAAE,IAAI,EAAE;YAChD,GAAG,EAAE,OAAO;YACZ,QAAQ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CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,+BAA+B,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import * as path from 'path';\r\n\r\nimport { childProcessSet } from '../exit/childProcessManager';\r\nimport { spawn } from 'child_process';\r\n\r\nexport function runSpawn(execCmd: string, args: string[], workDir: string, errorHandler, closeHandler): Promise<any> {\r\n return new Promise((resolve) => {\r\n const normalizedCommand = path.normalize(execCmd);\r\n\r\n console.log(`Running ${path.basename(normalizedCommand)}:\\n ${normalizedCommand} ${args.join(' ')} ...`);\r\n\r\n const startTime = Date.now();\r\n // Split command into executable and arguments for spawn\r\n // const childProcess = spawn(`\"${normalizedCommand}\"`, args, {\r\n const childProcess = spawn(normalizedCommand, args, {\r\n cwd: workDir,\r\n detached: true,\r\n windowsHide: true, // Hide the console window on Windows\r\n stdio: ['inherit', 'pipe', 'pipe'], // Pipe stdout and stderr for streaming\r\n // shell: true // Required to handle quoted paths and command-line arguments\r\n });\r\n\r\n let stdout = '';\r\n let stderr = '';\r\n\r\n // Collect stdout data\r\n childProcess.stdout.on('data', (data) => {\r\n stdout += data.toString();\r\n });\r\n\r\n // Collect stderr data\r\n childProcess.stderr.on('data', (data) => {\r\n stderr += data.toString();\r\n });\r\n\r\n // Handle process errors, case: the cmd can't be executed, like path not found...\r\n childProcess.on('error', (error) => {\r\n console.log(`exec error cost time: ${(Date.now() - startTime) / 1000} seconds`);\r\n const result = errorHandler(error);\r\n resolve(result);\r\n });\r\n\r\n // Handle process exit, case: the cmd executed but failed with error, or succeeded\r\n childProcess.on('close', (code) => {\r\n console.log(`exec complete cost time: ${(Date.now() - startTime) / 1000} seconds`);\r\n const result = closeHandler(code, stdout, stderr);\r\n resolve(result);\r\n });\r\n\r\n childProcessSet.add(childProcess.pid);\r\n console.log(`Running spawnExec with PID: ${childProcess.pid}`);\r\n });\r\n}"]}
@@ -1 +0,0 @@
1
- export declare function verifyBuildErrorCausedFile(testCodePath: string, buildErrors: any[]): boolean;
@@ -1,60 +0,0 @@
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.verifyBuildErrorCausedFile = verifyBuildErrorCausedFile;
37
- const path = __importStar(require("path"));
38
- function verifyBuildErrorCausedFile(testCodePath, buildErrors) {
39
- if (!buildErrors || buildErrors.length === 0) {
40
- return true;
41
- }
42
- let abortSignal = false;
43
- // Check if the test code path is mentioned in any of the build errors
44
- for (const buildError of buildErrors) {
45
- if (!buildError.file) {
46
- continue;
47
- }
48
- const normalizedFilePath = path.normalize(buildError.file);
49
- const normalizedTestCodePath = path.normalize(testCodePath);
50
- if (normalizedFilePath !== normalizedTestCodePath) {
51
- console.error(`Build error was caused by other code file: ${buildError.file}, plesase fix it first.`);
52
- abortSignal = true;
53
- }
54
- }
55
- if (abortSignal) {
56
- return false;
57
- }
58
- return true; // No errors related to the test code path
59
- }
60
- //# sourceMappingURL=verifyBuildErrorCausedFile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verifyBuildErrorCausedFile.js","sourceRoot":"","sources":["../../src/utils/verifyBuildErrorCausedFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gEAwBC;AA1BD,2CAA6B;AAE7B,SAAgB,0BAA0B,CAAC,YAAoB,EAAE,WAAkB;IAC/E,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,sEAAsE;IACtE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;YACnB,SAAS;QACb,CAAC;QACD,MAAM,kBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC3D,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QAC5D,IAAI,kBAAkB,KAAK,sBAAsB,EAAE,CAAC;YAChD,OAAO,CAAC,KAAK,CAAC,8CAA8C,UAAU,CAAC,IAAI,yBAAyB,CAAC,CAAC;YACtG,WAAW,GAAG,IAAI,CAAC;QACvB,CAAC;IACL,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QACd,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,0CAA0C;AAC3D,CAAC","sourcesContent":["import * as path from 'path';\r\n\r\nexport function verifyBuildErrorCausedFile(testCodePath: string, buildErrors: any[]) {\r\n if (!buildErrors || buildErrors.length === 0) {\r\n return true;\r\n }\r\n\r\n let abortSignal = false;\r\n // Check if the test code path is mentioned in any of the build errors\r\n for (const buildError of buildErrors) {\r\n if (!buildError.file) {\r\n continue;\r\n }\r\n const normalizedFilePath = path.normalize(buildError.file);\r\n const normalizedTestCodePath = path.normalize(testCodePath);\r\n if (normalizedFilePath !== normalizedTestCodePath) {\r\n console.error(`Build error was caused by other code file: ${buildError.file}, plesase fix it first.`);\r\n abortSignal = true;\r\n }\r\n }\r\n\r\n if (abortSignal) {\r\n return false;\r\n }\r\n\r\n return true; // No errors related to the test code path\r\n}"]}
@@ -1,2 +0,0 @@
1
- import { VerifyResult } from "../types/verifyResult";
2
- export declare function verifyTestCode(testCode: string, testProjectPath: string): Promise<VerifyResult>;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyTestCode = verifyTestCode;
4
- const getCodeStructurePath_1 = require("./getCodeStructurePath");
5
- const getTestCodeInfo_1 = require("./getTestCodeInfo");
6
- const msBuild_1 = require("../vs/msBuild");
7
- const vsTest_1 = require("../vs/vsTest");
8
- async function verifyTestCode(testCode, testProjectPath) {
9
- const startTime = Date.now();
10
- const { success: buildSuccess, message: buildMessage, buildErrors } = await (0, msBuild_1.runMsBuild)(testProjectPath);
11
- if (!buildSuccess) {
12
- console.error(`build failed: ${buildMessage}`);
13
- return { success: false, message: buildMessage, buildErrors: buildErrors, testResult: null };
14
- }
15
- const testProjectDll = (0, getCodeStructurePath_1.getBuiltDllPath)(testProjectPath);
16
- const testClassName = (0, getTestCodeInfo_1.getTestClassName)(testCode);
17
- const { success: testSuccess, message: testMessage, testResult } = await (0, vsTest_1.runTestClass)(testProjectDll, testClassName);
18
- if (!testSuccess) {
19
- console.error(`test failed: ${testMessage}`);
20
- return { success: false, message: testMessage, buildErrors: null, testResult };
21
- }
22
- console.log(`Verify time: ${(Date.now() - startTime) / 1000} seconds`);
23
- return { success: true, message: "", buildErrors: null, testResult: null };
24
- }
25
- //# sourceMappingURL=verifyTestCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verifyTestCode.js","sourceRoot":"","sources":["../../src/utils/verifyTestCode.ts"],"names":[],"mappings":";;AAMA,wCAkBC;AAvBD,iEAAyD;AACzD,uDAAqD;AACrD,2CAA2C;AAC3C,yCAA4C;AAErC,KAAK,UAAU,cAAc,CAAC,QAAgB,EAAE,eAAuB;IAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,oBAAU,EAAC,eAAe,CAAC,CAAC;IACxG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACjG,CAAC;IAED,MAAM,cAAc,GAAG,IAAA,sCAAe,EAAC,eAAe,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,IAAA,kCAAgB,EAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,qBAAY,EAAC,cAAc,EAAE,aAAa,CAAC,CAAC;IACrH,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,WAAW,EAAE,CAAC,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACnF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;IACvE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC/E,CAAC","sourcesContent":["import { VerifyResult } from \"../types/verifyResult\";\r\nimport { getBuiltDllPath } from \"./getCodeStructurePath\";\r\nimport { getTestClassName } from \"./getTestCodeInfo\";\r\nimport { runMsBuild } from \"../vs/msBuild\";\r\nimport { runTestClass } from \"../vs/vsTest\";\r\n\r\nexport async function verifyTestCode(testCode: string, testProjectPath: string): Promise<VerifyResult> {\r\n const startTime = Date.now();\r\n const { success: buildSuccess, message: buildMessage, buildErrors } = await runMsBuild(testProjectPath);\r\n if (!buildSuccess) {\r\n console.error(`build failed: ${buildMessage}`);\r\n return { success: false, message: buildMessage, buildErrors: buildErrors, testResult: null };\r\n }\r\n\r\n const testProjectDll = getBuiltDllPath(testProjectPath);\r\n const testClassName = getTestClassName(testCode);\r\n const { success: testSuccess, message: testMessage, testResult } = await runTestClass(testProjectDll, testClassName);\r\n if (!testSuccess) {\r\n console.error(`test failed: ${testMessage}`);\r\n return { success: false, message: testMessage, buildErrors: null, testResult };\r\n }\r\n\r\n console.log(`Verify time: ${(Date.now() - startTime) / 1000} seconds`);\r\n return { success: true, message: \"\", buildErrors: null, testResult: null };\r\n}"]}
@@ -1 +0,0 @@
1
- export declare function writeGenCode(sourceCodePath: string, genCode: string, genCnt: number): void;
@@ -1,50 +0,0 @@
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.writeGenCode = writeGenCode;
37
- const path = __importStar(require("path"));
38
- const getOrCreateDir_1 = require("./getOrCreateDir");
39
- const fileUtils_1 = require("./fileUtils");
40
- const TESTFILEDIR = './testFiles';
41
- function writeGenCode(sourceCodePath, genCode, genCnt) {
42
- const sourceFileName = path.basename(sourceCodePath, '.cs');
43
- const testFileName = `${sourceFileName}Tests${genCnt}.cs`;
44
- const testFileDir = (0, getOrCreateDir_1.getTmpCacheDir)(TESTFILEDIR);
45
- const testFilePath = path.join(testFileDir, testFileName);
46
- (0, fileUtils_1.writeTestCode)(genCode, testFilePath);
47
- console.log(`Generated code written to: ${testFilePath}`);
48
- }
49
- // writeGenCode('D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConfigManager.cs', 'public class EplantConfigManagerTests { }', 1);
50
- //# sourceMappingURL=writeGenCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"writeGenCode.js","sourceRoot":"","sources":["../../src/utils/writeGenCode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,oCAOC;AAbD,2CAA6B;AAE7B,qDAAkD;AAClD,2CAA4C;AAE5C,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,SAAgB,YAAY,CAAC,cAAsB,EAAE,OAAe,EAAE,MAAc;IAChF,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,GAAG,cAAc,QAAQ,MAAM,KAAK,CAAC;IAC1D,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,WAAW,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC1D,IAAA,yBAAa,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,8BAA8B,YAAY,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,+LAA+L","sourcesContent":["import * as path from 'path';\r\n\r\nimport { getTmpCacheDir } from './getOrCreateDir';\r\nimport { writeTestCode } from './fileUtils';\r\n\r\nconst TESTFILEDIR = './testFiles';\r\nexport function writeGenCode(sourceCodePath: string, genCode: string, genCnt: number) {\r\n const sourceFileName = path.basename(sourceCodePath, '.cs');\r\n const testFileName = `${sourceFileName}Tests${genCnt}.cs`;\r\n const testFileDir = getTmpCacheDir(TESTFILEDIR);\r\n const testFilePath = path.join(testFileDir, testFileName);\r\n writeTestCode(genCode, testFilePath);\r\n console.log(`Generated code written to: ${testFilePath}`);\r\n}\r\n\r\n// writeGenCode('D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConfigManager.cs', 'public class EplantConfigManagerTests { }', 1);"]}
@@ -1,13 +0,0 @@
1
- export declare function runMsBuild(projectPath: string): Promise<any>;
2
- export declare function buildErrorHandler(error: any): {
3
- success: boolean;
4
- };
5
- export declare function buildCloseHandler(code: any, stdout: any, stderr: any): {
6
- success: boolean;
7
- message: string;
8
- buildErrors: import("../types/buildResult").BuildResult[];
9
- } | {
10
- success: boolean;
11
- message: any;
12
- buildErrors: any;
13
- };
package/out/vs/msBuild.js DELETED
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runMsBuild = runMsBuild;
4
- exports.buildErrorHandler = buildErrorHandler;
5
- exports.buildCloseHandler = buildCloseHandler;
6
- const parseBuildResult_1 = require("../utils/parseBuildResult");
7
- const vsTools_1 = require("./vsTools");
8
- const spawnExec_1 = require("../utils/spawnExec");
9
- const getOrCreateDir_1 = require("../utils/getOrCreateDir");
10
- const BuildCacheDir = "./build/";
11
- function runMsBuild(projectPath) {
12
- const args = [projectPath, '/t:Build', '/m', '/nr:true', '/v:minimal'];
13
- const workDir = (0, getOrCreateDir_1.getTmpCacheDir)(BuildCacheDir);
14
- return (0, spawnExec_1.runSpawn)(`${vsTools_1.msBuildPath}`, args, workDir, buildErrorHandler, buildCloseHandler);
15
- }
16
- function buildErrorHandler(error) {
17
- console.error(`buildErrorHandler - failed: ${error.message}`);
18
- return ({ success: false });
19
- }
20
- function buildCloseHandler(code, stdout, stderr) {
21
- if (code !== 0) {
22
- console.error(`Build failed with exit code ${code}`);
23
- const buildErrors = (0, parseBuildResult_1.parseMsbuildErrors)(stdout);
24
- const formattedBuildErrors = (0, parseBuildResult_1.formatMsbuildResultToMarkdown)(buildErrors);
25
- return { success: false, message: formattedBuildErrors, buildErrors: buildErrors };
26
- }
27
- if (stderr) {
28
- console.error(`Warnings/Errors:\n${stdout}`);
29
- return { success: false, message: stdout, buildErrors: null };
30
- }
31
- console.log(`Build succeeded`);
32
- return { success: true, message: stdout, buildErrors: null };
33
- }
34
- // setupSignalHandlers();
35
- // runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
36
- // runMsBuild3('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
37
- // devenv "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
38
- // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
39
- // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
40
- // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug // incremental compile
41
- // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
42
- // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
43
- // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal /nr:true
44
- // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /project "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug
45
- // devenvexe.cmd "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug /project "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj"
46
- // devenvcom.cmd "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug /project "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj"
47
- // msbuildexe.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /m /nr:true /v:minimal
48
- // runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
49
- //# sourceMappingURL=msBuild.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"msBuild.js","sourceRoot":"","sources":["../../src/vs/msBuild.ts"],"names":[],"mappings":";;AASA,gCAKC;AAED,8CAGC;AAED,8CAeC;AAlCD,gEAA8F;AAE9F,uCAAwC;AACxC,kDAA8C;AAC9C,4DAAyD;AAEzD,MAAM,aAAa,GAAG,UAAU,CAAA;AAChC,SAAgB,UAAU,CAAC,WAAmB;IAC1C,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAEvE,MAAM,OAAO,GAAG,IAAA,+BAAc,EAAC,aAAa,CAAC,CAAC;IAC9C,OAAO,IAAA,oBAAQ,EAAC,GAAG,qBAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AAC3F,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAK;IACnC,OAAO,CAAC,KAAK,CAAC,+BAA+B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM;IAClD,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,IAAA,qCAAkB,EAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,oBAAoB,GAAG,IAAA,gDAA6B,EAAC,WAAW,CAAC,CAAC;QACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IACvF,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,qBAAqB,MAAM,EAAE,CAAC,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAClE,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AACjE,CAAC;AAGD,yBAAyB;AACzB,qIAAqI;AACrI,sIAAsI;AAEtI,+JAA+J;AAC/J,mKAAmK;AACnK,mKAAmK;AACnK,sHAAsH;AACtH,wKAAwK;AACxK,wKAAwK;AACxK,iLAAiL;AAEjL,sNAAsN;AAEtN,yNAAyN;AACzN,yNAAyN;AAEzN,yKAAyK;AACzK,qIAAqI","sourcesContent":["import * as path from 'path';\r\n\r\nimport { formatMsbuildResultToMarkdown, parseMsbuildErrors } from '../utils/parseBuildResult';\r\n\r\nimport { msBuildPath } from './vsTools';\r\nimport { runSpawn } from '../utils/spawnExec';\r\nimport { getTmpCacheDir } from '../utils/getOrCreateDir';\r\n\r\nconst BuildCacheDir = \"./build/\"\r\nexport function runMsBuild(projectPath: string): Promise<any> {\r\n const args = [projectPath, '/t:Build', '/m', '/nr:true', '/v:minimal'];\r\n\r\n const workDir = getTmpCacheDir(BuildCacheDir);\r\n return runSpawn(`${msBuildPath}`, args, workDir, buildErrorHandler, buildCloseHandler);\r\n}\r\n\r\nexport function buildErrorHandler(error) {\r\n console.error(`buildErrorHandler - failed: ${error.message}`);\r\n return ({ success: false });\r\n}\r\n\r\nexport function buildCloseHandler(code, stdout, stderr) {\r\n if (code !== 0) {\r\n console.error(`Build failed with exit code ${code}`);\r\n const buildErrors = parseMsbuildErrors(stdout);\r\n const formattedBuildErrors = formatMsbuildResultToMarkdown(buildErrors);\r\n return { success: false, message: formattedBuildErrors, buildErrors: buildErrors };\r\n }\r\n\r\n if (stderr) {\r\n console.error(`Warnings/Errors:\\n${stdout}`);\r\n return { success: false, message: stdout, buildErrors: null };\r\n }\r\n\r\n console.log(`Build succeeded`);\r\n return { success: true, message: stdout, buildErrors: null };\r\n}\r\n\r\n\r\n// setupSignalHandlers();\r\n// runMsBuild('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');\r\n// runMsBuild3('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');\r\n\r\n// devenv \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug // incremental compile\r\n// msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal\r\n// msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal\r\n// msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal /nr:true\r\n\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug\r\n\r\n// devenvexe.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\"\r\n// devenvcom.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\"\r\n\r\n// msbuildexe.cmd \\\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj\\\" /t:Build /m /nr:true /v:minimal\r\n// runMsBuild('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');"]}
@@ -1,15 +0,0 @@
1
- export declare function runSingleTestMethod(testDll: string, testMethod: string): Promise<any>;
2
- export declare function runTestClass(testDll: string, className: string): Promise<any>;
3
- export declare function runTestCommand(args: string[]): Promise<any>;
4
- export declare function testErrorHandler(error: any): {
5
- success: boolean;
6
- };
7
- export declare function testCloseHandler(code: any, stdout: any, stderr: any): {
8
- success: boolean;
9
- message: string;
10
- testResult: import("../types/testResult").TestResult;
11
- } | {
12
- success: boolean;
13
- message: any;
14
- testResult: any;
15
- };