@ai-dev-tools/test-copilot-core 1.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/README.md +6 -0
- package/azure-pipelines.yml +51 -0
- package/out/cli/commands/appInsightTelemetry.d.ts +7 -0
- package/out/cli/commands/appInsightTelemetry.d.ts.map +1 -0
- package/out/cli/commands/appInsightTelemetry.js +76 -0
- package/out/cli/commands/appInsightTelemetry.js.map +1 -0
- package/out/cli/commands/cliConfig.d.ts +4 -0
- package/out/cli/commands/cliConfig.d.ts.map +1 -0
- package/out/cli/commands/cliConfig.js +68 -0
- package/out/cli/commands/cliConfig.js.map +1 -0
- package/out/cli/commands/prompt.d.ts +6 -0
- package/out/cli/commands/prompt.d.ts.map +1 -0
- package/out/cli/commands/prompt.js +29 -0
- package/out/cli/commands/prompt.js.map +1 -0
- package/out/cli/commands/ut.d.ts +14 -0
- package/out/cli/commands/ut.d.ts.map +1 -0
- package/out/cli/commands/ut.js +72 -0
- package/out/cli/commands/ut.js.map +1 -0
- package/out/cli/commands/utPipeCmdWrapper.d.ts +18 -0
- package/out/cli/commands/utPipeCmdWrapper.d.ts.map +1 -0
- package/out/cli/commands/utPipeCmdWrapper.js +37 -0
- package/out/cli/commands/utPipeCmdWrapper.js.map +1 -0
- package/out/cli/config/index.d.ts +15 -0
- package/out/cli/config/index.d.ts.map +1 -0
- package/out/cli/config/index.js +10 -0
- package/out/cli/config/index.js.map +1 -0
- package/out/cli/index.d.ts +3 -0
- package/out/cli/index.d.ts.map +1 -0
- package/out/cli/index.js +169 -0
- package/out/cli/index.js.map +1 -0
- package/out/cli/type.d.ts +11 -0
- package/out/cli/type.d.ts.map +1 -0
- package/out/cli/type.js +3 -0
- package/out/cli/type.js.map +1 -0
- package/out/cli/utils/ds.d.ts +3 -0
- package/out/cli/utils/ds.d.ts.map +1 -0
- package/out/cli/utils/ds.js +50 -0
- package/out/cli/utils/ds.js.map +1 -0
- package/out/cli/utils/gpt.d.ts +3 -0
- package/out/cli/utils/gpt.d.ts.map +1 -0
- package/out/cli/utils/gpt.js +63 -0
- package/out/cli/utils/gpt.js.map +1 -0
- package/out/core/analyze/cjs.d.ts +61 -0
- package/out/core/analyze/cjs.d.ts.map +1 -0
- package/out/core/analyze/cjs.js +358 -0
- package/out/core/analyze/cjs.js.map +1 -0
- package/out/core/analyze/class.d.ts +4 -0
- package/out/core/analyze/class.d.ts.map +1 -0
- package/out/core/analyze/class.js +32 -0
- package/out/core/analyze/class.js.map +1 -0
- package/out/core/analyze/declares.d.ts +7 -0
- package/out/core/analyze/declares.d.ts.map +1 -0
- package/out/core/analyze/declares.js +316 -0
- package/out/core/analyze/declares.js.map +1 -0
- package/out/core/analyze/deps.d.ts +8 -0
- package/out/core/analyze/deps.d.ts.map +1 -0
- package/out/core/analyze/deps.js +210 -0
- package/out/core/analyze/deps.js.map +1 -0
- package/out/core/analyze/functionComponent.d.ts +4 -0
- package/out/core/analyze/functionComponent.d.ts.map +1 -0
- package/out/core/analyze/functionComponent.js +77 -0
- package/out/core/analyze/functionComponent.js.map +1 -0
- package/out/core/analyze/functions.d.ts +4 -0
- package/out/core/analyze/functions.d.ts.map +1 -0
- package/out/core/analyze/functions.js +46 -0
- package/out/core/analyze/functions.js.map +1 -0
- package/out/core/analyze/index.d.ts +16 -0
- package/out/core/analyze/index.d.ts.map +1 -0
- package/out/core/analyze/index.js +149 -0
- package/out/core/analyze/index.js.map +1 -0
- package/out/core/analyze/index.type.d.ts +69 -0
- package/out/core/analyze/index.type.d.ts.map +1 -0
- package/out/core/analyze/index.type.js +14 -0
- package/out/core/analyze/index.type.js.map +1 -0
- package/out/core/analyze/utils/global.d.ts +2 -0
- package/out/core/analyze/utils/global.d.ts.map +1 -0
- package/out/core/analyze/utils/global.js +84 -0
- package/out/core/analyze/utils/global.js.map +1 -0
- package/out/core/analyzev2/declare/class.d.ts +4 -0
- package/out/core/analyzev2/declare/class.d.ts.map +1 -0
- package/out/core/analyzev2/declare/class.js +24 -0
- package/out/core/analyzev2/declare/class.js.map +1 -0
- package/out/core/analyzev2/declare/funcLike.d.ts +8 -0
- package/out/core/analyzev2/declare/funcLike.d.ts.map +1 -0
- package/out/core/analyzev2/declare/funcLike.js +71 -0
- package/out/core/analyzev2/declare/funcLike.js.map +1 -0
- package/out/core/analyzev2/declare/variable.d.ts +3 -0
- package/out/core/analyzev2/declare/variable.d.ts.map +1 -0
- package/out/core/analyzev2/declare/variable.js +15 -0
- package/out/core/analyzev2/declare/variable.js.map +1 -0
- package/out/core/analyzev2/file.d.ts +19 -0
- package/out/core/analyzev2/file.d.ts.map +1 -0
- package/out/core/analyzev2/file.js +449 -0
- package/out/core/analyzev2/file.js.map +1 -0
- package/out/core/analyzev2/index.d.ts +5 -0
- package/out/core/analyzev2/index.d.ts.map +1 -0
- package/out/core/analyzev2/index.js +30 -0
- package/out/core/analyzev2/index.js.map +1 -0
- package/out/core/analyzev2/type.d.ts +35 -0
- package/out/core/analyzev2/type.d.ts.map +1 -0
- package/out/core/analyzev2/type.js +3 -0
- package/out/core/analyzev2/type.js.map +1 -0
- package/out/core/config/index.d.ts +25 -0
- package/out/core/config/index.d.ts.map +1 -0
- package/out/core/config/index.js +14 -0
- package/out/core/config/index.js.map +1 -0
- package/out/core/constants.d.ts +9 -0
- package/out/core/constants.d.ts.map +1 -0
- package/out/core/constants.js +12 -0
- package/out/core/constants.js.map +1 -0
- package/out/core/features/common/base.d.ts +20 -0
- package/out/core/features/common/base.d.ts.map +1 -0
- package/out/core/features/common/base.js +77 -0
- package/out/core/features/common/base.js.map +1 -0
- package/out/core/features/common/types.d.ts +16 -0
- package/out/core/features/common/types.d.ts.map +1 -0
- package/out/core/features/common/types.js +12 -0
- package/out/core/features/common/types.js.map +1 -0
- package/out/core/features/generateFile.d.ts +31 -0
- package/out/core/features/generateFile.d.ts.map +1 -0
- package/out/core/features/generateFile.js +148 -0
- package/out/core/features/generateFile.js.map +1 -0
- package/out/core/features/generateSingle.d.ts +28 -0
- package/out/core/features/generateSingle.d.ts.map +1 -0
- package/out/core/features/generateSingle.js +149 -0
- package/out/core/features/generateSingle.js.map +1 -0
- package/out/core/features/index.d.ts +9 -0
- package/out/core/features/index.d.ts.map +1 -0
- package/out/core/features/index.js +16 -0
- package/out/core/features/index.js.map +1 -0
- package/out/core/features/lintFix.d.ts +2 -0
- package/out/core/features/lintFix.d.ts.map +1 -0
- package/out/core/features/lintFix.js +33 -0
- package/out/core/features/lintFix.js.map +1 -0
- package/out/core/features/mergeUTFile.d.ts +19 -0
- package/out/core/features/mergeUTFile.d.ts.map +1 -0
- package/out/core/features/mergeUTFile.js +63 -0
- package/out/core/features/mergeUTFile.js.map +1 -0
- package/out/core/features/removeFailedCases.d.ts +23 -0
- package/out/core/features/removeFailedCases.d.ts.map +1 -0
- package/out/core/features/removeFailedCases.js +81 -0
- package/out/core/features/removeFailedCases.js.map +1 -0
- package/out/core/features/updateSpec.d.ts +20 -0
- package/out/core/features/updateSpec.d.ts.map +1 -0
- package/out/core/features/updateSpec.js +98 -0
- package/out/core/features/updateSpec.js.map +1 -0
- package/out/core/features/validFix.d.ts +29 -0
- package/out/core/features/validFix.d.ts.map +1 -0
- package/out/core/features/validFix.js +219 -0
- package/out/core/features/validFix.js.map +1 -0
- package/out/core/generate/UTGen.d.ts +79 -0
- package/out/core/generate/UTGen.d.ts.map +1 -0
- package/out/core/generate/UTGen.js +795 -0
- package/out/core/generate/UTGen.js.map +1 -0
- package/out/core/llm/index.d.ts +9 -0
- package/out/core/llm/index.d.ts.map +1 -0
- package/out/core/llm/index.js +39 -0
- package/out/core/llm/index.js.map +1 -0
- package/out/core/llm/prompts/config.d.ts +6 -0
- package/out/core/llm/prompts/config.d.ts.map +1 -0
- package/out/core/llm/prompts/config.js +239 -0
- package/out/core/llm/prompts/config.js.map +1 -0
- package/out/core/llm/prompts/templates/common.d.ts +3 -0
- package/out/core/llm/prompts/templates/common.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/common.js +27 -0
- package/out/core/llm/prompts/templates/common.js.map +1 -0
- package/out/core/llm/prompts/templates/fixCase.d.ts +4 -0
- package/out/core/llm/prompts/templates/fixCase.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/fixCase.js +46 -0
- package/out/core/llm/prompts/templates/fixCase.js.map +1 -0
- package/out/core/llm/prompts/templates/fixLint.d.ts +3 -0
- package/out/core/llm/prompts/templates/fixLint.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/fixLint.js +22 -0
- package/out/core/llm/prompts/templates/fixLint.js.map +1 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.d.ts +5 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.js +115 -0
- package/out/core/llm/prompts/templates/genClassMemberUT.js.map +1 -0
- package/out/core/llm/prompts/templates/genFuncUT.d.ts +4 -0
- package/out/core/llm/prompts/templates/genFuncUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/genFuncUT.js +64 -0
- package/out/core/llm/prompts/templates/genFuncUT.js.map +1 -0
- package/out/core/llm/prompts/templates/mergeUT.d.ts +4 -0
- package/out/core/llm/prompts/templates/mergeUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/mergeUT.js +106 -0
- package/out/core/llm/prompts/templates/mergeUT.js.map +1 -0
- package/out/core/llm/prompts/templates/msnStudio.d.ts +3 -0
- package/out/core/llm/prompts/templates/msnStudio.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/msnStudio.js +36 -0
- package/out/core/llm/prompts/templates/msnStudio.js.map +1 -0
- package/out/core/llm/prompts/templates/snapshotUT.d.ts +4 -0
- package/out/core/llm/prompts/templates/snapshotUT.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/snapshotUT.js +68 -0
- package/out/core/llm/prompts/templates/snapshotUT.js.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.d.ts +3 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.js +38 -0
- package/out/core/llm/prompts/templates/updateSpecBlock.js.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecFile.d.ts +3 -0
- package/out/core/llm/prompts/templates/updateSpecFile.d.ts.map +1 -0
- package/out/core/llm/prompts/templates/updateSpecFile.js +30 -0
- package/out/core/llm/prompts/templates/updateSpecFile.js.map +1 -0
- package/out/core/llm/types.d.ts +80 -0
- package/out/core/llm/types.d.ts.map +1 -0
- package/out/core/llm/types.js +5 -0
- package/out/core/llm/types.js.map +1 -0
- package/out/core/quality/validateMockedTest.d.ts +3 -0
- package/out/core/quality/validateMockedTest.d.ts.map +1 -0
- package/out/core/quality/validateMockedTest.js +211 -0
- package/out/core/quality/validateMockedTest.js.map +1 -0
- package/out/core/utils/checkTestIgnore.d.ts +4 -0
- package/out/core/utils/checkTestIgnore.d.ts.map +1 -0
- package/out/core/utils/checkTestIgnore.js +52 -0
- package/out/core/utils/checkTestIgnore.js.map +1 -0
- package/out/core/utils/common.d.ts +4 -0
- package/out/core/utils/common.d.ts.map +1 -0
- package/out/core/utils/common.js +34 -0
- package/out/core/utils/common.js.map +1 -0
- package/out/core/utils/console.d.ts +8 -0
- package/out/core/utils/console.d.ts.map +1 -0
- package/out/core/utils/console.js +24 -0
- package/out/core/utils/console.js.map +1 -0
- package/out/core/utils/deps.d.ts +3 -0
- package/out/core/utils/deps.d.ts.map +1 -0
- package/out/core/utils/deps.js +58 -0
- package/out/core/utils/deps.js.map +1 -0
- package/out/core/utils/eslintRuleHandler.d.ts +3 -0
- package/out/core/utils/eslintRuleHandler.d.ts.map +1 -0
- package/out/core/utils/eslintRuleHandler.js +98 -0
- package/out/core/utils/eslintRuleHandler.js.map +1 -0
- package/out/core/utils/file.d.ts +18 -0
- package/out/core/utils/file.d.ts.map +1 -0
- package/out/core/utils/file.js +142 -0
- package/out/core/utils/file.js.map +1 -0
- package/out/core/utils/lint.d.ts +9 -0
- package/out/core/utils/lint.d.ts.map +1 -0
- package/out/core/utils/lint.js +95 -0
- package/out/core/utils/lint.js.map +1 -0
- package/out/core/utils/lru.d.ts +12 -0
- package/out/core/utils/lru.d.ts.map +1 -0
- package/out/core/utils/lru.js +47 -0
- package/out/core/utils/lru.js.map +1 -0
- package/out/core/utils/move.d.ts +12 -0
- package/out/core/utils/move.d.ts.map +1 -0
- package/out/core/utils/move.js +93 -0
- package/out/core/utils/move.js.map +1 -0
- package/out/core/utils/msnStudio.d.ts +13 -0
- package/out/core/utils/msnStudio.d.ts.map +1 -0
- package/out/core/utils/msnStudio.js +150 -0
- package/out/core/utils/msnStudio.js.map +1 -0
- package/out/core/utils/parseCustomizedCmd.d.ts +2 -0
- package/out/core/utils/parseCustomizedCmd.d.ts.map +1 -0
- package/out/core/utils/parseCustomizedCmd.js +32 -0
- package/out/core/utils/parseCustomizedCmd.js.map +1 -0
- package/out/core/utils/specBlock.d.ts +20 -0
- package/out/core/utils/specBlock.d.ts.map +1 -0
- package/out/core/utils/specBlock.js +231 -0
- package/out/core/utils/specBlock.js.map +1 -0
- package/out/core/utils/system.d.ts +13 -0
- package/out/core/utils/system.d.ts.map +1 -0
- package/out/core/utils/system.js +86 -0
- package/out/core/utils/system.js.map +1 -0
- package/out/core/utils/telemetry.d.ts +9 -0
- package/out/core/utils/telemetry.d.ts.map +1 -0
- package/out/core/utils/telemetry.js +32 -0
- package/out/core/utils/telemetry.js.map +1 -0
- package/out/core/utils/tsMorph.d.ts +13 -0
- package/out/core/utils/tsMorph.d.ts.map +1 -0
- package/out/core/utils/tsMorph.js +76 -0
- package/out/core/utils/tsMorph.js.map +1 -0
- package/out/core/valid/customizedLint.d.ts +2 -0
- package/out/core/valid/customizedLint.d.ts.map +1 -0
- package/out/core/valid/customizedLint.js +64 -0
- package/out/core/valid/customizedLint.js.map +1 -0
- package/out/core/valid/customizedTest.d.ts +3 -0
- package/out/core/valid/customizedTest.d.ts.map +1 -0
- package/out/core/valid/customizedTest.js +58 -0
- package/out/core/valid/customizedTest.js.map +1 -0
- package/out/core/valid/extractVitestConfig.d.ts +5 -0
- package/out/core/valid/extractVitestConfig.d.ts.map +1 -0
- package/out/core/valid/extractVitestConfig.js +97 -0
- package/out/core/valid/extractVitestConfig.js.map +1 -0
- package/out/core/valid/getViteConfig.d.ts +2 -0
- package/out/core/valid/getViteConfig.d.ts.map +1 -0
- package/out/core/valid/getViteConfig.js +65 -0
- package/out/core/valid/getViteConfig.js.map +1 -0
- package/out/core/valid/index.d.ts +15 -0
- package/out/core/valid/index.d.ts.map +1 -0
- package/out/core/valid/index.js +99 -0
- package/out/core/valid/index.js.map +1 -0
- package/out/core/valid/jest.d.ts +4 -0
- package/out/core/valid/jest.d.ts.map +1 -0
- package/out/core/valid/jest.js +121 -0
- package/out/core/valid/jest.js.map +1 -0
- package/out/core/valid/mock.d.ts +2 -0
- package/out/core/valid/mock.d.ts.map +1 -0
- package/out/core/valid/mock.js +149 -0
- package/out/core/valid/mock.js.map +1 -0
- package/out/core/valid/remove.d.ts +5 -0
- package/out/core/valid/remove.d.ts.map +1 -0
- package/out/core/valid/remove.js +109 -0
- package/out/core/valid/remove.js.map +1 -0
- package/out/core/valid/tag.d.ts +3 -0
- package/out/core/valid/tag.d.ts.map +1 -0
- package/out/core/valid/tag.js +91 -0
- package/out/core/valid/tag.js.map +1 -0
- package/out/core/valid/type.d.ts +83 -0
- package/out/core/valid/type.d.ts.map +1 -0
- package/out/core/valid/type.js +3 -0
- package/out/core/valid/type.js.map +1 -0
- package/out/core/valid/vitest.d.ts +3 -0
- package/out/core/valid/vitest.d.ts.map +1 -0
- package/out/core/valid/vitest.js +82 -0
- package/out/core/valid/vitest.js.map +1 -0
- package/out/index.d.ts +20 -0
- package/out/index.d.ts.map +1 -0
- package/out/index.js +60 -0
- package/out/index.js.map +1 -0
- package/out/setup.d.ts +11 -0
- package/out/setup.d.ts.map +1 -0
- package/out/setup.js +14 -0
- package/out/setup.js.map +1 -0
- package/out/types.d.ts +23 -0
- package/out/types.d.ts.map +1 -0
- package/out/types.js +3 -0
- package/out/types.js.map +1 -0
- package/package.json +39 -0
- package/package_devops.json +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# trigger:
|
|
2
|
+
# - main # branch
|
|
3
|
+
|
|
4
|
+
trigger: none
|
|
5
|
+
pr: none
|
|
6
|
+
|
|
7
|
+
pool:
|
|
8
|
+
vmImage: 'ubuntu-latest'
|
|
9
|
+
|
|
10
|
+
variables:
|
|
11
|
+
workingDir: 'msnews-ut-copilot'
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- task: NodeTool@0
|
|
15
|
+
inputs:
|
|
16
|
+
versionSpec: '18.x'
|
|
17
|
+
displayName: 'Install Node.js'
|
|
18
|
+
|
|
19
|
+
# Auth Azure Artifacts Feed using .npmrc
|
|
20
|
+
- task: npmAuthenticate@0
|
|
21
|
+
inputs:
|
|
22
|
+
workingFile: '$(workingDir)/.npmrc'
|
|
23
|
+
displayName: 'Authenticate with Azure Artifacts'
|
|
24
|
+
|
|
25
|
+
# install package, build and pack
|
|
26
|
+
- script: |
|
|
27
|
+
cd $(workingDir)
|
|
28
|
+
echo "================ Installing common dependencies ================"
|
|
29
|
+
npm install
|
|
30
|
+
cd ./test-copilot-core
|
|
31
|
+
echo "================ Building test-copilot-core ================"
|
|
32
|
+
npm install --userconfig=../.npmrc
|
|
33
|
+
npm run build
|
|
34
|
+
npm pack
|
|
35
|
+
displayName: 'Install and Pack NPM Package'
|
|
36
|
+
|
|
37
|
+
# publish to Azure Artifacts npm feed
|
|
38
|
+
# - script: |
|
|
39
|
+
# cd $(workingDir)
|
|
40
|
+
# npm publish --registry https://pkgs.dev.azure.com/msasg/ContentServices/_packaging/MSNews/npm/registry
|
|
41
|
+
# displayName: 'Publish to Azure Artifacts'
|
|
42
|
+
|
|
43
|
+
- task: Npm@1
|
|
44
|
+
inputs:
|
|
45
|
+
command: publish
|
|
46
|
+
publishRegistry: useFeed
|
|
47
|
+
publishFeed: ContentServices/MSNews
|
|
48
|
+
workingDir: '$(workingDir)/test-copilot-core'
|
|
49
|
+
# condition: and(succeeded(), in(variables['commitType'], 'feat', 'fix', 'chore', 'prerelease'))
|
|
50
|
+
continueOnError: true
|
|
51
|
+
displayName: Publish
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function sendTelemetryEvent(eventName: string, properties?: {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
}, measurements?: {
|
|
4
|
+
[key: string]: number;
|
|
5
|
+
}): void;
|
|
6
|
+
export declare function sendUserUsageEvent(customUserName?: string, source?: string): void;
|
|
7
|
+
//# sourceMappingURL=appInsightTelemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appInsightTelemetry.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/appInsightTelemetry.ts"],"names":[],"mappings":"AA2BA,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EAAE,YAAY,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,QAQrI;AAED,wBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,QAM1E"}
|
|
@@ -0,0 +1,76 @@
|
|
|
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.sendTelemetryEvent = sendTelemetryEvent;
|
|
37
|
+
exports.sendUserUsageEvent = sendUserUsageEvent;
|
|
38
|
+
const appInsights = __importStar(require("applicationinsights"));
|
|
39
|
+
const telemetry_1 = require("../../core/utils/telemetry");
|
|
40
|
+
const system_1 = require("../../core/utils/system");
|
|
41
|
+
const os_1 = require("os");
|
|
42
|
+
const connectionString = "InstrumentationKey=c1a0c6a2-06a6-405f-9343-c8fbe29e0dc2;IngestionEndpoint=https://eastus2-3.in.applicationinsights.azure.com/;LiveEndpoint=https://eastus2.livediagnostics.monitor.azure.com/;ApplicationId=e90435ce-8771-4069-bc94-77aaf8099529";
|
|
43
|
+
// init Application Insights
|
|
44
|
+
appInsights.setup(connectionString)
|
|
45
|
+
.setAutoCollectConsole(false)
|
|
46
|
+
.setAutoCollectDependencies(false)
|
|
47
|
+
.setAutoCollectExceptions(false)
|
|
48
|
+
.setAutoCollectPerformance(false)
|
|
49
|
+
.setAutoCollectRequests(false)
|
|
50
|
+
.setUseDiskRetryCaching(false)
|
|
51
|
+
.start();
|
|
52
|
+
let userId;
|
|
53
|
+
function initUser() {
|
|
54
|
+
if (userId) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
userId = (0, system_1.getMachineId)();
|
|
58
|
+
appInsights.defaultClient.context.tags[appInsights.defaultClient.context.keys.userId] = userId;
|
|
59
|
+
}
|
|
60
|
+
function sendTelemetryEvent(eventName, properties, measurements) {
|
|
61
|
+
initUser();
|
|
62
|
+
appInsights.defaultClient.trackEvent({
|
|
63
|
+
name: eventName,
|
|
64
|
+
properties: (0, telemetry_1.formatEventProps)(properties, properties?.source),
|
|
65
|
+
measurements
|
|
66
|
+
});
|
|
67
|
+
appInsights.defaultClient.flush();
|
|
68
|
+
}
|
|
69
|
+
function sendUserUsageEvent(customUserName, source) {
|
|
70
|
+
const userName = customUserName || (0, os_1.userInfo)()?.username;
|
|
71
|
+
sendTelemetryEvent("userUsage", {
|
|
72
|
+
"user": userName,
|
|
73
|
+
"source": source
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=appInsightTelemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appInsightTelemetry.js","sourceRoot":"","sources":["../../../src/cli/commands/appInsightTelemetry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,gDAQC;AAED,gDAMC;AA3CD,iEAAmD;AAEnD,0DAA8D;AAC9D,oDAAuD;AACvD,2BAA8B;AAE9B,MAAM,gBAAgB,GAAG,kPAAkP,CAAC;AAE5Q,4BAA4B;AAC5B,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC;KAC9B,qBAAqB,CAAC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,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CA6BlE;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,QA0B/C"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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.readConfig = readConfig;
|
|
7
|
+
exports.initConfigFile = initConfigFile;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const constants_1 = require("../../core/constants");
|
|
11
|
+
const config_1 = require("../../core/llm/prompts/config");
|
|
12
|
+
function readConfig(filePath) {
|
|
13
|
+
if (!filePath) {
|
|
14
|
+
return {
|
|
15
|
+
common: {
|
|
16
|
+
ignoreFuncs: new Set([])
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const configFilePath = path_1.default.resolve(filePath);
|
|
22
|
+
const { common, customizePrompt, ...other } = require(configFilePath);
|
|
23
|
+
const res = {
|
|
24
|
+
...other,
|
|
25
|
+
common: {
|
|
26
|
+
...common,
|
|
27
|
+
ignoreFuncs: new Set(common?.ignoreFuncs || [])
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
if (customizePrompt) {
|
|
31
|
+
const configFileDir = path_1.default.dirname(configFilePath);
|
|
32
|
+
res.promptConfigs = (0, config_1.getCustomizePrompt)(configFileDir, customizePrompt, constants_1.TEST_COPILOT_CONFIG_PROMPTS_UT_TS);
|
|
33
|
+
}
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error(`Error reading configuration file: ${filePath}`);
|
|
38
|
+
console.error(error);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function initConfigFile(inputPath) {
|
|
43
|
+
let outPath = path_1.default.resolve(inputPath || '.');
|
|
44
|
+
if (!outPath.endsWith('.json') || !outPath.endsWith('.js')) {
|
|
45
|
+
outPath = path_1.default.join(outPath, 'test-copilot-config.js');
|
|
46
|
+
}
|
|
47
|
+
const dirName = path_1.default.dirname(outPath);
|
|
48
|
+
if (!fs_1.default.existsSync(dirName)) {
|
|
49
|
+
fs_1.default.mkdirSync(dirName, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
const content = `module.exports = {
|
|
52
|
+
// customizePrompt: true, // or path to the prompt folder; true means to look up \`${constants_1.TEST_COPILOT_CONFIG_PROMPTS_UT_TS}\` folder
|
|
53
|
+
common: {
|
|
54
|
+
// createIndexSpec: true, // default: false; whether to create index.spec.ts file
|
|
55
|
+
// removeFailedCases: false, // default: true; remove failed cases from the test file instead of commenting them out
|
|
56
|
+
// ignoreFuncs: [], // default: []; function names to ignore when generating tests
|
|
57
|
+
// retryCount: 3, // default: 0; number of retries for failed tests
|
|
58
|
+
// saveFailed: true, // default: false; save failed tests to a separate file
|
|
59
|
+
// mockDependencies: {}, // TBD
|
|
60
|
+
},
|
|
61
|
+
// gpt: {
|
|
62
|
+
// api: "" // URL
|
|
63
|
+
// }
|
|
64
|
+
};`;
|
|
65
|
+
fs_1.default.writeFileSync(outPath, content, 'utf8');
|
|
66
|
+
console.log(`Config file created at: ${outPath}`);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=cliConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliConfig.js","sourceRoot":"","sources":["../../../src/cli/commands/cliConfig.ts"],"names":[],"mappings":";;;;;AAMA,gCA6BC;AAED,wCA0BC;AA/DD,gDAAwB;AACxB,4CAAoB;AAEpB,oDAAyE;AACzE,0DAAmE;AAEnE,SAAgB,UAAU,CAAC,QAAgB;IACvC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO;YACH,MAA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CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,YAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,OAAO,GAAG;yFACqE,6CAAiC;;;;;;;;;;;;GAYvH,CAAA;IAEC,YAAE,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,CAAC,GAAG,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/prompt.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,QAc3C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.exposePrompt = exposePrompt;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const config_1 = require("../../core/llm/prompts/config");
|
|
9
|
+
/**
|
|
10
|
+
* Expose the prompt template to the output directory.
|
|
11
|
+
* @param outPath Absolute path to the output directory
|
|
12
|
+
*/
|
|
13
|
+
function exposePrompt(outPath) {
|
|
14
|
+
try {
|
|
15
|
+
if (!fs_1.default.existsSync(outPath)) {
|
|
16
|
+
fs_1.default.mkdirSync(outPath, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
else if (!fs_1.default.statSync(outPath).isDirectory()) {
|
|
19
|
+
console.error(`Output path ${outPath} is not a directory.`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
(0, config_1.promptsToFiles)(outPath);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.error(`Error creating output directory: ${outPath}`);
|
|
26
|
+
console.error(error);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/cli/commands/prompt.ts"],"names":[],"mappings":";;;;;AAOA,oCAcC;AArBD,4CAAoB;AACpB,0DAA+D;AAE/D;;;GAGG;AACH,SAAgB,YAAY,CAAC,OAAe;IACxC,IAAI,CAAC;QACD,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,YAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;aAAM,IAAI,CAAC,YAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,CAAC,eAAe,OAAO,sBAAsB,CAAC,CAAC;YAC5D,OAAO;QACX,CAAC;QAED,IAAA,uBAAc,EAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CliConfig } from "../type";
|
|
2
|
+
export declare function runUT(params: {
|
|
3
|
+
userName?: string;
|
|
4
|
+
config?: CliConfig;
|
|
5
|
+
target: string;
|
|
6
|
+
line?: number;
|
|
7
|
+
runTest?: boolean;
|
|
8
|
+
repair?: boolean;
|
|
9
|
+
methods?: Set<string>;
|
|
10
|
+
lineRanges?: number[][];
|
|
11
|
+
source?: string;
|
|
12
|
+
skipFileLevelCheck?: number;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=ut.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ut.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/ut.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAOpC,wBAAsB,KAAK,CAAC,MAAM,EAAE;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B,iBA+DA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
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.runUT = runUT;
|
|
7
|
+
const UTGen_1 = require("../../core/generate/UTGen");
|
|
8
|
+
const appInsightTelemetry_1 = require("./appInsightTelemetry");
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
const gpt_1 = require("../utils/gpt");
|
|
11
|
+
const file_1 = require("../../core/utils/file");
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
13
|
+
const setup_1 = require("../../setup");
|
|
14
|
+
async function runUT(params) {
|
|
15
|
+
const { userName, config, target, line, runTest, repair, methods, lineRanges, source, skipFileLevelCheck } = params;
|
|
16
|
+
(0, appInsightTelemetry_1.sendUserUsageEvent)(userName, source);
|
|
17
|
+
(0, setup_1.setup)({
|
|
18
|
+
getConfig: () => ({
|
|
19
|
+
...config
|
|
20
|
+
}),
|
|
21
|
+
getLLMResponse: gpt_1.getGPTResponse,
|
|
22
|
+
sendTelemetry: appInsightTelemetry_1.sendTelemetryEvent
|
|
23
|
+
});
|
|
24
|
+
const targetPath = path_1.default.resolve(target);
|
|
25
|
+
if (!fs_1.default.existsSync(targetPath)) {
|
|
26
|
+
console.error(`Target file or directory does not exist: ${target}`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const packages = (0, file_1.getPackagesFrom)(targetPath);
|
|
30
|
+
const genOptions = {
|
|
31
|
+
progress: ({ message }) => { message && console.log(message); },
|
|
32
|
+
};
|
|
33
|
+
if (line) {
|
|
34
|
+
genOptions.selectedLine = line;
|
|
35
|
+
}
|
|
36
|
+
if (methods) {
|
|
37
|
+
genOptions.methods = methods;
|
|
38
|
+
}
|
|
39
|
+
if (lineRanges) {
|
|
40
|
+
genOptions.lineRanges = lineRanges;
|
|
41
|
+
}
|
|
42
|
+
if (runTest) {
|
|
43
|
+
genOptions.runTest = runTest;
|
|
44
|
+
}
|
|
45
|
+
if (repair) {
|
|
46
|
+
genOptions.repair = repair;
|
|
47
|
+
}
|
|
48
|
+
if (config.promptConfigs) {
|
|
49
|
+
genOptions.promptConfigs = config.promptConfigs;
|
|
50
|
+
}
|
|
51
|
+
genOptions.skipFileLevelCheck = skipFileLevelCheck === 1;
|
|
52
|
+
const currentPath = path_1.default.resolve('.');
|
|
53
|
+
console.log(`Found ${packages.length} packages to generate unit tests.`);
|
|
54
|
+
console.log(JSON.stringify(packages, null, 4));
|
|
55
|
+
for (let i = 0; i < packages.length; i++) {
|
|
56
|
+
const root = packages[i].packagePath;
|
|
57
|
+
const files = packages[i].targetFiles;
|
|
58
|
+
console.log(`Found ${files.length} files to generate unit tests:`);
|
|
59
|
+
for (let j = 0; j < files.length; j++) {
|
|
60
|
+
console.log('to: ', files[j]);
|
|
61
|
+
const file = files[j];
|
|
62
|
+
const relativePath = path_1.default.relative(currentPath, file);
|
|
63
|
+
console.log(`(${j + 1}/${files.length}) Generating unit test for ${relativePath}`);
|
|
64
|
+
const gen = new UTGen_1.UTGen(file, root, genOptions);
|
|
65
|
+
await gen.run();
|
|
66
|
+
console.log(`Unit test generation completed for ${relativePath}`);
|
|
67
|
+
console.log(`\t${gen.count.success} tests generated, ${gen.count.classMemberFailed + gen.count.funFailed} tests failed`);
|
|
68
|
+
console.log('---------------------------------------------------');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=ut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ut.js","sourceRoot":"","sources":["../../../src/cli/commands/ut.ts"],"names":[],"mappings":";;;;;AAUA,sBA0EC;AApFD,qDAAgE;AAChE,+DAA+E;AAG/E,4CAAoB;AACpB,sCAA8C;AAC9C,gDAAwD;AACxD,gDAAwB;AACxB,uCAAoC;AAE7B,KAAK,UAAU,KAAK,CAAC,MAW3B;IACG,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC;IACpH,IAAA,wCAAkB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAErC,IAAA,aAAK,EAAC;QACF,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;YACd,GAAG,MAAM;SACZ,CAAC;QACF,cAAc,EAAE,oBAAc;QAC9B,aAAa,EAAE,wCAAkB;KACpC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,YAAE,CAAC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eta: string;
|
|
5
|
+
mode?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
code?: string;
|
|
8
|
+
keepFailedTestFile?: number;
|
|
9
|
+
removeFailedTestCases?: number;
|
|
10
|
+
skipFileLevelCheck?: number;
|
|
11
|
+
enableCov?: number;
|
|
12
|
+
LLMModel?: string;
|
|
13
|
+
LLMAuthKey?: string;
|
|
14
|
+
testDirRelativeToPackage?: string;
|
|
15
|
+
customizedTestCmd?: string;
|
|
16
|
+
customizedLintCmd?: string;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=utPipeCmdWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utPipeCmdWrapper.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/utPipeCmdWrapper.ts"],"names":[],"mappings":"AAMA,wBAAsB,QAAQ,CAAC,MAAM,EAAE;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B,iBA8BA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runUTCmd = runUTCmd;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const ut_1 = require("./ut");
|
|
6
|
+
// run ut from cmd call
|
|
7
|
+
async function runUTCmd(params) {
|
|
8
|
+
const { sourceMeta, mode, keepFailedTestFile, removeFailedTestCases, userName, source, skipFileLevelCheck, testDirRelativeToPackage, customizedTestCmd, customizedLintCmd } = params;
|
|
9
|
+
const isRepair = mode == config_1.Mode.Repair;
|
|
10
|
+
const cliConfig = {
|
|
11
|
+
common: {
|
|
12
|
+
saveFailed: keepFailedTestFile === 1,
|
|
13
|
+
removeFailedCases: removeFailedTestCases === 1,
|
|
14
|
+
testDirRelativeToPackage: testDirRelativeToPackage,
|
|
15
|
+
customizedTestCmd: customizedTestCmd,
|
|
16
|
+
customizedLintCmd: customizedLintCmd
|
|
17
|
+
},
|
|
18
|
+
promptConfigs: {}
|
|
19
|
+
};
|
|
20
|
+
const sourceMetas = JSON.parse(sourceMeta);
|
|
21
|
+
for (const sourceMeta of sourceMetas) {
|
|
22
|
+
const sourcePath = sourceMeta.codePath;
|
|
23
|
+
const verifyTests = sourceMeta.verifyTests === 1;
|
|
24
|
+
(0, ut_1.runUT)({
|
|
25
|
+
userName,
|
|
26
|
+
config: cliConfig,
|
|
27
|
+
target: sourcePath,
|
|
28
|
+
runTest: verifyTests,
|
|
29
|
+
repair: isRepair,
|
|
30
|
+
methods: new Set(sourceMeta.methods),
|
|
31
|
+
lineRanges: sourceMeta.lineRanges,
|
|
32
|
+
source: source,
|
|
33
|
+
skipFileLevelCheck: skipFileLevelCheck
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=utPipeCmdWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utPipeCmdWrapper.js","sourceRoot":"","sources":["../../../src/cli/commands/utPipeCmdWrapper.ts"],"names":[],"mappings":";;AAMA,4BA8CC;AApDD,sCAAmD;AAGnD,6BAA6B;AAE7B,uBAA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|
+
testCodePath?: string;
|
|
7
|
+
prompt?: string;
|
|
8
|
+
covPath?: string;
|
|
9
|
+
verifyTests?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare enum Mode {
|
|
12
|
+
Generate = "generate",
|
|
13
|
+
Repair = "repair"
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/config/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,oBAAY,IAAI;IACZ,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mode = void 0;
|
|
4
|
+
var Mode;
|
|
5
|
+
(function (Mode) {
|
|
6
|
+
Mode["Generate"] = "generate";
|
|
7
|
+
Mode["Repair"] = "repair";
|
|
8
|
+
})(Mode || (exports.Mode = Mode = {}));
|
|
9
|
+
;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/config/index.ts"],"names":[],"mappings":";;;AAWA,IAAY,IAGT;AAHH,WAAY,IAAI;IACZ,6BAAqB,CAAA;IACrB,yBAAiB,CAAA;AACnB,CAAC,EAHS,IAAI,oBAAJ,IAAI,QAGb;AAAA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|