deflake 1.1.2 → 1.1.5
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/cli.js +19 -19
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -641,7 +641,7 @@ async function runDoctor(argv) {
|
|
|
641
641
|
console.log("");
|
|
642
642
|
|
|
643
643
|
console.log(`${C.BRIGHT}Summary:${C.RESET}`);
|
|
644
|
-
if (apiKey &&
|
|
644
|
+
if (apiKey && activeFramework !== 'generic') {
|
|
645
645
|
console.log(` ✨ ${C.GREEN}${C.BRIGHT}You are ready to use DeFlake!${C.RESET}`);
|
|
646
646
|
} else {
|
|
647
647
|
console.log(` ⚠️ ${C.YELLOW}Please address the issues above to ensure DeFlake works correctly.${C.RESET}`);
|
|
@@ -650,12 +650,6 @@ async function runDoctor(argv) {
|
|
|
650
650
|
}
|
|
651
651
|
|
|
652
652
|
async function applySelfHealing(result) {
|
|
653
|
-
const C = {
|
|
654
|
-
RESET: "\x1b[0m",
|
|
655
|
-
GREEN: "\x1b[32m",
|
|
656
|
-
RED: "\x1b[31m",
|
|
657
|
-
GRAY: "\x1b[90m"
|
|
658
|
-
};
|
|
659
653
|
|
|
660
654
|
if (!result.location || !result.location.fullRootPath || !result.fix) return;
|
|
661
655
|
|
|
@@ -709,11 +703,11 @@ async function analyzeFailures(artifacts, fullLog, client) {
|
|
|
709
703
|
if (result.status === 'success') {
|
|
710
704
|
const usage = result.data;
|
|
711
705
|
tier = usage.tier || 'free';
|
|
712
|
-
if (tier === 'free') limit =
|
|
706
|
+
if (tier === 'free') limit = 10;
|
|
713
707
|
else if (tier === 'pro') limit = 50;
|
|
714
708
|
else if (tier === 'master' || tier === 'byok') limit = 100;
|
|
715
709
|
|
|
716
|
-
console.log(`🎫 Subscription: ${tier.toUpperCase()} |
|
|
710
|
+
console.log(`🎫 Subscription: ${tier.toUpperCase()} | Monthly Usage: ${usage.usage}/${usage.limit}`);
|
|
717
711
|
}
|
|
718
712
|
|
|
719
713
|
if (artifacts.length > limit) {
|
|
@@ -775,21 +769,27 @@ async function analyzeFailures(artifacts, fullLog, client) {
|
|
|
775
769
|
// GROUPING & PRINTING
|
|
776
770
|
const groups = {};
|
|
777
771
|
for (const res of results) {
|
|
778
|
-
|
|
772
|
+
let fixCode = res.fix;
|
|
773
|
+
try {
|
|
774
|
+
const p = JSON.parse(res.fix);
|
|
775
|
+
if (p.code) fixCode = p.code;
|
|
776
|
+
} catch (e) { }
|
|
777
|
+
|
|
779
778
|
const locId = res.location ? `${res.location.rootFile}:${res.location.rootLine}` : `unknown-${res.testName}`;
|
|
780
|
-
const key = `${locId}|${
|
|
779
|
+
const key = `${locId}|${fixCode.trim()}`;
|
|
780
|
+
|
|
781
781
|
if (!groups[key]) {
|
|
782
|
-
groups[key] = {
|
|
782
|
+
groups[key] = { ...res, count: 0 };
|
|
783
783
|
}
|
|
784
|
-
groups[key].
|
|
784
|
+
groups[key].count++;
|
|
785
785
|
}
|
|
786
786
|
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
printDetailedFix(groups[key].fix, groups[key].location, groups[key].sourceCode, argv.fix);
|
|
787
|
+
const finalGroups = Object.values(groups);
|
|
788
|
+
for (const group of finalGroups) {
|
|
789
|
+
if (group.count > 1) {
|
|
790
|
+
console.log(`${C.GRAY}ℹ️ Suggested for ${group.count} similar failures:${C.RESET}`);
|
|
792
791
|
}
|
|
792
|
+
printDetailedFix(group.fix, group.location, group.source_code, argv.fix);
|
|
793
793
|
}
|
|
794
794
|
|
|
795
795
|
// SUMMARY
|
|
@@ -803,7 +803,7 @@ async function analyzeFailures(artifacts, fullLog, client) {
|
|
|
803
803
|
if (updatedUsage.status === 'success') {
|
|
804
804
|
const u = updatedUsage.data;
|
|
805
805
|
const remaining = u.limit - u.usage;
|
|
806
|
-
console.log(` - Quota
|
|
806
|
+
console.log(` - Monthly Quota: ${C.GREEN}${remaining}/${u.limit} remaining${C.RESET}`);
|
|
807
807
|
}
|
|
808
808
|
} catch (e) {
|
|
809
809
|
// usage fetch failed is non-critical
|