Fix prettier formatting issues
This commit is contained in:
@@ -87,7 +87,7 @@ class PerformanceMonitorScript {
|
||||
} else {
|
||||
console.error("❌ Lighthouse CI tests failed");
|
||||
reject(
|
||||
new Error(`Lighthouse CI failed with code ${code}: ${errorOutput}`)
|
||||
new Error(`Lighthouse CI failed with code ${code}: ${errorOutput}`),
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -112,7 +112,7 @@ class PerformanceMonitorScript {
|
||||
{
|
||||
stdio: "pipe",
|
||||
shell: true,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
let output = "";
|
||||
@@ -135,8 +135,8 @@ class PerformanceMonitorScript {
|
||||
console.error("❌ Playwright performance tests failed");
|
||||
reject(
|
||||
new Error(
|
||||
`Playwright tests failed with code ${code}: ${errorOutput}`
|
||||
)
|
||||
`Playwright tests failed with code ${code}: ${errorOutput}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -162,7 +162,7 @@ class PerformanceMonitorScript {
|
||||
|
||||
if (score < 90) {
|
||||
this.warnings.push(
|
||||
`Performance score below threshold: ${score}/100`
|
||||
`Performance score below threshold: ${score}/100`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class PerformanceMonitorScript {
|
||||
|
||||
if (time > PERFORMANCE_BUDGETS.first_contentful_paint) {
|
||||
this.warnings.push(
|
||||
`First Contentful Paint exceeded budget: ${time}ms`
|
||||
`First Contentful Paint exceeded budget: ${time}ms`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ class PerformanceMonitorScript {
|
||||
|
||||
if (time > PERFORMANCE_BUDGETS.largest_contentful_paint) {
|
||||
this.warnings.push(
|
||||
`Largest Contentful Paint exceeded budget: ${time}ms`
|
||||
`Largest Contentful Paint exceeded budget: ${time}ms`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -204,7 +204,7 @@ class PerformanceMonitorScript {
|
||||
|
||||
if (time > 300) {
|
||||
this.warnings.push(
|
||||
`Total Blocking Time exceeded budget: ${time}ms`
|
||||
`Total Blocking Time exceeded budget: ${time}ms`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ class PerformanceMonitorScript {
|
||||
|
||||
if (shift > 0.1) {
|
||||
this.warnings.push(
|
||||
`Cumulative Layout Shift exceeded budget: ${shift}`
|
||||
`Cumulative Layout Shift exceeded budget: ${shift}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -283,7 +283,7 @@ class PerformanceMonitorScript {
|
||||
console.log("📊 Summary:");
|
||||
console.log(`- Total metrics recorded: ${this.metrics.size}`);
|
||||
console.log(
|
||||
`- Performance regressions detected: ${this.regressions.length}`
|
||||
`- Performance regressions detected: ${this.regressions.length}`,
|
||||
);
|
||||
console.log(`- Warnings: ${this.warnings.length}\n`);
|
||||
|
||||
@@ -292,7 +292,7 @@ class PerformanceMonitorScript {
|
||||
console.log("🚨 Performance Regressions:");
|
||||
for (const regression of this.regressions) {
|
||||
console.log(
|
||||
` - ${regression.metric}: ${regression.current} (baseline: ${regression.baseline}, regression: ${regression.regression})`
|
||||
` - ${regression.metric}: ${regression.current} (baseline: ${regression.baseline}, regression: ${regression.regression})`,
|
||||
);
|
||||
}
|
||||
console.log("");
|
||||
|
||||
+29
-25
@@ -5,58 +5,62 @@
|
||||
* This script validates the configuration without running actual tests
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
console.log('🔍 Testing LHCI Configuration...\n');
|
||||
console.log("🔍 Testing LHCI Configuration...\n");
|
||||
|
||||
// Check if .lighthouserc.json exists
|
||||
const configPath = path.join(process.cwd(), '.lighthouserc.json');
|
||||
const configPath = path.join(process.cwd(), ".lighthouserc.json");
|
||||
if (fs.existsSync(configPath)) {
|
||||
console.log('✅ .lighthouserc.json found');
|
||||
|
||||
console.log("✅ .lighthouserc.json found");
|
||||
|
||||
try {
|
||||
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
||||
console.log('✅ Configuration is valid JSON');
|
||||
|
||||
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
||||
console.log("✅ Configuration is valid JSON");
|
||||
|
||||
if (config.ci && config.ci.collect && config.ci.assert) {
|
||||
console.log('✅ Configuration has required sections (collect, assert)');
|
||||
console.log("✅ Configuration has required sections (collect, assert)");
|
||||
console.log(`✅ Testing ${config.ci.collect.numberOfRuns} runs`);
|
||||
console.log(`✅ URL: ${config.ci.collect.url[0]}`);
|
||||
} else {
|
||||
console.log('❌ Configuration missing required sections');
|
||||
console.log("❌ Configuration missing required sections");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('❌ Configuration is not valid JSON:', error.message);
|
||||
console.log("❌ Configuration is not valid JSON:", error.message);
|
||||
}
|
||||
} else {
|
||||
console.log('❌ .lighthouserc.json not found');
|
||||
console.log("❌ .lighthouserc.json not found");
|
||||
}
|
||||
|
||||
// Check if @lhci/cli is installed
|
||||
try {
|
||||
const { execSync } = require('child_process');
|
||||
execSync('npx lhci --version', { stdio: 'pipe' });
|
||||
console.log('✅ @lhci/cli package is installed and working');
|
||||
const { execSync } = require("child_process");
|
||||
execSync("npx lhci --version", { stdio: "pipe" });
|
||||
console.log("✅ @lhci/cli package is installed and working");
|
||||
} catch (error) {
|
||||
console.log('❌ @lhci/cli package is not working:', error.message);
|
||||
console.log("❌ @lhci/cli package is not working:", error.message);
|
||||
}
|
||||
|
||||
// Check package.json scripts
|
||||
const packagePath = path.join(process.cwd(), 'package.json');
|
||||
const packagePath = path.join(process.cwd(), "package.json");
|
||||
if (fs.existsSync(packagePath)) {
|
||||
try {
|
||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
|
||||
if (packageJson.scripts && packageJson.scripts.lhci) {
|
||||
console.log('✅ LHCI script found in package.json');
|
||||
console.log("✅ LHCI script found in package.json");
|
||||
} else {
|
||||
console.log('❌ LHCI script not found in package.json');
|
||||
console.log("❌ LHCI script not found in package.json");
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('❌ Error reading package.json:', error.message);
|
||||
console.log("❌ Error reading package.json:", error.message);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('\n🎉 LHCI Configuration Test Complete!');
|
||||
console.log('Note: Actual LHCI tests may fail locally due to Node.js architecture issues on macOS.');
|
||||
console.log('The CI environment should work correctly with the provided configuration.');
|
||||
console.log("\n🎉 LHCI Configuration Test Complete!");
|
||||
console.log(
|
||||
"Note: Actual LHCI tests may fail locally due to Node.js architecture issues on macOS.",
|
||||
);
|
||||
console.log(
|
||||
"The CI environment should work correctly with the provided configuration.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user