Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>pull/6259/head
parent
0fc2efc938
commit
a087906b83
|
@ -205,42 +205,44 @@ export default defineConfig({
|
|||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
console.log('Loading incremental validator module...');
|
||||
|
||||
|
||||
// Use CommonJS require for better compatibility
|
||||
const { IncrementalValidator } = require('./.github/scripts/incremental-validator.cjs');
|
||||
const {
|
||||
IncrementalValidator,
|
||||
} = require('./.github/scripts/incremental-validator.cjs');
|
||||
console.log('✅ Incremental validator loaded successfully');
|
||||
|
||||
|
||||
const validator = new IncrementalValidator();
|
||||
const results = await validator.validateFiles(filePaths);
|
||||
resolve(results);
|
||||
} catch (error) {
|
||||
console.error(`Incremental validation error: ${error.message}`);
|
||||
console.error(`Stack: ${error.stack}`);
|
||||
|
||||
|
||||
// Don't fail the entire test run due to cache issues
|
||||
// Fall back to validating all files
|
||||
console.warn('Falling back to validate all files without cache');
|
||||
resolve({
|
||||
validationStrategy: {
|
||||
unchanged: [],
|
||||
changed: filePaths.map(filePath => ({
|
||||
changed: filePaths.map((filePath) => ({
|
||||
filePath,
|
||||
fileHash: 'unknown',
|
||||
links: []
|
||||
links: [],
|
||||
})),
|
||||
newLinks: [],
|
||||
total: filePaths.length
|
||||
total: filePaths.length,
|
||||
},
|
||||
filesToValidate: filePaths.map(filePath => ({
|
||||
filesToValidate: filePaths.map((filePath) => ({
|
||||
filePath,
|
||||
fileHash: 'unknown'
|
||||
fileHash: 'unknown',
|
||||
})),
|
||||
cacheStats: {
|
||||
totalFiles: filePaths.length,
|
||||
cacheHits: 0,
|
||||
cacheMisses: filePaths.length,
|
||||
hitRate: 0
|
||||
}
|
||||
hitRate: 0,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -249,7 +251,9 @@ export default defineConfig({
|
|||
cacheValidationResults(filePath, fileHash, results) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const { IncrementalValidator } = require('./.github/scripts/incremental-validator.cjs');
|
||||
const {
|
||||
IncrementalValidator,
|
||||
} = require('./.github/scripts/incremental-validator.cjs');
|
||||
const validator = new IncrementalValidator();
|
||||
const success = await validator.cacheResults(
|
||||
filePath,
|
||||
|
@ -275,7 +279,9 @@ export default defineConfig({
|
|||
} catch (error) {
|
||||
console.error(`URL transformation error: ${error.message}`);
|
||||
// Fallback: return the file path as-is if transformation fails
|
||||
console.warn(`Using fallback URL transformation for: ${filePath}`);
|
||||
console.warn(
|
||||
`Using fallback URL transformation for: ${filePath}`
|
||||
);
|
||||
resolve(filePath);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue