@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,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import * as path from 'path';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
// import { exec, spawn } from 'child_process';
|
|
5
|
+
// import { formatMsbuildResultToMarkdown, parseMsbuildErrors } from '../utils/parseBuildResult';
|
|
6
|
+
// import { msBuildPath } from './vsTools';
|
|
7
|
+
// // import { vsDevCmdPath } from './vsTools';
|
|
8
|
+
// export function runMsBuild(projectPath: string): Promise<any> {
|
|
9
|
+
// return new Promise((resolve) => {
|
|
10
|
+
// // in vsdevcmd env, MSBuild.exe is available
|
|
11
|
+
// const msbuildCommand = `"${msBuildPath}" "${projectPath}" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;
|
|
12
|
+
// // const msbuildCommand = `"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe" "${projectPath}" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;
|
|
13
|
+
// // const fullCommand = `cmd /c "call "${vsDevCmdPath}" && ${msbuildCommand}"`;
|
|
14
|
+
// const workDir = path.join(__dirname, '../tools');
|
|
15
|
+
// console.log(`📦 Running MSBuild... \n ${msbuildCommand}`);
|
|
16
|
+
// const startTime = Date.now();
|
|
17
|
+
// exec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
|
|
18
|
+
// console.log(`Build time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
19
|
+
// if (error) {
|
|
20
|
+
// console.error(`❌ Build failed: ${error.message}`);
|
|
21
|
+
// const buildErrors = parseMsbuildErrors(stdout);
|
|
22
|
+
// const formattedBuildErrors = formatMsbuildResultToMarkdown(buildErrors);
|
|
23
|
+
// resolve({ success: false, message: formattedBuildErrors, buildErrors: buildErrors });
|
|
24
|
+
// return;
|
|
25
|
+
// }
|
|
26
|
+
// if (stderr) {
|
|
27
|
+
// console.warn(`⚠️ Warnings/Errors:\n${stdout}`);
|
|
28
|
+
// resolve({ success: false, message: stdout, buildErrors: null });
|
|
29
|
+
// return;
|
|
30
|
+
// }
|
|
31
|
+
// console.log(`✅ Build succeeded`);
|
|
32
|
+
// resolve({ success: true, message: stdout, buildErrors: null });
|
|
33
|
+
// });
|
|
34
|
+
// });
|
|
35
|
+
// }
|
|
36
|
+
// export function runMsBuildWithDevenv(projectPath: string): Promise<{ success: boolean; message: string }> {
|
|
37
|
+
// return new Promise((resolve) => {
|
|
38
|
+
// // in vsdevcmd env, MSBuild.exe is available
|
|
39
|
+
// const msbuildCommand = `devenvexe.cmd "${projectPath}" /build`; // /p:Configuration=debug`;
|
|
40
|
+
// // const fullCommand = `cmd /c "call "${vsDevCmdPath}" && ${msbuildCommand}"`;
|
|
41
|
+
// const workDir = path.join(__dirname, '../tools');
|
|
42
|
+
// console.log('📦 Running MSBuild...');
|
|
43
|
+
// exec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
|
|
44
|
+
// if (error) {
|
|
45
|
+
// console.error(`❌ Build failed: ${error.message}`);
|
|
46
|
+
// resolve({ success: false, message: error.message });
|
|
47
|
+
// return;
|
|
48
|
+
// }
|
|
49
|
+
// if (stderr) {
|
|
50
|
+
// console.warn(`⚠️ Warnings/Errors:\n${stderr}`);
|
|
51
|
+
// resolve({ success: false, message: stderr });
|
|
52
|
+
// return;
|
|
53
|
+
// }
|
|
54
|
+
// console.log(`✅ Build succeeded:\n${stdout}`);
|
|
55
|
+
// resolve({ success: true, message: stdout });
|
|
56
|
+
// });
|
|
57
|
+
// });
|
|
58
|
+
// }
|
|
59
|
+
// export function runMsBuild3(projectPath: string): Promise<{ success: boolean; message: string }> {
|
|
60
|
+
// return new Promise((resolve) => {
|
|
61
|
+
// // const vsDevCmdPath = process.env.VSDEVCMD_PATH || 'path_to_vsdevcmd'; // Ensure vsDevCmdPath is defined
|
|
62
|
+
// const fullCommand = `devenvexe.cmd "${projectPath}" /build Debug`;
|
|
63
|
+
// // const fullCommand = `call "${vsDevCmdPath}" && ${msbuildCommand}`;
|
|
64
|
+
// console.log('📦 Running MSBuild...');
|
|
65
|
+
// const workDir = path.join(__dirname, '../tools'); // Define a working directory for the build
|
|
66
|
+
// // Spawn cmd.exe with /c to execute the command
|
|
67
|
+
// const child = spawn('cmd', ['/c', fullCommand], {
|
|
68
|
+
// cwd: workDir,
|
|
69
|
+
// // stdio: ['inherit', 'inherit', 'inherit'], // Pipe stdout and stderr
|
|
70
|
+
// stdio: ['inherit', 'pipe', 'pipe'], // Pipe stdout and stderr
|
|
71
|
+
// shell: true
|
|
72
|
+
// });
|
|
73
|
+
// let stdout = '';
|
|
74
|
+
// let stderr = '';
|
|
75
|
+
// // Collect stdout
|
|
76
|
+
// child.stdout.on('data', (data) => {
|
|
77
|
+
// const output = data.toString();
|
|
78
|
+
// stdout += output;
|
|
79
|
+
// console.log(output);
|
|
80
|
+
// });
|
|
81
|
+
// // Collect stderr
|
|
82
|
+
// child.stderr.on('data', (data) => {
|
|
83
|
+
// const errorOutput = data.toString();
|
|
84
|
+
// stderr += errorOutput;
|
|
85
|
+
// console.warn(errorOutput);
|
|
86
|
+
// });
|
|
87
|
+
// // Handle process exit
|
|
88
|
+
// child.on('close', (code) => {
|
|
89
|
+
// if (code !== 0) {
|
|
90
|
+
// console.error(`❌ Build failed with exit code ${code}`);
|
|
91
|
+
// resolve({ success: false, message: stderr || `Build failed with exit code ${code}` });
|
|
92
|
+
// return;
|
|
93
|
+
// }
|
|
94
|
+
// if (stderr) {
|
|
95
|
+
// console.warn(`⚠️ Warnings/Errors:\n${stderr}`);
|
|
96
|
+
// resolve({ success: false, message: stderr });
|
|
97
|
+
// return;
|
|
98
|
+
// }
|
|
99
|
+
// console.log(`✅ Build succeeded`);
|
|
100
|
+
// resolve({ success: true, message: stdout });
|
|
101
|
+
// });
|
|
102
|
+
// // Handle spawn error
|
|
103
|
+
// child.on('error', (error) => {
|
|
104
|
+
// console.error(`❌ Spawn error: ${error.message}`);
|
|
105
|
+
// resolve({ success: false, message: error.message });
|
|
106
|
+
// });
|
|
107
|
+
// });
|
|
108
|
+
// }
|
|
109
|
+
// // runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
|
|
110
|
+
// // runMsBuild3('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
|
|
111
|
+
// // devenv "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
|
|
112
|
+
// // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
|
|
113
|
+
// // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
|
|
114
|
+
// // devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug // incremental compile
|
|
115
|
+
// // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
|
|
116
|
+
// // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
|
|
117
|
+
// // msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal /nr:true
|
|
118
|
+
// // 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
|
|
119
|
+
// // 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"
|
|
120
|
+
// // 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"
|
|
121
|
+
// // msbuildexe.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /m /nr:true /v:minimal
|
|
122
|
+
// // runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
|
|
123
|
+
//# sourceMappingURL=msBuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msBuild.js","sourceRoot":"","sources":["../../src/codebk/msBuild.ts"],"names":[],"mappings":";AAAA,gCAAgC;;AAEhC,+CAA+C;AAC/C,iGAAiG;AAEjG,2CAA2C;AAE3C,+CAA+C;AAE/C,kEAAkE;AAClE,qCAAqC;AACrC,iDAAiD;AACjD,4HAA4H;AAC5H,wNAAwN;AAExN,mFAAmF;AAEnF,4DAA4D;AAC5D,+DAA+D;AAC/D,wCAAwC;AACxC,qGAAqG;AACrG,qFAAqF;AACrF,kBAAkB;AAClB,yDAAyD;AACzD,kEAAkE;AAClE,2FAA2F;AAC3F,4FAA4F;AAC5F,cAAc;AACd,OAAO;AAEP,mBAAmB;AACnB,sDAAsD;AACtD,uEAAuE;AACvE,cAAc;AACd,OAAO;AAEP,uCAAuC;AACvC,sEAAsE;AACtE,QAAQ;AACR,OAAO;AACP,IAAI;AAGJ,8GAA8G;AAC9G,qCAAqC;AACrC,iDAAiD;AACjD,gGAAgG;AAEhG,mFAAmF;AACnF,4DAA4D;AAC5D,0CAA0C;AAC1C,qGAAqG;AACrG,kBAAkB;AAClB,yDAAyD;AACzD,2DAA2D;AAC3D,cAAc;AACd,OAAO;AAEP,mBAAmB;AACnB,sDAAsD;AACtD,oDAAoD;AACpD,cAAc;AACd,OAAO;AAEP,mDAAmD;AACnD,kDAAkD;AAClD,QAAQ;AACR,OAAO;AACP,IAAI;AAEJ,qGAAqG;AACrG,wCAAwC;AACxC,qHAAqH;AACrH,6EAA6E;AAC7E,gFAAgF;AAEhF,gDAAgD;AAChD,kGAAkG;AAClG,0DAA0D;AAC1D,4DAA4D;AAC5D,4BAA4B;AAC5B,qFAAqF;AACrF,4EAA4E;AAC5E,0BAA0B;AAC1B,cAAc;AAEd,2BAA2B;AAC3B,2BAA2B;AAE3B,4BAA4B;AAC5B,8CAA8C;AAC9C,8CAA8C;AAC9C,gCAAgC;AAChC,mCAAmC;AACnC,cAAc;AAEd,4BAA4B;AAC5B,8CAA8C;AAC9C,mDAAmD;AACnD,qCAAqC;AACrC,yCAAyC;AACzC,cAAc;AAEd,iCAAiC;AACjC,wCAAwC;AACxC,gCAAgC;AAChC,0EAA0E;AAC1E,yGAAyG;AACzG,0BAA0B;AAC1B,gBAAgB;AAEhB,4BAA4B;AAC5B,kEAAkE;AAClE,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,gDAAgD;AAChD,2DAA2D;AAC3D,cAAc;AAEd,gCAAgC;AAChC,yCAAyC;AACzC,gEAAgE;AAChE,mEAAmE;AACnE,cAAc;AACd,UAAU;AACV,IAAI;AAEJ,wIAAwI;AACxI,yIAAyI;AAEzI,kKAAkK;AAClK,sKAAsK;AACtK,sKAAsK;AACtK,yHAAyH;AACzH,2KAA2K;AAC3K,2KAA2K;AAC3K,oLAAoL;AAEpL,yNAAyN;AAEzN,4NAA4N;AAC5N,4NAA4N;AAE5N,4KAA4K;AAC5K,wIAAwI","sourcesContent":["// import * as path from 'path';\r\n\r\n// import { exec, spawn } from 'child_process';\r\n// import { formatMsbuildResultToMarkdown, parseMsbuildErrors } from '../utils/parseBuildResult';\r\n\r\n// import { msBuildPath } from './vsTools';\r\n\r\n// // import { vsDevCmdPath } from './vsTools';\r\n\r\n// export function runMsBuild(projectPath: string): Promise<any> {\r\n// \treturn new Promise((resolve) => {\r\n// \t\t// in vsdevcmd env, MSBuild.exe is available\r\n// \t\tconst msbuildCommand = `\"${msBuildPath}\" \"${projectPath}\" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;\r\n// \t\t// const msbuildCommand = `\"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\MSBuild\\\\Current\\\\Bin\\\\amd64\\\\MSBuild.exe\" \"${projectPath}\" /t:Build /m /nr:true /v:minimal`; // /p:Configuration=debug`;\r\n\r\n// \t\t// const fullCommand = `cmd /c \"call \"${vsDevCmdPath}\" && ${msbuildCommand}\"`;\r\n\r\n// const workDir = path.join(__dirname, '../tools');\r\n// \t\tconsole.log(`📦 Running MSBuild... \\n ${msbuildCommand}`);\r\n// const startTime = Date.now();\r\n// \t\texec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// console.log(`Build time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// \t\t\tif (error) {\r\n// \t\t\t\tconsole.error(`❌ Build failed: ${error.message}`);\r\n// const buildErrors = parseMsbuildErrors(stdout);\r\n// const formattedBuildErrors = formatMsbuildResultToMarkdown(buildErrors);\r\n// \t\t\t\tresolve({ success: false, message: formattedBuildErrors, buildErrors: buildErrors });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\r\n// \t\t\tif (stderr) {\r\n// \t\t\t\tconsole.warn(`⚠️ Warnings/Errors:\\n${stdout}`);\r\n// \t\t\t\tresolve({ success: false, message: stdout, buildErrors: null });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\r\n// \t\t\tconsole.log(`✅ Build succeeded`);\r\n// \t\t\tresolve({ success: true, message: stdout, buildErrors: null });\r\n// \t\t});\r\n// \t});\r\n// }\r\n\r\n\r\n// export function runMsBuildWithDevenv(projectPath: string): Promise<{ success: boolean; message: string }> {\r\n// \treturn new Promise((resolve) => {\r\n// \t\t// in vsdevcmd env, MSBuild.exe is available\r\n// \t\tconst msbuildCommand = `devenvexe.cmd \"${projectPath}\" /build`; // /p:Configuration=debug`;\r\n\r\n// \t\t// const fullCommand = `cmd /c \"call \"${vsDevCmdPath}\" && ${msbuildCommand}\"`;\r\n// const workDir = path.join(__dirname, '../tools');\r\n// \t\tconsole.log('📦 Running MSBuild...');\r\n// \t\texec(msbuildCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// \t\t\tif (error) {\r\n// \t\t\t\tconsole.error(`❌ Build failed: ${error.message}`);\r\n// \t\t\t\tresolve({ success: false, message: error.message });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\r\n// \t\t\tif (stderr) {\r\n// \t\t\t\tconsole.warn(`⚠️ Warnings/Errors:\\n${stderr}`);\r\n// \t\t\t\tresolve({ success: false, message: stderr });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\r\n// \t\t\tconsole.log(`✅ Build succeeded:\\n${stdout}`);\r\n// \t\t\tresolve({ success: true, message: stdout });\r\n// \t\t});\r\n// \t});\r\n// }\r\n\r\n// export function runMsBuild3(projectPath: string): Promise<{ success: boolean; message: string }> {\r\n// return new Promise((resolve) => {\r\n// // const vsDevCmdPath = process.env.VSDEVCMD_PATH || 'path_to_vsdevcmd'; // Ensure vsDevCmdPath is defined\r\n// const fullCommand = `devenvexe.cmd \"${projectPath}\" /build Debug`;\r\n// // const fullCommand = `call \"${vsDevCmdPath}\" && ${msbuildCommand}`;\r\n\r\n// console.log('📦 Running MSBuild...');\r\n// \t\tconst workDir = path.join(__dirname, '../tools'); // Define a working directory for the build\r\n// // Spawn cmd.exe with /c to execute the command\r\n// const child = spawn('cmd', ['/c', fullCommand], {\r\n// cwd: workDir,\r\n// // stdio: ['inherit', 'inherit', 'inherit'], // Pipe stdout and stderr\r\n// stdio: ['inherit', 'pipe', 'pipe'], // Pipe stdout and stderr\r\n// shell: true\r\n// });\r\n\r\n// let stdout = '';\r\n// let stderr = '';\r\n\r\n// // Collect stdout\r\n// child.stdout.on('data', (data) => {\r\n// const output = data.toString();\r\n// stdout += output;\r\n// console.log(output);\r\n// });\r\n\r\n// // Collect stderr\r\n// child.stderr.on('data', (data) => {\r\n// const errorOutput = data.toString();\r\n// stderr += errorOutput;\r\n// console.warn(errorOutput);\r\n// });\r\n\r\n// // Handle process exit\r\n// child.on('close', (code) => {\r\n// if (code !== 0) {\r\n// console.error(`❌ Build failed with exit code ${code}`);\r\n// resolve({ success: false, message: stderr || `Build failed with exit code ${code}` });\r\n// return;\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`⚠️ Warnings/Errors:\\n${stderr}`);\r\n// resolve({ success: false, message: stderr });\r\n// return;\r\n// }\r\n\r\n// console.log(`✅ Build succeeded`);\r\n// resolve({ success: true, message: stdout });\r\n// });\r\n\r\n// // Handle spawn error\r\n// child.on('error', (error) => {\r\n// console.error(`❌ Spawn error: ${error.message}`);\r\n// resolve({ success: false, message: error.message });\r\n// });\r\n// });\r\n// }\r\n\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');"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{%- if isBuildFailure -%}
|
|
2
|
+
{%- assign failedStage = "MSBuild" -%}
|
|
3
|
+
{%- assign failedTitle = "MSBuild failed information:" -%}
|
|
4
|
+
{%- else -%}
|
|
5
|
+
{%- assign failedStage = "vstest" -%}
|
|
6
|
+
{%- assign failedTitle = "vstest failed test methods:" -%}
|
|
7
|
+
{%- endif -%}
|
|
8
|
+
|
|
9
|
+
The unit test code provided in the assistant response failed with {{failedStage}}. Fix the test code based on {{failedStage}} failure information.
|
|
10
|
+
|
|
11
|
+
### {{failedTitle}}
|
|
12
|
+
%s
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{%- if isXapTest -%}
|
|
2
|
+
{%- assign xapSuffix = " with the XAP framework" -%}
|
|
3
|
+
{%- else -%}
|
|
4
|
+
{%- assign xapSuffix = "" -%}
|
|
5
|
+
{%- endif -%}
|
|
6
|
+
|
|
7
|
+
You are a **highly skilled software engineer specializing in C# unit testing**.
|
|
8
|
+
|
|
9
|
+
Write **unit tests** for the user-provided C# source code, strictly following the guidelines below.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
### ✅ Unit Test Guidelines
|
|
14
|
+
|
|
15
|
+
* **Framework**:
|
|
16
|
+
✅ Use **MSTest** for all test code.
|
|
17
|
+
|
|
18
|
+
* **Output Format**:
|
|
19
|
+
✅ Return the test code **only**, wrapped like this:
|
|
20
|
+
|
|
21
|
+
```C#
|
|
22
|
+
<Test Code>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
* **Comments / Explanations**:
|
|
26
|
+
❌ Do **not** include **any comments, descriptions, or explanations** in the output.
|
|
27
|
+
|
|
28
|
+
* **Syntax Validity**:
|
|
29
|
+
✅ Ensure **no syntax errors**.
|
|
30
|
+
✅ The generated code **must compile and run under Visual Studio `vstest`**.
|
|
31
|
+
|
|
32
|
+
* **Mocking Rules**:
|
|
33
|
+
|
|
34
|
+
✅ **Mock all external dependencies** (any class, method, or value not included in the user input) using **Moq**.
|
|
35
|
+
❌ **Do not** mock any class, function, or value that exists inside the source code.
|
|
36
|
+
✅ **Do not** attempt to access private members of the source class. Only use **public methods and properties**.
|
|
37
|
+
|
|
38
|
+
* **Namespace & Usings**:
|
|
39
|
+
|
|
40
|
+
✅ Always include a **namespace** block for the test code.
|
|
41
|
+
✅ Place **all using statements above** the namespace.
|
|
42
|
+
✅ **Import the namespace of the source code** in the test code.
|
|
43
|
+
✅ **Import all required .NET namespaces** needed for compilation.
|
|
44
|
+
|
|
45
|
+
* **Test Method Naming**:
|
|
46
|
+
|
|
47
|
+
✅ Follow the naming pattern:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
[MethodName]_[Scenario]_[ExpectedResult]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
* **Test Coverage Requirements**:
|
|
54
|
+
|
|
55
|
+
✅ Write **valid and meaningful test cases** covering:
|
|
56
|
+
|
|
57
|
+
| Coverage Area | Requirement |
|
|
58
|
+
| ------------------- | ---------------------------------------------------- |
|
|
59
|
+
| Main Logic Paths | Cover normal/happy paths |
|
|
60
|
+
| Edge Cases | Cover nulls, boundary values |
|
|
61
|
+
| Exception Handling | If source code throws exceptions, test that |
|
|
62
|
+
| Boundary Conditions | Check for inputs like 0, negative, empty lists, etc. |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
{% if isXapTest %}
|
|
67
|
+
{%- include 'xap/xapGuideline' -%}
|
|
68
|
+
{%- endif -%}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{%- if isXapTest -%}
|
|
2
|
+
{%- assign xapSuffix = " with the XAP framework" -%}
|
|
3
|
+
{%- else -%}
|
|
4
|
+
{%- assign xapSuffix = "" -%}
|
|
5
|
+
{%- endif -%}
|
|
6
|
+
|
|
7
|
+
You are a highly skilled software engineer specializing in C# unit testing{{xapSuffix}}. Write unit tests for user-provided C# code, must obey the following guidelines:
|
|
8
|
+
### Unit Test Guidelines
|
|
9
|
+
- Use MSTest framework for all test code.
|
|
10
|
+
- MUST NOT add any comments or explanations in the test code.
|
|
11
|
+
- Ensure the test code has no syntax errors.
|
|
12
|
+
- Mock all dependencies not included in the user-provided inputs using Moq.
|
|
13
|
+
- Must not access private members (fields or methods) of the source class in test code, use public methods only.
|
|
14
|
+
- Must include a namespace in the test code, and put using statement above namespace.
|
|
15
|
+
- Must import source code namespace in the test code.
|
|
16
|
+
- Must import required .Net namespaces if using .Net class or interface in the test code.
|
|
17
|
+
- Test method names must follow the pattern: [MethodName]_[Scenario]_[ExpectedResult].
|
|
18
|
+
- Return the test code in the format: ```C#\n<Test code>\n```.
|
|
19
|
+
- Write valid test cases that cover:
|
|
20
|
+
- Main logic paths (e.g., happy path, edge cases).
|
|
21
|
+
- Exception handling if applicable.
|
|
22
|
+
- Boundary conditions (e.g., zero, negative, or null inputs).
|
|
23
|
+
- Ensure the generated test code can pass the test of vstest in visual studio.
|
|
24
|
+
- NOTE: It is critical to pass the vstest. If some test cases are not covered by the source code and cause the vstest test to fail, please remove these test cases.
|
|
25
|
+
|
|
26
|
+
{% if isXapTest %}
|
|
27
|
+
{%- include 'xap/xapGuideline' -%}
|
|
28
|
+
{%- endif -%}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# ✅ XAP Code Unit Test Guidelines
|
|
2
|
+
|
|
3
|
+
**⚠️ These rules only apply when the code under test is a XAP class.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
## 1. What is a XAP Class?
|
|
7
|
+
|
|
8
|
+
A class is considered a **XAP class** if it meets **both** of the following conditions:
|
|
9
|
+
* **It inherits from one or more of the following interfaces:**
|
|
10
|
+
* `IPlugin`
|
|
11
|
+
* `IConditionPlugin`
|
|
12
|
+
* `Workflow`
|
|
13
|
+
* `IExperiment`
|
|
14
|
+
* `IPluginDataStore`
|
|
15
|
+
* `IAsyncPlugin`
|
|
16
|
+
* **It implements an `Execute` method**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. XAP Class Instantiation Rule
|
|
21
|
+
* **Always create XAP class instances using:**
|
|
22
|
+
```csharp
|
|
23
|
+
ExecutionServices.CreateInstance<I{ClassName}>()
|
|
24
|
+
```
|
|
25
|
+
Where `{ClassName}` is the original class name prefixed with "I".
|
|
26
|
+
|
|
27
|
+
**Example:**
|
|
28
|
+
|
|
29
|
+
For a class named `SampleWorkflow`:
|
|
30
|
+
```csharp
|
|
31
|
+
var sampleWorkflow = ExecutionServices.CreateInstance<ISampleWorkflow>();
|
|
32
|
+
```
|
|
33
|
+
❌ **Never use `new {Xap class name}` to create instance for XAP classes.**
|
|
34
|
+
❌ **Never use `ExecutionServices.CreateInstance` for non-XAP classes.**
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 3. Special Rules for `Execute` Method Parameters (XAP Classes Only)
|
|
39
|
+
### 3.1 Parameter Differences Between Source Code and Test Code
|
|
40
|
+
When calling `Execute` on a XAP class instance in test code:
|
|
41
|
+
* The following parameter types **are automatically removed**:
|
|
42
|
+
* `PluginServices`
|
|
43
|
+
* Any `PluginOutput<T>`
|
|
44
|
+
* Any parameter decorated with `[ConfigFile("{ConfigFileName}")]`
|
|
45
|
+
|
|
46
|
+
❌ **You MUST NOT try to mock or pass these removed parameters manually in test code.**
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
### 3.2 How to Call `Execute` in Test Code
|
|
51
|
+
For each **remaining parameter** (after removal):
|
|
52
|
+
* ✅ **Keep the original parameter order**
|
|
53
|
+
* ✅ **Match the parameter types exactly**
|
|
54
|
+
* ✅ **Wrap each argument with `Task.FromResult({value})`**
|
|
55
|
+
|
|
56
|
+
**Example:**
|
|
57
|
+
|
|
58
|
+
Given this source method signature:
|
|
59
|
+
```csharp
|
|
60
|
+
PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)
|
|
61
|
+
```
|
|
62
|
+
✅ The correct test call is:
|
|
63
|
+
```csharp
|
|
64
|
+
sampleWorkflow.Execute(Task.FromResult(osResp), Task.FromResult(req)).Result;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 4. Handling `PluginOutput<T>` Parameters (Outputs)
|
|
70
|
+
For each `PluginOutput<T>` parameter in the XAP class `Execute` method:
|
|
71
|
+
* ✅ Treat it as a **method output**
|
|
72
|
+
* ✅ Access it via the **XAP class instance** using the **original parameter name**
|
|
73
|
+
|
|
74
|
+
**Example:**
|
|
75
|
+
|
|
76
|
+
If the instance is `sampleWorkflow`, and the parameter is `pluginResult`, access:
|
|
77
|
+
```csharp
|
|
78
|
+
sampleWorkflow.pluginResult
|
|
79
|
+
```
|
|
80
|
+
To access fields inside the pluginResult, must use `.Result` first, assume pluginResult has a field named Key, access:
|
|
81
|
+
```csharp
|
|
82
|
+
sampleWorkflow.pluginResult.Result.Key
|
|
83
|
+
```
|
|
84
|
+
**Assertion Example:**
|
|
85
|
+
```csharp
|
|
86
|
+
Assert.NotNull(sampleWorkflow.pluginResult.Result.Key);
|
|
87
|
+
Assert.AreEqual("key", sampleWorkflow.pluginResult.Result.Key);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 5. Working with Bond Structures in Test Code
|
|
93
|
+
### 5.1 Treat Bond Structures Like Regular C# Classes
|
|
94
|
+
* ✅ **Import Bond namespaces by used Bond structures**
|
|
95
|
+
* ✅ **Use full type names to get nested Bond types definitions from user input**
|
|
96
|
+
* ✅ Create Bond structure instances with:
|
|
97
|
+
```csharp
|
|
98
|
+
ExecutionServices.CreateInstance<{BondStructName}>()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 5.2 Required Fields Rule (No Optional Modifier)
|
|
104
|
+
|
|
105
|
+
For each Bond structure field **without the `optional` modifier**:
|
|
106
|
+
|
|
107
|
+
* ✅ You **MUST assign a valid, non-null value** in test code.
|
|
108
|
+
|
|
109
|
+
**Example Bond Structure:**
|
|
110
|
+
|
|
111
|
+
```csharp
|
|
112
|
+
struct EplantUser
|
|
113
|
+
{
|
|
114
|
+
1: uint64 Score;
|
|
115
|
+
2: int64 Created;
|
|
116
|
+
3: string Market;
|
|
117
|
+
4: vector<string> Trees;
|
|
118
|
+
5: EplantUserWeatherContent WeatherContent;
|
|
119
|
+
6: bool MergeNotifyWeather;
|
|
120
|
+
7: optional EplantUserWalletContent WalletContent;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
✅ In test code:
|
|
124
|
+
|
|
125
|
+
You **must** assign values for all fields except `WalletContent`.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### 5.3 Special Case: Source Code Null Checks for Required Fields
|
|
130
|
+
|
|
131
|
+
If the source code contains null checks on required fields (e.g., `if (sampleRequest?.Category == null)`):
|
|
132
|
+
|
|
133
|
+
* ✅ You can generate a test case where the entire Bond object (e.g., `sampleRequest`) is null.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 6. Type Conversion Rules
|
|
138
|
+
|
|
139
|
+
For scenarios where `IList<T>` needs to be converted to `IEnumerable<T>`:
|
|
140
|
+
|
|
141
|
+
* ✅ Use `.AsEnumerable()`
|
|
142
|
+
|
|
143
|
+
**Example:**
|
|
144
|
+
|
|
145
|
+
```csharp
|
|
146
|
+
IEnumerable osResponses = osResponseList.AsEnumerable();
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
### XAP Framework Guidelines
|
|
2
|
+
- XAP class MUST meets following conditions:
|
|
3
|
+
- inherit from IPlugin, IConditionPlugin, Workflow, IExperiment, IPluginDataStore, IAsyncPlugin.
|
|
4
|
+
- implement **Execute** methond
|
|
5
|
+
- MUST use ExecutionServices.CreateInstance<{ClassName}>() to create XAP class instance.
|
|
6
|
+
- Bond defined data structures may be used in the source code. Must treat Bond structs as normal C# classes.
|
|
7
|
+
- MUST follow these rules when call Execute method of XAP class in test code:
|
|
8
|
+
- ignore parameters with type: PluginServices, PluginOutput<{type}>.
|
|
9
|
+
- ignore parameters with attribute: [ConfigFile("{configFileName}")].
|
|
10
|
+
- parameters must be convert to Task using Task.FromResult({param}).
|
|
11
|
+
This is one example:
|
|
12
|
+
```C#
|
|
13
|
+
public class EplantMeResponseBuilder : IPlugin
|
|
14
|
+
{
|
|
15
|
+
// xap class Execute
|
|
16
|
+
public PluginResult Execute(
|
|
17
|
+
PluginServices pluginServices,
|
|
18
|
+
PluginOutput<EplantPluginOutput> eplantPluginOutput,
|
|
19
|
+
PluginOutput<EplantUserResp> eplantUserResp,
|
|
20
|
+
PluginOutput<ObjectStoreRequest<EplantUserKey, EplantUser, EMPTY>> userUpdateRequest,
|
|
21
|
+
[ConfigFile("CommonPluginConfig.ini")]
|
|
22
|
+
PluginConfig eplantMeResponseBuilderConfig,
|
|
23
|
+
[ConfigFile("WeatherOSConfig.ini")]
|
|
24
|
+
OSTableInfo eplantUserTableConfig,
|
|
25
|
+
[ConfigFile("EplantConfig.ini")]
|
|
26
|
+
EplantConfig eplantConfig,
|
|
27
|
+
IEnumerable<ObjectStoreResponse_2<EplantUserKey, EMPTY, EMPTY, EplantUser>> osResponses = null,
|
|
28
|
+
EplantRequest req = null)
|
|
29
|
+
{
|
|
30
|
+
......
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Test code of creating instance and test Execute method
|
|
35
|
+
var builder = ExecutionServices.CreateInstance<IEplantMeResponseBuilder>();
|
|
36
|
+
var result = workflow.Execute(Task.FromResult(osResponses), Task.FromResult(request)).Result;
|
|
37
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import * as fs from 'fs';
|
|
3
|
+
// import * as path from 'path';
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
// import { childProcessSet } from '../exit/childProcessManager';
|
|
6
|
+
// import { exec } from 'child_process';
|
|
7
|
+
// const DllRefCacheDir = "./dllref/"
|
|
8
|
+
// export async function checkCodeSyntax(testFilePath: string): Promise<{ success: boolean; message: string }> {
|
|
9
|
+
// createCodeDllRefsDir();
|
|
10
|
+
// const { success, message } = await runTestCodeSyntaxCheck(testFilePath);
|
|
11
|
+
// if (!success) {
|
|
12
|
+
// console.error(`Code analysis failed: ${message}`);
|
|
13
|
+
// return {success: true, message}; // return true to build the project since syntax check fails
|
|
14
|
+
// }
|
|
15
|
+
// if (message.includes("PassedSyntaxCheck")) {
|
|
16
|
+
// console.log(`Pass Syntax check: ${message}`);
|
|
17
|
+
// return {success: true, message};
|
|
18
|
+
// }
|
|
19
|
+
// if (message.includes("SyntaxErrors:")) {
|
|
20
|
+
// const syntaxErrors = getSyntaxErrors(message);
|
|
21
|
+
// console.log(`Syntax errors found in the code:\n ${syntaxErrors}`);
|
|
22
|
+
// return { success: false, message: syntaxErrors };
|
|
23
|
+
// }
|
|
24
|
+
// return { success: true, message };
|
|
25
|
+
// }
|
|
26
|
+
// function getSyntaxErrors(message: string) {
|
|
27
|
+
// const match = message.match(/SyntaxErrors:\s*\n([\s\S]*)/);
|
|
28
|
+
// if (!match || match.length < 2) {
|
|
29
|
+
// return "";
|
|
30
|
+
// }
|
|
31
|
+
// return match[1];
|
|
32
|
+
// }
|
|
33
|
+
// function runTestCodeSyntaxCheck(testCodePath: string): Promise<any> {
|
|
34
|
+
// return new Promise((resolve) => {
|
|
35
|
+
// const analyzerCmd = `ccanalyzer -b "${testCodePath}"`;
|
|
36
|
+
// console.log('📦 Running Csharp code syntax check...');
|
|
37
|
+
// const workDir = path.join(__dirname, DllRefCacheDir);
|
|
38
|
+
// const startTime = Date.now();
|
|
39
|
+
// const codeSyntaxProcess = exec(analyzerCmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
|
|
40
|
+
// console.log(`Csharp code syntax check time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
41
|
+
// if (error) {
|
|
42
|
+
// // console.error(`❌ Analyze failed: ${error.message}`);
|
|
43
|
+
// resolve({ success: false, message: stdout });
|
|
44
|
+
// return;
|
|
45
|
+
// }
|
|
46
|
+
// if (stderr) {
|
|
47
|
+
// // console.warn(`⚠️ Warnings/Errors:\n${stderr}`);
|
|
48
|
+
// resolve({ success: false, message: stdout });
|
|
49
|
+
// return;
|
|
50
|
+
// }
|
|
51
|
+
// // console.log(`✅ Analyze succeeded:\n${stdout}`);
|
|
52
|
+
// resolve({ success: true, message: stdout });
|
|
53
|
+
// });
|
|
54
|
+
// childProcessSet.add(codeSyntaxProcess.pid);
|
|
55
|
+
// });
|
|
56
|
+
// }
|
|
57
|
+
// function createCodeDllRefsDir() {
|
|
58
|
+
// try {
|
|
59
|
+
// const codeDllRefsDir = path.join(__dirname, DllRefCacheDir);
|
|
60
|
+
// const resolvedPath = path.resolve(codeDllRefsDir);
|
|
61
|
+
// // Check if directory exists
|
|
62
|
+
// if (!fs.existsSync(resolvedPath)) {
|
|
63
|
+
// // Create directory recursively
|
|
64
|
+
// fs.mkdirSync(resolvedPath, { recursive: true });
|
|
65
|
+
// console.log(`Directory created: ${resolvedPath}`);
|
|
66
|
+
// } else {
|
|
67
|
+
// console.log(`Directory already exists: ${resolvedPath}`);
|
|
68
|
+
// }
|
|
69
|
+
// } catch (error) {
|
|
70
|
+
// console.error('Error processing directory:', error);
|
|
71
|
+
// }
|
|
72
|
+
// }
|
|
73
|
+
// // checkCodeSyntax("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\Eplant\\PluginTest\\ResponseBuilder\\EplantUserUpdateResponseBuilderTest.cs",).then(result => {
|
|
74
|
+
// // // checkCodeSyntax("D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\Eplant\\PluginTest\\ResponseBuilder\\EplantRankResponseBuilderTest.cs",).then(result => {
|
|
75
|
+
// // if (result.success) {
|
|
76
|
+
// // console.log("Code syntax check passed:", result.message);
|
|
77
|
+
// // } else {
|
|
78
|
+
// // console.error("Code syntax check failed:", result.message);
|
|
79
|
+
// // }
|
|
80
|
+
// // });
|
|
81
|
+
//# sourceMappingURL=checkCodeSyntax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkCodeSyntax.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/checkCodeSyntax.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,gCAAgC;;AAEhC,iEAAiE;AACjE,wCAAwC;AAExC,qCAAqC;AAErC,gHAAgH;AAChH,8BAA8B;AAE9B,+EAA+E;AAC/E,sBAAsB;AACtB,6DAA6D;AAC7D,wGAAwG;AACxG,QAAQ;AAER,mDAAmD;AACnD,wDAAwD;AACxD,2CAA2C;AAC3C,QAAQ;AAER,+CAA+C;AAC/C,yDAAyD;AACzD,6EAA6E;AAC7E,4DAA4D;AAC5D,QAAQ;AAER,yCAAyC;AACzC,IAAI;AAEJ,8CAA8C;AAC9C,kEAAkE;AAClE,wCAAwC;AACxC,qBAAqB;AACrB,QAAQ;AAER,uBAAuB;AACvB,IAAI;AAEJ,wEAAwE;AACxE,wCAAwC;AACxC,iEAAiE;AACjE,iEAAiE;AACjE,gEAAgE;AAChE,wCAAwC;AACxC,kIAAkI;AAClI,wGAAwG;AACxG,2BAA2B;AAC3B,0EAA0E;AAC1E,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,4BAA4B;AAC5B,qEAAqE;AACrE,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,iEAAiE;AACjE,2DAA2D;AAC3D,cAAc;AAEd,sDAAsD;AACtD,UAAU;AACV,IAAI;AAEJ,oCAAoC;AACpC,YAAY;AACZ,uEAAuE;AACvE,6DAA6D;AAE7D,uCAAuC;AACvC,8CAA8C;AAC9C,8CAA8C;AAC9C,+DAA+D;AAC/D,iEAAiE;AACjE,mBAAmB;AACnB,wEAAwE;AACxE,YAAY;AACZ,wBAAwB;AACxB,+DAA+D;AAC/D,QAAQ;AACR,IAAI;AAEJ,8MAA8M;AAC9M,2MAA2M;AAC3M,+BAA+B;AAC/B,uEAAuE;AACvE,kBAAkB;AAClB,yEAAyE;AACzE,WAAW;AACX,SAAS","sourcesContent":["// import * as fs from 'fs';\r\n// import * as path from 'path';\r\n\r\n// import { childProcessSet } from '../exit/childProcessManager';\r\n// import { exec } from 'child_process';\r\n\r\n// const DllRefCacheDir = \"./dllref/\"\r\n\r\n// export async function checkCodeSyntax(testFilePath: string): Promise<{ success: boolean; message: string }> {\r\n// createCodeDllRefsDir();\r\n \r\n// const { success, message } = await runTestCodeSyntaxCheck(testFilePath);\r\n// if (!success) {\r\n// console.error(`Code analysis failed: ${message}`);\r\n// return {success: true, message}; // return true to build the project since syntax check fails\r\n// }\r\n\r\n// if (message.includes(\"PassedSyntaxCheck\")) {\r\n// console.log(`Pass Syntax check: ${message}`);\r\n// return {success: true, message};\r\n// }\r\n\r\n// if (message.includes(\"SyntaxErrors:\")) {\r\n// const syntaxErrors = getSyntaxErrors(message);\r\n// console.log(`Syntax errors found in the code:\\n ${syntaxErrors}`);\r\n// return { success: false, message: syntaxErrors };\r\n// }\r\n\r\n// return { success: true, message };\r\n// }\r\n\r\n// function getSyntaxErrors(message: string) {\r\n// const match = message.match(/SyntaxErrors:\\s*\\n([\\s\\S]*)/);\r\n// if (!match || match.length < 2) {\r\n// return \"\";\r\n// }\r\n \r\n// return match[1];\r\n// }\r\n\r\n// function runTestCodeSyntaxCheck(testCodePath: string): Promise<any> {\r\n// return new Promise((resolve) => {\r\n// const analyzerCmd = `ccanalyzer -b \"${testCodePath}\"`;\r\n// console.log('📦 Running Csharp code syntax check...');\r\n// const workDir = path.join(__dirname, DllRefCacheDir);\r\n// const startTime = Date.now();\r\n// const codeSyntaxProcess = exec(analyzerCmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// console.log(`Csharp code syntax check time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// if (error) {\r\n// // console.error(`❌ Analyze failed: ${error.message}`);\r\n// resolve({ success: false, message: stdout });\r\n// return;\r\n// }\r\n\r\n// if (stderr) {\r\n// // console.warn(`⚠️ Warnings/Errors:\\n${stderr}`);\r\n// resolve({ success: false, message: stdout });\r\n// return;\r\n// }\r\n\r\n// // console.log(`✅ Analyze succeeded:\\n${stdout}`);\r\n// resolve({ success: true, message: stdout });\r\n// });\r\n\r\n// childProcessSet.add(codeSyntaxProcess.pid);\r\n// });\r\n// }\r\n\r\n// function createCodeDllRefsDir() {\r\n// try {\r\n// const codeDllRefsDir = path.join(__dirname, DllRefCacheDir);\r\n// const resolvedPath = path.resolve(codeDllRefsDir);\r\n\r\n// // Check if directory exists\r\n// if (!fs.existsSync(resolvedPath)) {\r\n// // Create directory recursively\r\n// fs.mkdirSync(resolvedPath, { recursive: true });\r\n// console.log(`Directory created: ${resolvedPath}`);\r\n// } else {\r\n// console.log(`Directory already exists: ${resolvedPath}`);\r\n// }\r\n// } catch (error) {\r\n// console.error('Error processing directory:', error);\r\n// }\r\n// }\r\n\r\n// // checkCodeSyntax(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\Eplant\\\\PluginTest\\\\ResponseBuilder\\\\EplantUserUpdateResponseBuilderTest.cs\",).then(result => {\r\n// // // checkCodeSyntax(\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\Eplant\\\\PluginTest\\\\ResponseBuilder\\\\EplantRankResponseBuilderTest.cs\",).then(result => {\r\n// // if (result.success) {\r\n// // console.log(\"Code syntax check passed:\", result.message);\r\n// // } else {\r\n// // console.error(\"Code syntax check failed:\", result.message);\r\n// // }\r\n// // });"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import * as path from 'path';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
// import { childProcessSet } from '../exit/childProcessManager';
|
|
5
|
+
// import { exec } from 'child_process';
|
|
6
|
+
// import { extractCoberturaXmlPath } from './extractCodeCoverageInfo';
|
|
7
|
+
// import { vstestPath } from '../vs/vsTools';
|
|
8
|
+
// export function runCodeCoverage(testProjectDllPath: string, codeCoverageSettingPath: string): Promise<any> {
|
|
9
|
+
// return new Promise((resolve) => {
|
|
10
|
+
// const codeCoverageCommand = `"${vstestPath}" "${testProjectDllPath}" /Settings:"${codeCoverageSettingPath}" /TestCaseFilter:"TestCategory!=FunctionalGate&TestCategory!=LocalAH" /EnableCodeCoverage /collect:"Code Coverage;Format=Cobertura"`;
|
|
11
|
+
// const workDir = path.join(__dirname, '../tools');
|
|
12
|
+
// console.log(`Running Code coverage... \n ${codeCoverageCommand}`);
|
|
13
|
+
// const startTime = Date.now();
|
|
14
|
+
// const codeCoverageProcess = exec(codeCoverageCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {
|
|
15
|
+
// console.log(`Code coverage generation time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
16
|
+
// if (error) {
|
|
17
|
+
// console.error(`Code coverage generation failed: ${error.message}`);
|
|
18
|
+
// resolve({ success: false, message: stdout });
|
|
19
|
+
// return;
|
|
20
|
+
// }
|
|
21
|
+
// if (stderr) {
|
|
22
|
+
// console.warn(`Code coverage generation Warnings/Errors:\n${stdout}`);
|
|
23
|
+
// resolve({ success: false, message: stdout, });
|
|
24
|
+
// return;
|
|
25
|
+
// }
|
|
26
|
+
// console.log(`Code coverage generation succeeded`);
|
|
27
|
+
// const coberturaXmlPath = extractCoberturaXmlPath(stdout);
|
|
28
|
+
// resolve({ success: true, message: coberturaXmlPath});
|
|
29
|
+
// });
|
|
30
|
+
// childProcessSet.add(codeCoverageProcess.pid);
|
|
31
|
+
// });
|
|
32
|
+
// }
|
|
33
|
+
// export function containsValidMethods(codePath: string): Promise<boolean> {
|
|
34
|
+
// const analyzerArgs = ['-m', codePath];
|
|
35
|
+
// return runSpawn("ccanalyzer", analyzerArgs, ".", codeCoverageErrorHandler, codeCoverageCloseHandler);
|
|
36
|
+
// }
|
|
37
|
+
// export function codeCoverageErrorHandler(error) {
|
|
38
|
+
// console.error(`codeCoverageErrorHandler - failed: ${error.message}`);
|
|
39
|
+
// return true;
|
|
40
|
+
// }
|
|
41
|
+
// export function codeCoverageCloseHandler(code, stdout, stderr) {
|
|
42
|
+
// if (code !== 0) {
|
|
43
|
+
// console.error(`valid method analyze failed with exit code ${code}, stdout: ${stdout}`);
|
|
44
|
+
// return true; // If the command fails, we assume there are valid methods
|
|
45
|
+
// }
|
|
46
|
+
// if (stderr) {
|
|
47
|
+
// console.warn(`Warnings/Errors:\n${stderr}`);
|
|
48
|
+
// return true;
|
|
49
|
+
// }
|
|
50
|
+
// console.log(`valid method analyze succeeded:\n${stdout}`);
|
|
51
|
+
// const contains = stdout.includes("true");
|
|
52
|
+
// return contains;
|
|
53
|
+
// }
|
|
54
|
+
//# sourceMappingURL=codeCoverage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeCoverage.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/codeCoverage.ts"],"names":[],"mappings":";AAAA,gCAAgC;;AAEhC,iEAAiE;AACjE,wCAAwC;AACxC,uEAAuE;AACvE,8CAA8C;AAE9C,+GAA+G;AAC/G,wCAAwC;AACxC,4PAA4P;AAE5P,4DAA4D;AAC5D,6EAA6E;AAC7E,wCAAwC;AACxC,4IAA4I;AAC5I,wGAAwG;AACxG,2BAA2B;AAC3B,sFAAsF;AACtF,gEAAgE;AAChE,0BAA0B;AAC1B,gBAAgB;AAEhB,4BAA4B;AAC5B,wFAAwF;AACxF,iEAAiE;AACjE,0BAA0B;AAC1B,gBAAgB;AAEhB,iEAAiE;AACjE,wEAAwE;AACxE,oEAAoE;AACpE,cAAc;AACd,wDAAwD;AACxD,UAAU;AACV,IAAI;AAEJ,6EAA6E;AAC7E,6CAA6C;AAC7C,4GAA4G;AAC5G,IAAI;AAEJ,oDAAoD;AACpD,4EAA4E;AAC5E,mBAAmB;AACnB,IAAI;AAEJ,mEAAmE;AACnE,wBAAwB;AACxB,kGAAkG;AAClG,kFAAkF;AAClF,QAAQ;AAER,oBAAoB;AACpB,uDAAuD;AACvD,uBAAuB;AACvB,QAAQ;AACR,iEAAiE;AACjE,gDAAgD;AAEhD,uBAAuB;AACvB,IAAI","sourcesContent":["// import * as path from 'path';\r\n\r\n// import { childProcessSet } from '../exit/childProcessManager';\r\n// import { exec } from 'child_process';\r\n// import { extractCoberturaXmlPath } from './extractCodeCoverageInfo';\r\n// import { vstestPath } from '../vs/vsTools';\r\n\r\n// export function runCodeCoverage(testProjectDllPath: string, codeCoverageSettingPath: string): Promise<any> {\r\n// return new Promise((resolve) => {\r\n// const codeCoverageCommand = `\"${vstestPath}\" \"${testProjectDllPath}\" /Settings:\"${codeCoverageSettingPath}\" /TestCaseFilter:\"TestCategory!=FunctionalGate&TestCategory!=LocalAH\" /EnableCodeCoverage /collect:\"Code Coverage;Format=Cobertura\"`;\r\n\r\n// const workDir = path.join(__dirname, '../tools');\r\n// console.log(`Running Code coverage... \\n ${codeCoverageCommand}`);\r\n// const startTime = Date.now();\r\n// const codeCoverageProcess = exec(codeCoverageCommand, { cwd: workDir, maxBuffer: 1024 * 1024 * 50 }, (error, stdout, stderr) => {\r\n// console.log(`Code coverage generation time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// if (error) {\r\n// console.error(`Code coverage generation failed: ${error.message}`);\r\n// resolve({ success: false, message: stdout });\r\n// return;\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`Code coverage generation Warnings/Errors:\\n${stdout}`);\r\n// resolve({ success: false, message: stdout, });\r\n// return;\r\n// }\r\n\r\n// console.log(`Code coverage generation succeeded`);\r\n// const coberturaXmlPath = extractCoberturaXmlPath(stdout);\r\n// resolve({ success: true, message: coberturaXmlPath});\r\n// });\r\n// childProcessSet.add(codeCoverageProcess.pid);\r\n// });\r\n// }\r\n\r\n// export function containsValidMethods(codePath: string): Promise<boolean> {\r\n// const analyzerArgs = ['-m', codePath];\r\n// return runSpawn(\"ccanalyzer\", analyzerArgs, \".\", codeCoverageErrorHandler, codeCoverageCloseHandler);\r\n// }\r\n\r\n// export function codeCoverageErrorHandler(error) {\r\n// console.error(`codeCoverageErrorHandler - failed: ${error.message}`);\r\n// return true;\r\n// }\r\n\r\n// export function codeCoverageCloseHandler(code, stdout, stderr) {\r\n// if (code !== 0) {\r\n// console.error(`valid method analyze failed with exit code ${code}, stdout: ${stdout}`);\r\n// return true; // If the command fails, we assume there are valid methods\r\n// }\r\n\r\n// if (stderr) {\r\n// console.warn(`Warnings/Errors:\\n${stderr}`);\r\n// return true;\r\n// }\r\n// console.log(`valid method analyze succeeded:\\n${stdout}`);\r\n// const contains = stdout.includes(\"true\");\r\n\r\n// return contains;\r\n// }"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|