@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,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyTestCode = verifyTestCode;
|
|
4
|
+
const getCodeStructurePath_1 = require("./getCodeStructurePath");
|
|
5
|
+
const getTestCodeInfo_1 = require("./getTestCodeInfo");
|
|
6
|
+
const msBuild_1 = require("../vs/msBuild");
|
|
7
|
+
const vsTest_1 = require("../vs/vsTest");
|
|
8
|
+
async function verifyTestCode(testCode, testProjectPath) {
|
|
9
|
+
const startTime = Date.now();
|
|
10
|
+
const { success: buildSuccess, message: buildMessage, buildErrors } = await (0, msBuild_1.runMsBuild)(testProjectPath);
|
|
11
|
+
if (!buildSuccess) {
|
|
12
|
+
console.error(`build failed: ${buildMessage}`);
|
|
13
|
+
return { success: false, message: buildMessage, buildErrors: buildErrors, testResult: null };
|
|
14
|
+
}
|
|
15
|
+
const testProjectDll = (0, getCodeStructurePath_1.getBuiltDllPath)(testProjectPath);
|
|
16
|
+
const testClassName = (0, getTestCodeInfo_1.getTestClassName)(testCode);
|
|
17
|
+
const { success: testSuccess, message: testMessage, testResult } = await (0, vsTest_1.runTestClass)(testProjectDll, testClassName);
|
|
18
|
+
if (!testSuccess) {
|
|
19
|
+
console.error(`test failed: ${testMessage}`);
|
|
20
|
+
return { success: false, message: testMessage, buildErrors: null, testResult };
|
|
21
|
+
}
|
|
22
|
+
console.log(`Verify time: ${(Date.now() - startTime) / 1000} seconds`);
|
|
23
|
+
return { success: true, message: "", buildErrors: null, testResult: null };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=verifyTestCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyTestCode.js","sourceRoot":"","sources":["../../src/utils/verifyTestCode.ts"],"names":[],"mappings":";;AAMA,wCAkBC;AAvBD,iEAAyD;AACzD,uDAAqD;AACrD,2CAA2C;AAC3C,yCAA4C;AAErC,KAAK,UAAU,cAAc,CAAC,QAAgB,EAAE,eAAuB;IAC1E,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,oBAAU,EAAC,eAAe,CAAC,CAAC;IACxG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,iBAAiB,YAAY,EAAE,CAAC,CAAC;QAC/C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACjG,CAAC;IAED,MAAM,cAAc,GAAG,IAAA,sCAAe,EAAC,eAAe,CAAC,CAAC;IACxD,MAAM,aAAa,GAAG,IAAA,kCAAgB,EAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,qBAAY,EAAC,cAAc,EAAE,aAAa,CAAC,CAAC;IACrH,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,WAAW,EAAE,CAAC,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACnF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,UAAU,CAAC,CAAC;IACvE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC/E,CAAC","sourcesContent":["import { VerifyResult } from \"../types/verifyResult\";\r\nimport { getBuiltDllPath } from \"./getCodeStructurePath\";\r\nimport { getTestClassName } from \"./getTestCodeInfo\";\r\nimport { runMsBuild } from \"../vs/msBuild\";\r\nimport { runTestClass } from \"../vs/vsTest\";\r\n\r\nexport async function verifyTestCode(testCode: string, testProjectPath: string): Promise<VerifyResult> {\r\n const startTime = Date.now();\r\n const { success: buildSuccess, message: buildMessage, buildErrors } = await runMsBuild(testProjectPath);\r\n if (!buildSuccess) {\r\n console.error(`build failed: ${buildMessage}`);\r\n return { success: false, message: buildMessage, buildErrors: buildErrors, testResult: null };\r\n }\r\n\r\n const testProjectDll = getBuiltDllPath(testProjectPath);\r\n const testClassName = getTestClassName(testCode);\r\n const { success: testSuccess, message: testMessage, testResult } = await runTestClass(testProjectDll, testClassName);\r\n if (!testSuccess) {\r\n console.error(`test failed: ${testMessage}`);\r\n return { success: false, message: testMessage, buildErrors: null, testResult };\r\n }\r\n\r\n console.log(`Verify time: ${(Date.now() - startTime) / 1000} seconds`);\r\n return { success: true, message: \"\", buildErrors: null, testResult: null };\r\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function writeGenCode(sourceCodePath: string, genCode: string, genCnt: number): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.writeGenCode = writeGenCode;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const getOrCreateDir_1 = require("./getOrCreateDir");
|
|
39
|
+
const fileUtils_1 = require("./fileUtils");
|
|
40
|
+
const TESTFILEDIR = './testFiles';
|
|
41
|
+
function writeGenCode(sourceCodePath, genCode, genCnt) {
|
|
42
|
+
const sourceFileName = path.basename(sourceCodePath, '.cs');
|
|
43
|
+
const testFileName = `${sourceFileName}Tests${genCnt}.cs`;
|
|
44
|
+
const testFileDir = (0, getOrCreateDir_1.getTmpCacheDir)(TESTFILEDIR);
|
|
45
|
+
const testFilePath = path.join(testFileDir, testFileName);
|
|
46
|
+
(0, fileUtils_1.writeTestCode)(genCode, testFilePath);
|
|
47
|
+
console.log(`Generated code written to: ${testFilePath}`);
|
|
48
|
+
}
|
|
49
|
+
// writeGenCode('D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConfigManager.cs', 'public class EplantConfigManagerTests { }', 1);
|
|
50
|
+
//# sourceMappingURL=writeGenCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeGenCode.js","sourceRoot":"","sources":["../../src/utils/writeGenCode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,oCAOC;AAbD,2CAA6B;AAE7B,qDAAkD;AAClD,2CAA4C;AAE5C,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,SAAgB,YAAY,CAAC,cAAsB,EAAE,OAAe,EAAE,MAAc;IAChF,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,YAAY,GAAG,GAAG,cAAc,QAAQ,MAAM,KAAK,CAAC;IAC1D,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,WAAW,CAAC,CAAC;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC1D,IAAA,yBAAa,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,8BAA8B,YAAY,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,+LAA+L","sourcesContent":["import * as path from 'path';\r\n\r\nimport { getTmpCacheDir } from './getOrCreateDir';\r\nimport { writeTestCode } from './fileUtils';\r\n\r\nconst TESTFILEDIR = './testFiles';\r\nexport function writeGenCode(sourceCodePath: string, genCode: string, genCnt: number) {\r\n const sourceFileName = path.basename(sourceCodePath, '.cs');\r\n const testFileName = `${sourceFileName}Tests${genCnt}.cs`;\r\n const testFileDir = getTmpCacheDir(TESTFILEDIR);\r\n const testFilePath = path.join(testFileDir, testFileName);\r\n writeTestCode(genCode, testFilePath);\r\n console.log(`Generated code written to: ${testFilePath}`);\r\n}\r\n\r\n// writeGenCode('D:/code/CS.Service.Fundamental/SharedSegments/SharedSegments/SharedSegments.Plugins/Workflows/Eplant/EplantConfigManager.cs', 'public class EplantConfigManagerTests { }', 1);"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function runMsBuild(projectPath: string): Promise<any>;
|
|
2
|
+
export declare function buildErrorHandler(error: any): {
|
|
3
|
+
success: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare function buildCloseHandler(code: any, stdout: any, stderr: any): {
|
|
6
|
+
success: boolean;
|
|
7
|
+
message: string;
|
|
8
|
+
buildErrors: import("../types/buildResult").BuildResult[];
|
|
9
|
+
} | {
|
|
10
|
+
success: boolean;
|
|
11
|
+
message: any;
|
|
12
|
+
buildErrors: any;
|
|
13
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.runMsBuild = runMsBuild;
|
|
37
|
+
exports.buildErrorHandler = buildErrorHandler;
|
|
38
|
+
exports.buildCloseHandler = buildCloseHandler;
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const parseBuildResult_1 = require("../utils/parseBuildResult");
|
|
41
|
+
const vsTools_1 = require("./vsTools");
|
|
42
|
+
const spawnExec_1 = require("../utils/spawnExec");
|
|
43
|
+
function runMsBuild(projectPath) {
|
|
44
|
+
const args = [projectPath, '/t:Build', '/m', '/nr:true', '/v:minimal'];
|
|
45
|
+
const workDir = path.join(__dirname, '../tools');
|
|
46
|
+
return (0, spawnExec_1.runSpawn)(`${vsTools_1.msBuildPath}`, args, workDir, buildErrorHandler, buildCloseHandler);
|
|
47
|
+
}
|
|
48
|
+
function buildErrorHandler(error) {
|
|
49
|
+
console.error(`buildErrorHandler - failed: ${error.message}`);
|
|
50
|
+
return ({ success: false });
|
|
51
|
+
}
|
|
52
|
+
function buildCloseHandler(code, stdout, stderr) {
|
|
53
|
+
if (code !== 0) {
|
|
54
|
+
console.error(`Build failed with exit code ${code}`);
|
|
55
|
+
const buildErrors = (0, parseBuildResult_1.parseMsbuildErrors)(stdout);
|
|
56
|
+
const formattedBuildErrors = (0, parseBuildResult_1.formatMsbuildResultToMarkdown)(buildErrors);
|
|
57
|
+
return { success: false, message: formattedBuildErrors, buildErrors: buildErrors };
|
|
58
|
+
}
|
|
59
|
+
if (stderr) {
|
|
60
|
+
console.error(`Warnings/Errors:\n${stdout}`);
|
|
61
|
+
return { success: false, message: stdout, buildErrors: null };
|
|
62
|
+
}
|
|
63
|
+
console.log(`Build succeeded`);
|
|
64
|
+
return { success: true, message: stdout, buildErrors: null };
|
|
65
|
+
}
|
|
66
|
+
// setupSignalHandlers();
|
|
67
|
+
// runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
|
|
68
|
+
// runMsBuild3('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
|
|
69
|
+
// devenv "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
|
|
70
|
+
// devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
|
|
71
|
+
// devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /build Debug // incremental compile
|
|
72
|
+
// devenv.com "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments.sln" /build Debug // incremental compile
|
|
73
|
+
// msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
|
|
74
|
+
// msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal
|
|
75
|
+
// msbuild "D:\code\CS.Service.Fundamental\SharedSegments\SharedSegments\SharedSegments.Tests\SharedSegments.Tests.csproj" /t:Build /p:Configuration=Debug /m /v:minimal /nr:true
|
|
76
|
+
// 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
|
|
77
|
+
// 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"
|
|
78
|
+
// 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"
|
|
79
|
+
// msbuildexe.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /m /nr:true /v:minimal
|
|
80
|
+
// runMsBuild('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj');
|
|
81
|
+
//# sourceMappingURL=msBuild.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msBuild.js","sourceRoot":"","sources":["../../src/vs/msBuild.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,gCAKC;AAED,8CAGC;AAED,8CAeC;AAlCD,2CAA6B;AAE7B,gEAA8F;AAE9F,uCAAwC;AACxC,kDAA8C;AAE9C,SAAgB,UAAU,CAAC,WAAmB;IAC1C,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAEvE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,OAAO,IAAA,oBAAQ,EAAC,GAAG,qBAAW,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;AAC3F,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAK;IACnC,OAAO,CAAC,KAAK,CAAC,+BAA+B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM;IAClD,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,+BAA+B,IAAI,EAAE,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,IAAA,qCAAkB,EAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,oBAAoB,GAAG,IAAA,gDAA6B,EAAC,WAAW,CAAC,CAAC;QACxE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IACvF,CAAC;IAED,IAAI,MAAM,EAAE,CAAC;QACT,OAAO,CAAC,KAAK,CAAC,qBAAqB,MAAM,EAAE,CAAC,CAAC;QAC7C,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAClE,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AACjE,CAAC;AAGD,yBAAyB;AACzB,qIAAqI;AACrI,sIAAsI;AAEtI,+JAA+J;AAC/J,mKAAmK;AACnK,mKAAmK;AACnK,sHAAsH;AACtH,wKAAwK;AACxK,wKAAwK;AACxK,iLAAiL;AAEjL,sNAAsN;AAEtN,yNAAyN;AACzN,yNAAyN;AAEzN,yKAAyK;AACzK,qIAAqI","sourcesContent":["import * as path from 'path';\r\n\r\nimport { formatMsbuildResultToMarkdown, parseMsbuildErrors } from '../utils/parseBuildResult';\r\n\r\nimport { msBuildPath } from './vsTools';\r\nimport { runSpawn } from '../utils/spawnExec';\r\n\r\nexport function runMsBuild(projectPath: string): Promise<any> {\r\n const args = [projectPath, '/t:Build', '/m', '/nr:true', '/v:minimal'];\r\n\r\n const workDir = path.join(__dirname, '../tools');\r\n return runSpawn(`${msBuildPath}`, args, workDir, buildErrorHandler, buildCloseHandler);\r\n}\r\n\r\nexport function buildErrorHandler(error) {\r\n console.error(`buildErrorHandler - failed: ${error.message}`);\r\n return ({ success: false });\r\n}\r\n\r\nexport function buildCloseHandler(code, stdout, stderr) {\r\n if (code !== 0) {\r\n console.error(`Build failed with exit code ${code}`);\r\n const buildErrors = parseMsbuildErrors(stdout);\r\n const formattedBuildErrors = formatMsbuildResultToMarkdown(buildErrors);\r\n return { success: false, message: formattedBuildErrors, buildErrors: buildErrors };\r\n }\r\n\r\n if (stderr) {\r\n console.error(`Warnings/Errors:\\n${stdout}`);\r\n return { success: false, message: stdout, buildErrors: null };\r\n }\r\n\r\n console.log(`Build succeeded`);\r\n return { success: true, message: stdout, buildErrors: null };\r\n}\r\n\r\n\r\n// setupSignalHandlers();\r\n// runMsBuild('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');\r\n// runMsBuild3('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');\r\n\r\n// devenv \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug // incremental compile\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug // incremental compile\r\n// msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal\r\n// msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal\r\n// msbuild \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /t:Build /p:Configuration=Debug /m /v:minimal /nr:true\r\n\r\n// devenv.com \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\" /build Debug\r\n\r\n// devenvexe.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\"\r\n// devenvcom.cmd \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments.sln\" /build Debug /project \"D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\SharedSegments.Tests.csproj\"\r\n\r\n// msbuildexe.cmd \\\"D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj\\\" /t:Build /m /nr:true /v:minimal\r\n// runMsBuild('D:\\\\code\\\\CS.Service.Fundamental\\\\SharedSegments\\\\SharedSegments\\\\SharedSegments.Tests\\\\SharedSegments.Tests.csproj');"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function runSingleTestMethod(testDll: string, testMethod: string): Promise<any>;
|
|
2
|
+
export declare function runTestClass(testDll: string, className: string): Promise<any>;
|
|
3
|
+
export declare function runTestCommand(args: string[]): Promise<any>;
|
|
4
|
+
export declare function testErrorHandler(error: any): {
|
|
5
|
+
success: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function testCloseHandler(code: any, stdout: any, stderr: any): {
|
|
8
|
+
success: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
testResult: import("../types/testResult").TestResult;
|
|
11
|
+
} | {
|
|
12
|
+
success: boolean;
|
|
13
|
+
message: any;
|
|
14
|
+
testResult: any;
|
|
15
|
+
};
|
package/out/vs/vsTest.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.runSingleTestMethod = runSingleTestMethod;
|
|
37
|
+
exports.runTestClass = runTestClass;
|
|
38
|
+
exports.runTestCommand = runTestCommand;
|
|
39
|
+
exports.testErrorHandler = testErrorHandler;
|
|
40
|
+
exports.testCloseHandler = testCloseHandler;
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const parseVstestResult_1 = require("../utils/parseVstestResult");
|
|
43
|
+
const spawnExec_1 = require("../utils/spawnExec");
|
|
44
|
+
const vsTools_1 = require("./vsTools");
|
|
45
|
+
// const vstestPath = `"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\Extensions\\TestPlatform\\vstest.console.exe"`;
|
|
46
|
+
async function runSingleTestMethod(testDll, testMethod) {
|
|
47
|
+
// const cmd = `vstestexe.cmd "${testDll}" /Tests:${testMethod}`;
|
|
48
|
+
const args = [testDll, `/Tests:${testMethod}`];
|
|
49
|
+
return await runTestCommand(args);
|
|
50
|
+
}
|
|
51
|
+
async function runTestClass(testDll, className) {
|
|
52
|
+
// const cmd = `vstestexe.cmd "${testDll}" /TestCaseFilter:"FullyQualifiedName~${className}"`;
|
|
53
|
+
const args = [testDll, `/TestCaseFilter:FullyQualifiedName~${className}`];
|
|
54
|
+
return await runTestCommand(args);
|
|
55
|
+
}
|
|
56
|
+
// export function runTestFile(testDll: string, fullyQualifiedNames: string[]) {
|
|
57
|
+
// const testsArg = fullyQualifiedNames.map(name => `/Tests:${name}`).join(' ');
|
|
58
|
+
// const cmd = `vstest.console.exe "${testDll}" ${testsArg}`;
|
|
59
|
+
// execCommand(cmd);
|
|
60
|
+
// }
|
|
61
|
+
function runTestCommand(args) {
|
|
62
|
+
const workDir = path.join(__dirname, '../tools');
|
|
63
|
+
return (0, spawnExec_1.runSpawn)(`${vsTools_1.vstestPath}`, args, workDir, testErrorHandler, testCloseHandler);
|
|
64
|
+
}
|
|
65
|
+
function testErrorHandler(error) {
|
|
66
|
+
console.error(`testErrorHandler - failed: ${error.message}`);
|
|
67
|
+
return ({ success: false });
|
|
68
|
+
}
|
|
69
|
+
function testCloseHandler(code, stdout, stderr) {
|
|
70
|
+
if (code !== 0) {
|
|
71
|
+
console.error(`vstest failed with exit code ${code}`);
|
|
72
|
+
const testResult = (0, parseVstestResult_1.parseVSTestOutput)(stdout);
|
|
73
|
+
const formatedVSTestResult = (0, parseVstestResult_1.formatVSTestResultToMarkdown)(testResult);
|
|
74
|
+
if (!parseVstestResult_1.formatVSTestResultToMarkdown) {
|
|
75
|
+
// case: .NET version is not correct! like You must install or update .NET to run this application...
|
|
76
|
+
console.error(`Failed to parse vstest output: ${stdout}`);
|
|
77
|
+
}
|
|
78
|
+
return { success: false, message: formatedVSTestResult, testResult };
|
|
79
|
+
}
|
|
80
|
+
if (stderr) {
|
|
81
|
+
console.error(`STDERR:\n${stdout}`);
|
|
82
|
+
return { success: false, message: stdout, testResult: null };
|
|
83
|
+
}
|
|
84
|
+
console.log(`vstest succeeded`);
|
|
85
|
+
return { success: true, message: stdout, testResult: null };
|
|
86
|
+
}
|
|
87
|
+
// runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests');
|
|
88
|
+
// FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest
|
|
89
|
+
// setupSignalHandlers();
|
|
90
|
+
// runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.EplantMeResponseBuilderTest').then(result => {
|
|
91
|
+
// console.log('Test Class Result:', result.success, result.message);
|
|
92
|
+
// });
|
|
93
|
+
// runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Plugin.AudienceResponseParserTests.ResponseParserTests');
|
|
94
|
+
// vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /TestCaseFilter:"FullyQualifiedName~${className}"
|
|
95
|
+
// vstest.console.exe "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /Tests:SqmidHelperTests.GetSqmidFromCookie_ValidCookie_ReturnsDecodedBlisId
|
|
96
|
+
// ./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
|
|
97
|
+
// .\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
|
|
98
|
+
//.\vstestexe.cmd "D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll" /TestCaseFilter:"FullyQualifiedName~SharedSegments.Tests.Weather.Eplant.SqmidHelperTests"
|
|
99
|
+
// runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests').then(result => {
|
|
100
|
+
// console.log('Test Class Result:', result.success, result.message);
|
|
101
|
+
// });
|
|
102
|
+
// runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_MissingUsrLocCookie_ReturnsEmptyString')
|
|
103
|
+
// runSingleTestMethod('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Tests.Weather.Eplant.SqmidHelperTests.GetSqmidFromCookie_InvalidBase64Bid_ReturnsEmptyString');
|
|
104
|
+
// runTestClass('D:\\code\\CS.Service.Fundamental\\SharedSegments\\SharedSegments\\SharedSegments.Tests\\bin\\Debug\\SharedSegments.Tests.dll', 'SharedSegments.Plugins.Tests.Workflows.Eplant.Conditions.EplantRequestCategoryConditionTests').then(result => {
|
|
105
|
+
// console.log('Test Class Result:', result.success, result.message);
|
|
106
|
+
// });
|
|
107
|
+
//# sourceMappingURL=vsTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vsTest.js","sourceRoot":"","sources":["../../src/vs/vsTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,kDAIC;AAED,oCAIC;AAQD,wCAGC;AAED,4CAGC;AAED,4CAkBC;AAvDD,2CAA6B;AAE7B,kEAA6F;AAE7F,kDAA8C;AAC9C,uCAAuC;AAEvC,kJAAkJ;AAE3I,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,UAAkB;IAC5E,iEAAiE;IACjE,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,UAAU,UAAU,EAAE,CAAC,CAAC;IAC/C,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,OAAe,EAAE,SAAiB;IACpE,8FAA8F;IAC9F,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,sCAAsC,SAAS,EAAE,CAAC,CAAC;IAC1E,OAAO,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,gFAAgF;AAChF,iFAAiF;AACjF,8DAA8D;AAC9D,qBAAqB;AACrB,IAAI;AAEJ,SAAgB,cAAc,CAAC,IAAc;IAC5C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,OAAO,IAAA,oBAAQ,EAAC,GAAG,oBAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;AACrF,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAAK;IACrC,OAAO,CAAC,KAAK,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED,SAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM;IACpD,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,IAAA,qCAAiB,EAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,oBAAoB,GAAG,IAAA,gDAA4B,EAAC,UAAU,CAAC,CAAC;QACtE,IAAI,CAAC,gDAA4B,EAAE,CAAC;YACnC,qGAAqG;YACrG,OAAO,CAAC,KAAK,CAAC,kCAAkC,MAAM,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,CAAC;IACtE,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,YAAY,MAAM,EAAE,CAAC,CAAC;QACpC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAC9D,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AAC7D,CAAC;AAID,mNAAmN;AACnN,qFAAqF;AACrF,yBAAyB;AACzB,mOAAmO;AACnO,sEAAsE;AACtE,MAAM;AACN,8OAA8O;AAE9O,sMAAsM;AACtM,gOAAgO;AAChO,sQAAsQ;AACtQ,iQAAiQ;AACjQ,2OAA2O;AAE3O,wNAAwN;AACxN,sEAAsE;AACtE,MAAM;AACN,wQAAwQ;AACxQ,sQAAsQ;AACtQ,gQAAgQ;AAChQ,sEAAsE;AACtE,MAAM","sourcesContent":["import * as path from 'path';\r\n\r\nimport { formatVSTestResultToMarkdown, parseVSTestOutput } from '../utils/parseVstestResult';\r\n\r\nimport { runSpawn } from '../utils/spawnExec';\r\nimport { 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\nexport async function runSingleTestMethod(testDll: string, testMethod: string) {\r\n\t// const cmd = `vstestexe.cmd \"${testDll}\" /Tests:${testMethod}`;\r\n\tconst args = [testDll, `/Tests:${testMethod}`];\r\n\treturn await runTestCommand(args);\r\n}\r\n\r\nexport async function runTestClass(testDll: string, className: string) {\r\n\t// const cmd = `vstestexe.cmd \"${testDll}\" /TestCaseFilter:\"FullyQualifiedName~${className}\"`;\r\n\tconst args = [testDll, `/TestCaseFilter:FullyQualifiedName~${className}`];\r\n\treturn await runTestCommand(args);\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\nexport function runTestCommand(args: string[]): Promise<any> {\r\n\tconst workDir = path.join(__dirname, '../tools');\r\n\treturn runSpawn(`${vstestPath}`, args, workDir, testErrorHandler, testCloseHandler);\r\n}\r\n\r\nexport function testErrorHandler(error) {\r\n\tconsole.error(`testErrorHandler - failed: ${error.message}`);\r\n\treturn ({ success: false });\r\n}\r\n\r\nexport function testCloseHandler(code, stdout, stderr) {\r\n\tif (code !== 0) {\r\n\t\tconsole.error(`vstest failed with exit code ${code}`);\r\n\t\tconst testResult = parseVSTestOutput(stdout);\r\n\t\tconst formatedVSTestResult = formatVSTestResultToMarkdown(testResult);\r\n\t\tif (!formatVSTestResultToMarkdown) {\r\n\t\t\t// case: .NET version is not correct! like You must install or update .NET to run this application...\r\n\t\t\tconsole.error(`Failed to parse vstest output: ${stdout}`);\r\n\t\t}\r\n\t\treturn { success: false, message: formatedVSTestResult, testResult };\r\n\t}\r\n\tif (stderr) {\r\n\t\tconsole.error(`STDERR:\\n${stdout}`);\r\n\t\treturn { success: false, message: stdout, testResult: null };\r\n\t}\r\n\r\n\tconsole.log(`vstest succeeded`);\r\n\treturn { success: true, message: stdout, testResult: null };\r\n}\r\n\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,7 @@
|
|
|
1
|
+
export declare const vsDevCmdPath: string;
|
|
2
|
+
export declare const msBuildPath: string;
|
|
3
|
+
export declare const vstestPath: string;
|
|
4
|
+
export declare function findVsDevCmd(): string | null;
|
|
5
|
+
export declare function findMsBuild(): string | null;
|
|
6
|
+
export declare function findVsTestConsole(): string | null;
|
|
7
|
+
export declare function findCodeCoverage(): string | null;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.vstestPath = exports.msBuildPath = exports.vsDevCmdPath = void 0;
|
|
37
|
+
exports.findVsDevCmd = findVsDevCmd;
|
|
38
|
+
exports.findMsBuild = findMsBuild;
|
|
39
|
+
exports.findVsTestConsole = findVsTestConsole;
|
|
40
|
+
exports.findCodeCoverage = findCodeCoverage;
|
|
41
|
+
const fs = __importStar(require("fs"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const child_process_1 = require("child_process");
|
|
44
|
+
const VSVERSION = ['2022', '2019'];
|
|
45
|
+
const VSEROOT = [
|
|
46
|
+
'C:\\Program Files\\Microsoft Visual Studio\\',
|
|
47
|
+
'C:\\Program Files (x86)\\Microsoft Visual Studio\\',
|
|
48
|
+
];
|
|
49
|
+
const VSEDITION = ['Community', 'Professional', 'Enterprise', 'BuildTools'];
|
|
50
|
+
let vsStaticInstallationPaths = [];
|
|
51
|
+
exports.vsDevCmdPath = findVsDevCmd();
|
|
52
|
+
exports.msBuildPath = findMsBuild();
|
|
53
|
+
exports.vstestPath = findVsTestConsole();
|
|
54
|
+
function getStaticVsInstallationPaths() {
|
|
55
|
+
for (const root of VSEROOT) {
|
|
56
|
+
for (const version of VSVERSION) {
|
|
57
|
+
for (const edition of VSEDITION) {
|
|
58
|
+
const installPath = path.join(root, version, edition);
|
|
59
|
+
if (fs.existsSync(installPath)) {
|
|
60
|
+
vsStaticInstallationPaths.push(installPath);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function getToolPath(subPath) {
|
|
67
|
+
for (const vsStaticInstallationPath of vsStaticInstallationPaths) {
|
|
68
|
+
const toolPath = path.join(vsStaticInstallationPath, subPath);
|
|
69
|
+
if (fileExists(toolPath)) {
|
|
70
|
+
return toolPath;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
function fileExists(p) {
|
|
76
|
+
return fs.existsSync(p) && fs.statSync(p).isFile();
|
|
77
|
+
}
|
|
78
|
+
// vswhere.exe 位置(默认 VS 安装目录下)
|
|
79
|
+
function getVsWherePath() {
|
|
80
|
+
const defaultPath = path.join(process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)', 'Microsoft Visual Studio', 'Installer', 'vswhere.exe');
|
|
81
|
+
if (fileExists(defaultPath)) {
|
|
82
|
+
return defaultPath;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// init default static paths
|
|
86
|
+
getStaticVsInstallationPaths();
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// 调用 vswhere 获取 VS 安装路径
|
|
91
|
+
function getVSInstallationPath() {
|
|
92
|
+
const vswhere = getVsWherePath();
|
|
93
|
+
if (!vswhere)
|
|
94
|
+
return null;
|
|
95
|
+
const result = (0, child_process_1.spawnSync)(vswhere, [
|
|
96
|
+
'-latest',
|
|
97
|
+
'-requires', 'Microsoft.Component.MSBuild',
|
|
98
|
+
'-property', 'installationPath',
|
|
99
|
+
'-products', '*',
|
|
100
|
+
], {
|
|
101
|
+
encoding: 'utf-8',
|
|
102
|
+
});
|
|
103
|
+
if (result.status !== 0) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const installPath = result.stdout.trim();
|
|
107
|
+
return installPath;
|
|
108
|
+
}
|
|
109
|
+
function findVsDevCmd() {
|
|
110
|
+
// find by vswhere first
|
|
111
|
+
const installPath = getVSInstallationPath();
|
|
112
|
+
if (installPath) {
|
|
113
|
+
const vsdev = path.join(installPath, 'Common7', 'Tools', 'VsDevCmd.bat');
|
|
114
|
+
if (fileExists(vsdev)) {
|
|
115
|
+
return vsdev;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// try static path
|
|
119
|
+
const subPath = path.join('Common7', 'Tools', 'VsDevCmd.bat');
|
|
120
|
+
const toolPath = getToolPath(subPath);
|
|
121
|
+
return toolPath;
|
|
122
|
+
}
|
|
123
|
+
function findMsBuild() {
|
|
124
|
+
const base = getVSInstallationPath();
|
|
125
|
+
if (base) {
|
|
126
|
+
const is64Bit = process.arch === "x64" || process.arch === "arm64";
|
|
127
|
+
const pathPart = is64Bit ? 'amd64' : '';
|
|
128
|
+
const candidates = [
|
|
129
|
+
path.join(base, 'MSBuild', 'Current', 'Bin', pathPart, 'MSBuild.exe'),
|
|
130
|
+
path.join(base, 'MSBuild', '15.0', 'Bin', pathPart, 'MSBuild.exe'),
|
|
131
|
+
];
|
|
132
|
+
for (const c of candidates) {
|
|
133
|
+
if (fileExists(c))
|
|
134
|
+
return c;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const subPath = path.join('MSBuild', 'Current', 'Bin', 'MSBuild.exe');
|
|
138
|
+
const toolPath = getToolPath(subPath);
|
|
139
|
+
return toolPath;
|
|
140
|
+
}
|
|
141
|
+
// find vstest.console.exe
|
|
142
|
+
function findVsTestConsole() {
|
|
143
|
+
const base = getVSInstallationPath();
|
|
144
|
+
if (base) {
|
|
145
|
+
const candidates = [
|
|
146
|
+
path.join(base, 'Common7', 'IDE', 'CommonExtensions', 'Microsoft', 'TestWindow', 'vstest.console.exe'),
|
|
147
|
+
path.join(base, 'Common7', 'IDE', 'Extensions', 'TestPlatform', 'vstest.console.exe'),
|
|
148
|
+
];
|
|
149
|
+
for (const c of candidates) {
|
|
150
|
+
if (fileExists(c))
|
|
151
|
+
return c;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const subPath = path.join('Common7', 'IDE', 'CommonExtensions', 'Microsoft', 'TestWindow', 'vstest.console.exe');
|
|
155
|
+
const toolPath = getToolPath(subPath);
|
|
156
|
+
return toolPath;
|
|
157
|
+
}
|
|
158
|
+
// "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe"
|
|
159
|
+
function findCodeCoverage() {
|
|
160
|
+
const base = getVSInstallationPath();
|
|
161
|
+
if (base) {
|
|
162
|
+
const codeCoveragePath = path.join(base, 'Team Tools', 'IDE', 'Dynamic Code Coverage Tools', 'CodeCoverage.exe');
|
|
163
|
+
if (fileExists(codeCoveragePath))
|
|
164
|
+
return codeCoveragePath;
|
|
165
|
+
}
|
|
166
|
+
const subPath = path.join('Team Tools', 'IDE', 'Dynamic Code Coverage Tools', 'CodeCoverage.exe');
|
|
167
|
+
const toolPath = getToolPath(subPath);
|
|
168
|
+
return toolPath;
|
|
169
|
+
}
|
|
170
|
+
// console.log('🔍 find Visual Studio tool path:');
|
|
171
|
+
// const vsDev = findVsDevCmd();
|
|
172
|
+
// const msbuild = findMsBuild();
|
|
173
|
+
// const vstest = findVsTestConsole();
|
|
174
|
+
// console.log('VsDevCmd.bat:', vsDev || 'Not found');
|
|
175
|
+
// console.log('MSBuild.exe:', msbuild || 'Not found');
|
|
176
|
+
// console.log('vstest.console.exe:', vstest || 'Not found');
|
|
177
|
+
//# sourceMappingURL=vsTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vsTools.js","sourceRoot":"","sources":["../../src/vs/vsTools.ts"],"names":[],"mappings":"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","sourcesContent":["import * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\nimport { spawnSync } from 'child_process';\r\n\r\nconst VSVERSION = ['2022', '2019'];\r\nconst VSEROOT = [\r\n\t\t'C:\\\\Program Files\\\\Microsoft Visual Studio\\\\',\r\n\t\t'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\',\r\n\t];\r\nconst VSEDITION = ['Community', 'Professional', 'Enterprise', 'BuildTools'];\r\n\r\nlet vsStaticInstallationPaths:string[] = [];\r\n\r\nexport const vsDevCmdPath = findVsDevCmd();\r\nexport const msBuildPath = findMsBuild();\r\nexport const vstestPath = findVsTestConsole();\r\n\r\nfunction getStaticVsInstallationPaths() {\r\n\tfor (const root of VSEROOT) {\r\n\t\tfor (const version of VSVERSION) {\r\n\t\t\tfor (const edition of VSEDITION) {\r\n\t\t\t\tconst installPath = path.join(root, version, edition);\r\n\t\t\t\tif (fs.existsSync(installPath)) {\r\n\t\t\t\t\tvsStaticInstallationPaths.push(installPath);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nfunction getToolPath(subPath: string): string | null {\r\n\tfor (const vsStaticInstallationPath of vsStaticInstallationPaths) {\r\n\t\tconst toolPath = path.join(vsStaticInstallationPath, subPath);\r\n\t\tif (fileExists(toolPath)) {\r\n\t\t\treturn toolPath;\r\n\t\t}\r\n\t}\r\n\r\n\treturn null;\r\n}\r\n\r\nfunction fileExists(p: string): boolean {\r\n\treturn fs.existsSync(p) && fs.statSync(p).isFile();\r\n}\r\n\r\n// vswhere.exe 位置(默认 VS 安装目录下)\r\nfunction getVsWherePath(): string | null {\r\n\tconst defaultPath = path.join(\r\n\t\tprocess.env['ProgramFiles(x86)'] || 'C:\\\\Program Files (x86)',\r\n\t\t'Microsoft Visual Studio',\r\n\t\t'Installer',\r\n\t\t'vswhere.exe'\r\n\t);\r\n if (fileExists(defaultPath)) {\r\n\t\treturn defaultPath;\r\n\t} else {\r\n\t\t// init default static paths\r\n\t\tgetStaticVsInstallationPaths();\r\n\t\treturn null;\r\n\t}\r\n}\r\n\r\n// 调用 vswhere 获取 VS 安装路径\r\nfunction getVSInstallationPath(): string | null {\r\n\tconst vswhere = getVsWherePath();\r\n\tif (!vswhere) return null;\r\n\r\n\tconst result = spawnSync(vswhere, [\r\n\t\t'-latest',\r\n\t\t'-requires', 'Microsoft.Component.MSBuild',\r\n\t\t'-property', 'installationPath',\r\n\t\t'-products', '*',\r\n\t], {\r\n\t\tencoding: 'utf-8',\r\n\t});\r\n\r\n\tif (result.status !== 0) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\tconst installPath = result.stdout.trim();\r\n\treturn installPath;\r\n}\r\n\r\nexport function findVsDevCmd(): string | null {\r\n\t// find by vswhere first\r\n\tconst installPath = getVSInstallationPath();\r\n\tif (installPath) {\r\n\t\tconst vsdev = path.join(installPath, 'Common7', 'Tools', 'VsDevCmd.bat');\r\n\t\tif (fileExists(vsdev)) {\r\n\t\t\treturn vsdev;\r\n\t\t}\r\n\t}\r\n\r\n\t// try static path\r\n\tconst subPath = path.join('Common7', 'Tools', 'VsDevCmd.bat');\r\n\r\n\tconst toolPath = getToolPath(subPath);\r\n\treturn toolPath;\r\n}\r\n\r\nexport function findMsBuild(): string | null {\r\n\tconst base = getVSInstallationPath();\r\n\tif (base) {\r\n\t\tconst is64Bit = process.arch === \"x64\" || process.arch === \"arm64\";\r\n\t\tconst pathPart = is64Bit ? 'amd64' : '';\r\n\t\tconst candidates = [\r\n\t\t\tpath.join(base, 'MSBuild', 'Current', 'Bin', pathPart, 'MSBuild.exe'),\r\n\t\t\tpath.join(base, 'MSBuild', '15.0', 'Bin', pathPart, 'MSBuild.exe'),\r\n\t\t];\r\n\t\tfor (const c of candidates) {\r\n\t\t\tif (fileExists(c)) return c;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tconst subPath = path.join('MSBuild', 'Current', 'Bin', 'MSBuild.exe');\r\n\tconst toolPath = getToolPath(subPath);\r\n\treturn toolPath;\r\n}\r\n\r\n// find vstest.console.exe\r\nexport function findVsTestConsole(): string | null {\r\n\tconst base = getVSInstallationPath();\r\n\tif (base) {\r\n\t\tconst candidates = [\r\n\t\t\tpath.join(base, 'Common7', 'IDE', 'CommonExtensions', 'Microsoft', 'TestWindow', 'vstest.console.exe'),\r\n\t\t\tpath.join(base, 'Common7', 'IDE', 'Extensions', 'TestPlatform', 'vstest.console.exe'),\r\n\t\t];\r\n\t\tfor (const c of candidates) {\r\n\t\t\tif (fileExists(c)) return c;\r\n\t\t}\r\n\t}\r\n\r\n\tconst subPath = path.join('Common7', 'IDE', 'CommonExtensions', 'Microsoft', 'TestWindow', 'vstest.console.exe');\r\n\tconst toolPath = getToolPath(subPath);\r\n\treturn toolPath;\r\n}\r\n\r\n// \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Team Tools\\Dynamic Code Coverage Tools\\CodeCoverage.exe\"\r\nexport function findCodeCoverage(): string | null {\r\n\tconst base = getVSInstallationPath();\r\n\tif (base) {\r\n\t\tconst codeCoveragePath = path.join(base, 'Team Tools', 'IDE', 'Dynamic Code Coverage Tools', 'CodeCoverage.exe');\r\n\t\tif (fileExists(codeCoveragePath)) return codeCoveragePath;\r\n\t}\r\n\r\n\tconst subPath = path.join('Team Tools', 'IDE', 'Dynamic Code Coverage Tools', 'CodeCoverage.exe');\r\n\tconst toolPath = getToolPath(subPath);\r\n\treturn toolPath;\r\n}\r\n\r\n// console.log('🔍 find Visual Studio tool path:');\r\n\r\n// const vsDev = findVsDevCmd();\r\n// const msbuild = findMsBuild();\r\n// const vstest = findVsTestConsole();\r\n\r\n// console.log('VsDevCmd.bat:', vsDev || 'Not found');\r\n// console.log('MSBuild.exe:', msbuild || 'Not found');\r\n// console.log('vstest.console.exe:', vstest || 'Not found');\r\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyTestCodeByVsPlugin = verifyTestCodeByVsPlugin;
|
|
4
|
+
const interactionConstants_1 = require("./interactionConstants");
|
|
5
|
+
const sendStdToVsPlugin_1 = require("./sendStdToVsPlugin");
|
|
6
|
+
const stdListener_1 = require("./stdListener");
|
|
7
|
+
async function verifyTestCodeByVsPlugin(testFilePath) {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
// Todo: Add timeout handling to get rid of vs plugin crash issue
|
|
10
|
+
// const timeout = new Promise((_, reject) => {
|
|
11
|
+
// setTimeout(() => reject(new Error('timeout')), 5000);
|
|
12
|
+
// });
|
|
13
|
+
console.log("Sending verify test code command to VS plugin...");
|
|
14
|
+
(0, sendStdToVsPlugin_1.sendStdToVsPlugin)(interactionConstants_1.VERIFYTESTCODE, testFilePath);
|
|
15
|
+
console.log("Waiting for VERIFYTESTCODE event from VS plugin...");
|
|
16
|
+
stdListener_1.vsPluginEventEmitter.once(interactionConstants_1.VERIFYTESTCODE, (msg) => {
|
|
17
|
+
const verifyResult = handleVsVerifyCompletedEvent(msg);
|
|
18
|
+
if (!verifyResult) {
|
|
19
|
+
console.error("Failed to get verify result from VS plugin.");
|
|
20
|
+
reject({ success: false, message: undefined, buildErrors: undefined, testResult: undefined });
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.log("Test code verified by VS plugin.");
|
|
24
|
+
resolve(verifyResult);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function handleVsVerifyCompletedEvent(msg) {
|
|
30
|
+
console.log("handling VS Verify Completed event:", msg);
|
|
31
|
+
if (!msg) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
success: msg.success,
|
|
36
|
+
message: msg.message,
|
|
37
|
+
buildErrors: msg.buildErrors,
|
|
38
|
+
testResult: msg.testResult
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=getVsPluginVerifyResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getVsPluginVerifyResult.js","sourceRoot":"","sources":["../../src/vsPlugin/getVsPluginVerifyResult.ts"],"names":[],"mappings":";;AAKA,4DAsBC;AA3BD,iEAAwD;AAExD,2DAAwD;AACxD,+CAAqD;AAE9C,KAAK,UAAU,wBAAwB,CAAC,YAAoB;IAC/D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,iEAAiE;QACjE,+CAA+C;QAC/C,4DAA4D;QAC5D,MAAM;QAEN,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAChE,IAAA,qCAAiB,EAAC,qCAAc,EAAE,YAAY,CAAC,CAAC;QAEhD,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;QAClE,kCAAoB,CAAC,IAAI,CAAC,qCAAc,EAAE,CAAC,GAAG,EAAE,EAAE;YAC9C,MAAM,YAAY,GAAG,4BAA4B,CAAC,GAAG,CAAC,CAAC;YACvD,IAAI,CAAC,YAAY,EAAE,CAAC;gBAChB,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;gBAC7D,MAAM,CAAC,EAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAC,CAAC,CAAC;YAChG,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;gBAChD,OAAO,CAAC,YAAY,CAAC,CAAC;YAC1B,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,4BAA4B,CAAC,GAAG;IACrC,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;IACxD,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO;QACH,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,UAAU,EAAE,GAAG,CAAC,UAAU;KAC7B,CAAC;AACN,CAAC","sourcesContent":["import { VERIFYTESTCODE } from \"./interactionConstants\";\r\nimport { VerifyResult } from \"../types/verifyResult\";\r\nimport { sendStdToVsPlugin } from \"./sendStdToVsPlugin\";\r\nimport { vsPluginEventEmitter } from \"./stdListener\";\r\n\r\nexport async function verifyTestCodeByVsPlugin(testFilePath: string): Promise<VerifyResult> {\r\n return new Promise((resolve, reject) => {\r\n // Todo: Add timeout handling to get rid of vs plugin crash issue\r\n // const timeout = new Promise((_, reject) => {\r\n // setTimeout(() => reject(new Error('timeout')), 5000);\r\n // });\r\n\r\n console.log(\"Sending verify test code command to VS plugin...\");\r\n sendStdToVsPlugin(VERIFYTESTCODE, testFilePath);\r\n\r\n console.log(\"Waiting for VERIFYTESTCODE event from VS plugin...\");\r\n vsPluginEventEmitter.once(VERIFYTESTCODE, (msg) => {\r\n const verifyResult = handleVsVerifyCompletedEvent(msg);\r\n if (!verifyResult) {\r\n console.error(\"Failed to get verify result from VS plugin.\");\r\n reject({success: false, message: undefined, buildErrors: undefined, testResult: undefined});\r\n } else {\r\n console.log(\"Test code verified by VS plugin.\");\r\n resolve(verifyResult);\r\n }\r\n });\r\n });\r\n}\r\n\r\nfunction handleVsVerifyCompletedEvent(msg): VerifyResult {\r\n console.log(\"handling VS Verify Completed event:\", msg);\r\n if (!msg) {\r\n return undefined;\r\n }\r\n\r\n return {\r\n success: msg.success,\r\n message: msg.message,\r\n buildErrors: msg.buildErrors,\r\n testResult: msg.testResult\r\n };\r\n}\r\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INTERACTIONTAG = exports.VERIFYTESTCODE = void 0;
|
|
4
|
+
// interaction commands between vs plugin and csharp-ut-core
|
|
5
|
+
// these commands are used to communicate between the vs plugin and csharp-ut-core
|
|
6
|
+
exports.VERIFYTESTCODE = "__VERIFY_TEST_CODE__";
|
|
7
|
+
// interaction tag for logging
|
|
8
|
+
// this tag is used to identify the interaction messages in the logs
|
|
9
|
+
exports.INTERACTIONTAG = "__INTERACTION_TAG__";
|
|
10
|
+
//# sourceMappingURL=interactionConstants.js.map
|