refactored tests

This commit is contained in:
Woody
2024-01-17 16:24:13 +01:00
parent 73d48c8ac4
commit e0facf35c8
2 changed files with 96 additions and 120 deletions

View File

@@ -188,13 +188,8 @@ async function writeChunks(srcDir, specs, resultFile) {
// Check if a file is newer than a given time
function isFileNewerThan(filePath, time) {
try {
const stats = fs.statSync(filePath);
return stats.mtimeMs > time;
} catch (e) {
console.error(`Failed to get stats for file ${filePath}:`, e);
return false;
}
const stats = fs.statSync(filePath);
return stats.mtimeMs > time;
}
// Check if any file in a folder (or its subfolders) is newer than a given time
@@ -219,8 +214,9 @@ function isAlreadyBuilt(folderPath) {
for (const file of output) {
try {
lastBuildTime = Math.min(lastBuildTime, fs.statSync(file).mtimeMs);
}
catch (e) {
} catch (e) {
if (e.code !== 'ENOENT') throw e;
console.info("File " + file + " does not exist. Rebuilding...");
return false;
}
}