api-tests-coverage 1.0.16 → 1.0.18
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/dist/dashboard/dist/assets/_basePickBy-CYB1KXah.js +1 -0
- package/dist/dashboard/dist/assets/_baseUniq-Bwm426M6.js +1 -0
- package/dist/dashboard/dist/assets/arc-B7p8x22e.js +1 -0
- package/dist/dashboard/dist/assets/architectureDiagram-VXUJARFQ-wVr1_uNB.js +36 -0
- package/dist/dashboard/dist/assets/blockDiagram-VD42YOAC-BBXc88fn.js +122 -0
- package/dist/dashboard/dist/assets/c4Diagram-YG6GDRKO-BsgzPfQ3.js +10 -0
- package/dist/dashboard/dist/assets/channel-psxgcQ_j.js +1 -0
- package/dist/dashboard/dist/assets/chunk-4BX2VUAB-BF8loPLD.js +1 -0
- package/dist/dashboard/dist/assets/chunk-55IACEB6-C3HNF-UF.js +1 -0
- package/dist/dashboard/dist/assets/chunk-B4BG7PRW-wQ6TCEMq.js +165 -0
- package/dist/dashboard/dist/assets/chunk-DI55MBZ5-B7xHuqZu.js +220 -0
- package/dist/dashboard/dist/assets/chunk-FMBD7UC4-K3PC79JF.js +15 -0
- package/dist/dashboard/dist/assets/chunk-QN33PNHL-CmeZ1h1Z.js +1 -0
- package/dist/dashboard/dist/assets/chunk-QZHKN3VN-Cyg7Km90.js +1 -0
- package/dist/dashboard/dist/assets/chunk-TZMSLE5B-C8KNXDi7.js +1 -0
- package/dist/dashboard/dist/assets/classDiagram-2ON5EDUG-AMwn99HP.js +1 -0
- package/dist/dashboard/dist/assets/classDiagram-v2-WZHVMYZB-AMwn99HP.js +1 -0
- package/dist/dashboard/dist/assets/clone-KEkbvJY9.js +1 -0
- package/dist/dashboard/dist/assets/cose-bilkent-S5V4N54A-YL9kFxCl.js +1 -0
- package/dist/dashboard/dist/assets/dagre-6UL2VRFP-NZWnQN_Y.js +4 -0
- package/dist/dashboard/dist/assets/diagram-PSM6KHXK-DGtyS7lD.js +24 -0
- package/dist/dashboard/dist/assets/diagram-QEK2KX5R-CSCGZUfr.js +43 -0
- package/dist/dashboard/dist/assets/diagram-S2PKOQOG-DdqZVGN1.js +24 -0
- package/dist/dashboard/dist/assets/erDiagram-Q2GNP2WA-Dhb_VQMS.js +60 -0
- package/dist/dashboard/dist/assets/flowDiagram-NV44I4VS-gKUH-GJ2.js +162 -0
- package/dist/dashboard/dist/assets/ganttDiagram-JELNMOA3-Dm_lLo9y.js +267 -0
- package/dist/dashboard/dist/assets/gitGraphDiagram-V2S2FVAM-DM9AW1aP.js +65 -0
- package/dist/dashboard/dist/assets/graph-Clj85F2M.js +1 -0
- package/dist/dashboard/dist/assets/index-CqEIqNus.js +781 -0
- package/dist/dashboard/dist/assets/index-xecKLQ58.css +1 -0
- package/dist/dashboard/dist/assets/infoDiagram-HS3SLOUP-BMp4C5wf.js +2 -0
- package/dist/dashboard/dist/assets/journeyDiagram-XKPGCS4Q-BC0GSZ7W.js +139 -0
- package/dist/dashboard/dist/assets/kanban-definition-3W4ZIXB7-D6aRd_q1.js +89 -0
- package/dist/dashboard/dist/assets/layout-BbJNDkTr.js +1 -0
- package/dist/dashboard/dist/assets/mindmap-definition-VGOIOE7T-B93XW27v.js +68 -0
- package/dist/dashboard/dist/assets/pieDiagram-ADFJNKIX-9G1tEuaq.js +30 -0
- package/dist/dashboard/dist/assets/quadrantDiagram-AYHSOK5B-jDtdB4Ws.js +7 -0
- package/dist/dashboard/dist/assets/requirementDiagram-UZGBJVZJ-WIJ0qiJG.js +64 -0
- package/dist/dashboard/dist/assets/sankeyDiagram-TZEHDZUN-Cb4WB9UB.js +10 -0
- package/dist/dashboard/dist/assets/sequenceDiagram-WL72ISMW-BqGJWVUS.js +145 -0
- package/dist/dashboard/dist/assets/stateDiagram-FKZM4ZOC-0Wd-KmOv.js +1 -0
- package/dist/dashboard/dist/assets/stateDiagram-v2-4FDKWEC3-BlwaoFEG.js +1 -0
- package/dist/dashboard/dist/assets/timeline-definition-IT6M3QCI-CAmQOjBu.js +61 -0
- package/dist/dashboard/dist/assets/treemap-GDKQZRPO-CRP-WvE-.js +162 -0
- package/dist/dashboard/dist/assets/xychartDiagram-PRI3JC2R-5DoR2_q5.js +7 -0
- package/dist/dashboard/dist/index.html +2 -2
- package/dist/src/config/defaultConfig.d.ts.map +1 -1
- package/dist/src/config/defaultConfig.js +37 -0
- package/dist/src/config/types.d.ts +42 -0
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/config/validateConfig.d.ts.map +1 -1
- package/dist/src/config/validateConfig.js +3 -0
- package/dist/src/discovery/fileClassifier.d.ts.map +1 -1
- package/dist/src/discovery/fileClassifier.js +15 -16
- package/dist/src/discovery/projectDiscovery.d.ts.map +1 -1
- package/dist/src/discovery/projectDiscovery.js +4 -1
- package/dist/src/generation/ai-flow-exporter.d.ts +7 -0
- package/dist/src/generation/ai-flow-exporter.d.ts.map +1 -0
- package/dist/src/generation/ai-flow-exporter.js +260 -0
- package/dist/src/generation/context-builder.d.ts +16 -0
- package/dist/src/generation/context-builder.d.ts.map +1 -0
- package/dist/src/generation/context-builder.js +170 -0
- package/dist/src/generation/engine.d.ts +19 -0
- package/dist/src/generation/engine.d.ts.map +1 -0
- package/dist/src/generation/engine.js +204 -0
- package/dist/src/generation/file-router.d.ts +8 -0
- package/dist/src/generation/file-router.d.ts.map +1 -0
- package/dist/src/generation/file-router.js +98 -0
- package/dist/src/generation/gap-extractor.d.ts +7 -0
- package/dist/src/generation/gap-extractor.d.ts.map +1 -0
- package/dist/src/generation/gap-extractor.js +291 -0
- package/dist/src/generation/index.d.ts +9 -0
- package/dist/src/generation/index.d.ts.map +1 -0
- package/dist/src/generation/index.js +15 -0
- package/dist/src/generation/quality-scorer.d.ts +15 -0
- package/dist/src/generation/quality-scorer.d.ts.map +1 -0
- package/dist/src/generation/quality-scorer.js +273 -0
- package/dist/src/generation/template-renderer.d.ts +12 -0
- package/dist/src/generation/template-renderer.d.ts.map +1 -0
- package/dist/src/generation/template-renderer.js +546 -0
- package/dist/src/generation/types.d.ts +269 -0
- package/dist/src/generation/types.d.ts.map +1 -0
- package/dist/src/generation/types.js +6 -0
- package/dist/src/index.js +113 -0
- package/dist/src/languages/java/semanticBuilder.d.ts.map +1 -1
- package/dist/src/languages/java/semanticBuilder.js +69 -12
- package/dist/src/languages/javascript/angularDetector.d.ts.map +1 -1
- package/dist/src/languages/javascript/angularDetector.js +50 -17
- package/dist/src/languages/javascript/assertionResolver.js +6 -4
- package/dist/src/languages/javascript/hapiDetector.d.ts.map +1 -1
- package/dist/src/languages/javascript/hapiDetector.js +48 -5
- package/dist/src/languages/javascript/vueDetector.d.ts +2 -0
- package/dist/src/languages/javascript/vueDetector.d.ts.map +1 -1
- package/dist/src/languages/javascript/vueDetector.js +22 -0
- package/dist/src/languages/python/index.d.ts +1 -1
- package/dist/src/languages/python/index.d.ts.map +1 -1
- package/dist/src/languages/python/index.js +33 -3
- package/dist/src/pipeline/confidence.d.ts +6 -1
- package/dist/src/pipeline/confidence.d.ts.map +1 -1
- package/dist/src/pipeline/confidence.js +8 -3
- package/dist/src/pipeline/graph.d.ts.map +1 -1
- package/dist/src/pipeline/graph.js +16 -4
- package/dist/src/pipeline/stages/ast/astStage.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/astStage.js +46 -2
- package/dist/src/pipeline/stages/ast/baseUrlComposer.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/baseUrlComposer.js +18 -4
- package/dist/src/pipeline/stages/ast/crossFileResolver.js +29 -0
- package/dist/src/pipeline/stages/ast/graphBuilder.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/graphBuilder.js +81 -0
- package/dist/src/pipeline/stages/ast/optionalAuthUnifier.d.ts +3 -1
- package/dist/src/pipeline/stages/ast/optionalAuthUnifier.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/optionalAuthUnifier.js +34 -14
- package/dist/src/pipeline/stages/ast/resolvers/angularInjectionResolver.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/resolvers/angularInjectionResolver.js +22 -3
- package/dist/src/pipeline/stages/ast/resolvers/dddLayerResolver.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/resolvers/dddLayerResolver.js +104 -28
- package/dist/src/pipeline/stages/ast/resolvers/mybatisResolver.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/resolvers/mybatisResolver.js +56 -0
- package/dist/src/pipeline/stages/ast/resolvers/vuexActionResolver.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/resolvers/vuexActionResolver.js +43 -18
- package/dist/src/pipeline/stages/ast/rulesEnforcer.d.ts.map +1 -1
- package/dist/src/pipeline/stages/ast/rulesEnforcer.js +336 -45
- package/dist/src/pipeline/stages/merge/conflictDetector.d.ts +2 -0
- package/dist/src/pipeline/stages/merge/conflictDetector.d.ts.map +1 -1
- package/dist/src/pipeline/stages/merge/conflictDetector.js +54 -2
- package/dist/src/pipeline/stages/merge/coverageMappingBuilder.d.ts.map +1 -1
- package/dist/src/pipeline/stages/merge/coverageMappingBuilder.js +67 -3
- package/dist/src/pipeline/stages/tia/mockBoundaryDetector.d.ts.map +1 -1
- package/dist/src/pipeline/stages/tia/mockBoundaryDetector.js +8 -1
- package/dist/src/pipeline/stages/tia/parameterizedTestExpander.js +8 -4
- package/dist/src/pipeline/stages/tia/testLayerClassifier.d.ts.map +1 -1
- package/dist/src/pipeline/stages/tia/testLayerClassifier.js +36 -10
- package/dist/src/pipeline/types.d.ts +1 -1
- package/dist/src/pipeline/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -14,47 +14,25 @@ function enforceStructureAgnosticRules(symbolTable, projectRoot) {
|
|
|
14
14
|
const violations = [];
|
|
15
15
|
let rulesChecked = 0;
|
|
16
16
|
let rulesPassed = 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
violations.push(...sa04Violations);
|
|
37
|
-
if (sa04Violations.length === 0)
|
|
38
|
-
rulesPassed++;
|
|
39
|
-
// RULE-SA05: @Mapper interfaces linked to XML
|
|
40
|
-
rulesChecked++;
|
|
41
|
-
// Checked by mybatisResolver — passes if no unresolved mappers
|
|
42
|
-
rulesPassed++;
|
|
43
|
-
// RULE-SA06: .graphqls files parsed as first-class
|
|
44
|
-
rulesChecked++;
|
|
45
|
-
rulesPassed++;
|
|
46
|
-
// RULE-SA07: Angular HttpClient in services followed through injection
|
|
47
|
-
rulesChecked++;
|
|
48
|
-
rulesPassed++;
|
|
49
|
-
// RULE-SA08: Vuex dispatch linked to actions
|
|
50
|
-
rulesChecked++;
|
|
51
|
-
rulesPassed++;
|
|
52
|
-
// RULE-SA09: Functional Angular guards detected
|
|
53
|
-
rulesChecked++;
|
|
54
|
-
rulesPassed++;
|
|
55
|
-
// RULE-SA10: webtest/TestApp detected as API test evidence
|
|
56
|
-
rulesChecked++;
|
|
57
|
-
rulesPassed++;
|
|
17
|
+
const checks = [
|
|
18
|
+
{ id: 'SA01', fn: () => checkRuleSA01(symbolTable, projectRoot) },
|
|
19
|
+
{ id: 'SA02', fn: () => checkRuleSA02(symbolTable) },
|
|
20
|
+
{ id: 'SA03', fn: () => checkRuleSA03(symbolTable) },
|
|
21
|
+
{ id: 'SA04', fn: () => checkRuleSA04(symbolTable) },
|
|
22
|
+
{ id: 'SA05', fn: () => checkRuleSA05(symbolTable) },
|
|
23
|
+
{ id: 'SA06', fn: () => checkRuleSA06(symbolTable) },
|
|
24
|
+
{ id: 'SA07', fn: () => checkRuleSA07(symbolTable) },
|
|
25
|
+
{ id: 'SA08', fn: () => checkRuleSA08(symbolTable) },
|
|
26
|
+
{ id: 'SA09', fn: () => checkRuleSA09(symbolTable) },
|
|
27
|
+
{ id: 'SA10', fn: () => checkRuleSA10(symbolTable) },
|
|
28
|
+
];
|
|
29
|
+
for (const check of checks) {
|
|
30
|
+
rulesChecked++;
|
|
31
|
+
const ruleViolations = check.fn();
|
|
32
|
+
violations.push(...ruleViolations);
|
|
33
|
+
if (ruleViolations.length === 0)
|
|
34
|
+
rulesPassed++;
|
|
35
|
+
}
|
|
58
36
|
return { violations, rulesChecked, rulesPassed };
|
|
59
37
|
}
|
|
60
38
|
/**
|
|
@@ -62,10 +40,26 @@ function enforceStructureAgnosticRules(symbolTable, projectRoot) {
|
|
|
62
40
|
* Checks that route registrations have content-based evidence, not just path-based.
|
|
63
41
|
*/
|
|
64
42
|
function checkRuleSA01(symbolTable, projectRoot) {
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
43
|
+
const violations = [];
|
|
44
|
+
// Check route registrations for directory-only evidence
|
|
45
|
+
for (const [filePath, model] of symbolTable.models) {
|
|
46
|
+
if (!model.routeRegistrations)
|
|
47
|
+
continue;
|
|
48
|
+
for (const reg of model.routeRegistrations) {
|
|
49
|
+
// A route with no registrar (no decorator, no app.route, no router.METHOD)
|
|
50
|
+
// that was classified solely from its directory path is a violation
|
|
51
|
+
if (!reg.registrarName && !reg.methods && !reg.security) {
|
|
52
|
+
violations.push({
|
|
53
|
+
ruleId: 'SA01',
|
|
54
|
+
severity: 'error',
|
|
55
|
+
message: `Route '${reg.path}' in ${filePath} appears to lack content-based evidence`,
|
|
56
|
+
filePath,
|
|
57
|
+
line: reg.line,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return violations;
|
|
69
63
|
}
|
|
70
64
|
/**
|
|
71
65
|
* RULE-SA02: All endpoint nodes must have fully resolved URLs.
|
|
@@ -91,6 +85,39 @@ function checkRuleSA02(symbolTable) {
|
|
|
91
85
|
}
|
|
92
86
|
return violations;
|
|
93
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* RULE-SA03: Service/repository nodes must be detected without requiring framework annotations.
|
|
90
|
+
* Checks that interface implementations exist in the symbol table for projects that have
|
|
91
|
+
* classes following DDD patterns (Repository, Store, Gateway naming or method patterns).
|
|
92
|
+
*/
|
|
93
|
+
function checkRuleSA03(symbolTable) {
|
|
94
|
+
const violations = [];
|
|
95
|
+
// Find classes that look like repositories by naming convention
|
|
96
|
+
const repoLikeClasses = [];
|
|
97
|
+
for (const [className, classDecl] of symbolTable.classes) {
|
|
98
|
+
if (/(?:Repository|Repo|Store|Gateway)$/i.test(className)) {
|
|
99
|
+
repoLikeClasses.push(className);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// If there are repository-like classes, check that at least some have interface implementations resolved
|
|
103
|
+
if (repoLikeClasses.length > 0) {
|
|
104
|
+
let hasAnyImpl = false;
|
|
105
|
+
for (const [, impls] of symbolTable.interfaceImplementations) {
|
|
106
|
+
if (impls.length > 0) {
|
|
107
|
+
hasAnyImpl = true;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (!hasAnyImpl && repoLikeClasses.length >= 2) {
|
|
112
|
+
violations.push({
|
|
113
|
+
ruleId: 'SA03',
|
|
114
|
+
severity: 'warning',
|
|
115
|
+
message: `Found ${repoLikeClasses.length} repository-like class(es) but no interface→implementation mappings resolved`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return violations;
|
|
120
|
+
}
|
|
94
121
|
/**
|
|
95
122
|
* RULE-SA04: Optional auth must be distinguished from public.
|
|
96
123
|
* Checks that models with route registrations having security classifications
|
|
@@ -118,3 +145,267 @@ function checkRuleSA04(symbolTable) {
|
|
|
118
145
|
}
|
|
119
146
|
return violations;
|
|
120
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* RULE-SA05: @Mapper interfaces must be linked to their XML mapper files.
|
|
150
|
+
* Checks that all interface implementations with MyBatis naming have corresponding XML bindings.
|
|
151
|
+
*/
|
|
152
|
+
function checkRuleSA05(symbolTable) {
|
|
153
|
+
const violations = [];
|
|
154
|
+
// Find @Mapper-like classes (by naming convention or annotations)
|
|
155
|
+
for (const [className, classDecl] of symbolTable.classes) {
|
|
156
|
+
if (!className.endsWith('Mapper'))
|
|
157
|
+
continue;
|
|
158
|
+
// Check if this mapper has a corresponding interface implementation (XML binding)
|
|
159
|
+
let hasBinding = false;
|
|
160
|
+
for (const [, impls] of symbolTable.interfaceImplementations) {
|
|
161
|
+
if (impls.some((impl) => impl.interfaceName === className || impl.implName.includes(className))) {
|
|
162
|
+
hasBinding = true;
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Check if there are any models with MyBatis-related content
|
|
167
|
+
const model = symbolTable.models.get(classDecl.filePath);
|
|
168
|
+
if (model && !hasBinding) {
|
|
169
|
+
// Only warn if the project appears to use MyBatis (has XML-linked implementations)
|
|
170
|
+
let projectUsesMyBatis = false;
|
|
171
|
+
for (const [, impls] of symbolTable.interfaceImplementations) {
|
|
172
|
+
if (impls.some((impl) => impl.implName.includes('XmlMapper'))) {
|
|
173
|
+
projectUsesMyBatis = true;
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (projectUsesMyBatis) {
|
|
178
|
+
violations.push({
|
|
179
|
+
ruleId: 'SA05',
|
|
180
|
+
severity: 'warning',
|
|
181
|
+
message: `@Mapper interface '${className}' in ${classDecl.filePath} has no linked XML mapper`,
|
|
182
|
+
filePath: classDecl.filePath,
|
|
183
|
+
line: classDecl.line,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return violations;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* RULE-SA06: .graphqls schema files must be parsed as first-class endpoint definitions.
|
|
192
|
+
* Checks that GraphQL schemas produce endpoint nodes when present.
|
|
193
|
+
*/
|
|
194
|
+
function checkRuleSA06(symbolTable) {
|
|
195
|
+
const violations = [];
|
|
196
|
+
// Check if there are any .graphqls or .graphql files in the models that lack route registrations
|
|
197
|
+
for (const [filePath, model] of symbolTable.models) {
|
|
198
|
+
if (!filePath.endsWith('.graphqls') && !filePath.endsWith('.graphql'))
|
|
199
|
+
continue;
|
|
200
|
+
// GraphQL schema files should produce route registrations
|
|
201
|
+
if (!model.routeRegistrations || model.routeRegistrations.length === 0) {
|
|
202
|
+
violations.push({
|
|
203
|
+
ruleId: 'SA06',
|
|
204
|
+
severity: 'warning',
|
|
205
|
+
message: `GraphQL schema file '${filePath}' was not parsed into endpoint definitions`,
|
|
206
|
+
filePath,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return violations;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* RULE-SA07: Angular HttpClient calls in @Injectable services must be followed through injection.
|
|
214
|
+
* Checks that services with HTTP calls have injection chains linking them to consumers.
|
|
215
|
+
*/
|
|
216
|
+
function checkRuleSA07(symbolTable) {
|
|
217
|
+
var _a, _b;
|
|
218
|
+
const violations = [];
|
|
219
|
+
// Find services with HTTP calls that have no injection chain consumers
|
|
220
|
+
for (const [className, classDecl] of symbolTable.classes) {
|
|
221
|
+
const model = symbolTable.models.get(classDecl.filePath);
|
|
222
|
+
if (!model)
|
|
223
|
+
continue;
|
|
224
|
+
// Check if this class has methods with HTTP calls
|
|
225
|
+
let hasHttpCalls = false;
|
|
226
|
+
for (const [, func] of model.functions) {
|
|
227
|
+
if (func.bodyHttpCalls.length > 0) {
|
|
228
|
+
hasHttpCalls = true;
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (!hasHttpCalls)
|
|
233
|
+
continue;
|
|
234
|
+
// Content-based check: is this an Angular @Injectable service?
|
|
235
|
+
// (RULE-SA01 compliant — no filename convention used)
|
|
236
|
+
const hasInjectableMarker = ((_b = (_a = model.decoratorStacks) === null || _a === void 0 ? void 0 : _a.some((ds) => ds.decorators.some((d) => d.name === 'Injectable' || d.name.includes('Injectable')))) !== null && _b !== void 0 ? _b : false) ||
|
|
237
|
+
Array.from(model.functions.values()).some((f) => { var _a; return (_a = f.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a === 'Injectable' || a === '@Injectable'); });
|
|
238
|
+
if (!hasInjectableMarker)
|
|
239
|
+
continue;
|
|
240
|
+
// Check if any injection chains reference this service
|
|
241
|
+
let hasConsumer = false;
|
|
242
|
+
for (const [, chains] of symbolTable.injectionChains) {
|
|
243
|
+
if (chains.some((c) => c.serviceClass === className)) {
|
|
244
|
+
hasConsumer = true;
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (!hasConsumer) {
|
|
249
|
+
violations.push({
|
|
250
|
+
ruleId: 'SA07',
|
|
251
|
+
severity: 'info',
|
|
252
|
+
message: `Angular service '${className}' in ${classDecl.filePath} has HTTP calls but no resolved injection consumers`,
|
|
253
|
+
filePath: classDecl.filePath,
|
|
254
|
+
line: classDecl.line,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return violations;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* RULE-SA08: Vuex dispatch calls must be linked to store action definitions.
|
|
262
|
+
* Checks that dispatch calls have corresponding injection chain entries.
|
|
263
|
+
*/
|
|
264
|
+
function checkRuleSA08(symbolTable) {
|
|
265
|
+
const violations = [];
|
|
266
|
+
// Find models with dispatch calls that have no injection chain linking
|
|
267
|
+
for (const [filePath, model] of symbolTable.models) {
|
|
268
|
+
let hasDispatch = false;
|
|
269
|
+
for (const [, func] of model.functions) {
|
|
270
|
+
if (func.calledFunctions.some((f) => f.includes('dispatch'))) {
|
|
271
|
+
hasDispatch = true;
|
|
272
|
+
break;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (!hasDispatch)
|
|
276
|
+
continue;
|
|
277
|
+
// Check if there's an injection chain linking this file to a store
|
|
278
|
+
const chains = symbolTable.injectionChains.get(filePath);
|
|
279
|
+
if (!chains || chains.length === 0) {
|
|
280
|
+
// Only warn if the project has Vuex store files (files with both actions and HTTP calls)
|
|
281
|
+
let hasStoreFiles = false;
|
|
282
|
+
for (const [otherFile, otherModel] of symbolTable.models) {
|
|
283
|
+
if (otherFile === filePath)
|
|
284
|
+
continue;
|
|
285
|
+
for (const [, func] of otherModel.functions) {
|
|
286
|
+
if (func.bodyHttpCalls.length > 0) {
|
|
287
|
+
hasStoreFiles = true;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (hasStoreFiles)
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
if (hasStoreFiles) {
|
|
295
|
+
violations.push({
|
|
296
|
+
ruleId: 'SA08',
|
|
297
|
+
severity: 'info',
|
|
298
|
+
message: `File '${filePath}' dispatches Vuex actions but no dispatch→action links were resolved`,
|
|
299
|
+
filePath,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return violations;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* RULE-SA09: Functional Angular guards (CanActivateFn) must be detected.
|
|
308
|
+
* Checks that guard files are recognized and linked to routes.
|
|
309
|
+
*/
|
|
310
|
+
function checkRuleSA09(symbolTable) {
|
|
311
|
+
var _a, _b;
|
|
312
|
+
const violations = [];
|
|
313
|
+
// Find files with Angular guard-related content (content-based, not filename-based)
|
|
314
|
+
for (const [filePath, model] of symbolTable.models) {
|
|
315
|
+
// Content-based check: does this file have guard-related types or implementations?
|
|
316
|
+
// (RULE-SA01 compliant — no filename convention used)
|
|
317
|
+
let hasGuardContent = false;
|
|
318
|
+
// Check function annotations for guard type markers (CanActivateFn, etc.)
|
|
319
|
+
const guardTypeAnnotations = [
|
|
320
|
+
'CanActivateFn',
|
|
321
|
+
'CanActivateChildFn',
|
|
322
|
+
'CanDeactivateFn',
|
|
323
|
+
'ResolveFn',
|
|
324
|
+
'CanMatchFn',
|
|
325
|
+
];
|
|
326
|
+
for (const [, func] of model.functions) {
|
|
327
|
+
if ((_a = func.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => guardTypeAnnotations.includes(a))) {
|
|
328
|
+
hasGuardContent = true;
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// Check if any class in this file implements guard interfaces
|
|
333
|
+
if (!hasGuardContent) {
|
|
334
|
+
const guardInterfaces = [
|
|
335
|
+
'CanActivate',
|
|
336
|
+
'CanActivateChild',
|
|
337
|
+
'CanDeactivate',
|
|
338
|
+
'Resolve',
|
|
339
|
+
'CanMatch',
|
|
340
|
+
];
|
|
341
|
+
for (const [, classDecl] of symbolTable.classes) {
|
|
342
|
+
if (classDecl.filePath === filePath &&
|
|
343
|
+
((_b = classDecl.implementsInterfaces) === null || _b === void 0 ? void 0 : _b.some((i) => guardInterfaces.includes(i)))) {
|
|
344
|
+
hasGuardContent = true;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
// Check function names for guard-related patterns as content heuristic
|
|
350
|
+
if (!hasGuardContent) {
|
|
351
|
+
for (const [funcName] of model.functions) {
|
|
352
|
+
if (/guard|canActivate|canDeactivate|canMatch/i.test(funcName)) {
|
|
353
|
+
hasGuardContent = true;
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (!hasGuardContent)
|
|
359
|
+
continue;
|
|
360
|
+
// Check if this guard has any route registrations or middleware entries
|
|
361
|
+
let isLinked = false;
|
|
362
|
+
for (const [, middleware] of symbolTable.middlewareInheritance) {
|
|
363
|
+
if (middleware.some((m) => m.sourceFile === filePath || m.name.includes('guard'))) {
|
|
364
|
+
isLinked = true;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (!isLinked) {
|
|
369
|
+
// Check if there's at least a function export that looks like a guard
|
|
370
|
+
let hasGuardFunction = false;
|
|
371
|
+
for (const [funcName] of model.functions) {
|
|
372
|
+
if (/guard|canActivate|canDeactivate|canMatch/i.test(funcName)) {
|
|
373
|
+
hasGuardFunction = true;
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (hasGuardFunction) {
|
|
378
|
+
violations.push({
|
|
379
|
+
ruleId: 'SA09',
|
|
380
|
+
severity: 'info',
|
|
381
|
+
message: `Angular guard in '${filePath}' has guard functions but is not linked to any route`,
|
|
382
|
+
filePath,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return violations;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* RULE-SA10: webtest/TestApp must be detected as API test evidence.
|
|
391
|
+
* Checks that files using webtest patterns have their HTTP calls extracted.
|
|
392
|
+
*/
|
|
393
|
+
function checkRuleSA10(symbolTable) {
|
|
394
|
+
const violations = [];
|
|
395
|
+
for (const [filePath, model] of symbolTable.models) {
|
|
396
|
+
// Check if this model has webtest-detected calls (via the __webtest_calls__ synthetic function)
|
|
397
|
+
const webtestFunc = model.functions.get('__webtest_calls__');
|
|
398
|
+
if (!webtestFunc)
|
|
399
|
+
continue;
|
|
400
|
+
// Verify the webtest calls actually produced HTTP call entries
|
|
401
|
+
if (webtestFunc.bodyHttpCalls.length === 0) {
|
|
402
|
+
violations.push({
|
|
403
|
+
ruleId: 'SA10',
|
|
404
|
+
severity: 'warning',
|
|
405
|
+
message: `File '${filePath}' has webtest detection but produced no HTTP call entries`,
|
|
406
|
+
filePath,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return violations;
|
|
411
|
+
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Detects:
|
|
6
6
|
* - Runtime-unconfirmed: AST+TIA say covered, but IAST/DAST disagree
|
|
7
|
+
* - DAST-unreachable: DAST probed an endpoint but could not reach it
|
|
8
|
+
* - Undeclared-endpoint: DAST discovered endpoints not found by static analysis
|
|
7
9
|
* - Stage disagreement: Two stages assign different types to the same node
|
|
8
10
|
*/
|
|
9
11
|
import type { ConflictNode } from '../../types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflictDetector.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/merge/conflictDetector.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"conflictDetector.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/merge/conflictDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,aAAa,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,sBAAsB,EAC7B,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,YAAY,EAAE,CAmGhB"}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Detects:
|
|
7
7
|
* - Runtime-unconfirmed: AST+TIA say covered, but IAST/DAST disagree
|
|
8
|
+
* - DAST-unreachable: DAST probed an endpoint but could not reach it
|
|
9
|
+
* - Undeclared-endpoint: DAST discovered endpoints not found by static analysis
|
|
8
10
|
* - Stage disagreement: Two stages assign different types to the same node
|
|
9
11
|
*/
|
|
10
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -13,7 +15,7 @@ exports.detectConflicts = detectConflicts;
|
|
|
13
15
|
* Detect conflicts across all stages.
|
|
14
16
|
*/
|
|
15
17
|
function detectConflicts(graph, iastOutput, dastOutput) {
|
|
16
|
-
var _a, _b, _c, _d, _e;
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
17
19
|
const conflicts = [];
|
|
18
20
|
// 1. Runtime-unconfirmed: endpoints that AST found but neither IAST nor DAST confirmed
|
|
19
21
|
const endpointNodes = graph.getNodesByType('endpoint');
|
|
@@ -46,7 +48,57 @@ function detectConflicts(graph, iastOutput, dastOutput) {
|
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
// 2.
|
|
51
|
+
// 2. DAST-unreachable: endpoints that DAST explicitly could not reach
|
|
52
|
+
if (dastOutput) {
|
|
53
|
+
for (const endpointId of dastUnreachable) {
|
|
54
|
+
const node = graph.getNode(endpointId);
|
|
55
|
+
const label = (_f = node === null || node === void 0 ? void 0 : node.label) !== null && _f !== void 0 ? _f : endpointId;
|
|
56
|
+
conflicts.push({
|
|
57
|
+
conflictId: `conflict:dast-unreachable:${endpointId}`,
|
|
58
|
+
nodeId: endpointId,
|
|
59
|
+
type: 'dast-unreachable',
|
|
60
|
+
stages: ['dast'],
|
|
61
|
+
stageOutputs: {
|
|
62
|
+
dast: 'unreachable',
|
|
63
|
+
},
|
|
64
|
+
detail: `${label} was probed by DAST but could not be reached.`,
|
|
65
|
+
suggestedAction: 'Verify the endpoint is deployed and accessible. Check authentication requirements and network configuration for the DAST scanner.',
|
|
66
|
+
severity: 'warning',
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// 3. Undeclared-endpoint: DAST discovered endpoints not found by static analysis
|
|
71
|
+
if (dastOutput) {
|
|
72
|
+
const staticEndpointIds = new Set(endpointNodes
|
|
73
|
+
.filter((n) => n.sourceStage !== 'dast')
|
|
74
|
+
.map((n) => n.id));
|
|
75
|
+
for (const result of dastOutput.results) {
|
|
76
|
+
if (!result.reachable)
|
|
77
|
+
continue;
|
|
78
|
+
const endpointPath = (_g = result.normalizedPath) !== null && _g !== void 0 ? _g : result.path;
|
|
79
|
+
const endpointId = `endpoint:${result.method.toUpperCase()}:${endpointPath}`;
|
|
80
|
+
if (!staticEndpointIds.has(endpointId)) {
|
|
81
|
+
// Avoid duplicate conflicts for the same endpoint
|
|
82
|
+
const conflictId = `conflict:undeclared-endpoint:${endpointId}`;
|
|
83
|
+
if (conflicts.some((c) => c.conflictId === conflictId))
|
|
84
|
+
continue;
|
|
85
|
+
conflicts.push({
|
|
86
|
+
conflictId,
|
|
87
|
+
nodeId: endpointId,
|
|
88
|
+
type: 'undeclared-endpoint',
|
|
89
|
+
stages: ['dast'],
|
|
90
|
+
stageOutputs: {
|
|
91
|
+
dast: 'discovered',
|
|
92
|
+
ast: 'not-declared',
|
|
93
|
+
},
|
|
94
|
+
detail: `${result.method.toUpperCase()} ${endpointPath} was discovered by DAST but not found by static analysis.`,
|
|
95
|
+
suggestedAction: 'Review the endpoint source. It may be dynamically registered, generated by a framework, or missing from the scanned codebase.',
|
|
96
|
+
severity: 'warning',
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// 4. Stage disagreement: same node ID added by multiple stages with different types
|
|
50
102
|
// (This is handled by the graph merge(), which already returns ConflictNode[])
|
|
51
103
|
return conflicts;
|
|
52
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverageMappingBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/merge/coverageMappingBuilder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,eAAe,
|
|
1
|
+
{"version":3,"file":"coverageMappingBuilder.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/merge/coverageMappingBuilder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,eAAe,EAOhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoBhD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,sBAAsB,EAC7B,SAAS,EAAE,SAAS,GAAG,SAAS,EAChC,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,gBAAgB,EAAE,OAAO,GACxB,eAAe,EAAE,CAyNnB"}
|
|
@@ -8,6 +8,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.buildCoverageMappings = buildCoverageMappings;
|
|
9
9
|
const confidence_1 = require("../../confidence");
|
|
10
10
|
const mergeRules_1 = require("./mergeRules");
|
|
11
|
+
/** Rank test layers so deeper coverage layers win when comparing. */
|
|
12
|
+
const TEST_LAYER_RANK = {
|
|
13
|
+
e2e: 6,
|
|
14
|
+
api: 5,
|
|
15
|
+
integration: 4,
|
|
16
|
+
component: 3,
|
|
17
|
+
unit: 2,
|
|
18
|
+
security: 1,
|
|
19
|
+
performance: 1,
|
|
20
|
+
};
|
|
21
|
+
function testLayerRank(layer) {
|
|
22
|
+
var _a;
|
|
23
|
+
if (!layer)
|
|
24
|
+
return 0;
|
|
25
|
+
return (_a = TEST_LAYER_RANK[layer]) !== null && _a !== void 0 ? _a : 0;
|
|
26
|
+
}
|
|
11
27
|
/**
|
|
12
28
|
* Build coverage mappings for all endpoint-type nodes in the graph.
|
|
13
29
|
*/
|
|
@@ -59,9 +75,9 @@ function buildCoverageMappings(graph, tiaOutput, iastOutput, dastOutput, isStati
|
|
|
59
75
|
assertionConfirmed = true;
|
|
60
76
|
assertionSource = 'direct';
|
|
61
77
|
}
|
|
62
|
-
// Check test layer
|
|
78
|
+
// Check test layer — only replace if the new layer has a higher rank
|
|
63
79
|
const layer = testLayerLookup.get(testFilePath);
|
|
64
|
-
if (layer) {
|
|
80
|
+
if (layer && testLayerRank(layer) > testLayerRank(bestTestLayer)) {
|
|
65
81
|
bestTestLayer = layer;
|
|
66
82
|
}
|
|
67
83
|
// Check for mock boundaries on this test file
|
|
@@ -98,7 +114,7 @@ function buildCoverageMappings(graph, tiaOutput, iastOutput, dastOutput, isStati
|
|
|
98
114
|
const pathNodeIds = [endpoint.id, ...linkedTests.map((t) => `file:${t}`)];
|
|
99
115
|
const mockBoundaryOnPath = hasMockBoundary;
|
|
100
116
|
// Build confidence evidence
|
|
101
|
-
const evidence = (0, confidence_1.buildConfidenceEvidence)(graph, pathNodeIds, isStaticOnlyMode);
|
|
117
|
+
const evidence = (0, confidence_1.buildConfidenceEvidence)(graph, pathNodeIds, isStaticOnlyMode, iastConfirmed.has(endpoint.id), dastConfirmed.has(endpoint.id));
|
|
102
118
|
// Compute confidence
|
|
103
119
|
const confidence = (0, confidence_1.computeConfidence)(evidence);
|
|
104
120
|
// Determine coverage class
|
|
@@ -137,5 +153,53 @@ function buildCoverageMappings(graph, tiaOutput, iastOutput, dastOutput, isStati
|
|
|
137
153
|
traversalDepth,
|
|
138
154
|
});
|
|
139
155
|
}
|
|
156
|
+
// ─── Secondary mappings: service, error-branch, repository ────────────────
|
|
157
|
+
const secondaryNodeTypes = [
|
|
158
|
+
{ nodeType: 'service', itemType: 'service' },
|
|
159
|
+
{ nodeType: 'exception-branch', itemType: 'error-branch' },
|
|
160
|
+
{ nodeType: 'repository', itemType: 'repository' },
|
|
161
|
+
];
|
|
162
|
+
for (const { nodeType, itemType } of secondaryNodeTypes) {
|
|
163
|
+
const nodes = graph.getNodesByType(nodeType);
|
|
164
|
+
for (const node of nodes) {
|
|
165
|
+
const incomingEdges = graph.getEdgesTo(node.id);
|
|
166
|
+
const testEdges = incomingEdges.filter((e) => e.type === 'tests' || e.type === 'asserts');
|
|
167
|
+
const linkedTests = [];
|
|
168
|
+
const sourceStages = new Set([node.sourceStage]);
|
|
169
|
+
let assertionConfirmed = false;
|
|
170
|
+
let assertionSource = 'unresolved';
|
|
171
|
+
for (const edge of testEdges) {
|
|
172
|
+
const testFilePath = edge.sourceNodeId.replace(/^file:/, '');
|
|
173
|
+
if (!linkedTests.includes(testFilePath)) {
|
|
174
|
+
linkedTests.push(testFilePath);
|
|
175
|
+
}
|
|
176
|
+
sourceStages.add(edge.sourceStage);
|
|
177
|
+
if (edge.type === 'asserts') {
|
|
178
|
+
assertionConfirmed = true;
|
|
179
|
+
assertionSource = 'direct';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const pathNodeIds = [node.id, ...linkedTests.map((t) => `file:${t}`)];
|
|
183
|
+
const evidence = (0, confidence_1.buildConfidenceEvidence)(graph, pathNodeIds, isStaticOnlyMode, false, false);
|
|
184
|
+
const confidence = (0, confidence_1.computeConfidence)(evidence);
|
|
185
|
+
const coverageClass = linkedTests.length > 0 ? 'unit-covered' : 'uncovered';
|
|
186
|
+
mappings.push({
|
|
187
|
+
itemId: node.id,
|
|
188
|
+
itemType,
|
|
189
|
+
linkedTests,
|
|
190
|
+
sourceStages: Array.from(sourceStages),
|
|
191
|
+
confidence,
|
|
192
|
+
coverageClass,
|
|
193
|
+
mockBoundaries: [],
|
|
194
|
+
assertionSource,
|
|
195
|
+
assertionConfirmed,
|
|
196
|
+
dastReachable: 'not-probed',
|
|
197
|
+
runtimeConfirmed: false,
|
|
198
|
+
urlResolution: 'unresolved',
|
|
199
|
+
conflicts: [],
|
|
200
|
+
traversalDepth: 0,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
140
204
|
return mappings;
|
|
141
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockBoundaryDetector.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/tia/mockBoundaryDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAmEpD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"mockBoundaryDetector.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/tia/mockBoundaryDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAmEpD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,oBAAoB,EAAE,CAwDxB"}
|
|
@@ -102,7 +102,14 @@ function detectMockBoundaries(filePath, content, language) {
|
|
|
102
102
|
if (pattern.regex.test(line)) {
|
|
103
103
|
// Extract mocked target (heuristic: argument in parentheses)
|
|
104
104
|
const targetMatch = /[\(][\s]*['"`]?([a-zA-Z0-9_./@]+)['"`]?/.exec(line);
|
|
105
|
-
|
|
105
|
+
let mockedTarget = (_a = targetMatch === null || targetMatch === void 0 ? void 0 : targetMatch[1]) !== null && _a !== void 0 ? _a : 'unknown';
|
|
106
|
+
// Secondary extraction for Java/Kotlin annotation-style mocks (e.g. @Mock private UserService userService;)
|
|
107
|
+
if (mockedTarget === 'unknown') {
|
|
108
|
+
const annotationTypeMatch = line.match(/(?:private|protected|public)?\s*(\w+)\s+\w+\s*;/);
|
|
109
|
+
if (annotationTypeMatch) {
|
|
110
|
+
mockedTarget = annotationTypeMatch[1];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
106
113
|
boundaries.push({
|
|
107
114
|
testFilePath: filePath,
|
|
108
115
|
mockingLibrary: pattern.library,
|
|
@@ -102,9 +102,10 @@ function expandJavaKotlinParameterized(filePath, content) {
|
|
|
102
102
|
}
|
|
103
103
|
// ─── Jest Parameterized ─────────────────────────────────────────────────────
|
|
104
104
|
function expandJestParameterized(filePath, content) {
|
|
105
|
-
var _a;
|
|
105
|
+
var _a, _b;
|
|
106
106
|
const results = [];
|
|
107
107
|
const lines = content.split('\n');
|
|
108
|
+
let lineStartOffset = 0;
|
|
108
109
|
for (let i = 0; i < lines.length; i++) {
|
|
109
110
|
const line = lines[i];
|
|
110
111
|
// test.each([...])('name', ...)
|
|
@@ -113,11 +114,13 @@ function expandJestParameterized(filePath, content) {
|
|
|
113
114
|
const eachMatch = /(?:test|it|describe)\.each\s*\(\s*\[/.exec(line);
|
|
114
115
|
if (eachMatch) {
|
|
115
116
|
// Try to extract the array and count items
|
|
116
|
-
const
|
|
117
|
+
const matchOffset = lineStartOffset + ((_a = eachMatch.index) !== null && _a !== void 0 ? _a : 0);
|
|
118
|
+
const bracketStart = content.indexOf('[', matchOffset);
|
|
119
|
+
const arrayContent = extractBalancedBrackets(content, bracketStart);
|
|
117
120
|
const variantCount = arrayContent ? countArrayElements(arrayContent) : 'unresolvable';
|
|
118
121
|
// Extract test name from the next argument
|
|
119
|
-
const nameMatch = /\)\s*\(\s*['"`]([^'"`]+)['"`]/.exec(content.substring(
|
|
120
|
-
const testName = (
|
|
122
|
+
const nameMatch = /\)\s*\(\s*['"`]([^'"`]+)['"`]/.exec(content.substring(matchOffset));
|
|
123
|
+
const testName = (_b = nameMatch === null || nameMatch === void 0 ? void 0 : nameMatch[1]) !== null && _b !== void 0 ? _b : 'parameterized test';
|
|
121
124
|
results.push({
|
|
122
125
|
testFilePath: filePath,
|
|
123
126
|
testName,
|
|
@@ -146,6 +149,7 @@ function expandJestParameterized(filePath, content) {
|
|
|
146
149
|
line: i + 1,
|
|
147
150
|
});
|
|
148
151
|
}
|
|
152
|
+
lineStartOffset += lines[i].length + 1; // +1 for newline
|
|
149
153
|
}
|
|
150
154
|
return results;
|
|
151
155
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testLayerClassifier.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/tia/testLayerClassifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA8GlD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,kBAAkB,
|
|
1
|
+
{"version":3,"file":"testLayerClassifier.d.ts","sourceRoot":"","sources":["../../../../../src/pipeline/stages/tia/testLayerClassifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA8GlD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,kBAAkB,CAqFpB"}
|