@ai-dev-tools/csharp-copilot-core 0.0.19
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.
- package/ai-dev-tools-csharp-copilot-core-0.0.19.tgz +0 -0
- package/azure-pipelines.yml +52 -0
- package/out/analyze/cecil.d.ts +1 -0
- package/out/analyze/cecil.js +42 -0
- package/out/analyze/cecil.js.map +1 -0
- package/out/analyze/checkCodeSyntax.d.ts +7 -0
- package/out/analyze/checkCodeSyntax.js +67 -0
- package/out/analyze/checkCodeSyntax.js.map +1 -0
- package/out/analyze/generateCodeDependency.d.ts +6 -0
- package/out/analyze/generateCodeDependency.js +122 -0
- package/out/analyze/generateCodeDependency.js.map +1 -0
- package/out/analyze/installAnalyzerTool.d.ts +1 -0
- package/out/analyze/installAnalyzerTool.js +82 -0
- package/out/analyze/installAnalyzerTool.js.map +1 -0
- package/out/atmpCache/deps/EplantRequestCategoryCondition_Conditions_Eplant_Workflows_SharedSegmentsPlugins_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +281 -0
- package/out/atmpCache/deps/IdentitySelectAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/deps/SqmidHelperTests_Utils_HttpRequestParser_Overview_Workflows_SharedSegmentsTests_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +1 -0
- package/out/atmpCache/deps/SqmidHelper_Utils_HttpRequestParser_Overview_Workflows_SharedSegmentsPlugins_SharedSegments_SharedSegments_CSServiceFundamental_code_D.deps +1 -0
- package/out/atmpCache/deps/ToListCountAnalyzerTests_ToListinatorTests_test_AIUnitTestExample_code_d.deps +4037 -0
- package/out/atmpCache/deps/ToListCountAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/deps/ToListCountCodeFixProvider_ToListinatorCodeFixes_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/deps/ToListForEachAnalyzer_ToListinatorAnalyzers_src_AIUnitTestExample_code_d.deps +1 -0
- package/out/atmpCache/dllref/ToListinatorTests_ToListinatorTests_test_AIUnitTestExample_code_d.dllref +202 -0
- package/out/batch/generateCodeTests.d.ts +6 -0
- package/out/batch/generateCodeTests.js +147 -0
- package/out/batch/generateCodeTests.js.map +1 -0
- package/out/batch/getFolderCodeFile.d.ts +1 -0
- package/out/batch/getFolderCodeFile.js +19 -0
- package/out/batch/getFolderCodeFile.js.map +1 -0
- package/out/batch/getProjectCodeFile.d.ts +4 -0
- package/out/batch/getProjectCodeFile.js +87 -0
- package/out/batch/getProjectCodeFile.js.map +1 -0
- package/out/batch/getSolutionCodeFile.d.ts +8 -0
- package/out/batch/getSolutionCodeFile.js +70 -0
- package/out/batch/getSolutionCodeFile.js.map +1 -0
- package/out/benchmark/formatToMarkdown.d.ts +2 -0
- package/out/benchmark/formatToMarkdown.js +101 -0
- package/out/benchmark/formatToMarkdown.js.map +1 -0
- package/out/benchmark/generateBenchmarkReport.d.ts +1 -0
- package/out/benchmark/generateBenchmarkReport.js +82 -0
- package/out/benchmark/generateBenchmarkReport.js.map +1 -0
- package/out/codeCoverage/codeCoverage.d.ts +6 -0
- package/out/codeCoverage/codeCoverage.js +35 -0
- package/out/codeCoverage/codeCoverage.js.map +1 -0
- package/out/codeCoverage/codeCoverageReport.d.ts +6 -0
- package/out/codeCoverage/codeCoverageReport.js +72 -0
- package/out/codeCoverage/codeCoverageReport.js.map +1 -0
- package/out/codeCoverage/extractCodeCoverageInfo.d.ts +2 -0
- package/out/codeCoverage/extractCodeCoverageInfo.js +80 -0
- package/out/codeCoverage/extractCodeCoverageInfo.js.map +1 -0
- package/out/codeCoverage/generateCodeCoverageReport.d.ts +1 -0
- package/out/codeCoverage/generateCodeCoverageReport.js +27 -0
- package/out/codeCoverage/generateCodeCoverageReport.js.map +1 -0
- package/out/codeCoverage/getCodeCoverageSetting.d.ts +1 -0
- package/out/codeCoverage/getCodeCoverageSetting.js +58 -0
- package/out/codeCoverage/getCodeCoverageSetting.js.map +1 -0
- package/out/codeCoverage/reportTool.d.ts +2 -0
- package/out/codeCoverage/reportTool.js +22 -0
- package/out/codeCoverage/reportTool.js.map +1 -0
- package/out/codeCoverage/simplifyCoverageXml.d.ts +2 -0
- package/out/codeCoverage/simplifyCoverageXml.js +116 -0
- package/out/codeCoverage/simplifyCoverageXml.js.map +1 -0
- package/out/codebk/250804prompt/buildAfGuidelines.liquid +15 -0
- package/out/codebk/250804prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
- package/out/codebk/250804prompt/general/generalUtGuidelines.liquid +18 -0
- package/out/codebk/250804prompt/generateUtAutoFix.liquid +19 -0
- package/out/codebk/250804prompt/generateUtGuidelines.liquid +13 -0
- package/out/codebk/250804prompt/generateUtSystem.liquid +5 -0
- package/out/codebk/250804prompt/generateUtUserInput.liquid +27 -0
- package/out/codebk/250804prompt/testAfGuidelines.liquid +6 -0
- package/out/codebk/250804prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
- package/out/codebk/250804prompt/xap/xapCodeCodeDependency.liquid +0 -0
- package/out/codebk/250804prompt/xap/xapCodeSample.liquid +38 -0
- package/out/codebk/250804prompt/xap/xapUtGuideline-240804.liquid +36 -0
- package/out/codebk/250804prompt/xap/xapUtGuideline.liquid +36 -0
- package/out/codebk/childProcessManager.d.ts +1 -0
- package/out/codebk/childProcessManager.js +50 -0
- package/out/codebk/childProcessManager.js.map +1 -0
- package/out/codebk/msBuidSpawn.d.ts +1 -0
- package/out/codebk/msBuidSpawn.js +58 -0
- package/out/codebk/msBuidSpawn.js.map +1 -0
- package/out/codebk/msBuild.d.ts +1 -0
- package/out/codebk/msBuild.js +123 -0
- package/out/codebk/msBuild.js.map +1 -0
- package/out/codebk/old/generateXapTestAutoFix.liquid +12 -0
- package/out/codebk/old/generateXapTestGuidelines-fm.liquid +68 -0
- package/out/codebk/old/generateXapTestGuidelines.liquid +28 -0
- package/out/codebk/old/xapGuideline-fm.liquid +149 -0
- package/out/codebk/old/xapGuideline.liquid +37 -0
- package/out/codebk/oldExec/checkCodeSyntax.d.ts +1 -0
- package/out/codebk/oldExec/checkCodeSyntax.js +81 -0
- package/out/codebk/oldExec/checkCodeSyntax.js.map +1 -0
- package/out/codebk/oldExec/codeCoverage.d.ts +1 -0
- package/out/codebk/oldExec/codeCoverage.js +54 -0
- package/out/codebk/oldExec/codeCoverage.js.map +1 -0
- package/out/codebk/oldExec/codeCoverageReport.d.ts +1 -0
- package/out/codebk/oldExec/codeCoverageReport.js +64 -0
- package/out/codebk/oldExec/codeCoverageReport.js.map +1 -0
- package/out/codebk/oldExec/containsMethods.d.ts +1 -0
- package/out/codebk/oldExec/containsMethods.js +74 -0
- package/out/codebk/oldExec/containsMethods.js.map +1 -0
- package/out/codebk/oldExec/generateCodeDependency.d.ts +1 -0
- package/out/codebk/oldExec/generateCodeDependency.js +95 -0
- package/out/codebk/oldExec/generateCodeDependency.js.map +1 -0
- package/out/codebk/oldExec/msBuild.d.ts +1 -0
- package/out/codebk/oldExec/msBuild.js +53 -0
- package/out/codebk/oldExec/msBuild.js.map +1 -0
- package/out/codebk/oldExec/vsTest.d.ts +1 -0
- package/out/codebk/oldExec/vsTest.js +71 -0
- package/out/codebk/oldExec/vsTest.js.map +1 -0
- package/out/codebk/prompts/general/generalUnitTestGuidelines-20250702.liquid +56 -0
- package/out/codebk/prompts/generateXapTestGuidelines-20250704.liquid +21 -0
- package/out/codebk/prompts/generateXapTestGuidelines-o.liquid +29 -0
- package/out/codebk/prompts/xap/xapGuideline-o.liquid +45 -0
- package/out/codebk/testbuildkill.d.ts +1 -0
- package/out/codebk/testbuildkill.js +37 -0
- package/out/codebk/testbuildkill.js.map +1 -0
- package/out/command/index.d.ts +2 -0
- package/out/command/index.js +85 -0
- package/out/command/index.js.map +1 -0
- package/out/command/utGenWrapper.d.ts +3 -0
- package/out/command/utGenWrapper.js +40 -0
- package/out/command/utGenWrapper.js.map +1 -0
- package/out/exit/childProcessManager.d.ts +2 -0
- package/out/exit/childProcessManager.js +43 -0
- package/out/exit/childProcessManager.js.map +1 -0
- package/out/exit/setupProcessSignalHandler.d.ts +1 -0
- package/out/exit/setupProcessSignalHandler.js +18 -0
- package/out/exit/setupProcessSignalHandler.js.map +1 -0
- package/out/gen/autoFix.d.ts +4 -0
- package/out/gen/autoFix.js +125 -0
- package/out/gen/autoFix.js.map +1 -0
- package/out/gen/csharpUtGen.d.ts +2 -0
- package/out/gen/csharpUtGen.js +151 -0
- package/out/gen/csharpUtGen.js.map +1 -0
- package/out/gen/ensureValidLLMResponse.d.ts +1 -0
- package/out/gen/ensureValidLLMResponse.js +19 -0
- package/out/gen/ensureValidLLMResponse.js.map +1 -0
- package/out/gen/postGen/extractCodeFromResponse.d.ts +1 -0
- package/out/gen/postGen/extractCodeFromResponse.js +37 -0
- package/out/gen/postGen/extractCodeFromResponse.js.map +1 -0
- package/out/gen/postGen/postGenProcess.d.ts +1 -0
- package/out/gen/postGen/postGenProcess.js +36 -0
- package/out/gen/postGen/postGenProcess.js.map +1 -0
- package/out/gen/postGen/removeComments.d.ts +1 -0
- package/out/gen/postGen/removeComments.js +92 -0
- package/out/gen/postGen/removeComments.js.map +1 -0
- package/out/gen/postGen/removeSingleLines.d.ts +1 -0
- package/out/gen/postGen/removeSingleLines.js +28 -0
- package/out/gen/postGen/removeSingleLines.js.map +1 -0
- package/out/gen/postGen/repairRequiredNameSpaces.d.ts +1 -0
- package/out/gen/postGen/repairRequiredNameSpaces.js +116 -0
- package/out/gen/postGen/repairRequiredNameSpaces.js.map +1 -0
- package/out/gen/postGen/validateTestCode.d.ts +1 -0
- package/out/gen/postGen/validateTestCode.js +14 -0
- package/out/gen/postGen/validateTestCode.js.map +1 -0
- package/out/gen/preGen/excludeFileName.d.ts +1 -0
- package/out/gen/preGen/excludeFileName.js +49 -0
- package/out/gen/preGen/excludeFileName.js.map +1 -0
- package/out/gen/preGen/excludeSpecificTag.d.ts +1 -0
- package/out/gen/preGen/excludeSpecificTag.js +18 -0
- package/out/gen/preGen/excludeSpecificTag.js.map +1 -0
- package/out/gen/preGen/preGenProcess.d.ts +1 -0
- package/out/gen/preGen/preGenProcess.js +22 -0
- package/out/gen/preGen/preGenProcess.js.map +1 -0
- package/out/gen/preGen/validateCode.d.ts +3 -0
- package/out/gen/preGen/validateCode.js +62 -0
- package/out/gen/preGen/validateCode.js.map +1 -0
- package/out/index.d.ts +2 -0
- package/out/index.js +8 -0
- package/out/index.js.map +1 -0
- package/out/llm/model/Gpt4o.d.ts +1 -0
- package/out/llm/model/Gpt4o.js +91 -0
- package/out/llm/model/Gpt4o.js.map +1 -0
- package/out/llm/model/claude4.d.ts +1 -0
- package/out/llm/model/claude4.js +3 -0
- package/out/llm/model/claude4.js.map +1 -0
- package/out/llm/preparePrompt.d.ts +2 -0
- package/out/llm/preparePrompt.js +110 -0
- package/out/llm/preparePrompt.js.map +1 -0
- package/out/llm/prompt/buildAfGuidelines.liquid +15 -0
- package/out/llm/prompt/general/generalBuildAutofixGuidelines.liquid +13 -0
- package/out/llm/prompt/general/generalUtGuidelines.liquid +16 -0
- package/out/llm/prompt/generateUtAutoFix.liquid +19 -0
- package/out/llm/prompt/generateUtDependency.liquid +3 -0
- package/out/llm/prompt/generateUtGuidelines.liquid +29 -0
- package/out/llm/prompt/generateUtSystem.liquid +5 -0
- package/out/llm/prompt/generateUtTemplate.liquid +30 -0
- package/out/llm/prompt/generateUtUserInput.liquid +4 -0
- package/out/llm/prompt/testAfGuidelines.liquid +6 -0
- package/out/llm/prompt/userCustomPrompt.liquid +0 -0
- package/out/llm/prompt/xap/xapBuildAutofixGuidelines.liquid +13 -0
- package/out/llm/prompt/xap/xapCodeCodeDependency.liquid +0 -0
- package/out/llm/prompt/xap/xapCodeSample.liquid +38 -0
- package/out/llm/prompt/xap/xapUtGuideline-240804.liquid +36 -0
- package/out/llm/prompt/xap/xapUtGuideline.liquid +37 -0
- package/out/llm/sendRequestToLLM.d.ts +4 -0
- package/out/llm/sendRequestToLLM.js +12 -0
- package/out/llm/sendRequestToLLM.js.map +1 -0
- package/out/llm/sendRequestToSelfHostLLM.d.ts +4 -0
- package/out/llm/sendRequestToSelfHostLLM.js +41 -0
- package/out/llm/sendRequestToSelfHostLLM.js.map +1 -0
- package/out/metrics/appInsightTelemetry.d.ts +6 -0
- package/out/metrics/appInsightTelemetry.js +77 -0
- package/out/metrics/appInsightTelemetry.js.map +1 -0
- package/out/metrics/machineId.d.ts +11 -0
- package/out/metrics/machineId.js +85 -0
- package/out/metrics/machineId.js.map +1 -0
- package/out/setup/setup.d.ts +1 -0
- package/out/setup/setup.js +10 -0
- package/out/setup/setup.js.map +1 -0
- package/out/setup/setupConsole.d.ts +1 -0
- package/out/setup/setupConsole.js +23 -0
- package/out/setup/setupConsole.js.map +1 -0
- package/out/setup/setupLLMRequest.d.ts +2 -0
- package/out/setup/setupLLMRequest.js +10 -0
- package/out/setup/setupLLMRequest.js.map +1 -0
- package/out/tools/devenvcom.cmd +13 -0
- package/out/tools/devenvexe.cmd +13 -0
- package/out/tools/msbuildexe.cmd +13 -0
- package/out/tools/vstestexe.cmd +13 -0
- package/out/types/benchmark.d.ts +11 -0
- package/out/types/benchmark.js +3 -0
- package/out/types/benchmark.js.map +1 -0
- package/out/types/buildResult.d.ts +8 -0
- package/out/types/buildResult.js +3 -0
- package/out/types/buildResult.js.map +1 -0
- package/out/types/constants.d.ts +3 -0
- package/out/types/constants.js +7 -0
- package/out/types/constants.js.map +1 -0
- package/out/types/genResult.d.ts +10 -0
- package/out/types/genResult.js +3 -0
- package/out/types/genResult.js.map +1 -0
- package/out/types/testResult.d.ts +12 -0
- package/out/types/testResult.js +3 -0
- package/out/types/testResult.js.map +1 -0
- package/out/types/verifyResult.d.ts +8 -0
- package/out/types/verifyResult.js +3 -0
- package/out/types/verifyResult.js.map +1 -0
- package/out/utils/checkTestProject.d.ts +2 -0
- package/out/utils/checkTestProject.js +79 -0
- package/out/utils/checkTestProject.js.map +1 -0
- package/out/utils/checkXapCode.d.ts +2 -0
- package/out/utils/checkXapCode.js +59 -0
- package/out/utils/checkXapCode.js.map +1 -0
- package/out/utils/delay.d.ts +1 -0
- package/out/utils/delay.js +7 -0
- package/out/utils/delay.js.map +1 -0
- package/out/utils/detectTestFramework.d.ts +1 -0
- package/out/utils/detectTestFramework.js +32 -0
- package/out/utils/detectTestFramework.js.map +1 -0
- package/out/utils/fileUtils.d.ts +2 -0
- package/out/utils/fileUtils.js +42 -0
- package/out/utils/fileUtils.js.map +1 -0
- package/out/utils/generateCodeSha256.d.ts +1 -0
- package/out/utils/generateCodeSha256.js +46 -0
- package/out/utils/generateCodeSha256.js.map +1 -0
- package/out/utils/getCodeStructurePath.d.ts +5 -0
- package/out/utils/getCodeStructurePath.js +155 -0
- package/out/utils/getCodeStructurePath.js.map +1 -0
- package/out/utils/getOrCreateDir.d.ts +2 -0
- package/out/utils/getOrCreateDir.js +63 -0
- package/out/utils/getOrCreateDir.js.map +1 -0
- package/out/utils/getTestCodeInfo.d.ts +2 -0
- package/out/utils/getTestCodeInfo.js +121 -0
- package/out/utils/getTestCodeInfo.js.map +1 -0
- package/out/utils/getTestFile.d.ts +13 -0
- package/out/utils/getTestFile.js +295 -0
- package/out/utils/getTestFile.js.map +1 -0
- package/out/utils/parseBuildResult.d.ts +3 -0
- package/out/utils/parseBuildResult.js +44 -0
- package/out/utils/parseBuildResult.js.map +1 -0
- package/out/utils/parseSyntaxCheckResult.d.ts +2 -0
- package/out/utils/parseSyntaxCheckResult.js +38 -0
- package/out/utils/parseSyntaxCheckResult.js.map +1 -0
- package/out/utils/parseVstestResult.d.ts +3 -0
- package/out/utils/parseVstestResult.js +61 -0
- package/out/utils/parseVstestResult.js.map +1 -0
- package/out/utils/removeFailedTestMethods.d.ts +3 -0
- package/out/utils/removeFailedTestMethods.js +207 -0
- package/out/utils/removeFailedTestMethods.js.map +1 -0
- package/out/utils/runCommand.d.ts +1 -0
- package/out/utils/runCommand.js +14 -0
- package/out/utils/runCommand.js.map +1 -0
- package/out/utils/spawnExec.d.ts +1 -0
- package/out/utils/spawnExec.js +80 -0
- package/out/utils/spawnExec.js.map +1 -0
- package/out/utils/verifyBuildErrorCausedFile.d.ts +1 -0
- package/out/utils/verifyBuildErrorCausedFile.js +60 -0
- package/out/utils/verifyBuildErrorCausedFile.js.map +1 -0
- package/out/utils/verifyTestCode.d.ts +2 -0
- package/out/utils/verifyTestCode.js +25 -0
- package/out/utils/verifyTestCode.js.map +1 -0
- package/out/utils/writeGenCode.d.ts +1 -0
- package/out/utils/writeGenCode.js +50 -0
- package/out/utils/writeGenCode.js.map +1 -0
- package/out/vs/msBuild.d.ts +13 -0
- package/out/vs/msBuild.js +81 -0
- package/out/vs/msBuild.js.map +1 -0
- package/out/vs/vsTest.d.ts +15 -0
- package/out/vs/vsTest.js +107 -0
- package/out/vs/vsTest.js.map +1 -0
- package/out/vs/vsTools.d.ts +7 -0
- package/out/vs/vsTools.js +177 -0
- package/out/vs/vsTools.js.map +1 -0
- package/out/vsPlugin/getVsPluginVerifyResult.d.ts +2 -0
- package/out/vsPlugin/getVsPluginVerifyResult.js +41 -0
- package/out/vsPlugin/getVsPluginVerifyResult.js.map +1 -0
- package/out/vsPlugin/interactionConstants.d.ts +2 -0
- package/out/vsPlugin/interactionConstants.js +10 -0
- package/out/vsPlugin/interactionConstants.js.map +1 -0
- package/out/vsPlugin/sendStdToVsPlugin.d.ts +1 -0
- package/out/vsPlugin/sendStdToVsPlugin.js +12 -0
- package/out/vsPlugin/sendStdToVsPlugin.js.map +1 -0
- package/out/vsPlugin/stdListener.d.ts +3 -0
- package/out/vsPlugin/stdListener.js +57 -0
- package/out/vsPlugin/stdListener.js.map +1 -0
- package/package.json +33 -0
- package/tools/devenvcom.cmd +13 -0
- package/tools/devenvexe.cmd +13 -0
- package/tools/msbuildexe.cmd +13 -0
- package/tools/vstestexe.cmd +13 -0
|
@@ -0,0 +1,116 @@
|
|
|
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.removeZeroLineRateClassFromCoverageXml = removeZeroLineRateClassFromCoverageXml;
|
|
37
|
+
exports.simplifyCoverageXmlByFiles = simplifyCoverageXmlByFiles;
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const fast_xml_parser_1 = require("fast-xml-parser");
|
|
40
|
+
const fs_1 = require("fs");
|
|
41
|
+
function removeZeroLineRateClassFromCoverageXml(coverageXmlPath) {
|
|
42
|
+
const outputPath = coverageXmlPath.replace(/\.xml$/, '_refine.xml');
|
|
43
|
+
const xmlData = (0, fs_1.readFileSync)(coverageXmlPath, 'utf-8');
|
|
44
|
+
const parser = new fast_xml_parser_1.XMLParser({
|
|
45
|
+
ignoreAttributes: false,
|
|
46
|
+
attributeNamePrefix: '@_',
|
|
47
|
+
allowBooleanAttributes: true,
|
|
48
|
+
ignoreDeclaration: false
|
|
49
|
+
});
|
|
50
|
+
const json = parser.parse(xmlData);
|
|
51
|
+
const packages = json.coverage.packages.package;
|
|
52
|
+
const packagesArr = Array.isArray(packages) ? packages : [packages];
|
|
53
|
+
const refinedPackages = packagesArr
|
|
54
|
+
.map((pkg) => {
|
|
55
|
+
const filteredClasses = filterClasses(pkg.classes);
|
|
56
|
+
if (!filteredClasses)
|
|
57
|
+
return null;
|
|
58
|
+
return {
|
|
59
|
+
...pkg,
|
|
60
|
+
classes: filteredClasses
|
|
61
|
+
};
|
|
62
|
+
})
|
|
63
|
+
.filter(pkg => pkg !== null);
|
|
64
|
+
json.coverage.packages.package = refinedPackages;
|
|
65
|
+
const builder = new fast_xml_parser_1.XMLBuilder({
|
|
66
|
+
ignoreAttributes: false,
|
|
67
|
+
attributeNamePrefix: '@_',
|
|
68
|
+
format: true,
|
|
69
|
+
suppressEmptyNode: true
|
|
70
|
+
});
|
|
71
|
+
const outputXml = builder.build(json);
|
|
72
|
+
(0, fs_1.writeFileSync)(outputPath, outputXml, 'utf-8');
|
|
73
|
+
console.log(`generated Completed Path: ${outputPath}`);
|
|
74
|
+
}
|
|
75
|
+
function filterClasses(classesObj) {
|
|
76
|
+
const classes = Array.isArray(classesObj.class)
|
|
77
|
+
? classesObj.class
|
|
78
|
+
: [classesObj.class];
|
|
79
|
+
const filtered = classes.filter((cls) => parseFloat(cls['@_line-rate']) > 0);
|
|
80
|
+
return filtered.length > 0 ? { class: filtered } : null;
|
|
81
|
+
}
|
|
82
|
+
function simplifyCoverageXmlByFiles(coverageXmlPath, filePaths) {
|
|
83
|
+
if (!coverageXmlPath || !filePaths || filePaths.length === 0) {
|
|
84
|
+
console.error(`invalid parameters: coverageXmlPath and filePaths must be provided, coverageXmlPath: ${coverageXmlPath}, filePaths: ${filePaths}`);
|
|
85
|
+
return coverageXmlPath;
|
|
86
|
+
}
|
|
87
|
+
const parser = new fast_xml_parser_1.XMLParser({ ignoreAttributes: false });
|
|
88
|
+
const builder = new fast_xml_parser_1.XMLBuilder({ ignoreAttributes: false, format: true });
|
|
89
|
+
const xmlRaw = (0, fs_1.readFileSync)(coverageXmlPath, 'utf-8');
|
|
90
|
+
const xmlObj = parser.parse(xmlRaw);
|
|
91
|
+
// Cobertura root: <coverage><packages><package><classes><class>...
|
|
92
|
+
const packages = xmlObj.coverage?.packages?.package ?? [];
|
|
93
|
+
for (const pkg of Array.isArray(packages) ? packages : [packages]) {
|
|
94
|
+
const classes = pkg.classes?.class;
|
|
95
|
+
if (!classes)
|
|
96
|
+
continue;
|
|
97
|
+
const filtered = (Array.isArray(classes) ? classes : [classes]).filter(cls => {
|
|
98
|
+
const filename = path.normalize(cls['@_filename'] || '');
|
|
99
|
+
return filePaths.includes(filename);
|
|
100
|
+
});
|
|
101
|
+
pkg.classes.class = filtered;
|
|
102
|
+
}
|
|
103
|
+
const refinedXml = builder.build(xmlObj);
|
|
104
|
+
const outPath = coverageXmlPath.replace(/\.xml$/, '_simplified.xml');
|
|
105
|
+
(0, fs_1.writeFileSync)(outPath, refinedXml, 'utf-8');
|
|
106
|
+
console.log(`Refined coverage written to: ${outPath}`);
|
|
107
|
+
return outPath;
|
|
108
|
+
}
|
|
109
|
+
// removeZeroLineRateClassFromCoverageXml("D:\\atmp\\TestResults\\744711fc-6729-4298-bc08-31ba5ca088f1\\jixiongge_CPC-jixio-Z5J9N_2025-07-14.18_26_28.cobertura.xml");
|
|
110
|
+
// const filePaths = [
|
|
111
|
+
// "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\Conditions\\EplantRequestCategoryCondition.cs",
|
|
112
|
+
// "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\Conditions\\EplantRequestTypeCondition.cs",
|
|
113
|
+
// "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\Conditions\\EplantUserUpdateCondition.cs"
|
|
114
|
+
// ];
|
|
115
|
+
// simplifyCoverageXmlByFiles("D:\\atmp\\TestResults\\744711fc-6729-4298-bc08-31ba5ca088f1\\jixiongge_CPC-jixio-Z5J9N_2025-07-14.18_26_28.cobertura.xml", filePaths);
|
|
116
|
+
//# sourceMappingURL=simplifyCoverageXml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simplifyCoverageXml.js","sourceRoot":"","sources":["../../src/codeCoverage/simplifyCoverageXml.ts"],"names":[],"mappings":"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","sourcesContent":["import * as path from 'path';\r\n\r\nimport { XMLBuilder, XMLParser } from 'fast-xml-parser';\r\nimport { readFileSync, writeFileSync } from 'fs';\r\n\r\nexport function removeZeroLineRateClassFromCoverageXml(coverageXmlPath: string) {\r\n const outputPath = coverageXmlPath.replace(/\\.xml$/, '_refine.xml');\r\n const xmlData = readFileSync(coverageXmlPath, 'utf-8');\r\n const parser = new XMLParser({\r\n ignoreAttributes: false,\r\n attributeNamePrefix: '@_',\r\n allowBooleanAttributes: true,\r\n ignoreDeclaration: false\r\n });\r\n const json = parser.parse(xmlData);\r\n\r\n const packages = json.coverage.packages.package;\r\n const packagesArr = Array.isArray(packages) ? packages : [packages];\r\n\r\n const refinedPackages = packagesArr\r\n .map((pkg: any) => {\r\n const filteredClasses = filterClasses(pkg.classes);\r\n if (!filteredClasses) return null;\r\n\r\n return {\r\n ...pkg,\r\n classes: filteredClasses\r\n };\r\n })\r\n .filter(pkg => pkg !== null);\r\n\r\n json.coverage.packages.package = refinedPackages;\r\n\r\n const builder = new XMLBuilder({\r\n ignoreAttributes: false,\r\n attributeNamePrefix: '@_',\r\n format: true,\r\n suppressEmptyNode: true\r\n });\r\n\r\n const outputXml = builder.build(json);\r\n writeFileSync(outputPath, outputXml, 'utf-8');\r\n\r\n console.log(`generated Completed Path: ${outputPath}`);\r\n}\r\n\r\nfunction filterClasses(classesObj: any) {\r\n const classes = Array.isArray(classesObj.class)\r\n ? classesObj.class\r\n : [classesObj.class];\r\n\r\n const filtered = classes.filter((cls: any) => parseFloat(cls['@_line-rate']) > 0);\r\n return filtered.length > 0 ? { class: filtered } : null;\r\n}\r\n\r\nexport function simplifyCoverageXmlByFiles(coverageXmlPath: string, filePaths: string[]) {\r\n if (!coverageXmlPath || !filePaths || filePaths.length === 0) {\r\n console.error(`invalid parameters: coverageXmlPath and filePaths must be provided, coverageXmlPath: ${coverageXmlPath}, filePaths: ${filePaths}`);\r\n return coverageXmlPath;\r\n }\r\n\r\n const parser = new XMLParser({ ignoreAttributes: false });\r\n const builder = new XMLBuilder({ ignoreAttributes: false, format: true });\r\n\r\n const xmlRaw = readFileSync(coverageXmlPath, 'utf-8');\r\n const xmlObj = parser.parse(xmlRaw);\r\n\r\n // Cobertura root: <coverage><packages><package><classes><class>...\r\n const packages = xmlObj.coverage?.packages?.package ?? [];\r\n\r\n for (const pkg of Array.isArray(packages) ? packages : [packages]) {\r\n const classes = pkg.classes?.class;\r\n if (!classes) continue;\r\n\r\n const filtered = (Array.isArray(classes) ? classes : [classes]).filter(cls => {\r\n const filename = path.normalize(cls['@_filename'] || '');\r\n return filePaths.includes(filename);\r\n });\r\n\r\n pkg.classes.class = filtered;\r\n }\r\n\r\n const refinedXml = builder.build(xmlObj);\r\n const outPath = coverageXmlPath.replace(/\\.xml$/, '_simplified.xml');\r\n writeFileSync(outPath, refinedXml, 'utf-8');\r\n\r\n console.log(`Refined coverage written to: ${outPath}`);\r\n return outPath;\r\n}\r\n\r\n\r\n// removeZeroLineRateClassFromCoverageXml(\"D:\\\\atmp\\\\TestResults\\\\744711fc-6729-4298-bc08-31ba5ca088f1\\\\jixiongge_CPC-jixio-Z5J9N_2025-07-14.18_26_28.cobertura.xml\");\r\n\r\n// const filePaths = [\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\\\\Conditions\\\\EplantRequestTypeCondition.cs\",\r\n// \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\Conditions\\\\EplantUserUpdateCondition.cs\"\r\n// ];\r\n\r\n// simplifyCoverageXmlByFiles(\"D:\\\\atmp\\\\TestResults\\\\744711fc-6729-4298-bc08-31ba5ca088f1\\\\jixiongge_CPC-jixio-Z5J9N_2025-07-14.18_26_28.cobertura.xml\", filePaths);"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Build Failure Fix Guideline:
|
|
2
|
+
- Case 1: The type or namespace name '{Class/Type}' does not exist in the namespace '{namespace}' (are you missing an assembly reference?)
|
|
3
|
+
Solution: Check the source code, code dependencies. Add the required `using` statements or assembly references.
|
|
4
|
+
- Case 2: No overload for method 'Execute' takes {number} arguments
|
|
5
|
+
Solution: Refer to section [The method parameters of Execute in Xap instance are different from the source code.] of Xap Unit Test Guidelines, Adjust the method parameters to match the correct overload as per the source code.
|
|
6
|
+
- Case 3: [CS0144] Cannot create an instance of the abstract type or interface '{class / bondstucture}'
|
|
7
|
+
Solution: use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance or use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instance.
|
|
8
|
+
- Case 4: [CS1503] cannot convert from '{Class / Bond type}' to '{Class / Bond type}'
|
|
9
|
+
Solution: Do explicitly type convert.
|
|
10
|
+
- Case 5: [CS0037] Cannot convert null to '{Class / Bond type}' because it is a non-nullable value type
|
|
11
|
+
Solution: MUST assign non-null and valid value.
|
|
12
|
+
- Case 6: [CS0246] The type or namespace name '{class / interface}' could not be found (are you missing a using directive or an assembly reference?)
|
|
13
|
+
Solution: MUST import the **namespace** of {class / interface}
|
|
14
|
+
- Case 7: [CS1501] No overload for method 'Execute' takes 2 arguments
|
|
15
|
+
Solution: - The parameters of **Execute** method with types: **PluginServices**, **PluginOutput<T>**, or decorated with **[ConfigFile("{configFileName}")]** MUST be deleted when using Xap class instance to call it.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Build Failure Fix Guideline:
|
|
2
|
+
- Case 1: The type or namespace name '{Class/Type}' does not exist in the namespace '{namespace}' (are you missing an assembly reference?)
|
|
3
|
+
Solution: Check the source code, code dependencies. Add the required `using` statements or assembly references.
|
|
4
|
+
- Case 2: No overload for method 'Execute' takes {number} arguments
|
|
5
|
+
Solution: Refer to section [The method parameters of Execute in Xap instance are different from the source code.] of Xap Unit Test Guidelines, Adjust the method parameters to match the correct overload as per the source code.
|
|
6
|
+
- Case 3: Cannot create an instance of the abstract type or interface '{class / bondstucture}'
|
|
7
|
+
Solution: use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance or use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instance.
|
|
8
|
+
- Case 4: cannot convert from '{Class / Bond type}' to '{Class / Bond type}'
|
|
9
|
+
Solution: Do explicitly type convert.
|
|
10
|
+
- Case 5: [CS0037] Cannot convert null to '{Class / Bond type}' because it is a non-nullable value type
|
|
11
|
+
Solution: MUST assign non-null and valid value.
|
|
12
|
+
- Case 6: [CS0246] The type or namespace name '{class / interface}' could not be found (are you missing a using directive or an assembly reference?)
|
|
13
|
+
Solution: MUST import the **namespace** of {class / interface}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# General Unit Test Guidelines (For All C# Code)
|
|
2
|
+
- MUST use {{testFramework}} test framework to generate test code.
|
|
3
|
+
- **MUST NOT** contain any comments or explanations in test code.
|
|
4
|
+
- Ensure the test code MUST has no syntax errors.
|
|
5
|
+
- Test public methods of class in source code only.
|
|
6
|
+
- **MUST NOT** access private members (fields or methods) of the source class in test code.
|
|
7
|
+
- Test method names must follow the pattern: [MethodName]_[Scenario]_[ExpectedResult].
|
|
8
|
+
- Return the test code in the format: ```C#\n{Test code}\n```.
|
|
9
|
+
- Mock all dependent methods, classes, and values not included in the user input using the Moq library.
|
|
10
|
+
- MUST include Test code in a namespace declaration and place all `using` statements above the namespace declaration.
|
|
11
|
+
- MUST import source code in the test code.
|
|
12
|
+
- MUST import all required .Net namespaces if any .Net class or interface are used in the test code. Like:
|
|
13
|
+
- .NET built-in types (e.g., `List<T>`, `IEnumerable<T>`, `Task`, `Assert`, `Moq.Mock`, etc.).
|
|
14
|
+
- Any attribute classes (e.g., `[TestMethod]`, `[TestClass]`, etc.).
|
|
15
|
+
- Any LINQ or threading related classes (e.g., `System.Linq`, `System.Threading.Tasks`).
|
|
16
|
+
- **MUST NOT** assign null to var type value, like: var request = null, it's forbidden.
|
|
17
|
+
- All assignments and method arguments in test code MUST strictly match the declared types.
|
|
18
|
+
- **MUST NOT** pass a single object to a collection type, like **MUST NOT** pass **SampleObject** type to **IEnumerable<SampleObject>** type.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{%- if isBuildFailure -%}
|
|
2
|
+
{%- assign failedStage = "MSBuild" -%}
|
|
3
|
+
{%- assign failedTitle = "MSBuild failure errors:" -%}
|
|
4
|
+
{%- else -%}
|
|
5
|
+
{%- assign failedStage = "vstest" -%}
|
|
6
|
+
{%- assign failedTitle = "vstest failure test errors:" -%}
|
|
7
|
+
{%- endif -%}
|
|
8
|
+
|
|
9
|
+
Your previously generated C# unit test code failed to {{failedStage}}. This means your answer was incorrect.
|
|
10
|
+
|
|
11
|
+
Your generated test code:
|
|
12
|
+
%s
|
|
13
|
+
|
|
14
|
+
{{failedTitle}}:
|
|
15
|
+
%s
|
|
16
|
+
|
|
17
|
+
{% if isBuildFailure %}
|
|
18
|
+
{%- include 'buildAfGuidelines' -%}
|
|
19
|
+
{%- endif -%}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{%- if isXapTest -%}
|
|
2
|
+
{%- assign xapSuffix = " that is using the XAP framework" -%}
|
|
3
|
+
{%- else -%}
|
|
4
|
+
{%- assign xapSuffix = "" -%}
|
|
5
|
+
{%- endif -%}
|
|
6
|
+
|
|
7
|
+
You are a **highly skilled software engineer specializing in C# unit testing** and tasked with writing **unit tests** for the user-provided C# source code{{xapSuffix}}. Strictly obey the following guidelines.
|
|
8
|
+
|
|
9
|
+
{% if isXapTest %}
|
|
10
|
+
{% include 'xap/xapUtGuideline' %}
|
|
11
|
+
{%- endif -%}
|
|
12
|
+
|
|
13
|
+
{% include 'general/generalUtGuidelines' %}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Keep your answers short and impersonal.
|
|
2
|
+
Use Markdown formatting in your answers.
|
|
3
|
+
Make sure to include the programming language name at the start of the Markdown code blocks.
|
|
4
|
+
Avoid wrapping the whole response in triple backticks.
|
|
5
|
+
You can only give one reply for each conversation turn.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Before generating the unit test:
|
|
2
|
+
- **MUST** analyze the provided code and verify its logic by following these steps:
|
|
3
|
+
1. Describe the functionality of each public method, including its inputs, outputs, and key logic.
|
|
4
|
+
2. Identify all possible execution paths for public methods, including normal cases, edge cases, and error conditions.
|
|
5
|
+
3. Explain any conditional branches, loops, or exception handling for public methods in the code.
|
|
6
|
+
4. Based on this analysis, generate unit test cases that cover all identified execution paths, ensuring that mock data and assertions align with the code's logic.
|
|
7
|
+
- **MUST** remove all code analysis information in responsed test code.
|
|
8
|
+
- Absolutely forbidden to contains any other information in response except the test code.
|
|
9
|
+
- **MUST NOT** generate tests for the methods that are attributed with **[ExcludeFromCodeCoverage]**.
|
|
10
|
+
- **MUST NOT** generate tests for **private** methods.
|
|
11
|
+
|
|
12
|
+
Please generate C# unit tests using the following information:
|
|
13
|
+
|
|
14
|
+
# Target Namespace for the Unit Test Code
|
|
15
|
+
{{ namespace }}
|
|
16
|
+
|
|
17
|
+
# Source Code to generate tests
|
|
18
|
+
The following code defines the class and method(s) that need to be unit tested:
|
|
19
|
+
```C#
|
|
20
|
+
{{ sourceCode }}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
{% if dependency != "" %}
|
|
24
|
+
# Dependency Definitions
|
|
25
|
+
Any dependencies (e.g., types, classes, or interfaces) referenced in the source code above are defined here. Use these definitions to resolve any types or dependencies required for the unit tests.
|
|
26
|
+
{{ dependency }}
|
|
27
|
+
{% endif %}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Build Failure Fix Guideline:
|
|
2
|
+
- Case1: The type or namespace name '{Class/Type}' does not exist in the namespace '{namespace}' (are you missing an assembly reference?)
|
|
3
|
+
Solution: Check the source code, code dependencies. Add the required `using` statements or assembly references.
|
|
4
|
+
- Case2: No overload for method 'Execute' takes {number} arguments
|
|
5
|
+
Solution: Refer to section [The method parameters of Execute in Xap instance are different from the source code.] Adjust the method parameters to match the correct overload as per the source code.
|
|
6
|
+
- Case3
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Build Failure Fix Guideline:
|
|
2
|
+
- Case 1: The type or namespace name '{Class/Type}' does not exist in the namespace '{namespace}' (are you missing an assembly reference?)
|
|
3
|
+
Solution: Check the source code, code dependencies. Add the required `using` statements or assembly references.
|
|
4
|
+
- Case 2: No overload for method 'Execute' takes {number} arguments
|
|
5
|
+
Solution: Refer to section [The method parameters of Execute in Xap instance are different from the source code.] of Xap Unit Test Guidelines, Adjust the method parameters to match the correct overload as per the source code.
|
|
6
|
+
- Case 3: Cannot create an instance of the abstract type or interface '{class / bondstucture}'
|
|
7
|
+
Solution: use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance or use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instance.
|
|
8
|
+
- Case 4: cannot convert from '{Class / Bond type}' to '{Class / Bond type}'
|
|
9
|
+
Solution: Do explicitly type convert.
|
|
10
|
+
- Case 5: [CS0037] Cannot convert null to '{Class / Bond type}' because it is a non-nullable value type
|
|
11
|
+
Solution: MUST assign non-null and valid value.
|
|
12
|
+
- Case 6: [CS0246] The type or namespace name '{class / interface}' could not be found (are you missing a using directive or an assembly reference?)
|
|
13
|
+
Solution: MUST import the **namespace** of {class / interface}
|
|
File without changes
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Xap source code and test code examples
|
|
2
|
+
D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Plugins\Workflows\Eplant\HttpRequestParser\EplantHttpRequestParser.cs
|
|
3
|
+
Example #1 ()
|
|
4
|
+
```C#
|
|
5
|
+
public class SampleBuilder : IPlugin
|
|
6
|
+
{
|
|
7
|
+
public PluginResult Execute(
|
|
8
|
+
PluginServices pluginServices,
|
|
9
|
+
PluginOutput<EplantUserResp> eplantUserResp,
|
|
10
|
+
[ConfigFile("EplantConfig.ini")]
|
|
11
|
+
EplantConfig eplantConfig,
|
|
12
|
+
IEnumerable<ObjectStoreResponse_2<EplantUserKey, EMPTY, EMPTY, EplantUser>> osResponses = null,
|
|
13
|
+
EplantRequest req = null)
|
|
14
|
+
{
|
|
15
|
+
..... // omit detail implementation
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Test Code snippet:
|
|
21
|
+
```C#
|
|
22
|
+
[TestClass]
|
|
23
|
+
public class SampleBuilderTest
|
|
24
|
+
{
|
|
25
|
+
[TestMethod]
|
|
26
|
+
public void Execute_InvalidRequestOrIntent_Failure()
|
|
27
|
+
{
|
|
28
|
+
var builder = ExecutionServices.CreateInstance<ISampleBuilder>();
|
|
29
|
+
request.type = EplantReqType.Me;
|
|
30
|
+
IEnumerable<ObjectStoreResponse_2<EplantUserKey, EMPTY, EMPTY, EplantUser>> osResponses = null;
|
|
31
|
+
|
|
32
|
+
var result = builder.Execute(Task.FromResult(osResponses), Task.FromResult(request)).Result;
|
|
33
|
+
|
|
34
|
+
Assert.IsFalse(result.Success);
|
|
35
|
+
Assert.IsNull(builder.eplantUserResp.Result);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Xap Unit Test Guidelines (**ONLY apply when the source code is a Xap class. Ignore all these rules for non-Xap classes.**):
|
|
2
|
+
- Xap class is a class that inherits one of these interfaces: IPlugin, IConditionPlugin, Workflow, IExperiment, IPluginDataStore, IAsyncPlugin and implements an Execute() method.
|
|
3
|
+
- MUST use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance, where the interface name is the class name prefixed with "I".
|
|
4
|
+
Example: For Xap class SampleWorkflow, create instance MUST be like: **var sampleWorkflow = ExecutionServices.CreateInstance<ISampleWorkflow>();**
|
|
5
|
+
- The parameters of **Execute** method with types: **PluginServices**, **PluginOutput<T>**, or attributed with **[ConfigFile("{configFileName}")]** MUST be deleted when using Xap class instance to call the Execute method.
|
|
6
|
+
- Xap freamwork will take care these deleted parameters, NEVER try to mock or create these deleted types, it's invalid and forbidden.
|
|
7
|
+
- **MUST NOT** mock these deleted types' object, even if its methods or properties are used in the source code.
|
|
8
|
+
- For Remaining parameters,
|
|
9
|
+
- MUST pass in exact type as declared in source code.
|
|
10
|
+
- MUST keep original parameter order.
|
|
11
|
+
- MUST wrap each parameter with Task.FromResult(value).
|
|
12
|
+
Example:
|
|
13
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
14
|
+
Base on above declared deleted types, **MUST delete** these three parameters: PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig,
|
|
15
|
+
call the Execute using Xap class instance MUST be like: **var pluginResult = sampleWorkflow.Execute(Task.FromResult(osResp), Task.FromResult(req)).Result;**
|
|
16
|
+
- The Execute method parameters with type PluginOutput<T> MUST be treated as method output, **T** is the type output value.
|
|
17
|
+
- MUST using the parameter name to access the output by the Xap instance
|
|
18
|
+
- MUST using **Result** property to access the output of type **T** in **PluginOutput<T>**.
|
|
19
|
+
- MUST assert PluginOutput<T> parameters' values if there's parameter with **PluginOutput<T>** type.
|
|
20
|
+
Example:
|
|
21
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
22
|
+
Get the output value using Xap class instance MUST be like: **sampleWorkflow.resp**.
|
|
23
|
+
Assume there's one field named **Key** in **Resp** type, get **Key** MUST be like: **sampleWorkflow.pluginResp.Result.Key**.
|
|
24
|
+
Assert the PluginOutput<T> value in test code MUST be like: Assert.NotNull(sampleWorkflow.pluginResult.Result.Id); Assert.AreEqual(sampleWorkflow.pluginResult.Result.Id, "id");
|
|
25
|
+
- The Bond structures MUST be treated as regular C# class in test code:
|
|
26
|
+
- **MUST** import **Bond namespace** before using the Bond structure in test code
|
|
27
|
+
Example: The namespace in bond structure is like: **namespace SharedSegments.Weather.OneService**, to use this bond structure, **MUST** add: **using SharedSegments.Weather.OneService** in test code.
|
|
28
|
+
- MUST use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instances.
|
|
29
|
+
Example: For a Bond structure named **SampleBondStructure<T>**, create bond instance **MUST** be like: ** var subResponse = ExecutionServices.CreateInstance<SampleBondStructure<SampleObject>>();
|
|
30
|
+
- MUST not access the fields that are not defined in bond structure, it's invalid and forbidden.
|
|
31
|
+
- MUST treated the fields as **required** if they **are not** decorated with **optional** in bond structure
|
|
32
|
+
- **MUST** assign a valid, non-null value to **required field** that are **NOT decorated** with **optional** explicitly.
|
|
33
|
+
- MUST assign a valid value to the fields that are used in source code explicitly.
|
|
34
|
+
- MUST correctly handle the null checks for required fields in source code.
|
|
35
|
+
Example: the source code contains **if (sampleRequest?.Category == null)**, the **Category** is require field in sampleRequest bond structure and **MUST be non-null**, just test the case when sampleRequest is null.
|
|
36
|
+
- MUST use AsEnumerable() to convert IList to IEnumerable, e.g. IEnumerable osResponses = osResponseList.AsEnumerable()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Xap Unit Test Guidelines (**ONLY apply when the source code is a Xap class. Ignore all these rules for non-Xap classes.**):
|
|
2
|
+
- Xap class is a class that inherits one of these interfaces: IPlugin, IConditionPlugin, Workflow, IExperiment, IPluginDataStore, IAsyncPlugin and implements an Execute() method.
|
|
3
|
+
- MUST use ExecutionServices.CreateInstance<I{ClassName}>() to create Xap class instance, where the interface name is the class name prefixed with "I".
|
|
4
|
+
Example: For Xap class SampleWorkflow, create instance MUST be like: **var sampleWorkflow = ExecutionServices.CreateInstance<ISampleWorkflow>();**
|
|
5
|
+
- The parameters of **Execute** method with types: **PluginServices**, **PluginOutput<T>**, or attributed with **[ConfigFile("{configFileName}")]** MUST be deleted when using Xap class instance to call the Execute method.
|
|
6
|
+
- Xap freamwork will take care these deleted parameters, NEVER try to mock or create these deleted types, it's invalid and forbidden.
|
|
7
|
+
- **MUST NOT** mock these deleted types' object, even if its methods or properties are used in the source code.
|
|
8
|
+
- For Remaining parameters,
|
|
9
|
+
- MUST pass in exact type as declared in source code.
|
|
10
|
+
- MUST keep original parameter order.
|
|
11
|
+
- MUST wrap each parameter with Task.FromResult(value).
|
|
12
|
+
Example:
|
|
13
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
14
|
+
Base on above declared deleted types, **MUST delete** these three parameters: PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig,
|
|
15
|
+
call the Execute using Xap class instance MUST be like: **var pluginResult = sampleWorkflow.Execute(Task.FromResult(osResp), Task.FromResult(req)).Result;**
|
|
16
|
+
- The Execute method parameters with type PluginOutput<T> MUST be treated as method output, **T** is the type output value.
|
|
17
|
+
- MUST using the parameter name to access the output by the Xap instance
|
|
18
|
+
- MUST using **Result** property to access the output of type **T** in **PluginOutput<T>**.
|
|
19
|
+
- MUST assert PluginOutput<T> parameters' values if there's parameter with **PluginOutput<T>** type.
|
|
20
|
+
Example:
|
|
21
|
+
The Execute method of Xap calss SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**,
|
|
22
|
+
Get the output value using Xap class instance MUST be like: **sampleWorkflow.resp**.
|
|
23
|
+
Assume there's one field named **Key** in **Resp** type, get **Key** MUST be like: **sampleWorkflow.pluginResp.Result.Key**.
|
|
24
|
+
Assert the PluginOutput<T> value in test code MUST be like: Assert.NotNull(sampleWorkflow.pluginResult.Result.Id); Assert.AreEqual(sampleWorkflow.pluginResult.Result.Id, "id");
|
|
25
|
+
- The Bond structures MUST be treated as regular C# class in test code:
|
|
26
|
+
- **MUST** import **Bond namespace** before using the Bond structure in test code
|
|
27
|
+
Example: The namespace in bond structure is like: **namespace SharedSegments.Weather.OneService**, to use this bond structure, **MUST** add: **using SharedSegments.Weather.OneService** in test code.
|
|
28
|
+
- MUST use ExecutionServices.CreateInstance<{StructName}>() to create Bond struct instances.
|
|
29
|
+
Example: For a Bond structure named **SampleBondStructure<T>**, create bond instance **MUST** be like: ** var subResponse = ExecutionServices.CreateInstance<SampleBondStructure<SampleObject>>();
|
|
30
|
+
- MUST not access the fields that are not defined in bond structure, it's invalid and forbidden.
|
|
31
|
+
- MUST treated the fields as **required** if they **are not** decorated with **optional** in bond structure
|
|
32
|
+
- **MUST** assign a valid, non-null value to **required field** that are **NOT decorated** with **optional** explicitly.
|
|
33
|
+
- MUST assign a valid value to the fields that are used in source code explicitly.
|
|
34
|
+
- MUST correctly handle the null checks for required fields in source code.
|
|
35
|
+
Example: the source code contains **if (sampleRequest?.Category == null)**, the **Category** is require field in sampleRequest bond structure and **MUST be non-null**, just test the case when sampleRequest is null.
|
|
36
|
+
- MUST use AsEnumerable() to convert IList to IEnumerable, e.g. IEnumerable osResponses = osResponseList.AsEnumerable()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { exec } from "child_process";
|
|
3
|
+
// import treeKill from "tree-kill";
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
// export const childProcessSet = new Set<number>();
|
|
6
|
+
// function isProcessAlive(pid: number): boolean {
|
|
7
|
+
// try {
|
|
8
|
+
// process.kill(pid, 0);
|
|
9
|
+
// return true;
|
|
10
|
+
// } catch {
|
|
11
|
+
// return false;
|
|
12
|
+
// }
|
|
13
|
+
// }
|
|
14
|
+
// function killPidAsync(pid: number): Promise<void> {
|
|
15
|
+
// return new Promise(async (resolve) => {
|
|
16
|
+
// if (!isProcessAlive(pid)) {
|
|
17
|
+
// console.log(`PID ${pid} already exited`);
|
|
18
|
+
// return resolve();
|
|
19
|
+
// }
|
|
20
|
+
// console.log(`Killing child process with PID: ${pid}`);
|
|
21
|
+
// treeKill(pid, "SIGKILL", (err) => {
|
|
22
|
+
// if (err) {
|
|
23
|
+
// console.error(`Failed to kill pid=${pid}:`, err.message);
|
|
24
|
+
// } else {
|
|
25
|
+
// console.log(`Killed pid=${pid}`);
|
|
26
|
+
// }
|
|
27
|
+
// resolve();
|
|
28
|
+
// });
|
|
29
|
+
// });
|
|
30
|
+
// }
|
|
31
|
+
// export async function killAllChildProcesses(): Promise<void> {
|
|
32
|
+
// const pids = Array.from(childProcessSet);
|
|
33
|
+
// console.log('Killing all child processes: ' + pids.join(', '));
|
|
34
|
+
// await Promise.all(pids.map((pid) => killPidAsync(pid)));
|
|
35
|
+
// console.log('All child processes have been killed.');
|
|
36
|
+
// childProcessSet.clear();
|
|
37
|
+
// }
|
|
38
|
+
// async function killVBCSCompiler() {
|
|
39
|
+
// try {
|
|
40
|
+
// exec('taskkill /IM VBCSCompiler.exe /F');
|
|
41
|
+
// console.log('Successfully terminated all VBCSCompiler.exe processes');
|
|
42
|
+
// } catch (err) {
|
|
43
|
+
// if (err.message.includes('not found')) {
|
|
44
|
+
// console.log('No VBCSCompiler.exe processes found');
|
|
45
|
+
// } else {
|
|
46
|
+
// console.error(`Failed to terminate VBCSCompiler.exe: ${err.message}`);
|
|
47
|
+
// }
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
//# sourceMappingURL=childProcessManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"childProcessManager.js","sourceRoot":"","sources":["../../src/codebk/childProcessManager.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,oCAAoC;;AAEpC,oDAAoD;AAEpD,kDAAkD;AAClD,YAAY;AACZ,gCAAgC;AAChC,uBAAuB;AACvB,gBAAgB;AAChB,wBAAwB;AACxB,QAAQ;AACR,IAAI;AAEJ,sDAAsD;AACtD,8CAA8C;AAC9C,sCAAsC;AACtC,wDAAwD;AACxD,gCAAgC;AAChC,YAAY;AAEZ,iEAAiE;AACjE,8CAA8C;AAC9C,yBAAyB;AACzB,4EAA4E;AAC5E,uBAAuB;AACvB,oDAAoD;AACpD,gBAAgB;AAChB,yBAAyB;AACzB,cAAc;AACd,UAAU;AACV,IAAI;AAEJ,iEAAiE;AACjE,gDAAgD;AAChD,sEAAsE;AACtE,+DAA+D;AAC/D,4DAA4D;AAC5D,+BAA+B;AAC/B,IAAI;AAGJ,sCAAsC;AACtC,YAAY;AACZ,oDAAoD;AACpD,iFAAiF;AACjF,sBAAsB;AACtB,mDAAmD;AACnD,kEAAkE;AAClE,mBAAmB;AACnB,qFAAqF;AACrF,YAAY;AACZ,QAAQ;AACR,IAAI","sourcesContent":["// import { exec } from \"child_process\";\r\n// import treeKill from \"tree-kill\";\r\n\r\n// export const childProcessSet = new Set<number>();\r\n\r\n// function isProcessAlive(pid: number): boolean {\r\n// try {\r\n// process.kill(pid, 0);\r\n// return true;\r\n// } catch {\r\n// return false;\r\n// }\r\n// }\r\n\r\n// function killPidAsync(pid: number): Promise<void> {\r\n// return new Promise(async (resolve) => {\r\n// if (!isProcessAlive(pid)) {\r\n// console.log(`PID ${pid} already exited`);\r\n// return resolve();\r\n// }\r\n \r\n// console.log(`Killing child process with PID: ${pid}`);\r\n// treeKill(pid, \"SIGKILL\", (err) => {\r\n// if (err) {\r\n// console.error(`Failed to kill pid=${pid}:`, err.message);\r\n// } else {\r\n// console.log(`Killed pid=${pid}`);\r\n// }\r\n// resolve();\r\n// });\r\n// });\r\n// }\r\n\r\n// export async function killAllChildProcesses(): Promise<void> {\r\n// const pids = Array.from(childProcessSet);\r\n// console.log('Killing all child processes: ' + pids.join(', '));\r\n// await Promise.all(pids.map((pid) => killPidAsync(pid)));\r\n// console.log('All child processes have been killed.');\r\n// childProcessSet.clear();\r\n// }\r\n\r\n\r\n// async function killVBCSCompiler() {\r\n// try {\r\n// exec('taskkill /IM VBCSCompiler.exe /F');\r\n// console.log('Successfully terminated all VBCSCompiler.exe processes');\r\n// } catch (err) {\r\n// if (err.message.includes('not found')) {\r\n// console.log('No VBCSCompiler.exe processes found');\r\n// } else {\r\n// console.error(`Failed to terminate VBCSCompiler.exe: ${err.message}`);\r\n// }\r\n// }\r\n// }"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const child_process_1 = require("child_process");
|
|
4
|
+
function runMsBuild() {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const vsDevCmdPath = `"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\Tools\\VsDevCmd.bat"`;
|
|
7
|
+
// const solutionPath = path.resolve(__dirname, 'YourProject.sln'); // 或 .csproj 文件
|
|
8
|
+
const projectPath = "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj";
|
|
9
|
+
const msbuildCommand = `MSBuild "${projectPath}" /p:Configuration=debug`;
|
|
10
|
+
// 使用 cmd /c call 确保环境变量被正确加载
|
|
11
|
+
const child = (0, child_process_1.spawn)('cmd.exe', [
|
|
12
|
+
'/c',
|
|
13
|
+
`call ${vsDevCmdPath} && ${msbuildCommand}`
|
|
14
|
+
], {
|
|
15
|
+
cwd: __dirname,
|
|
16
|
+
shell: true,
|
|
17
|
+
stdio: ['ignore', 'pipe', 'pipe'], // pipe:允许收集日志
|
|
18
|
+
});
|
|
19
|
+
// 缓冲日志,适配大体积输出
|
|
20
|
+
let stdout = '';
|
|
21
|
+
let stderr = '';
|
|
22
|
+
child.stdout.on('data', (chunk) => {
|
|
23
|
+
stdout += chunk.toString();
|
|
24
|
+
});
|
|
25
|
+
child.stderr.on('data', (chunk) => {
|
|
26
|
+
stderr += chunk.toString();
|
|
27
|
+
});
|
|
28
|
+
child.on('error', (err) => {
|
|
29
|
+
reject(err);
|
|
30
|
+
});
|
|
31
|
+
child.on('close', (code) => {
|
|
32
|
+
resolve({ stdout, stderr, code });
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function testMsBuild() {
|
|
37
|
+
try {
|
|
38
|
+
const { stdout, stderr, code } = await runMsBuild();
|
|
39
|
+
console.log('===== 构建完成,准备分析输出 =====');
|
|
40
|
+
if (code === 0) {
|
|
41
|
+
console.log('✅ 构建成功');
|
|
42
|
+
if (stdout.includes('Build succeeded')) {
|
|
43
|
+
console.log('🎯 日志中确认构建成功');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.error(`❌ 构建失败,退出码: ${code}`);
|
|
48
|
+
console.error(stderr.slice(0, 1000)); // 如日志过大,可限制显示前几百字
|
|
49
|
+
}
|
|
50
|
+
// 你可以把 stdout 写入文件做后续分析
|
|
51
|
+
// fs.writeFileSync('build.log', stdout);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
console.error('命令执行异常:', err);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// testMsBuild();
|
|
58
|
+
//# sourceMappingURL=msBuidSpawn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msBuidSpawn.js","sourceRoot":"","sources":["../../src/codebk/msBuidSpawn.ts"],"names":[],"mappings":";;AAAA,iDAAsC;AAQtC,SAAS,UAAU;IACjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,YAAY,GAAG,8FAA8F,CAAC;QAExH,qFAAqF;QACnF,MAAM,WAAW,GAAG,qHAAqH,CAAC;QAC1I,MAAM,cAAc,GAAG,YAAY,WAAW,0BAA0B,CAAC;QAEvE,6BAA6B;QAC7B,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,SAAS,EAAE;YAC7B,IAAI;YACJ,QAAQ,YAAY,OAAO,cAAc,EAAE;SAC5C,EAAE;YACD,GAAG,EAAE,SAAS;YACd,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc;SAClD,CAAC,CAAC;QAEH,eAAe;QACf,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,WAAW;IACxB,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,UAAU,EAAE,CAAC;QAEpD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QAEvC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACtB,IAAI,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBACvC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB;QAC1D,CAAC;QAED,wBAAwB;QACxB,yCAAyC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED,iBAAiB","sourcesContent":["import { spawn } from 'child_process';\r\n\r\ninterface CommandResult {\r\n stdout: string;\r\n stderr: string;\r\n code: number | null;\r\n}\r\n\r\nfunction runMsBuild(): Promise<CommandResult> {\r\n return new Promise((resolve, reject) => {\r\n const vsDevCmdPath = `\"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\Common7\\\\Tools\\\\VsDevCmd.bat\"`;\r\n\r\n// const solutionPath = path.resolve(__dirname, 'YourProject.sln'); // 或 .csproj 文件\r\n const projectPath = \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj\";\r\n const msbuildCommand = `MSBuild \"${projectPath}\" /p:Configuration=debug`;\r\n\r\n // 使用 cmd /c call 确保环境变量被正确加载\r\n const child = spawn('cmd.exe', [\r\n '/c',\r\n `call ${vsDevCmdPath} && ${msbuildCommand}`\r\n ], {\r\n cwd: __dirname,\r\n shell: true,\r\n stdio: ['ignore', 'pipe', 'pipe'], // pipe:允许收集日志\r\n });\r\n\r\n // 缓冲日志,适配大体积输出\r\n let stdout = '';\r\n let stderr = '';\r\n\r\n child.stdout.on('data', (chunk: Buffer) => {\r\n stdout += chunk.toString();\r\n });\r\n\r\n child.stderr.on('data', (chunk: Buffer) => {\r\n stderr += chunk.toString();\r\n });\r\n\r\n child.on('error', (err) => {\r\n reject(err);\r\n });\r\n\r\n child.on('close', (code) => {\r\n resolve({ stdout, stderr, code });\r\n });\r\n });\r\n}\r\n\r\nasync function testMsBuild() {\r\n try {\r\n const { stdout, stderr, code } = await runMsBuild();\r\n\r\n console.log('===== 构建完成,准备分析输出 =====');\r\n\r\n if (code === 0) {\r\n console.log('✅ 构建成功');\r\n if (stdout.includes('Build succeeded')) {\r\n console.log('🎯 日志中确认构建成功');\r\n }\r\n } else {\r\n console.error(`❌ 构建失败,退出码: ${code}`);\r\n console.error(stderr.slice(0, 1000)); // 如日志过大,可限制显示前几百字\r\n }\r\n\r\n // 你可以把 stdout 写入文件做后续分析\r\n // fs.writeFileSync('build.log', stdout);\r\n } catch (err) {\r\n console.error('命令执行异常:', err);\r\n }\r\n}\r\n\r\n// testMsBuild();"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|