@ai-dev-tools/csharp-copilot-core 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +127 -0
- package/out/analyze/generateCodeDependency.js.map +1 -0
- package/out/analyze/installAnalyzerTool.d.ts +1 -0
- package/out/analyze/installAnalyzerTool.js +83 -0
- package/out/analyze/installAnalyzerTool.js.map +1 -0
- package/out/batch/generateCodeTests.d.ts +6 -0
- package/out/batch/generateCodeTests.js +163 -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 +86 -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 +39 -0
- package/out/codeCoverage/codeCoverage.js.map +1 -0
- package/out/codeCoverage/codeCoverageReport.d.ts +6 -0
- package/out/codeCoverage/codeCoverageReport.js +76 -0
- package/out/codeCoverage/codeCoverageReport.js.map +1 -0
- package/out/codeCoverage/extractCodeCoverageInfo.d.ts +2 -0
- package/out/codeCoverage/extractCodeCoverageInfo.js +81 -0
- package/out/codeCoverage/extractCodeCoverageInfo.js.map +1 -0
- package/out/codeCoverage/extractCoverageReportPath.d.ts +1 -0
- package/out/codeCoverage/extractCoverageReportPath.js +25 -0
- package/out/codeCoverage/extractCoverageReportPath.js.map +1 -0
- package/out/codeCoverage/generateCodeCoverageReport.d.ts +1 -0
- package/out/codeCoverage/generateCodeCoverageReport.js +30 -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 +23 -0
- package/out/codeCoverage/reportTool.js.map +1 -0
- package/out/codeCoverage/simplifyCoverageXml.d.ts +2 -0
- package/out/codeCoverage/simplifyCoverageXml.js +117 -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 +90 -0
- package/out/command/index.js.map +1 -0
- package/out/command/utGenWrapper.d.ts +3 -0
- package/out/command/utGenWrapper.js +53 -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 +129 -0
- package/out/gen/autoFix.js.map +1 -0
- package/out/gen/csharpUtGen.d.ts +2 -0
- package/out/gen/csharpUtGen.js +125 -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/addAiAnnotation.d.ts +1 -0
- package/out/gen/postGen/addAiAnnotation.js +57 -0
- package/out/gen/postGen/addAiAnnotation.js.map +1 -0
- package/out/gen/postGen/extractCodeFromResponse.d.ts +1 -0
- package/out/gen/postGen/extractCodeFromResponse.js +38 -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 +39 -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 +29 -0
- package/out/gen/postGen/removeSingleLines.js.map +1 -0
- package/out/gen/postGen/repairRequiredNameSpaces.d.ts +2 -0
- package/out/gen/postGen/repairRequiredNameSpaces.js +142 -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 +19 -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 +63 -0
- package/out/gen/preGen/validateCode.js.map +1 -0
- package/out/index.d.ts +3 -0
- package/out/index.js +10 -0
- package/out/index.js.map +1 -0
- package/out/llm/model/Gpt.d.ts +1 -0
- package/out/llm/model/Gpt.js +93 -0
- package/out/llm/model/Gpt.js.map +1 -0
- package/out/llm/preparePrompt.d.ts +2 -0
- package/out/llm/preparePrompt.js +135 -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 +23 -0
- package/out/llm/prompt/generateUtDependency.liquid +3 -0
- package/out/llm/prompt/generateUtSystem.liquid +5 -0
- package/out/llm/prompt/generateUtTemplate.liquid +32 -0
- package/out/llm/prompt/generateUtUserInput.liquid +4 -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.liquid +37 -0
- package/out/llm/sendRequestToLLM.d.ts +4 -0
- package/out/llm/sendRequestToLLM.js +9 -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 +10 -0
- package/out/types/constants.js +14 -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 +33 -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 +297 -0
- package/out/utils/getTestFile.js.map +1 -0
- package/out/utils/parseBuildResult.d.ts +3 -0
- package/out/utils/parseBuildResult.js +45 -0
- package/out/utils/parseBuildResult.js.map +1 -0
- package/out/utils/parseSyntaxCheckResult.d.ts +2 -0
- package/out/utils/parseSyntaxCheckResult.js +39 -0
- package/out/utils/parseSyntaxCheckResult.js.map +1 -0
- package/out/utils/parseVstestResult.d.ts +3 -0
- package/out/utils/parseVstestResult.js +62 -0
- package/out/utils/parseVstestResult.js.map +1 -0
- package/out/utils/removeFailedTestMethods.d.ts +3 -0
- package/out/utils/removeFailedTestMethods.js +208 -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/writeFailedVerifyResult.d.ts +1 -0
- package/out/utils/writeFailedVerifyResult.js +67 -0
- package/out/utils/writeFailedVerifyResult.js.map +1 -0
- package/out/utils/writeGenCode.d.ts +1 -0
- package/out/utils/writeGenCode.js +63 -0
- package/out/utils/writeGenCode.js.map +1 -0
- package/out/vs/msBuild.d.ts +13 -0
- package/out/vs/msBuild.js +49 -0
- package/out/vs/msBuild.js.map +1 -0
- package/out/vs/vsTest.d.ts +15 -0
- package/out/vs/vsTest.js +75 -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 +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import * as path from 'path';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
// import { formatVSTestResultToMarkdown, parseVSTestOutput } from '../utils/parseVstestResult';
|
|
5
|
+
// import { childProcessSet } from '../exit/childProcessManager';
|
|
6
|
+
// import { exec } from 'child_process';
|
|
7
|
+
// import { setupSignalHandlers } from '../exit/setupProcessSignalHandler';
|
|
8
|
+
// import { vstestPath } from './vsTools';
|
|
9
|
+
// // const vstestPath = `"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe"`;
|
|
10
|
+
// export async function runSingleTestMethod(testDll: string, testMethod: string) {
|
|
11
|
+
// // const cmd = `vstestexe.cmd "${testDll}" /Tests:${testMethod}`;
|
|
12
|
+
// const cmd = `"${vstestPath}" "${testDll}" /Tests:${testMethod}`;
|
|
13
|
+
// return await execCommand(cmd);
|
|
14
|
+
// }
|
|
15
|
+
// export async function runTestClass(testDll: string, className: string) {
|
|
16
|
+
// // const cmd = `vstestexe.cmd "${testDll}" /TestCaseFilter:"FullyQualifiedName~${className}"`;
|
|
17
|
+
// const cmd = `"${vstestPath}" "${testDll}" /TestCaseFilter:"FullyQualifiedName~${className}"`;
|
|
18
|
+
// return await execCommand(cmd);
|
|
19
|
+
// }
|
|
20
|
+
// // export function runTestFile(testDll: string, fullyQualifiedNames: string[]) {
|
|
21
|
+
// // const testsArg = fullyQualifiedNames.map(name => `/Tests:${name}`).join(' ');
|
|
22
|
+
// // const cmd = `vstest.console.exe "${testDll}" ${testsArg}`;
|
|
23
|
+
// // execCommand(cmd);
|
|
24
|
+
// // }
|
|
25
|
+
// function execCommand(cmd: string): Promise<any> {
|
|
26
|
+
// return new Promise((resolve) => {
|
|
27
|
+
// // const fullCommand = `cmd /c "call "${vsDevCmdPath}" && ${cmd}"`;
|
|
28
|
+
// console.log(`▶ Running vstest:\n${cmd}\n`);
|
|
29
|
+
// const workDir = path.join(__dirname, '../tools/');
|
|
30
|
+
// const startTime = Date.now();
|
|
31
|
+
// const testProcess = exec(cmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 10 }, (error, stdout, stderr) => {
|
|
32
|
+
// console.log(`VSTest time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
33
|
+
// if (error) {
|
|
34
|
+
// console.error(`❌ Error: ${stdout}`);
|
|
35
|
+
// const vsTestResult = parseVSTestOutput(stdout);
|
|
36
|
+
// const formatedVSTestResult = formatVSTestResultToMarkdown(vsTestResult);
|
|
37
|
+
// resolve({ success: false, message: formatedVSTestResult, vsTestResult: vsTestResult });
|
|
38
|
+
// return;
|
|
39
|
+
// }
|
|
40
|
+
// if (stderr) {
|
|
41
|
+
// console.error(`⚠️ STDERR:\n${stdout}`);
|
|
42
|
+
// resolve({ success: false, message: stdout, vsTestResult: null });
|
|
43
|
+
// return;
|
|
44
|
+
// }
|
|
45
|
+
// console.log(`✅ vstest succeeded`);
|
|
46
|
+
// resolve({ success: true, message: stdout, vsTestResult: null });
|
|
47
|
+
// });
|
|
48
|
+
// childProcessSet.add(testProcess.pid);
|
|
49
|
+
// });
|
|
50
|
+
// }
|
|
51
|
+
// // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests');
|
|
52
|
+
// // FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest
|
|
53
|
+
// // setupSignalHandlers();
|
|
54
|
+
// // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest').then(result => {
|
|
55
|
+
// // console.log('Test Class Result:', result.success, result.message);
|
|
56
|
+
// // });
|
|
57
|
+
// // runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests.ResponseParserTests');
|
|
58
|
+
// // vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /TestCaseFilter:"FullyQualifiedName~${className}"
|
|
59
|
+
// // vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /Tests:SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId
|
|
60
|
+
// // ./vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId
|
|
61
|
+
// // .\vstestexe.cmd "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId
|
|
62
|
+
// //.\vstestexe.cmd "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /TestCaseFilter:"FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.SqmidHelperTests"
|
|
63
|
+
// // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests').then(result => {
|
|
64
|
+
// // console.log('Test Class Result:', result.success, result.message);
|
|
65
|
+
// // });
|
|
66
|
+
// // runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_MissingUsrLocCookie_ReturnsEmptyString')
|
|
67
|
+
// // runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_InvalidBase64Bid_ReturnsEmptyString');
|
|
68
|
+
// // runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Plugins.Tests.Workflows.Eplant.Conditions.EplantRequestCategoryConditionTests').then(result => {
|
|
69
|
+
// // console.log('Test Class Result:', result.success, result.message);
|
|
70
|
+
// // });
|
|
71
|
+
//# sourceMappingURL=vsTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vsTest.js","sourceRoot":"","sources":["../../../src/codebk/oldExec/vsTest.ts"],"names":[],"mappings":";AAAA,gCAAgC;;AAEhC,gGAAgG;AAEhG,iEAAiE;AACjE,wCAAwC;AACxC,2EAA2E;AAC3E,0CAA0C;AAE1C,qJAAqJ;AAErJ,mFAAmF;AACnF,qEAAqE;AACrE,oEAAoE;AACpE,kCAAkC;AAClC,IAAI;AAEJ,2EAA2E;AAC3E,kGAAkG;AAClG,iGAAiG;AACjG,kCAAkC;AAClC,IAAI;AAEJ,mFAAmF;AACnF,oFAAoF;AACpF,iEAAiE;AACjE,wBAAwB;AACxB,OAAO;AAEP,oDAAoD;AACpD,qCAAqC;AACrC,wEAAwE;AACxE,gDAAgD;AAChD,uDAAuD;AACvD,kCAAkC;AAClC,8GAA8G;AAC9G,6EAA6E;AAC7E,kBAAkB;AAClB,2CAA2C;AAC3C,sDAAsD;AACtD,+EAA+E;AAC/E,8FAA8F;AAC9F,cAAc;AACd,OAAO;AACP,mBAAmB;AACnB,8CAA8C;AAC9C,wEAAwE;AACxE,cAAc;AACd,OAAO;AAEP,wCAAwC;AACxC,sEAAsE;AACtE,QAAQ;AACR,0CAA0C;AAC1C,OAAO;AACP,IAAI;AAEJ,sNAAsN;AACtN,wFAAwF;AACxF,4BAA4B;AAC5B,sOAAsO;AACtO,yEAAyE;AACzE,SAAS;AACT,iPAAiP;AAEjP,yMAAyM;AACzM,mOAAmO;AACnO,yQAAyQ;AACzQ,oQAAoQ;AACpQ,8OAA8O;AAE9O,2NAA2N;AAC3N,yEAAyE;AACzE,SAAS;AACT,2QAA2Q;AAC3Q,yQAAyQ;AACzQ,mQAAmQ;AACnQ,yEAAyE;AACzE,SAAS","sourcesContent":["// import * as path from 'path';\r\n\r\n// import { formatVSTestResultToMarkdown, parseVSTestOutput } from '../utils/parseVstestResult';\r\n\r\n// import { childProcessSet } from '../exit/childProcessManager';\r\n// import { exec } from 'child_process';\r\n// import { setupSignalHandlers } from '../exit/setupProcessSignalHandler';\r\n// import { vstestPath } from './vsTools';\r\n\r\n// // const vstestPath = `\"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community\\\\Common7\\\\IDE\\\\Extensions\\\\TestPlatform\\\\vstest.console.exe\"`;\r\n\r\n// export async function runSingleTestMethod(testDll: string, testMethod: string) {\r\n// \t// const cmd = `vstestexe.cmd \"${testDll}\" /Tests:${testMethod}`;\r\n// \tconst cmd = `\"${vstestPath}\" \"${testDll}\" /Tests:${testMethod}`;\r\n// \treturn await execCommand(cmd);\r\n// }\r\n\r\n// export async function runTestClass(testDll: string, className: string) {\r\n// \t// const cmd = `vstestexe.cmd \"${testDll}\" /TestCaseFilter:\"FullyQualifiedName~${className}\"`;\r\n// \tconst cmd = `\"${vstestPath}\" \"${testDll}\" /TestCaseFilter:\"FullyQualifiedName~${className}\"`;\r\n// \treturn await execCommand(cmd);\r\n// }\r\n\r\n// // export function runTestFile(testDll: string, fullyQualifiedNames: string[]) {\r\n// // \tconst testsArg = fullyQualifiedNames.map(name => `/Tests:${name}`).join(' ');\r\n// // \tconst cmd = `vstest.console.exe \"${testDll}\" ${testsArg}`;\r\n// // \texecCommand(cmd);\r\n// // }\r\n\r\n// function execCommand(cmd: string): Promise<any> {\r\n// \treturn new Promise((resolve) => {\r\n// \t\t// const fullCommand = `cmd /c \"call \"${vsDevCmdPath}\" && ${cmd}\"`;\r\n// \t\tconsole.log(`▶ Running vstest:\\n${cmd}\\n`);\r\n// \t\tconst workDir = path.join(__dirname, '../tools/');\r\n// \t\tconst startTime = Date.now();\r\n// \t\tconst testProcess = exec(cmd, { cwd: workDir, maxBuffer: 1024 * 1024 * 10 }, (error, stdout, stderr) => {\r\n// \t\t\tconsole.log(`VSTest time: ${(Date.now() - startTime) / 1000} seconds`);\r\n// \t\t\tif (error) {\r\n// \t\t\t\tconsole.error(`❌ Error: ${stdout}`);\r\n// \t\t\t\tconst vsTestResult = parseVSTestOutput(stdout);\r\n// \t\t\t\tconst formatedVSTestResult = formatVSTestResultToMarkdown(vsTestResult);\r\n// \t\t\t\tresolve({ success: false, message: formatedVSTestResult, vsTestResult: vsTestResult });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n// \t\t\tif (stderr) {\r\n// \t\t\t\tconsole.error(`⚠️ STDERR:\\n${stdout}`);\r\n// \t\t\t\tresolve({ success: false, message: stdout, vsTestResult: null });\r\n// \t\t\t\treturn;\r\n// \t\t\t}\r\n\t\t\t\r\n// \t\t\tconsole.log(`✅ vstest succeeded`);\r\n// \t\t\tresolve({ success: true, message: stdout, vsTestResult: null });\r\n// \t\t});\r\n// \t\tchildProcessSet.add(testProcess.pid);\r\n// \t});\r\n// }\r\n\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests');\r\n// // FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest\r\n// // setupSignalHandlers();\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest').then(result => {\r\n// // \tconsole.log('Test Class Result:', result.success, result.message);\r\n// // });\r\n// // runSingleTestMethod('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests.ResponseParserTests');\r\n\r\n// // vstest.console.exe \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /TestCaseFilter:\"FullyQualifiedName~${className}\"\r\n// // vstest.console.exe \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /Tests:SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId\r\n// // ./vstest.console.exe \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId\r\n// // .\\vstestexe.cmd \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /Tests:SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId\r\n// //.\\vstestexe.cmd \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll\" /TestCaseFilter:\"FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.SqmidHelperTests\"\r\n\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests').then(result => {\r\n// // \tconsole.log('Test Class Result:', result.success, result.message);\r\n// // });\r\n// // runSingleTestMethod('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_MissingUsrLocCookie_ReturnsEmptyString')\r\n// // runSingleTestMethod('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_InvalidBase64Bid_ReturnsEmptyString');\r\n// // runTestClass('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\bin\\\\Debug\\\\SharedSegments.Tests.dll', 'SharedSegments.Plugins.Tests.Workflows.Eplant.Conditions.EplantRequestCategoryConditionTests').then(result => {\r\n// // \tconsole.log('Test Class Result:', result.success, result.message);\r\n// // });"]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# General Unit Test Guidelines (For All C# Code)
|
|
2
|
+
- Use MSTest framework for all test code.
|
|
3
|
+
- The test code MUST NOT contain any comments or explanations.
|
|
4
|
+
- Ensure the test code MUST has no syntax errors.
|
|
5
|
+
- DO NOT mock any functions, classes, or values that appear in source code.
|
|
6
|
+
- Mock all dependent methods, classes, and values not included in the user input using the Moq library.
|
|
7
|
+
- Test public methods of class in source code only.
|
|
8
|
+
- **MUST NOT** access private members (fields or methods) of the source class in test code.
|
|
9
|
+
- MUST follow the namespace Import Rules (CRITICAL)
|
|
10
|
+
- Test code MUST include a namespace declaration.
|
|
11
|
+
- Place all `using` statements above the namespace declaration.
|
|
12
|
+
- Must import source code namespace in the test code.
|
|
13
|
+
- Must import all required .Net namespaces if any .Net class or interface are used in the test code.
|
|
14
|
+
- For **every .NET class, interface, attribute, or type** used in the test code:
|
|
15
|
+
- The test code MUST include the correct `using` statement at the top of the file to import the corresponding namespace.
|
|
16
|
+
- This includes (but is not limited to):
|
|
17
|
+
- .NET built-in types (e.g., `List<T>`, `IEnumerable<T>`, `Task`, `Assert`, `Moq.Mock`, etc.).
|
|
18
|
+
- Any attribute classes (e.g., `[TestMethod]`, `[TestClass]`, etc.).
|
|
19
|
+
- Any LINQ or threading related classes (e.g., `System.Linq`, `System.Threading.Tasks`).
|
|
20
|
+
- DO NOT assume that any namespace is implicitly available.
|
|
21
|
+
- The test code MUST compile successfully **without manually adding missing using directives**.
|
|
22
|
+
- Test method names must follow the pattern: [MethodName]_[Scenario]_[ExpectedResult].
|
|
23
|
+
- Return the test code in the format: ```C#\n<Test code>\n```.
|
|
24
|
+
- Ensure the test code MUST be able to compile by Visual Studio's MSBuild and pass the test with Visual Studio's vstest.
|
|
25
|
+
- MUST follow Type Safety Rules (VERY IMPORTANT)
|
|
26
|
+
- MUST not assign null to var type value, like: var request = null, it's forbidden,
|
|
27
|
+
- All assignments and method arguments in test code MUST strictly match the declared types in the source code.
|
|
28
|
+
- DO NOT assign values with incompatible types. DO NOT rely on implicit or accidental type conversion.
|
|
29
|
+
- Generic type names and type parameters MUST match exactly.
|
|
30
|
+
- If a parameter type is `IEnumerable<SampleObject>`, you MUST pass an `IEnumerable<SampleObject>`, not a single object or a different collection type.
|
|
31
|
+
- If type conversion is needed (e.g., from `List<T>` to `IEnumerable<T>`), you MUST explicitly convert (e.g., `.AsEnumerable()`, `.ToList()`).
|
|
32
|
+
Example of correct conversion: IEnumerable<ObjectStoreResponse_2> osResponses = osResponseList.AsEnumerable();
|
|
33
|
+
- Before generating the unit test cases, **MUST** analyze the provided code and verify its logic by following these steps:
|
|
34
|
+
1. Describe the functionality of each public method, including its inputs, outputs, and key logic.
|
|
35
|
+
2. Identify all possible execution paths for public methods, including normal cases, edge cases, and error conditions.
|
|
36
|
+
3. Explain any conditional branches, loops, or exception handling for public methods in the code.
|
|
37
|
+
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.
|
|
38
|
+
- MUST follow the Logic Coverage and Assertion Rules to write valid and meaningful test cases:
|
|
39
|
+
- The unit tests **MUST include at least one dedicated test case** for each significant logical path and branch.
|
|
40
|
+
- For each conditional branch, the input data in the test **MUST be crafted** so that:
|
|
41
|
+
- The input triggers that specific branch path.
|
|
42
|
+
- The expected `Assert` exactly matches the runtime behavior resulting from that path.
|
|
43
|
+
- Example for early-return failure branches:
|
|
44
|
+
- If source code has a check like `if (muidUser == null) return new PluginResult(false);`, then:
|
|
45
|
+
- **MUST** include a test case where input data causes `muidUser` to be `null`, and:
|
|
46
|
+
- The corresponding `Assert` must validate that the returned result indicates failure (`Assert.IsFalse(result.Success)` in MSTest).
|
|
47
|
+
- The test input data and mocks **MUST accurately satisfy the condition** required for each logic path.
|
|
48
|
+
- For example:
|
|
49
|
+
- If code returns failure when a list is empty, **test must pass an empty list** to trigger that failure.
|
|
50
|
+
- If code requires a specific OwnerId match, **input data must set that value**.
|
|
51
|
+
- **MUST NOT** assume all paths result in success.
|
|
52
|
+
- Test case Asserts **MUST reflect the actual code behavior**, not default to IsTrue/IsNotNull.
|
|
53
|
+
- If unable to infer expected behavior for a branch, **prioritize strict condition-to-assert consistency over guessing**.
|
|
54
|
+
- **Fail the generation** if logic paths exist but the tests do not cover them.
|
|
55
|
+
- MUST cover these scenarios: Main logic paths (e.g., happy path, edge cases), Exception handling if applicable and Boundary conditions (e.g., zero, negative, or null inputs).
|
|
56
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
Following Guidelines Application Logic:
|
|
10
|
+
- When the source code is NOT a XAP class:
|
|
11
|
+
- Apply ONLY the General Unit Test Guidelines.
|
|
12
|
+
- Completely IGNORE all XAP Unit Test Guidelines.
|
|
13
|
+
- When the source code IS a XAP class:
|
|
14
|
+
- Apply BOTH General and XAP Unit Test Guidelines.
|
|
15
|
+
- XAP Unit Test Guidelines priority is hignest.
|
|
16
|
+
|
|
17
|
+
You MUST NOT skip or ignore any applicable Guidelines from any section.
|
|
18
|
+
|
|
19
|
+
{% include 'xap/xapGuideline' %}
|
|
20
|
+
|
|
21
|
+
{% include 'general/generalUnitTestGuidelines' %}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
- DO NOT mock the functions, classes and values in souce code.
|
|
13
|
+
- Mock all dependencies not included in the source code using Moq.
|
|
14
|
+
- Mock all the dependent methods, values and classes that are not included in user input.
|
|
15
|
+
- Must not access private members (fields or methods) of the source class in test code, use public methods only.
|
|
16
|
+
- Must include a namespace in the test code, and put using statement above namespace.
|
|
17
|
+
- Must import source code namespace in the test code.
|
|
18
|
+
- Must import required .Net namespaces if using .Net class or interface in the test code.
|
|
19
|
+
- Test method names must follow the pattern: [MethodName]_[Scenario]_[ExpectedResult].
|
|
20
|
+
- Return the test code in the format: ```C#\n<Test code>\n```.
|
|
21
|
+
- Write valid test cases that cover:
|
|
22
|
+
- Main logic paths (e.g., happy path, edge cases).
|
|
23
|
+
- Exception handling if applicable.
|
|
24
|
+
- Boundary conditions (e.g., zero, negative, or null inputs).
|
|
25
|
+
- Ensure the generated test code can pass the test of vstest of visual studio.
|
|
26
|
+
|
|
27
|
+
{% if isXapTest %}
|
|
28
|
+
{%- include 'xap/xapGuideline' -%}
|
|
29
|
+
{%- endif -%}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
These guideline ONLY apply when the source code is a XAP class. Ignore all these rules for non-XAP classes.
|
|
2
|
+
### XAP code unit test Guideline
|
|
3
|
+
- XAP class introduction:
|
|
4
|
+
- inherits from one of the following interfaces: IPlugin, IConditionPlugin, Workflow, IExperiment, IPluginDataStore, IAsyncPlugin.
|
|
5
|
+
- implements an Execute method.
|
|
6
|
+
- Use ExecutionServices.CreateInstance<I{className}>() to create an instance of the XAP class, where the interface name is the class name prefixed with "I".
|
|
7
|
+
- For example, for a XAP class named SampleWorkflow, create the instance: **var sampleWorkflow = ExecutionServices.CreateInstance<ISampleWorkflow>()**.
|
|
8
|
+
- ExecutionServices.CreateInstance can only be used to create XAP class instances, MUST not be used to create non-XAP class instance.
|
|
9
|
+
- The parameters of the Execute method in XAP class instance is different with source code.
|
|
10
|
+
- The parameters with types: **PluginServices**, **PluginOutput<T>** or decorated with the **[ConfigFile("{configFileName}")]** attribute are deleted, try to mock these types is invalid and not allowed.
|
|
11
|
+
- For example, for a Execute definition of SampleWorkflow is: **PluginResult Execute(PluginServices ps, PluginOutput<Resp> resp, [ConfigFile("config.ini")] EplantConfig eplantConfig, OsResponse osResp = null, EplantRequest req = null)**, call the Execute with SampleWorkflow instance: **sampleWorkflow.Execute(Task.FromResult(osResp), Task.FromResult(req)).Result**.
|
|
12
|
+
- For the remaining parameters
|
|
13
|
+
- MUST ensure that the argument types in test code match the method's declared parameter types exactly.
|
|
14
|
+
- MUST keep the original order and be wrapped using Task.FromResult({value}).
|
|
15
|
+
- The parameters of type **PluginOutput<T>** in Execute method must be treated as method outputs
|
|
16
|
+
- MUST access the value of type PluginOutput<T> using XAP class instance with the **parameter name**.
|
|
17
|
+
- For example, one XAP class named SampleWorkflow, its Execute method signature: **Execute(PluginServices pluginServices, PluginOutput<Resp> pluginResp, Request req = null)**, SampleWorkflow instance is sampleWorkflow,use **sampleWorkflow.pluginResult** can get the output value.
|
|
18
|
+
- MUST get the fields of type **T** of **PluginOutput<T>** using **Result** property.
|
|
19
|
+
- For example, there's one field named **Key** of **Resp**, for PluginOutput<Resp> pluginOutput, **MUST** get **Key** using: **sampleWorkflow.pluginResp.Result.Key**.
|
|
20
|
+
- **MUST** assert the value of type **PluginOutput<T>**, example:
|
|
21
|
+
```
|
|
22
|
+
Assert.NotNull(sampleWorkflow.pluginResult.Result.Key);
|
|
23
|
+
Assert.AreEqual(sampleWorkflow.pluginResult.Result.Key, "key");
|
|
24
|
+
```
|
|
25
|
+
- Bond stucture will be used in XAP class, treat these structures as regular C# classes.
|
|
26
|
+
- MUST import bond namespaces when using bond structures in test code.
|
|
27
|
+
- Bond structure can import other bond structures using namespaces, get dependent structures definition from user input by name and treat all as regular C# class.
|
|
28
|
+
- MUST use ExecutionServices.CreateInstance<{bond structure name}>() to create an instance of bond structure.
|
|
29
|
+
- Bond structure fields without **optional** modifier is **required** and MUST ensure that all required fields are assigned valid non-null values in test code.
|
|
30
|
+
- For following bond structure, after creating the instance, MUST assign valid non-null value to all fields except **WalletContent**
|
|
31
|
+
```
|
|
32
|
+
struct EplantUser
|
|
33
|
+
{
|
|
34
|
+
1: uint64 Score;
|
|
35
|
+
2: int64 Created;
|
|
36
|
+
3: string Market;
|
|
37
|
+
4: vector<string> Trees;
|
|
38
|
+
5: EplantUserWeatherContent WeatherContent;
|
|
39
|
+
6: bool MergeNotifyWeather;
|
|
40
|
+
7: optional EplantUserWalletContent WalletContent;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
- One confusing example, for the required fields, there's still null checks in the source code, like **if (eplantUser?.Market == null)**. In this case, just test the case when eplantUser is null.
|
|
44
|
+
- MUST take care type convertion
|
|
45
|
+
- To convert IList type to IEnumerable type, must use AsEnumerable(), e.g. IEnumerable osResponses = osResponseList.AsEnumerable()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const tree_kill_1 = __importDefault(require("tree-kill"));
|
|
8
|
+
const msbuildCommand = `"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\MSBuild.exe" "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj" /t:Build /m /nr:true /v:minimal`;
|
|
9
|
+
const child = (0, child_process_1.exec)(msbuildCommand);
|
|
10
|
+
const pid = child.pid;
|
|
11
|
+
// setTimeout(() => {
|
|
12
|
+
// console.log('Trying to kill...');
|
|
13
|
+
// // child.kill(); // 默认发送 SIGTERM(Windows 下为 TerminateProcess)
|
|
14
|
+
// treeKill(pid, (err) => {
|
|
15
|
+
// if (err) {
|
|
16
|
+
// console.error(`Failed to kill pid=${pid}:`, err.message);
|
|
17
|
+
// } else {
|
|
18
|
+
// console.log(`Killed pid=${pid}`);
|
|
19
|
+
// }
|
|
20
|
+
// });
|
|
21
|
+
// }, 30000);
|
|
22
|
+
// setTimeout(() => {
|
|
23
|
+
// console.log('exit...');
|
|
24
|
+
// }, 40000);
|
|
25
|
+
process.on('SIGINT', async () => {
|
|
26
|
+
console.log('🛑 SIGINT received (Ctrl+C)');
|
|
27
|
+
(0, tree_kill_1.default)(pid, (err) => {
|
|
28
|
+
if (err) {
|
|
29
|
+
console.error(`Failed to kill pid=${pid}:`, err.message);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log(`Killed pid=${pid}`);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
// process.exit(0);
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=testbuildkill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testbuildkill.js","sourceRoot":"","sources":["../../src/codebk/testbuildkill.ts"],"names":[],"mappings":";;;;;AAAA,iDAA4C;AAE5C,0DAAiC;AAEjC,MAAM,cAAc,GAAG,iQAAiQ,CAAC;AACzR,MAAM,KAAK,GAAG,IAAA,oBAAI,EAAC,cAAc,CAAC,CAAC;AACnC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;AACtB,qBAAqB;AACrB,sCAAsC;AACtC,kEAAkE;AAClE,4BAA4B;AAC5B,yBAAyB;AACzB,4EAA4E;AAC5E,uBAAuB;AACvB,oDAAoD;AACpD,gBAAgB;AAChB,cAAc;AAGd,aAAa;AAEb,qBAAqB;AACrB,oCAAoC;AACpC,qBAAqB;AAGrB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;IAC5B,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC3C,IAAA,mBAAQ,EAAC,GAAG,EAAG,CAAC,GAAG,EAAE,EAAE;QACf,IAAI,GAAG,EAAE,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,sBAAsB,GAAG,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,EAAE,CAAC,CAAC;QACrC,CAAC;IACL,CAAC,CAAC,CAAC;IACP,mBAAmB;AACvB,CAAC,CAAC,CAAC","sourcesContent":["import { exec, spawn } from 'child_process';\r\n\r\nimport treeKill from 'tree-kill';\r\n\r\nconst msbuildCommand = `\"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Enterprise\\\\MSBuild\\\\Current\\\\Bin\\\\amd64\\\\MSBuild.exe\" \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj\" /t:Build /m /nr:true /v:minimal`;\r\nconst child = exec(msbuildCommand);\r\nconst pid = child.pid;\r\n// setTimeout(() => {\r\n// console.log('Trying to kill...');\r\n// // child.kill(); // 默认发送 SIGTERM(Windows 下为 TerminateProcess)\r\n// treeKill(pid, (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// });\r\n \r\n \r\n// }, 30000);\r\n\r\n// setTimeout(() => {\r\n// console.log('exit...');\r\n// }, 40000);\r\n\r\n\r\nprocess.on('SIGINT', async () => {\r\n console.log('🛑 SIGINT received (Ctrl+C)');\r\n treeKill(pid, (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 });\r\n // process.exit(0);\r\n});\r\n"]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const utGenWrapper_1 = require("./utGenWrapper");
|
|
8
|
+
const yargs_1 = __importDefault(require("yargs/yargs"));
|
|
9
|
+
const helpers_1 = require("yargs/helpers");
|
|
10
|
+
const setupProcessSignalHandler_1 = require("../exit/setupProcessSignalHandler");
|
|
11
|
+
// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\HttpRequestParser\\Utils\\SqmidHelper.cs', '--keepFailedTest', "1", "--af", "1"];
|
|
12
|
+
// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\Conditions\\EplantRequestCategoryCondition.cs', '--keepFailedTest', "1", "--af", "1"];
|
|
13
|
+
// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\ResponseBuilders\\EplantMigrateResponseBuilder.cs', '--keepFailedTest', "1", "--af", "1"];
|
|
14
|
+
// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\HttpRequestParser\\Utils\\WeatherParamsHttpConverter.cs', '--keepFailedTest', "1", "--af", "1"];
|
|
15
|
+
// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Eplant\\RequestBuilders\\EplantRankRequestBuilder.cs', '--keepFailedTest', "1", "--af", "1"];
|
|
16
|
+
function main() {
|
|
17
|
+
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
|
|
18
|
+
// Yargs(hideBin(hardcodedArgs))
|
|
19
|
+
.scriptName('csharp-ut')
|
|
20
|
+
.option('source', {
|
|
21
|
+
describe: 'where the test copilot is running',
|
|
22
|
+
choices: ['csharpUtGen', 'csvsplugin', 'csVsCodePlugin', 'pipeline'],
|
|
23
|
+
default: 'csharpUtGen',
|
|
24
|
+
type: 'string',
|
|
25
|
+
})
|
|
26
|
+
.option('mode', {
|
|
27
|
+
alias: 'm',
|
|
28
|
+
describe: 'test copilot work mode.', // Note: only generate is supported now
|
|
29
|
+
choices: ['generate', 'repair'],
|
|
30
|
+
default: 'generate',
|
|
31
|
+
type: 'string',
|
|
32
|
+
})
|
|
33
|
+
.option('keepFailedTest', {
|
|
34
|
+
describe: 'whether to keep failed test cases',
|
|
35
|
+
choices: [0, 1], // 0 means delete failed test cases, 1 means keep failed test cases
|
|
36
|
+
default: 1,
|
|
37
|
+
type: 'number',
|
|
38
|
+
})
|
|
39
|
+
.option('enableCov', {
|
|
40
|
+
describe: 'whether to run coverage',
|
|
41
|
+
choices: [0, 1], // 0 means not run coverage, 1 means run coverage
|
|
42
|
+
default: 0,
|
|
43
|
+
type: 'number',
|
|
44
|
+
})
|
|
45
|
+
.option('LLMModel', {
|
|
46
|
+
describe: 'use which LLM model', // Note: only gpt4o is supported now
|
|
47
|
+
default: "gpt4o",
|
|
48
|
+
type: 'string',
|
|
49
|
+
})
|
|
50
|
+
.option('sourceCodePath', {
|
|
51
|
+
alias: 's',
|
|
52
|
+
describe: 'source code file path / project path or solution path for batch generation',
|
|
53
|
+
type: 'string',
|
|
54
|
+
})
|
|
55
|
+
.option('testCodePath', {
|
|
56
|
+
alias: 't',
|
|
57
|
+
describe: 'Target file or directory',
|
|
58
|
+
type: 'string',
|
|
59
|
+
})
|
|
60
|
+
.option('autofix', {
|
|
61
|
+
alias: 'af',
|
|
62
|
+
describe: 'whether to auto fix generated test code',
|
|
63
|
+
choices: [0, 1], // 0 means not auto fix, 1 means auto fix
|
|
64
|
+
default: 0,
|
|
65
|
+
type: 'number',
|
|
66
|
+
})
|
|
67
|
+
.option('nugetPackagePath', {
|
|
68
|
+
alias: 'np',
|
|
69
|
+
describe: 'The path to the NuGet packages used by the code analyzer. Used scenario: when the code analyzer is executed in CI pipeline',
|
|
70
|
+
type: 'string',
|
|
71
|
+
})
|
|
72
|
+
.command('utcmd', 'Generate unit test', () => { }, (c) => {
|
|
73
|
+
console.log('Command executed with options:', c);
|
|
74
|
+
(0, utGenWrapper_1.generateUtCode)(c);
|
|
75
|
+
})
|
|
76
|
+
.command('utbatch', 'Generate unit test report for all project/solution files using command line', () => { }, (c) => {
|
|
77
|
+
console.log('Command executed with options:', c);
|
|
78
|
+
(0, utGenWrapper_1.generateBatchUtCode)(c);
|
|
79
|
+
})
|
|
80
|
+
.command('utbenchmark', 'Generate unit test report for all project/solution files using command line', () => { }, (c) => {
|
|
81
|
+
console.log('Command executed with options:', c);
|
|
82
|
+
(0, utGenWrapper_1.generateUtBenchmark)(c);
|
|
83
|
+
})
|
|
84
|
+
.help()
|
|
85
|
+
.alias('help', 'h')
|
|
86
|
+
.parse();
|
|
87
|
+
}
|
|
88
|
+
(0, setupProcessSignalHandler_1.setupSignalHandlers)();
|
|
89
|
+
main();
|
|
90
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command/index.ts"],"names":[],"mappings":";;;;;;AAEA,iDAA0F;AAE1F,wDAAgC;AAChC,2CAAwC;AACxC,iFAAwE;AAExE,mPAAmP;AACnP,sPAAsP;AACtP,0PAA0P;AAC1P,kQAAkQ;AAClQ,qPAAqP;AACrP,SAAS,IAAI;IACT,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACxB,gCAAgC;SAC/B,UAAU,CAAC,WAAW,CAAC;SACvB,MAAM,CACH,QAAQ,EACR;QACI,QAAQ,EAAE,mCAAmC;QAC7C,OAAO,EAAE,CAAC,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,CAAC;QACpE,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,MAAM,EACN;QACI,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,yBAAyB,EAAE,uCAAuC;QAC5E,OAAO,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;QAC/B,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,gBAAgB,EAChB;QACI,QAAQ,EAAE,mCAAmC;QAC7C,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,mEAAmE;QACpF,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,WAAW,EACX;QACI,QAAQ,EAAE,yBAAyB;QACnC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,iDAAiD;QAClE,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,UAAU,EACV;QACI,QAAQ,EAAE,qBAAqB,EAAE,oCAAoC;QACrE,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,gBAAgB,EAChB;QACI,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,4EAA4E;QACtF,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,cAAc,EACd;QACI,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,0BAA0B;QACpC,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,SAAS,EACT;QACI,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,yCAAyC;QACnD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,yCAAyC;QAC1D,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,MAAM,CACH,kBAAkB,EAClB;QACI,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,4HAA4H;QACtI,IAAI,EAAE,QAAQ;KACjB,CACJ;SACA,OAAO,CACJ,OAAO,EACP,oBAAoB,EACpB,GAAG,EAAE,GAAG,CAAC,EACT,CAAC,CAAC,EAAE,EAAE;QACF,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC,CAAC;QACjD,IAAA,6BAAc,EAAC,CAAC,CAAC,CAAC;IACtB,CAAC,CACJ;SACA,OAAO,CACJ,SAAS,EACT,6EAA6E,EAC7E,GAAG,EAAE,GAAG,CAAC,EACT,CAAC,CAAC,EAAE,EAAE;QACF,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC,CAAC;QACjD,IAAA,kCAAmB,EAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CACJ;SACA,OAAO,CACJ,aAAa,EACb,6EAA6E,EAC7E,GAAG,EAAE,GAAG,CAAC,EACT,CAAC,CAAC,EAAE,EAAE;QACF,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,CAAC,CAAC,CAAC;QACjD,IAAA,kCAAmB,EAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CACJ;SACA,IAAI,EAAE;SACN,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC;SAClB,KAAK,EAAE,CAAC;AACjB,CAAC;AAED,IAAA,+CAAmB,GAAE,CAAC;AACtB,IAAI,EAAE,CAAC","sourcesContent":["#!/usr/bin/env node\r\n\r\nimport { generateBatchUtCode, generateUtBenchmark, generateUtCode } from './utGenWrapper';\r\n\r\nimport Yargs from 'yargs/yargs';\r\nimport { hideBin } from 'yargs/helpers';\r\nimport { setupSignalHandlers } from '../exit/setupProcessSignalHandler';\r\n\r\n// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\HttpRequestParser\\\\Utils\\\\SqmidHelper.cs', '--keepFailedTest', \"1\", \"--af\", \"1\"];\r\n// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\Conditions\\\\EplantRequestCategoryCondition.cs', '--keepFailedTest', \"1\", \"--af\", \"1\"];\r\n// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\ResponseBuilders\\\\EplantMigrateResponseBuilder.cs', '--keepFailedTest', \"1\", \"--af\", \"1\"];\r\n// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\HttpRequestParser\\\\Utils\\\\WeatherParamsHttpConverter.cs', '--keepFailedTest', \"1\", \"--af\", \"1\"];\r\n// const hardcodedArgs = ['', '', 'utcmd', '--s', 'D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Eplant\\\\RequestBuilders\\\\EplantRankRequestBuilder.cs', '--keepFailedTest', \"1\", \"--af\", \"1\"];\r\nfunction main() {\r\n Yargs(hideBin(process.argv))\r\n // Yargs(hideBin(hardcodedArgs))\r\n .scriptName('csharp-ut')\r\n .option(\r\n 'source',\r\n {\r\n describe: 'where the test copilot is running',\r\n choices: ['csharpUtGen', 'csvsplugin', 'csVsCodePlugin', 'pipeline'],\r\n default: 'csharpUtGen',\r\n type: 'string',\r\n }\r\n )\r\n .option(\r\n 'mode',\r\n {\r\n alias: 'm',\r\n describe: 'test copilot work mode.', // Note: only generate is supported now\r\n choices: ['generate', 'repair'],\r\n default: 'generate',\r\n type: 'string',\r\n }\r\n )\r\n .option(\r\n 'keepFailedTest',\r\n {\r\n describe: 'whether to keep failed test cases',\r\n choices: [0, 1], // 0 means delete failed test cases, 1 means keep failed test cases\r\n default: 1,\r\n type: 'number',\r\n }\r\n )\r\n .option(\r\n 'enableCov',\r\n {\r\n describe: 'whether to run coverage',\r\n choices: [0, 1], // 0 means not run coverage, 1 means run coverage\r\n default: 0,\r\n type: 'number',\r\n }\r\n )\r\n .option(\r\n 'LLMModel',\r\n {\r\n describe: 'use which LLM model', // Note: only gpt4o is supported now\r\n default: \"gpt4o\",\r\n type: 'string',\r\n }\r\n )\r\n .option(\r\n 'sourceCodePath',\r\n {\r\n alias: 's',\r\n describe: 'source code file path / project path or solution path for batch generation',\r\n type: 'string',\r\n }\r\n )\r\n .option(\r\n 'testCodePath',\r\n {\r\n alias: 't',\r\n describe: 'Target file or directory',\r\n type: 'string',\r\n }\r\n )\r\n .option(\r\n 'autofix',\r\n {\r\n alias: 'af',\r\n describe: 'whether to auto fix generated test code',\r\n choices: [0, 1], // 0 means not auto fix, 1 means auto fix\r\n default: 0,\r\n type: 'number',\r\n }\r\n )\r\n .option(\r\n 'nugetPackagePath',\r\n {\r\n alias: 'np',\r\n describe: 'The path to the NuGet packages used by the code analyzer. Used scenario: when the code analyzer is executed in CI pipeline',\r\n type: 'string',\r\n }\r\n )\r\n .command(\r\n 'utcmd',\r\n 'Generate unit test',\r\n () => { },\r\n (c) => {\r\n console.log('Command executed with options:', c);\r\n generateUtCode(c);\r\n }\r\n )\r\n .command(\r\n 'utbatch',\r\n 'Generate unit test report for all project/solution files using command line',\r\n () => { },\r\n (c) => {\r\n console.log('Command executed with options:', c);\r\n generateBatchUtCode(c);\r\n }\r\n )\r\n .command(\r\n 'utbenchmark',\r\n 'Generate unit test report for all project/solution files using command line',\r\n () => { },\r\n (c) => {\r\n console.log('Command executed with options:', c);\r\n generateUtBenchmark(c);\r\n }\r\n )\r\n .help()\r\n .alias('help', 'h')\r\n .parse();\r\n}\r\n\r\nsetupSignalHandlers();\r\nmain();"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateUtCode = generateUtCode;
|
|
4
|
+
exports.generateBatchUtCode = generateBatchUtCode;
|
|
5
|
+
exports.generateUtBenchmark = generateUtBenchmark;
|
|
6
|
+
const stdListener_1 = require("../vsPlugin/stdListener");
|
|
7
|
+
const constants_1 = require("../types/constants");
|
|
8
|
+
const generateCodeTests_1 = require("../batch/generateCodeTests");
|
|
9
|
+
const csharpUtGen_1 = require("../gen/csharpUtGen");
|
|
10
|
+
const generateBenchmarkReport_1 = require("../benchmark/generateBenchmarkReport");
|
|
11
|
+
async function generateUtCode(c) {
|
|
12
|
+
const autofix = c.autofix === 1;
|
|
13
|
+
const keepFailedTest = c.keepFailedTest === 1;
|
|
14
|
+
switch (c.source) {
|
|
15
|
+
case constants_1.CSVSPLUGIN:
|
|
16
|
+
try {
|
|
17
|
+
c.autofix === 1 && (0, stdListener_1.startStdListener)();
|
|
18
|
+
await (0, csharpUtGen_1.generateCsharpUtCode)(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, c.source, false, c.nugetPackagePath);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error("Error in generateUtCode with VS Plugin:", error);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
if (c.autofix === 1 && stdListener_1.readLineInterface) {
|
|
25
|
+
stdListener_1.readLineInterface.close();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
case constants_1.CSVSCODEPLUGIN:
|
|
30
|
+
await (0, csharpUtGen_1.generateCsharpUtCode)(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, constants_1.CSVSCODEPLUGIN, false, c.nugetPackagePath);
|
|
31
|
+
break;
|
|
32
|
+
case constants_1.PIPELINE:
|
|
33
|
+
await (0, csharpUtGen_1.generateCsharpUtCode)(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, constants_1.PIPELINE, false, c.nugetPackagePath);
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
await (0, csharpUtGen_1.generateCsharpUtCode)(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, constants_1.CSHARPUTGEN, false, c.nugetPackagePath);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function generateBatchUtCode(c) {
|
|
41
|
+
const autofix = c.autofix === 1;
|
|
42
|
+
const keepFailedTest = c.keepFailedTest === 1;
|
|
43
|
+
await (0, generateCodeTests_1.generateBatchTests)(c.sourceCodePath, autofix, keepFailedTest);
|
|
44
|
+
}
|
|
45
|
+
async function generateUtBenchmark(c) {
|
|
46
|
+
const autofix = c.autofix === 1;
|
|
47
|
+
const keepFailedTest = c.keepFailedTest === 1;
|
|
48
|
+
await (0, generateBenchmarkReport_1.generateBenchmarkReport)(c.sourceCodePath, autofix, keepFailedTest, c.source);
|
|
49
|
+
}
|
|
50
|
+
// generateUtCode({sourceCodePath: "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Plugins\\Workflows\\Overview\\HttpRequestParser\\Utils\\SqmidHelper.cs", keepFailedTest: 1});
|
|
51
|
+
// generateUtBenchmarkReport({sourceCodePath: "Q:\\MyProject\\TestTestReport\\TestTestReport\\TestTestReport.csproj", autofix: 1, keepFailedTest: 1, source: CSVSPLUGIN});
|
|
52
|
+
// generateUtBenchmarkReport({sourceCodePath: "Q:\\MyProject\\TestTestReport\\TestTestReport\\TestFolder", autofix: 1, keepFailedTest: 1, source: CSVSPLUGIN});
|
|
53
|
+
//# sourceMappingURL=utGenWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utGenWrapper.js","sourceRoot":"","sources":["../../src/command/utGenWrapper.ts"],"names":[],"mappings":";;AAOA,wCA0BC;AAED,kDAIC;AAED,kDAIC;AA7CD,yDAA8E;AAE9E,kDAAuF;AACvF,kEAAgE;AAChE,oDAA0D;AAC1D,kFAA+E;AAExE,KAAK,UAAU,cAAc,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC;IAChC,MAAM,cAAc,GAAG,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC;IAC9C,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;QACf,KAAK,sBAAU;YACX,IAAI,CAAC;gBACD,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,IAAA,8BAAgB,GAAE,CAAC;gBACtC,MAAM,IAAA,kCAAoB,EAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;YAC/H,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,KAAK,CAAC,CAAC;YACpE,CAAC;oBAAS,CAAC;gBACP,IAAI,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,+BAAiB,EAAC,CAAC;oBACtC,+BAAiB,CAAC,KAAK,EAAE,CAAC;gBAC9B,CAAC;YACL,CAAC;YACD,MAAM;QACV,KAAK,0BAAc;YACf,MAAM,IAAA,kCAAoB,EAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,0BAAc,EAAE,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;YACjI,MAAM;QACV,KAAK,oBAAQ;YACT,MAAM,IAAA,kCAAoB,EAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,oBAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;YAC3H,MAAM;QACV;YACI,MAAM,IAAA,kCAAoB,EAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,uBAAW,EAAE,KAAK,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;YAC9H,MAAM;IACd,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC;IAChC,MAAM,cAAc,GAAG,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC;IAC9C,MAAM,IAAA,sCAAkB,EAAC,CAAC,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AACxE,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC;IAChC,MAAM,cAAc,GAAG,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC;IAC9C,MAAM,IAAA,iDAAuB,EAAC,CAAC,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;AACvF,CAAC;AAGD,kNAAkN;AAClN,0KAA0K;AAC1K,+JAA+J","sourcesContent":["import { readLineInterface, startStdListener } from \"../vsPlugin/stdListener\";\r\n\r\nimport { CSHARPUTGEN, CSVSCODEPLUGIN, CSVSPLUGIN, PIPELINE } from \"../types/constants\";\r\nimport { generateBatchTests } from \"../batch/generateCodeTests\";\r\nimport { generateCsharpUtCode } from \"../gen/csharpUtGen\";\r\nimport { generateBenchmarkReport } from '../benchmark/generateBenchmarkReport';\r\n\r\nexport async function generateUtCode(c) {\r\n const autofix = c.autofix === 1;\r\n const keepFailedTest = c.keepFailedTest === 1;\r\n switch (c.source) {\r\n case CSVSPLUGIN:\r\n try {\r\n c.autofix === 1 && startStdListener();\r\n await generateCsharpUtCode(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, c.source, false, c.nugetPackagePath);\r\n } catch (error) {\r\n console.error(\"Error in generateUtCode with VS Plugin:\", error);\r\n } finally {\r\n if (c.autofix === 1 && readLineInterface){\r\n readLineInterface.close();\r\n }\r\n }\r\n break;\r\n case CSVSCODEPLUGIN:\r\n await generateCsharpUtCode(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, CSVSCODEPLUGIN, false, c.nugetPackagePath);\r\n break;\r\n case PIPELINE:\r\n await generateCsharpUtCode(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, PIPELINE, false, c.nugetPackagePath);\r\n break;\r\n default:\r\n await generateCsharpUtCode(c.sourceCodePath, c.testCodePath, autofix, keepFailedTest, CSHARPUTGEN, false, c.nugetPackagePath);\r\n break;\r\n }\r\n}\r\n\r\nexport async function generateBatchUtCode(c) {\r\n const autofix = c.autofix === 1;\r\n const keepFailedTest = c.keepFailedTest === 1;\r\n await generateBatchTests(c.sourceCodePath, autofix, keepFailedTest);\r\n}\r\n\r\nexport async function generateUtBenchmark(c) {\r\n const autofix = c.autofix === 1;\r\n const keepFailedTest = c.keepFailedTest === 1;\r\n await generateBenchmarkReport(c.sourceCodePath, autofix, keepFailedTest, c.source);\r\n}\r\n\r\n\r\n// generateUtCode({sourceCodePath: \"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Plugins\\\\Workflows\\\\Overview\\\\HttpRequestParser\\\\Utils\\\\SqmidHelper.cs\", keepFailedTest: 1});\r\n// generateUtBenchmarkReport({sourceCodePath: \"Q:\\\\MyProject\\\\TestTestReport\\\\TestTestReport\\\\TestTestReport.csproj\", autofix: 1, keepFailedTest: 1, source: CSVSPLUGIN});\r\n// generateUtBenchmarkReport({sourceCodePath: \"Q:\\\\MyProject\\\\TestTestReport\\\\TestTestReport\\\\TestFolder\", autofix: 1, keepFailedTest: 1, source: CSVSPLUGIN});"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.childProcessSet = void 0;
|
|
7
|
+
exports.killAllChildProcesses = killAllChildProcesses;
|
|
8
|
+
const tree_kill_1 = __importDefault(require("tree-kill"));
|
|
9
|
+
exports.childProcessSet = new Set();
|
|
10
|
+
function isProcessAlive(pid) {
|
|
11
|
+
try {
|
|
12
|
+
process.kill(pid, 0);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function killPidAsync(pid) {
|
|
20
|
+
return new Promise(async (resolve) => {
|
|
21
|
+
if (!isProcessAlive(pid)) {
|
|
22
|
+
console.log(`PID ${pid} already exited`);
|
|
23
|
+
return resolve();
|
|
24
|
+
}
|
|
25
|
+
console.log(`Killing child process with PID: ${pid}`);
|
|
26
|
+
(0, tree_kill_1.default)(pid, "SIGKILL", (err) => {
|
|
27
|
+
if (err) {
|
|
28
|
+
console.error(`Failed to kill pid=${pid}:`, err.message);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.log(`Killed pid=${pid}`);
|
|
32
|
+
}
|
|
33
|
+
resolve();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
async function killAllChildProcesses() {
|
|
38
|
+
const pids = Array.from(exports.childProcessSet);
|
|
39
|
+
console.log('Killing all child processes: ' + pids.join(', '));
|
|
40
|
+
await Promise.all(pids.map((pid) => killPidAsync(pid)));
|
|
41
|
+
console.log('All child processes have been killed.');
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=childProcessManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"childProcessManager.js","sourceRoot":"","sources":["../../src/exit/childProcessManager.ts"],"names":[],"mappings":";;;;;;AAgCA,sDAKC;AArCD,0DAAiC;AAEpB,QAAA,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;AAEjD,SAAS,cAAc,CAAC,GAAW;IAC/B,IAAI,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC7B,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACjC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC,CAAC;YACzC,OAAO,OAAO,EAAE,CAAC;QACrB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;QACtD,IAAA,mBAAQ,EAAC,GAAG,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7B,IAAI,GAAG,EAAE,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,sBAAsB,GAAG,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,GAAG,CAAC,cAAc,GAAG,EAAE,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAEM,KAAK,UAAU,qBAAqB;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,uBAAe,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,+BAA+B,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import treeKill from \"tree-kill\";\r\n\r\nexport const childProcessSet = new Set<number>();\r\n\r\nfunction 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\nfunction 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\nexport 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}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupSignalHandlers(): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupSignalHandlers = setupSignalHandlers;
|
|
4
|
+
const childProcessManager_1 = require("./childProcessManager");
|
|
5
|
+
const stdListener_1 = require("../vsPlugin/stdListener");
|
|
6
|
+
function setupSignalHandlers() {
|
|
7
|
+
process.on('SIGINT', async () => {
|
|
8
|
+
console.log('SIGINT received (Ctrl+C)');
|
|
9
|
+
await (0, childProcessManager_1.killAllChildProcesses)();
|
|
10
|
+
stdListener_1.readLineInterface?.close();
|
|
11
|
+
process.exit(0);
|
|
12
|
+
});
|
|
13
|
+
process.on('exit', () => {
|
|
14
|
+
childProcessManager_1.childProcessSet.clear();
|
|
15
|
+
console.log('Process exiting...');
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=setupProcessSignalHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupProcessSignalHandler.js","sourceRoot":"","sources":["../../src/exit/setupProcessSignalHandler.ts"],"names":[],"mappings":";;AAIA,kDAYC;AAhBD,+DAA+E;AAE/E,yDAA4D;AAE5D,SAAgB,mBAAmB;IAC/B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACxC,MAAM,IAAA,2CAAqB,GAAE,CAAC;QAC9B,+BAAiB,EAAE,KAAK,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,qCAAe,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { childProcessSet, killAllChildProcesses } from \"./childProcessManager\";\r\n\r\nimport { readLineInterface } from \"../vsPlugin/stdListener\";\r\n\r\nexport function setupSignalHandlers() {\r\n process.on('SIGINT', async () => {\r\n console.log('SIGINT received (Ctrl+C)');\r\n await killAllChildProcesses();\r\n readLineInterface?.close();\r\n process.exit(0);\r\n });\r\n\r\n process.on('exit', () => {\r\n childProcessSet.clear();\r\n console.log('Process exiting...');\r\n });\r\n}"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { GenResult } from "../types/genResult";
|
|
2
|
+
export declare function autoFixTestCode(prompts: any[], sourceCodePath: string, testCode: string, testProjectPath: string, testFilePath: string, testFramework: string, isXapCode: boolean, isVsPlugin: boolean, retryTimes?: number, isBenchmark?: boolean): Promise<GenResult>;
|
|
3
|
+
export declare function generateAutoFixCode(prompts: any[], generatedCode: string, errorMessage: string, isBuildFailure: boolean, testFilePath: string, testFramework: string, isXapCode: boolean): Promise<string>;
|
|
4
|
+
export declare function autoRetryTestCode(prompts: any[], sourceCodePath: string, testCode: string, testProjectPath: string, testFilePath: string, testFramework: string, isXapCode: boolean, retryTimes?: number): Promise<GenResult>;
|