@skyramp/mcp 0.3.2-rc.pom-3 → 0.3.2
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/build/commands/commandLibrary.d.ts +1 -0
- package/build/commands/commandLibrary.js +19 -13
- package/build/commands/localDevTestChangesCommand.d.ts +15 -0
- package/build/commands/localDevTestChangesCommand.js +201 -0
- package/build/index.js +80 -6
- package/build/prompts/code-reuse.js +3 -0
- package/build/prompts/enhance-assertions/sharedAssertionRules.d.ts +1 -0
- package/build/prompts/enhance-assertions/sharedAssertionRules.js +17 -0
- package/build/prompts/initialize-workspace/initializeWorkspacePrompt.js +11 -9
- package/build/prompts/local-dev/local-dev-plan.d.ts +35 -0
- package/build/prompts/local-dev/local-dev-plan.js +429 -0
- package/build/prompts/local-dev/local-dev-prompts.d.ts +4 -0
- package/build/prompts/local-dev/local-dev-prompts.js +190 -0
- package/build/prompts/pom-aware-code-reuse.js +12 -0
- package/build/prompts/prompt-utils.d.ts +8 -0
- package/build/prompts/prompt-utils.js +33 -0
- package/build/prompts/sut-setup/modes/adaptWorkflowPrompt.js +37 -14
- package/build/prompts/sut-setup/shared.js +16 -12
- package/build/prompts/test-recommendation/analysisOutputPrompt.js +21 -29
- package/build/prompts/test-recommendation/scopeAssessment.d.ts +24 -7
- package/build/prompts/test-recommendation/scopeAssessment.js +111 -12
- package/build/prompts/test-recommendation/test-recommendation-prompt.js +41 -4
- package/build/prompts/testbot/testbot-prompts.d.ts +0 -5
- package/build/prompts/testbot/testbot-prompts.js +32 -52
- package/build/recommendation/planRanker.d.ts +15 -2
- package/build/recommendation/planRanker.js +76 -5
- package/build/resources/testbotResource.js +2 -1
- package/build/services/AnalyticsService.d.ts +1 -1
- package/build/services/TestExecutionService.d.ts +2 -1
- package/build/services/TestExecutionService.js +8 -3
- package/build/services/TestGenerationService.d.ts +2 -2
- package/build/services/TestGenerationService.js +39 -21
- package/build/services/containerEnv.js +3 -1
- package/build/tool-phases.js +6 -0
- package/build/tools/code-refactor/codeReuseTool.js +43 -4
- package/build/tools/code-refactor/enhanceAssertionsTool.js +68 -18
- package/build/tools/code-refactor/reuse-outcome.d.ts +109 -0
- package/build/tools/code-refactor/reuse-outcome.js +158 -0
- package/build/tools/code-refactor/reuse-state.d.ts +45 -0
- package/build/tools/code-refactor/reuse-state.js +140 -0
- package/build/tools/enrichTestWithMocksTool.d.ts +28 -0
- package/build/tools/enrichTestWithMocksTool.js +726 -0
- package/build/tools/executeSkyrampTestTool.d.ts +11 -0
- package/build/tools/executeSkyrampTestTool.js +62 -21
- package/build/tools/generate-tests/batchMockGenerationTool.d.ts +106 -0
- package/build/tools/generate-tests/batchMockGenerationTool.js +545 -0
- package/build/tools/generate-tests/generateBatchScenarioRestTool.js +25 -23
- package/build/tools/generate-tests/generateContractRestTool.js +2 -2
- package/build/tools/generate-tests/generateE2ERestTool.d.ts +1 -1
- package/build/tools/generate-tests/generateE2ERestTool.js +1 -1
- package/build/tools/generate-tests/generateLoadRestTool.d.ts +1 -1
- package/build/tools/generate-tests/generateLoadRestTool.js +1 -1
- package/build/tools/generate-tests/generateMockRestTool.d.ts +179 -6
- package/build/tools/generate-tests/generateMockRestTool.js +391 -22
- package/build/tools/generate-tests/loadTestSchema.d.ts +1 -1
- package/build/tools/generate-tests/planGuard.js +2 -22
- package/build/tools/generateEnrichedIntegrationTestTool.d.ts +25 -0
- package/build/tools/generateEnrichedIntegrationTestTool.js +235 -0
- package/build/tools/localDevWorkerComposeTool.d.ts +24 -0
- package/build/tools/localDevWorkerComposeTool.js +264 -0
- package/build/tools/one-click/oneClickTool.d.ts +13 -0
- package/build/tools/one-click/oneClickTool.js +195 -24
- package/build/tools/preflightMockCheckTool.d.ts +2 -0
- package/build/tools/preflightMockCheckTool.js +96 -0
- package/build/tools/queryProxyMocksTool.d.ts +70 -0
- package/build/tools/queryProxyMocksTool.js +522 -0
- package/build/tools/runExistingTestsTool.d.ts +31 -0
- package/build/tools/runExistingTestsTool.js +214 -13
- package/build/tools/submitReportTool.js +38 -3
- package/build/tools/test-management/analyzeChangesTool.d.ts +2 -1
- package/build/tools/test-management/analyzeChangesTool.js +63 -40
- package/build/tools/test-management/registerTestPlanTool.js +55 -7
- package/build/tools/trace/startTraceCollectionTool.js +3 -3
- package/build/types/FrontendIntegration.d.ts +3 -0
- package/build/types/FrontendIntegration.js +3 -0
- package/build/types/OneClickCommands.d.ts +1 -1
- package/build/types/Recommendation.d.ts +20 -0
- package/build/types/Recommendation.js +32 -6
- package/build/types/RepositoryAnalysis.d.ts +131 -14
- package/build/types/RepositoryAnalysis.js +16 -2
- package/build/types/ReuseOutcome.d.ts +63 -0
- package/build/types/ReuseOutcome.js +33 -0
- package/build/types/TestExecution.d.ts +1 -0
- package/build/types/TestTypes.d.ts +25 -7
- package/build/types/TestTypes.js +22 -6
- package/build/types/TestbotReport.d.ts +7 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.js +1 -0
- package/build/utils/AnalysisStateManager.d.ts +26 -0
- package/build/utils/AnalysisStateManager.js +31 -1
- package/build/utils/analyze-openapi.js +18 -1
- package/build/utils/branchDiff.d.ts +17 -1
- package/build/utils/branchDiff.js +99 -14
- package/build/utils/featureFlags.d.ts +31 -0
- package/build/utils/featureFlags.js +37 -0
- package/build/utils/frontendIntegration.js +8 -1
- package/build/utils/grpcMockValidation.d.ts +1 -0
- package/build/utils/grpcMockValidation.js +49 -0
- package/build/utils/httpMethodValidation.d.ts +4 -0
- package/build/utils/httpMethodValidation.js +15 -0
- package/build/utils/logger.js +1 -1
- package/build/utils/mockCompatibility.d.ts +49 -0
- package/build/utils/mockCompatibility.js +82 -0
- package/build/utils/pom-scope/pom-files.js +7 -0
- package/build/utils/pom-verify/bindings.js +11 -1
- package/build/utils/pom-verify/re-exports.d.ts +10 -0
- package/build/utils/pom-verify/re-exports.js +61 -0
- package/build/utils/pom-verify/resolve.d.ts +4 -1
- package/build/utils/pom-verify/resolve.js +7 -4
- package/build/utils/pom-verify/verify.d.ts +5 -0
- package/build/utils/pom-verify/verify.js +25 -3
- package/build/utils/progress.js +10 -5
- package/build/utils/proxy-terminal.js +3 -3
- package/build/utils/routeParsers.d.ts +3 -9
- package/build/utils/routeParsers.js +79 -4
- package/build/utils/utils.js +2 -2
- package/build/utils/versions.d.ts +4 -3
- package/build/utils/versions.js +3 -1
- package/build/utils/workspaceAuth.d.ts +46 -0
- package/build/utils/workspaceAuth.js +156 -1
- package/build/workspace/testSuites.d.ts +2 -1
- package/build/workspace/testSuites.js +1 -1
- package/build/workspace/workspace.d.ts +108 -32
- package/build/workspace/workspace.js +32 -4
- package/package.json +5 -2
- package/build/adapters/jestAdapter.test.d.ts +0 -1
- package/build/adapters/jestAdapter.test.js +0 -93
- package/build/adapters/mochaAdapter.test.d.ts +0 -1
- package/build/adapters/mochaAdapter.test.js +0 -63
- package/build/adapters/playwrightAdapter.test.d.ts +0 -1
- package/build/adapters/playwrightAdapter.test.js +0 -169
- package/build/adapters/pytestAdapter.test.d.ts +0 -1
- package/build/adapters/pytestAdapter.test.js +0 -90
- package/build/prompts/code-reuse.test.d.ts +0 -1
- package/build/prompts/code-reuse.test.js +0 -62
- package/build/prompts/pom-aware-code-reuse.test.d.ts +0 -1
- package/build/prompts/pom-aware-code-reuse.test.js +0 -11
- package/build/prompts/test-maintenance/drift-analysis-prompt.test.d.ts +0 -1
- package/build/prompts/test-maintenance/drift-analysis-prompt.test.js +0 -51
- package/build/prompts/test-recommendation/analysisOutputPrompt.test.d.ts +0 -1
- package/build/prompts/test-recommendation/analysisOutputPrompt.test.js +0 -264
- package/build/prompts/test-recommendation/mergeEnrichedScenarios.test.d.ts +0 -1
- package/build/prompts/test-recommendation/mergeEnrichedScenarios.test.js +0 -126
- package/build/prompts/test-recommendation/promptPlan.test.d.ts +0 -1
- package/build/prompts/test-recommendation/promptPlan.test.js +0 -336
- package/build/prompts/test-recommendation/scopeAssessment.test.d.ts +0 -1
- package/build/prompts/test-recommendation/scopeAssessment.test.js +0 -371
- package/build/prompts/test-recommendation/test-recommendation-prompt.test.d.ts +0 -1
- package/build/prompts/test-recommendation/test-recommendation-prompt.test.js +0 -1925
- package/build/prompts/testbot/testbot-prompts.test.d.ts +0 -1
- package/build/prompts/testbot/testbot-prompts.test.js +0 -451
- package/build/recommendation/budgeters/diversityBalancedBudgeter.test.d.ts +0 -1
- package/build/recommendation/budgeters/diversityBalancedBudgeter.test.js +0 -138
- package/build/recommendation/budgeters/fixedNBudgeter.test.d.ts +0 -1
- package/build/recommendation/budgeters/fixedNBudgeter.test.js +0 -66
- package/build/recommendation/discriminators.test.d.ts +0 -1
- package/build/recommendation/discriminators.test.js +0 -324
- package/build/recommendation/diversity.test.d.ts +0 -1
- package/build/recommendation/diversity.test.js +0 -77
- package/build/recommendation/planRanker.test.d.ts +0 -1
- package/build/recommendation/planRanker.test.js +0 -110
- package/build/resources/testbotResource.test.d.ts +0 -1
- package/build/resources/testbotResource.test.js +0 -44
- package/build/services/AnalyticsService.test.d.ts +0 -1
- package/build/services/AnalyticsService.test.js +0 -86
- package/build/services/ScenarioGenerationService.integration.test.d.ts +0 -1
- package/build/services/ScenarioGenerationService.integration.test.js +0 -162
- package/build/services/ScenarioGenerationService.test.d.ts +0 -1
- package/build/services/ScenarioGenerationService.test.js +0 -414
- package/build/services/TestDiscoveryService.test.d.ts +0 -1
- package/build/services/TestDiscoveryService.test.js +0 -983
- package/build/services/TestExecutionService.test.d.ts +0 -1
- package/build/services/TestExecutionService.test.js +0 -1032
- package/build/services/TestGenerationService.test.d.ts +0 -1
- package/build/services/TestGenerationService.test.js +0 -578
- package/build/tool-phase-coverage.test.d.ts +0 -1
- package/build/tool-phase-coverage.test.js +0 -49
- package/build/tools/code-refactor/codeReuseTool.test.d.ts +0 -1
- package/build/tools/code-refactor/codeReuseTool.test.js +0 -572
- package/build/tools/generate-tests/generateBatchScenarioRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateBatchScenarioRestTool.test.js +0 -433
- package/build/tools/generate-tests/generateContractRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateContractRestTool.test.js +0 -142
- package/build/tools/generate-tests/generateIntegrationRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateIntegrationRestTool.test.js +0 -159
- package/build/tools/generate-tests/generateLoadRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateLoadRestTool.test.js +0 -169
- package/build/tools/generate-tests/generateUIRestTool.test.d.ts +0 -1
- package/build/tools/generate-tests/generateUIRestTool.test.js +0 -32
- package/build/tools/generate-tests/planGuard.test.d.ts +0 -1
- package/build/tools/generate-tests/planGuard.test.js +0 -185
- package/build/tools/generate-tests/scenarioLint.test.d.ts +0 -1
- package/build/tools/generate-tests/scenarioLint.test.js +0 -100
- package/build/tools/runExistingTestsTool.test.d.ts +0 -1
- package/build/tools/runExistingTestsTool.test.js +0 -379
- package/build/tools/submitReportTool.test.d.ts +0 -1
- package/build/tools/submitReportTool.test.js +0 -1428
- package/build/tools/test-management/actionsTool.test.d.ts +0 -1
- package/build/tools/test-management/actionsTool.test.js +0 -436
- package/build/tools/test-management/analyzeChangesTool.test.d.ts +0 -1
- package/build/tools/test-management/analyzeChangesTool.test.js +0 -522
- package/build/tools/test-management/analyzeTestHealthTool.test.d.ts +0 -1
- package/build/tools/test-management/analyzeTestHealthTool.test.js +0 -385
- package/build/tools/test-management/registerTestPlanTool.test.d.ts +0 -1
- package/build/tools/test-management/registerTestPlanTool.test.js +0 -296
- package/build/tools/trace/resolveSaveStoragePath.test.d.ts +0 -1
- package/build/tools/trace/resolveSaveStoragePath.test.js +0 -17
- package/build/tools/trace/resolveSessionPaths.test.d.ts +0 -1
- package/build/tools/trace/resolveSessionPaths.test.js +0 -104
- package/build/tools/trace/sessionState.test.d.ts +0 -1
- package/build/tools/trace/sessionState.test.js +0 -17
- package/build/tools/workspace/initializeWorkspaceTool.test.d.ts +0 -1
- package/build/tools/workspace/initializeWorkspaceTool.test.js +0 -139
- package/build/tools/workspace/serviceUpsert.test.d.ts +0 -1
- package/build/tools/workspace/serviceUpsert.test.js +0 -50
- package/build/utils/AnalysisStateManager.test.d.ts +0 -1
- package/build/utils/AnalysisStateManager.test.js +0 -134
- package/build/utils/dartRouteExtractor.test.d.ts +0 -1
- package/build/utils/dartRouteExtractor.test.js +0 -307
- package/build/utils/docker.test.d.ts +0 -1
- package/build/utils/docker.test.js +0 -114
- package/build/utils/featureFlags.test.d.ts +0 -1
- package/build/utils/featureFlags.test.js +0 -81
- package/build/utils/fileWalk.test.d.ts +0 -1
- package/build/utils/fileWalk.test.js +0 -252
- package/build/utils/frontendIntegration.test.d.ts +0 -1
- package/build/utils/frontendIntegration.test.js +0 -229
- package/build/utils/frontendSelectors.test.d.ts +0 -1
- package/build/utils/frontendSelectors.test.js +0 -118
- package/build/utils/gitStaging.test.d.ts +0 -1
- package/build/utils/gitStaging.test.js +0 -111
- package/build/utils/httpDefaults.test.d.ts +0 -1
- package/build/utils/httpDefaults.test.js +0 -21
- package/build/utils/importerHop.test.d.ts +0 -1
- package/build/utils/importerHop.test.js +0 -469
- package/build/utils/pathAffinityClassification.test.d.ts +0 -1
- package/build/utils/pathAffinityClassification.test.js +0 -208
- package/build/utils/planMatchKeys.test.d.ts +0 -1
- package/build/utils/planMatchKeys.test.js +0 -123
- package/build/utils/pom-scope/index.test.d.ts +0 -1
- package/build/utils/pom-scope/index.test.js +0 -278
- package/build/utils/pom-scope/pom-files.test.d.ts +0 -1
- package/build/utils/pom-scope/pom-files.test.js +0 -29
- package/build/utils/pom-scope/scoring.test.d.ts +0 -1
- package/build/utils/pom-scope/scoring.test.js +0 -39
- package/build/utils/pom-scope/selector-extractor.test.d.ts +0 -1
- package/build/utils/pom-scope/selector-extractor.test.js +0 -67
- package/build/utils/pom-verify/bindings.test.d.ts +0 -1
- package/build/utils/pom-verify/bindings.test.js +0 -164
- package/build/utils/pom-verify/calls.test.d.ts +0 -1
- package/build/utils/pom-verify/calls.test.js +0 -61
- package/build/utils/pom-verify/resolve.test.d.ts +0 -1
- package/build/utils/pom-verify/resolve.test.js +0 -114
- package/build/utils/pom-verify/verify.test.d.ts +0 -1
- package/build/utils/pom-verify/verify.test.js +0 -374
- package/build/utils/pr-comment-parser.test.d.ts +0 -1
- package/build/utils/pr-comment-parser.test.js +0 -428
- package/build/utils/progress.test.d.ts +0 -1
- package/build/utils/progress.test.js +0 -37
- package/build/utils/projectMetadata.test.d.ts +0 -1
- package/build/utils/projectMetadata.test.js +0 -172
- package/build/utils/pythonMountPrefixes.test.d.ts +0 -1
- package/build/utils/pythonMountPrefixes.test.js +0 -113
- package/build/utils/repoScanner.test.d.ts +0 -1
- package/build/utils/repoScanner.test.js +0 -190
- package/build/utils/reportVerification.test.d.ts +0 -1
- package/build/utils/reportVerification.test.js +0 -185
- package/build/utils/routeParsers.test.d.ts +0 -1
- package/build/utils/routeParsers.test.js +0 -1011
- package/build/utils/scenarioDrafting.test.d.ts +0 -1
- package/build/utils/scenarioDrafting.test.js +0 -876
- package/build/utils/sourceRouteExtractor.test.d.ts +0 -1
- package/build/utils/sourceRouteExtractor.test.js +0 -738
- package/build/utils/telemetry.test.d.ts +0 -1
- package/build/utils/telemetry.test.js +0 -70
- package/build/utils/trace-parser.test.d.ts +0 -6
- package/build/utils/trace-parser.test.js +0 -140
- package/build/utils/uiPageEnumerator.test.d.ts +0 -1
- package/build/utils/uiPageEnumerator.test.js +0 -824
- package/build/utils/utils.test.d.ts +0 -1
- package/build/utils/utils.test.js +0 -103
- package/build/utils/walkerCharacterization.test.d.ts +0 -1
- package/build/utils/walkerCharacterization.test.js +0 -233
- package/build/utils/workspaceAuth.test.d.ts +0 -1
- package/build/utils/workspaceAuth.test.js +0 -260
- package/build/workspace/testSuites.test.d.ts +0 -1
- package/build/workspace/testSuites.test.js +0 -23
- package/build/workspace/workspace.test.d.ts +0 -1
- package/build/workspace/workspace.test.js +0 -264
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { getRepositoryInfo, parseRepositoryFromRemoteUrl } from "./telemetry.js";
|
|
2
|
-
describe("parseRepositoryFromRemoteUrl", () => {
|
|
3
|
-
it("parses an HTTPS remote with .git suffix", () => {
|
|
4
|
-
expect(parseRepositoryFromRemoteUrl("https://github.com/acme-corp/their-api.git")).toEqual({ repository: "acme-corp/their-api", repositoryOwner: "acme-corp" });
|
|
5
|
-
});
|
|
6
|
-
it("parses an HTTPS remote without .git suffix", () => {
|
|
7
|
-
expect(parseRepositoryFromRemoteUrl("https://github.com/acme-corp/their-api")).toEqual({ repository: "acme-corp/their-api", repositoryOwner: "acme-corp" });
|
|
8
|
-
});
|
|
9
|
-
it("parses an SSH remote", () => {
|
|
10
|
-
expect(parseRepositoryFromRemoteUrl("git@github.com:acme-corp/their-api.git")).toEqual({ repository: "acme-corp/their-api", repositoryOwner: "acme-corp" });
|
|
11
|
-
});
|
|
12
|
-
it("trims trailing whitespace/newline from git output", () => {
|
|
13
|
-
expect(parseRepositoryFromRemoteUrl("git@github.com:acme-corp/their-api.git\n")).toEqual({ repository: "acme-corp/their-api", repositoryOwner: "acme-corp" });
|
|
14
|
-
});
|
|
15
|
-
it("returns undefined for an unparseable URL", () => {
|
|
16
|
-
expect(parseRepositoryFromRemoteUrl("not-a-remote")).toBeUndefined();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe("getRepositoryInfo", () => {
|
|
20
|
-
const originalEnv = { ...process.env };
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
process.env = { ...originalEnv };
|
|
23
|
-
});
|
|
24
|
-
describe("in GitHub Actions", () => {
|
|
25
|
-
beforeEach(() => {
|
|
26
|
-
process.env.GITHUB_ACTIONS = "true";
|
|
27
|
-
});
|
|
28
|
-
it("returns repository and owner from env vars", async () => {
|
|
29
|
-
process.env.GITHUB_REPOSITORY = "acme-corp/their-api";
|
|
30
|
-
process.env.GITHUB_REPOSITORY_OWNER = "acme-corp";
|
|
31
|
-
await expect(getRepositoryInfo()).resolves.toEqual({
|
|
32
|
-
repository: "acme-corp/their-api",
|
|
33
|
-
repositoryOwner: "acme-corp",
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
it("includes only the fields that are present", async () => {
|
|
37
|
-
process.env.GITHUB_REPOSITORY = "acme-corp/their-api";
|
|
38
|
-
delete process.env.GITHUB_REPOSITORY_OWNER;
|
|
39
|
-
await expect(getRepositoryInfo()).resolves.toEqual({
|
|
40
|
-
repository: "acme-corp/their-api",
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
describe("local / IDE", () => {
|
|
45
|
-
beforeEach(() => {
|
|
46
|
-
delete process.env.GITHUB_ACTIONS;
|
|
47
|
-
});
|
|
48
|
-
it("derives repository info from the local git remote", async () => {
|
|
49
|
-
// The test suite itself runs inside the mcp git repo (origin = letsramp/mcp),
|
|
50
|
-
// so a local lookup should resolve owner=letsramp, repo=mcp.
|
|
51
|
-
const info = await getRepositoryInfo();
|
|
52
|
-
expect(info.repositoryOwner).toBe("letsramp");
|
|
53
|
-
expect(info.repository).toBe("letsramp/mcp");
|
|
54
|
-
});
|
|
55
|
-
it("uses the caller-supplied cwd when provided", async () => {
|
|
56
|
-
// Passing the repo path explicitly (as tools do via repositoryPath)
|
|
57
|
-
// resolves the same remote even if process.cwd() differs.
|
|
58
|
-
const info = await getRepositoryInfo(process.cwd());
|
|
59
|
-
expect(info.repository).toBe("letsramp/mcp");
|
|
60
|
-
});
|
|
61
|
-
it("ignores GITHUB_REPOSITORY env when not in GitHub Actions", async () => {
|
|
62
|
-
// A stray env var must not be trusted outside Actions; the git remote is
|
|
63
|
-
// the source of truth locally.
|
|
64
|
-
process.env.GITHUB_REPOSITORY = "spoofed/repo";
|
|
65
|
-
process.env.GITHUB_REPOSITORY_OWNER = "spoofed";
|
|
66
|
-
const info = await getRepositoryInfo();
|
|
67
|
-
expect(info.repository).not.toBe("spoofed/repo");
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for trace-parser.ts — specifically the scanTraceArtifactDirs scoping
|
|
3
|
-
* introduced to prevent demo/fixture files (e.g. frontend/public/traces/) from being
|
|
4
|
-
* misidentified as testbot-generated traces.
|
|
5
|
-
*/
|
|
6
|
-
import * as fs from "fs";
|
|
7
|
-
import * as os from "os";
|
|
8
|
-
import * as path from "path";
|
|
9
|
-
import { discoverTraceFiles, discoverPlaywrightZips } from "./trace-parser.js";
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
// Helpers
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
function mkdirp(dir) {
|
|
14
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
15
|
-
}
|
|
16
|
-
function touch(file) {
|
|
17
|
-
mkdirp(path.dirname(file));
|
|
18
|
-
fs.writeFileSync(file, "");
|
|
19
|
-
}
|
|
20
|
-
function withTempRepo(fn) {
|
|
21
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "trace-parser-test-"));
|
|
22
|
-
try {
|
|
23
|
-
fn(dir);
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
// discoverPlaywrightZips — scoping tests
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
describe("discoverPlaywrightZips — scanTraceArtifactDirs scoping", () => {
|
|
33
|
-
it("does NOT discover playwright zip in frontend/public/traces/ (demo fixture dir)", () => {
|
|
34
|
-
withTempRepo(repo => {
|
|
35
|
-
touch(path.join(repo, "frontend", "public", "traces", "ui_test_playwright.zip"));
|
|
36
|
-
expect(discoverPlaywrightZips(repo)).toEqual([]);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
it("discovers playwright zip in tests/ (test-artifact dir)", () => {
|
|
40
|
-
withTempRepo(repo => {
|
|
41
|
-
const zip = path.join(repo, "tests", "ui_test_playwright.zip");
|
|
42
|
-
touch(zip);
|
|
43
|
-
expect(discoverPlaywrightZips(repo)).toContain(zip);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
it("discovers playwright zip in .skyramp/ (test-artifact dir)", () => {
|
|
47
|
-
withTempRepo(repo => {
|
|
48
|
-
const zip = path.join(repo, ".skyramp", "recording_playwright.zip");
|
|
49
|
-
touch(zip);
|
|
50
|
-
expect(discoverPlaywrightZips(repo)).toContain(zip);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
it("discovers playwright zip in e2e/ (test-artifact dir)", () => {
|
|
54
|
-
withTempRepo(repo => {
|
|
55
|
-
const zip = path.join(repo, "e2e", "flow_playwright.zip");
|
|
56
|
-
touch(zip);
|
|
57
|
-
expect(discoverPlaywrightZips(repo)).toContain(zip);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
it("discovers playwright zip in playwright/ (test-artifact dir)", () => {
|
|
61
|
-
withTempRepo(repo => {
|
|
62
|
-
const zip = path.join(repo, "playwright", "trace.zip");
|
|
63
|
-
touch(zip);
|
|
64
|
-
expect(discoverPlaywrightZips(repo)).toContain(zip);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
it("does NOT discover zip in src/ (not a test-artifact dir)", () => {
|
|
68
|
-
withTempRepo(repo => {
|
|
69
|
-
touch(path.join(repo, "src", "recordings", "ui_playwright.zip"));
|
|
70
|
-
expect(discoverPlaywrightZips(repo)).toEqual([]);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
it("does NOT discover zip in deeply nested non-test dir", () => {
|
|
74
|
-
withTempRepo(repo => {
|
|
75
|
-
touch(path.join(repo, "frontend", "src", "assets", "demo_playwright.zip"));
|
|
76
|
-
expect(discoverPlaywrightZips(repo)).toEqual([]);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
// ---------------------------------------------------------------------------
|
|
81
|
-
// discoverTraceFiles — scoping tests
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
describe("discoverTraceFiles — scanTraceArtifactDirs scoping", () => {
|
|
84
|
-
it("does NOT discover trace.json nested under frontend/public/traces/", () => {
|
|
85
|
-
withTempRepo(repo => {
|
|
86
|
-
touch(path.join(repo, "frontend", "public", "traces", "backend_trace.json"));
|
|
87
|
-
const found = discoverTraceFiles(repo);
|
|
88
|
-
// fixed-name root candidates don't match "backend_trace.json", and scan won't reach frontend/
|
|
89
|
-
expect(found.some(f => f.includes("frontend"))).toBe(false);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
it("discovers trace.json in tests/ dir", () => {
|
|
93
|
-
withTempRepo(repo => {
|
|
94
|
-
const f = path.join(repo, "tests", "backend_trace.json");
|
|
95
|
-
touch(f);
|
|
96
|
-
expect(discoverTraceFiles(repo)).toContain(f);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
it("discovers trace.json in .skyramp/ dir", () => {
|
|
100
|
-
withTempRepo(repo => {
|
|
101
|
-
const f = path.join(repo, ".skyramp", "skyramp_trace.json");
|
|
102
|
-
touch(f);
|
|
103
|
-
expect(discoverTraceFiles(repo)).toContain(f);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
it("discovers root-level trace.json", () => {
|
|
107
|
-
withTempRepo(repo => {
|
|
108
|
-
const f = path.join(repo, "trace.json");
|
|
109
|
-
touch(f);
|
|
110
|
-
expect(discoverTraceFiles(repo)).toContain(f);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
it("discovers root-level skyramp_traces.json via fixed-name check", () => {
|
|
114
|
-
withTempRepo(repo => {
|
|
115
|
-
const f = path.join(repo, "skyramp_traces.json");
|
|
116
|
-
touch(f);
|
|
117
|
-
expect(discoverTraceFiles(repo)).toContain(f);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
it("does NOT discover scenario_ json files (excluded by predicate)", () => {
|
|
121
|
-
withTempRepo(repo => {
|
|
122
|
-
touch(path.join(repo, "tests", "scenario_orders_trace.json"));
|
|
123
|
-
expect(discoverTraceFiles(repo)).toEqual([]);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
it("does NOT discover _test.json files (excluded by predicate)", () => {
|
|
127
|
-
withTempRepo(repo => {
|
|
128
|
-
touch(path.join(repo, "tests", "orders_trace_test.json"));
|
|
129
|
-
expect(discoverTraceFiles(repo)).toEqual([]);
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
it("results are deduplicated when fixed-name and scan both find the same root file", () => {
|
|
133
|
-
withTempRepo(repo => {
|
|
134
|
-
const f = path.join(repo, "trace.json");
|
|
135
|
-
touch(f);
|
|
136
|
-
const found = discoverTraceFiles(repo);
|
|
137
|
-
expect(found.filter(x => x === f)).toHaveLength(1);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|