vibecodingmachine-core 2026.2.26-1739 → 2026.3.9-850
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/package.json +1 -1
- package/src/agents/AgentCheckDiscoveryService.js +180 -0
- package/src/agents/AgentCheckService.js +18 -261
- package/src/agents/AgentCheckStatisticsService.js +195 -0
- package/src/agents/EnvironmentConfigurationManager.js +31 -380
- package/src/agents/InstallationType.js +19 -6
- package/src/agents/SimpleAgentCheckService.js +472 -0
- package/src/agents/config-managers/ConfigUtils.js +72 -0
- package/src/agents/config-managers/DefaultConfig.js +58 -0
- package/src/agents/config-managers/EnvVarLoader.js +66 -0
- package/src/agents/config-managers/FileConfigLoader.js +124 -0
- package/src/agents/config-managers/TypeConverters.js +61 -0
- package/src/agents/config-managers/VariableMappings.js +92 -0
- package/src/agents/discovery/AgentDiscoveryService-refactored.js +272 -0
- package/src/agents/discovery/AgentDiscoveryService.js +29 -403
- package/src/agents/discovery/agent-validator.js +262 -0
- package/src/agents/discovery/discovery-results.js +176 -0
- package/src/agents/discovery/discovery-scanner.js +268 -0
- package/src/agents/discovery/discovery-utils.js +161 -0
- package/src/agents/discovery/executable-analyzer.js +290 -0
- package/src/agents/discovery/history-manager.js +310 -0
- package/src/agents/verification/ResultAnalyzer-refactored.js +341 -0
- package/src/agents/verification/ResultAnalyzer.js +30 -431
- package/src/agents/verification/analysis-utils.js +310 -0
- package/src/agents/verification/batch-analyzer.js +440 -0
- package/src/agents/verification/pattern-recognizer.js +369 -0
- package/src/agents/verification/report-generator.js +320 -0
- package/src/agents/verification/test-analyzer.js +290 -0
- package/src/agents/windows/InstallerFactory.js +4 -0
- package/src/agents/windows/VSCodeExtensionInstaller.js +404 -0
- package/src/analysis/analysis-engine.js +314 -0
- package/src/analysis/ast-analyzer.js +342 -0
- package/src/analysis/boundary-detector-refactored.js +378 -0
- package/src/analysis/boundary-detector.js +200 -603
- package/src/analysis/boundary-scanner.js +609 -0
- package/src/analysis/boundary-types.js +118 -0
- package/src/analysis/boundary-utils.js +293 -0
- package/src/analysis/deadline-priority-calculator.js +18 -0
- package/src/analysis/detection-methods.js +347 -0
- package/src/analysis/importance-priority-calculator.js +18 -0
- package/src/analysis/priority/factor-calculators.js +204 -0
- package/src/analysis/priority/factor-helpers.js +71 -0
- package/src/analysis/priority/priority-constants.js +73 -0
- package/src/analysis/priority/priority-factor-calculators.js +301 -0
- package/src/analysis/priority/reasons-generator.js +44 -0
- package/src/analysis/priority-calculator.js +15 -580
- package/src/analysis/strategy-generator.js +16 -66
- package/src/analysis/type-priority-calculator.js +18 -0
- package/src/analysis/urgency-priority-calculator.js +18 -0
- package/src/auto-mode/AutoModeBusinessLogic.js +2 -40
- package/src/commands/disable-requirement.js +60 -0
- package/src/commands/disable-spec.js +60 -0
- package/src/commands/enable-requirement.js +60 -0
- package/src/commands/enable-spec.js +60 -0
- package/src/commands/registry.js +1 -6
- package/src/commands/requirements.js +8 -2
- package/src/ide-integration/applescript-manager.cjs +9 -24
- package/src/ide-integration/cdp-handlers/chat-reader.js +44 -0
- package/src/ide-integration/cdp-handlers/connection-handler.js +88 -0
- package/src/ide-integration/cdp-handlers/continuation-handler.js +314 -0
- package/src/ide-integration/cdp-handlers/message-submitter.js +75 -0
- package/src/ide-integration/cdp-handlers/text-sender.js +138 -0
- package/src/ide-integration/cdp-manager.js +28 -573
- package/src/ide-integration/claude-code-cli-manager.cjs +48 -12
- package/src/ide-integration/ide-openers/claude-opener.js +171 -0
- package/src/ide-integration/ide-openers/cursor-opener.js +53 -0
- package/src/ide-integration/ide-openers/other-ides-opener.js +230 -0
- package/src/ide-integration/ide-openers/vscode-opener.js +147 -0
- package/src/ide-integration/macos-ide-manager.js +20 -582
- package/src/ide-integration/macos-quota-checker.js +164 -0
- package/src/ide-integration/macos-text-sender.js +19 -38
- package/src/ide-integration/provider-manager.cjs +52 -7
- package/src/index.cjs +6 -0
- package/src/index.js +10 -0
- package/src/llm/direct-llm-manager.cjs +501 -0
- package/src/localization/translations/en-part1.js +363 -0
- package/src/localization/translations/en-part2.js +320 -0
- package/src/localization/translations/en.js +4 -687
- package/src/localization/translations/es-part1.js +363 -0
- package/src/localization/translations/es-part2.js +320 -0
- package/src/localization/translations/es.js +4 -688
- package/src/models/file-analysis-collection.js +139 -0
- package/src/models/file-analysis-metrics.js +50 -0
- package/src/models/file-analysis.js +15 -262
- package/src/models/plan-manager.js +410 -0
- package/src/models/refactoring-models.js +380 -0
- package/src/models/refactoring-plan-refactored.js +81 -0
- package/src/models/refactoring-plan.js +2 -663
- package/src/monitoring/alert-system.js +4 -45
- package/src/monitoring/continuous-scan-notifications.js +37 -191
- package/src/monitoring/notification-handlers/base-handler.js +58 -0
- package/src/monitoring/notification-handlers/error-handler.js +36 -0
- package/src/monitoring/notification-handlers/index.js +21 -0
- package/src/monitoring/notification-handlers/new-violation-handler.js +91 -0
- package/src/monitoring/notification-handlers/progress-handler.js +48 -0
- package/src/monitoring/notification-handlers/resolved-violation-handler.js +54 -0
- package/src/monitoring/notification-handlers/threshold-handler.js +36 -0
- package/src/provider-registry.js +8 -0
- package/src/refactoring/boundary/boundary-detector-refactored.js +58 -0
- package/src/refactoring/boundary/boundary-detector.js +26 -596
- package/src/refactoring/boundary/detectors/boundary-analyzers.js +281 -0
- package/src/refactoring/boundary/detectors/boundary-core.js +167 -0
- package/src/refactoring/boundary/detectors/class-detector.js +247 -0
- package/src/refactoring/boundary/detectors/config-detector.js +270 -0
- package/src/refactoring/boundary/detectors/constant-detector.js +269 -0
- package/src/refactoring/boundary/detectors/function-detector.js +248 -0
- package/src/refactoring/boundary/detectors/module-detector.js +249 -0
- package/src/refactoring/boundary/detectors/object-detector.js +247 -0
- package/src/refactoring/boundary/detectors/type-detectors.js +338 -0
- package/src/refactoring/boundary/detectors/utility-detector.js +270 -0
- package/src/refactoring/circular-dependency-resolver-original.js +16 -76
- package/src/refactoring/code-mover-refactored.js +309 -0
- package/src/refactoring/code-mover.js +48 -355
- package/src/refactoring/execution-status.js +18 -0
- package/src/refactoring/execution-strategies.js +172 -0
- package/src/refactoring/file-splitter-core.js +568 -0
- package/src/refactoring/file-splitter-types.js +136 -0
- package/src/refactoring/file-splitter.js +2 -682
- package/src/refactoring/functionality-validator.js +11 -51
- package/src/refactoring/import-manager-refactored.js +385 -0
- package/src/refactoring/import-manager.js +112 -487
- package/src/refactoring/import-models.js +189 -0
- package/src/refactoring/import-parser.js +306 -0
- package/src/refactoring/move-executor.js +431 -0
- package/src/refactoring/move-utils.js +368 -0
- package/src/refactoring/operation-executor.js +76 -0
- package/src/refactoring/plan-creator.js +36 -0
- package/src/refactoring/plan-executor.js +143 -0
- package/src/refactoring/plan-validator.js +68 -0
- package/src/refactoring/refactoring-executor-result.js +70 -0
- package/src/refactoring/refactoring-executor.js +34 -569
- package/src/refactoring/refactoring-operation.js +94 -0
- package/src/refactoring/refactoring-plan.js +69 -0
- package/src/refactoring/refactoring-rollback.js +22 -527
- package/src/refactoring/rollback-handlers/RollbackExecutor.js +107 -0
- package/src/refactoring/rollback-handlers/RollbackManager.js +265 -0
- package/src/refactoring/rollback-handlers/RollbackOperation.js +105 -0
- package/src/refactoring/rollback-handlers/RollbackResult.js +109 -0
- package/src/refactoring/rollback-handlers/RollbackStatistics.js +77 -0
- package/src/refactoring/test-validator.js +32 -448
- package/src/refactoring/validation/baseline-runner.js +71 -0
- package/src/refactoring/validation/report-generator.js +136 -0
- package/src/refactoring/validation/result-comparator.js +92 -0
- package/src/refactoring/validation/test-suite.js +59 -0
- package/src/refactoring/validation/test-validation-result.js +83 -0
- package/src/refactoring/validation/validation-runner.js +95 -0
- package/src/refactoring/validation/validation-status.js +18 -0
- package/src/rui/commands/AgentCommandParser.js +60 -369
- package/src/rui/commands/AgentResponseFormatter.js +7 -47
- package/src/rui/commands/parsers/CommandMapper.js +148 -0
- package/src/rui/commands/parsers/CommandValidator.js +228 -0
- package/src/rui/commands/parsers/ComponentExtractor.js +100 -0
- package/src/rui/commands/parsers/TokenParser.js +69 -0
- package/src/rui/commands/parsers/tokenizer.js +153 -0
- package/src/utils/current-requirement-operations.js +50 -1
- package/src/utils/report-generator.js +18 -514
- package/src/utils/report-generators/analysis-generator.js +115 -0
- package/src/utils/report-generators/base-generator.js +141 -0
- package/src/utils/report-generators/compliance-generator.js +41 -0
- package/src/utils/report-generators/format-handlers.js +185 -0
- package/src/utils/report-generators/refactoring-generator.js +46 -0
- package/src/utils/report-generators/validation-generator.js +63 -0
- package/src/utils/requirement-enable-disable.js +265 -0
- package/src/utils/requirement-helpers/requirement-file-ops.js +69 -1
- package/src/utils/requirement-helpers/requirement-mover.js +88 -1
- package/src/utils/requirement-helpers.js +5 -2
- package/src/utils/smoke-test-cli.js +45 -8
- package/src/utils/specification-enable-disable.js +122 -0
- package/src/utils/specification-helpers.js +30 -4
- package/src/utils/specification-migration.js +5 -5
- package/src/utils/test-comparator.js +118 -0
- package/src/utils/test-config.js +54 -0
- package/src/utils/test-executor.js +133 -0
- package/src/utils/test-parser.js +215 -0
- package/src/utils/test-runner-baseline.js +63 -0
- package/src/utils/test-runner-core.js +98 -0
- package/src/utils/test-runner-report.js +39 -0
- package/src/utils/test-runner-validation.js +71 -0
- package/src/utils/test-runner.js +11 -535
- package/src/validation/comparison-analyzer.js +333 -0
- package/src/validation/compliance-reporter-new.js +282 -0
- package/src/validation/compliance-reporter-refactored.js +344 -0
- package/src/validation/compliance-reporter.js +278 -591
- package/src/validation/compliance-utils.js +278 -0
- package/src/validation/html-generator.js +446 -0
- package/src/validation/metrics/category-calculator.js +137 -0
- package/src/validation/metrics/metrics-helpers.js +155 -0
- package/src/validation/metrics/overview-calculator.js +85 -0
- package/src/validation/metrics/overview-metrics.js +41 -0
- package/src/validation/metrics/quality-calculator.js +166 -0
- package/src/validation/metrics/size-calculator.js +69 -0
- package/src/validation/metrics-calculator.js +27 -551
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses test output from various test frameworks.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Parse test output (Jest JSON format)
|
|
9
|
+
*/
|
|
10
|
+
function parseTestOutput(stdout, stderr, exitCode, duration) {
|
|
11
|
+
try {
|
|
12
|
+
// Try to parse JSON output
|
|
13
|
+
const jsonMatch = stdout.match(/\{[\s\S]*\}/);
|
|
14
|
+
if (jsonMatch) {
|
|
15
|
+
const jsonData = JSON.parse(jsonMatch[0]);
|
|
16
|
+
return parseJestResults(jsonData, duration);
|
|
17
|
+
}
|
|
18
|
+
} catch (error) {
|
|
19
|
+
// JSON parsing failed, fall back to basic parsing
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return parseBasicOutput(stdout, stderr, exitCode, duration);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Parse Jest results
|
|
27
|
+
*/
|
|
28
|
+
function parseJestResults(jsonData, duration) {
|
|
29
|
+
const results = {
|
|
30
|
+
total: 0,
|
|
31
|
+
passed: 0,
|
|
32
|
+
failed: 0,
|
|
33
|
+
skipped: 0,
|
|
34
|
+
errors: 0,
|
|
35
|
+
duration,
|
|
36
|
+
suites: [],
|
|
37
|
+
tests: [],
|
|
38
|
+
coverage: null
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (jsonData.numTotalTests) {
|
|
42
|
+
results.total = jsonData.numTotalTests;
|
|
43
|
+
results.passed = jsonData.numPassedTests || 0;
|
|
44
|
+
results.failed = jsonData.numFailedTests || 0;
|
|
45
|
+
results.skipped = jsonData.numPendingTests || 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (jsonData.testResults) {
|
|
49
|
+
for (const testSuite of jsonData.testResults) {
|
|
50
|
+
const suite = {
|
|
51
|
+
name: testSuite.name,
|
|
52
|
+
file: testSuite.testFilePath,
|
|
53
|
+
passed: 0,
|
|
54
|
+
failed: 0,
|
|
55
|
+
skipped: 0,
|
|
56
|
+
duration: testSuite.perfStats?.end || 0,
|
|
57
|
+
tests: []
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (testSuite.assertionResults) {
|
|
61
|
+
for (const test of testSuite.assertionResults) {
|
|
62
|
+
const testResult = {
|
|
63
|
+
title: test.title,
|
|
64
|
+
fullName: test.fullName,
|
|
65
|
+
status: test.status,
|
|
66
|
+
duration: test.duration || 0,
|
|
67
|
+
failureMessages: test.failureMessages || []
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
suite.tests.push(testResult);
|
|
71
|
+
results.tests.push(testResult);
|
|
72
|
+
|
|
73
|
+
switch (test.status) {
|
|
74
|
+
case 'passed':
|
|
75
|
+
suite.passed++;
|
|
76
|
+
break;
|
|
77
|
+
case 'failed':
|
|
78
|
+
suite.failed++;
|
|
79
|
+
break;
|
|
80
|
+
case 'pending':
|
|
81
|
+
suite.skipped++;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
results.suites.push(suite);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (jsonData.coverageMap) {
|
|
92
|
+
results.coverage = parseCoverageData(jsonData.coverageMap);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return results;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Parse basic test output
|
|
100
|
+
*/
|
|
101
|
+
function parseBasicOutput(stdout, stderr, exitCode, duration) {
|
|
102
|
+
const results = {
|
|
103
|
+
total: 0,
|
|
104
|
+
passed: 0,
|
|
105
|
+
failed: 0,
|
|
106
|
+
skipped: 0,
|
|
107
|
+
errors: 0,
|
|
108
|
+
duration,
|
|
109
|
+
suites: [],
|
|
110
|
+
tests: [],
|
|
111
|
+
coverage: null
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Parse Jest-style output
|
|
115
|
+
const testMatch = stdout.match(/(\d+)\s+tests?\s+(\d+)\s+failed/);
|
|
116
|
+
if (testMatch) {
|
|
117
|
+
results.total = parseInt(testMatch[1]);
|
|
118
|
+
results.failed = parseInt(testMatch[2]);
|
|
119
|
+
results.passed = results.total - results.failed;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Parse pass/fail summary
|
|
123
|
+
const passMatch = stdout.match(/(\d+)\s+passing/);
|
|
124
|
+
if (passMatch) {
|
|
125
|
+
results.passed = parseInt(passMatch[1]);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const failMatch = stdout.match(/(\d+)\s+failing/);
|
|
129
|
+
if (failMatch) {
|
|
130
|
+
results.failed = parseInt(failMatch[1]);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const skipMatch = stdout.match(/(\d+)\s+skipping/);
|
|
134
|
+
if (skipMatch) {
|
|
135
|
+
results.skipped = parseInt(skipMatch[1]);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Extract individual test results
|
|
139
|
+
const testLines = stdout.split('\n');
|
|
140
|
+
for (const line of testLines) {
|
|
141
|
+
const testMatch = line.match(/^(✓|✗|○)\s+(.+)$/);
|
|
142
|
+
if (testMatch) {
|
|
143
|
+
const status = testMatch[1] === '✓' ? 'passed' :
|
|
144
|
+
testMatch[1] === '✗' ? 'failed' : 'skipped';
|
|
145
|
+
const title = testMatch[2];
|
|
146
|
+
|
|
147
|
+
results.tests.push({
|
|
148
|
+
title,
|
|
149
|
+
status,
|
|
150
|
+
duration: 0,
|
|
151
|
+
failureMessages: status === 'failed' ? [line] : []
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return results;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Parse coverage data
|
|
161
|
+
*/
|
|
162
|
+
function parseCoverageData(coverageMap) {
|
|
163
|
+
const coverage = {
|
|
164
|
+
lines: { total: 0, covered: 0, percentage: 0 },
|
|
165
|
+
functions: { total: 0, covered: 0, percentage: 0 },
|
|
166
|
+
branches: { total: 0, covered: 0, percentage: 0 },
|
|
167
|
+
statements: { total: 0, covered: 0, percentage: 0 }
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
for (const [filePath, fileCoverage] of Object.entries(coverageMap)) {
|
|
171
|
+
// Parse line coverage
|
|
172
|
+
if (fileCoverage.l) {
|
|
173
|
+
const lines = Object.values(fileCoverage.l);
|
|
174
|
+
coverage.lines.total += lines.length;
|
|
175
|
+
coverage.lines.covered += lines.filter(count => count > 0).length;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Parse function coverage
|
|
179
|
+
if (fileCoverage.f) {
|
|
180
|
+
const functions = Object.values(fileCoverage.f);
|
|
181
|
+
coverage.functions.total += functions.length;
|
|
182
|
+
coverage.functions.covered += functions.filter(count => count > 0).length;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Parse branch coverage
|
|
186
|
+
if (fileCoverage.b) {
|
|
187
|
+
for (const branches of Object.values(fileCoverage.b)) {
|
|
188
|
+
coverage.branches.total += branches.length;
|
|
189
|
+
coverage.branches.covered += branches.filter(count => count > 0).length;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Parse statement coverage
|
|
194
|
+
if (fileCoverage.s) {
|
|
195
|
+
const statements = Object.values(fileCoverage.s);
|
|
196
|
+
coverage.statements.total += statements.length;
|
|
197
|
+
coverage.statements.covered += statements.filter(count => count > 0).length;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Calculate percentages
|
|
202
|
+
for (const metric of Object.values(coverage)) {
|
|
203
|
+
metric.percentage = metric.total > 0 ?
|
|
204
|
+
Math.round((metric.covered / metric.total) * 100) : 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return coverage;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
module.exports = {
|
|
211
|
+
parseTestOutput,
|
|
212
|
+
parseJestResults,
|
|
213
|
+
parseBasicOutput,
|
|
214
|
+
parseCoverageData
|
|
215
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Runner Baseline Operations
|
|
3
|
+
*
|
|
4
|
+
* Handles baseline test execution before refactoring.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { executeTests } = require('./test-executor');
|
|
8
|
+
const { parseTestOutput, parseBasicOutput } = require('./test-parser');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Execute tests and collect results
|
|
12
|
+
*/
|
|
13
|
+
async function executeTestsAndCollect(options = {}) {
|
|
14
|
+
const executionResult = await executeTests({
|
|
15
|
+
verbose: options.verbose || false,
|
|
16
|
+
timeout: options.timeout || 300000
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const results = parseTestOutput(
|
|
21
|
+
executionResult.stdout,
|
|
22
|
+
executionResult.stderr,
|
|
23
|
+
executionResult.exitCode,
|
|
24
|
+
executionResult.duration
|
|
25
|
+
);
|
|
26
|
+
return results;
|
|
27
|
+
} catch (parseError) {
|
|
28
|
+
// Fallback to basic parsing
|
|
29
|
+
const fallbackResults = parseBasicOutput(
|
|
30
|
+
executionResult.stdout,
|
|
31
|
+
executionResult.stderr,
|
|
32
|
+
executionResult.exitCode,
|
|
33
|
+
executionResult.duration
|
|
34
|
+
);
|
|
35
|
+
return fallbackResults;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Run baseline tests before refactoring
|
|
41
|
+
*/
|
|
42
|
+
async function runBaseline(runner) {
|
|
43
|
+
console.log('Running baseline tests...');
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const results = await executeTestsAndCollect({
|
|
47
|
+
verbose: runner.options.verbose,
|
|
48
|
+
timeout: runner.options.timeout
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
runner.setBaselineResults(results);
|
|
52
|
+
|
|
53
|
+
console.log(`Baseline completed: ${results.passed}/${results.total} passed`);
|
|
54
|
+
return results;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
throw new Error(`Baseline test execution failed: ${error.message}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
module.exports = {
|
|
61
|
+
runBaseline,
|
|
62
|
+
executeTestsAndCollect
|
|
63
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Test Runner
|
|
3
|
+
*
|
|
4
|
+
* Base class for test runner operations.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { checkTestAvailability, getTestConfig } = require('./test-config');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Test result types
|
|
11
|
+
*/
|
|
12
|
+
const TEST_RESULT_TYPES = {
|
|
13
|
+
PASS: 'pass',
|
|
14
|
+
FAIL: 'fail',
|
|
15
|
+
SKIP: 'skip',
|
|
16
|
+
ERROR: 'error'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Core test runner class
|
|
21
|
+
*/
|
|
22
|
+
class TestRunnerCore {
|
|
23
|
+
constructor(options = {}) {
|
|
24
|
+
this.options = {
|
|
25
|
+
testCommand: 'npm test',
|
|
26
|
+
testDir: 'tests',
|
|
27
|
+
timeout: 300000, // 5 minutes
|
|
28
|
+
retries: 0,
|
|
29
|
+
verbose: false,
|
|
30
|
+
...options
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
this.baselineResults = null;
|
|
34
|
+
this.currentResults = null;
|
|
35
|
+
this.regressionDetected = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Check if tests are available
|
|
40
|
+
*/
|
|
41
|
+
checkTestAvailability() {
|
|
42
|
+
return checkTestAvailability();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Get test configuration
|
|
47
|
+
*/
|
|
48
|
+
getTestConfig() {
|
|
49
|
+
return getTestConfig();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get current baseline results
|
|
54
|
+
*/
|
|
55
|
+
getBaselineResults() {
|
|
56
|
+
return this.baselineResults;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get current test results
|
|
61
|
+
*/
|
|
62
|
+
getCurrentResults() {
|
|
63
|
+
return this.currentResults;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Check if regressions were detected
|
|
68
|
+
*/
|
|
69
|
+
hasRegressions() {
|
|
70
|
+
return this.regressionDetected;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Set baseline results
|
|
75
|
+
*/
|
|
76
|
+
setBaselineResults(results) {
|
|
77
|
+
this.baselineResults = results;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Set current results
|
|
82
|
+
*/
|
|
83
|
+
setCurrentResults(results) {
|
|
84
|
+
this.currentResults = results;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Set regression detection flag
|
|
89
|
+
*/
|
|
90
|
+
setRegressionDetected(detected) {
|
|
91
|
+
this.regressionDetected = detected;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports = {
|
|
96
|
+
TestRunnerCore,
|
|
97
|
+
TEST_RESULT_TYPES
|
|
98
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Runner Report Generation
|
|
3
|
+
*
|
|
4
|
+
* Generates comprehensive test reports.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { compareResults } = require('./test-comparator');
|
|
8
|
+
const { getTestConfig } = require('./test-config');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Generate test report
|
|
12
|
+
*/
|
|
13
|
+
function generateReport(runner) {
|
|
14
|
+
if (!runner.getCurrentResults()) {
|
|
15
|
+
throw new Error('No test results available. Run tests first.');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const baselineResults = runner.getBaselineResults();
|
|
19
|
+
const currentResults = runner.getCurrentResults();
|
|
20
|
+
|
|
21
|
+
const report = {
|
|
22
|
+
timestamp: new Date().toISOString(),
|
|
23
|
+
baseline: baselineResults,
|
|
24
|
+
current: currentResults,
|
|
25
|
+
comparison: compareResults(baselineResults, currentResults),
|
|
26
|
+
config: getTestConfig(),
|
|
27
|
+
summary: {
|
|
28
|
+
hasRegressions: runner.hasRegressions(),
|
|
29
|
+
testCountChanged: baselineResults.total !== currentResults.total,
|
|
30
|
+
performanceChanged: Math.abs(currentResults.duration - baselineResults.duration) > 1000
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return report;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = {
|
|
38
|
+
generateReport
|
|
39
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Runner Validation Operations
|
|
3
|
+
*
|
|
4
|
+
* Handles validation test execution after refactoring.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { runSpecificTests } = require('./test-executor');
|
|
8
|
+
const { parseBasicOutput } = require('./test-parser');
|
|
9
|
+
const { compareResults } = require('./test-comparator');
|
|
10
|
+
const { executeTestsAndCollect } = require('./test-runner-baseline');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Run tests after refactoring
|
|
14
|
+
*/
|
|
15
|
+
async function runValidation(runner) {
|
|
16
|
+
if (!runner.getBaselineResults()) {
|
|
17
|
+
throw new Error('Baseline results not available. Run baseline first.');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
console.log('Running validation tests...');
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const results = await executeTestsAndCollect({
|
|
24
|
+
verbose: runner.options.verbose,
|
|
25
|
+
timeout: runner.options.timeout
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
runner.setCurrentResults(results);
|
|
29
|
+
|
|
30
|
+
// Compare with baseline
|
|
31
|
+
const comparison = compareResults(runner.getBaselineResults(), results);
|
|
32
|
+
runner.setRegressionDetected(comparison.hasRegressions);
|
|
33
|
+
|
|
34
|
+
console.log(`Validation completed: ${results.passed}/${results.total} passed`);
|
|
35
|
+
|
|
36
|
+
if (comparison.hasRegressions) {
|
|
37
|
+
console.log(`⚠️ Regressions detected: ${comparison.regressions.length}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
results,
|
|
42
|
+
comparison,
|
|
43
|
+
hasRegressions: comparison.hasRegressions
|
|
44
|
+
};
|
|
45
|
+
} catch (error) {
|
|
46
|
+
throw new Error(`Validation test execution failed: ${error.message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Run specific test files
|
|
52
|
+
*/
|
|
53
|
+
async function runSpecific(testFiles, options = {}) {
|
|
54
|
+
const executionResult = await runSpecificTests(testFiles, {
|
|
55
|
+
verbose: options.verbose || false
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const results = parseBasicOutput(
|
|
59
|
+
executionResult.stdout,
|
|
60
|
+
executionResult.stderr,
|
|
61
|
+
executionResult.exitCode,
|
|
62
|
+
executionResult.duration
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return results;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = {
|
|
69
|
+
runValidation,
|
|
70
|
+
runSpecific
|
|
71
|
+
};
|