Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"@shopify/prettier-plugin-liquid": "^1.9.3",
"better-sqlite3": "^12.2.0",
"cheerio": "^1.1.2",
"cli-progress": "^3.12.0",
"css": "^3.0.0",
"glob": "^11.0.3",
"html-validate": "^10.0.0",
Expand Down
35 changes: 10 additions & 25 deletions test/build-html-validate.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { glob } from "glob";
import cliProgress from "cli-progress";
import { Worker } from "worker_threads";
import path from "path";
import { fileURLToPath } from "url";
Expand Down Expand Up @@ -28,21 +27,6 @@ console.log(`🧪 Validating ${targets.length} files with ${MAX_WORKERS} paralle
await validateParallel();

async function validateParallel() {
const multibar = new cliProgress.MultiBar(
{
format: "[{bar}] {percentage}% | {value}/{total} | {status}",
hideCursor: true,
clearOnComplete: false,
stopOnComplete: true,
forceRedraw: false,
},
cliProgress.Presets.shades_classic,
);

const overallBar = multibar.create(targets.length, 0, {
status: "Starting...",
});

let completedTasks = 0;
let allTestsPassed = true;
const results = [];
Expand All @@ -54,7 +38,6 @@ async function validateParallel() {
if (isDone) return;
isDone = true;

multibar.stop();
workers.forEach((worker) => worker.terminate());

const failedResults = results.filter((r) => !r.isValid);
Expand All @@ -65,9 +48,6 @@ async function validateParallel() {

if (failedResults.length > 0) {
console.log(`❌ ${failedResults.length} files failed validation`);
failedResults.forEach((result) => {
console.log(`\n✅ File: ${path.relative(process.cwd(), result.filePath)}\n${result.message.trim()}`);
});
process.exit(1);
} else {
console.log("✨ All tests passed!\n");
Expand All @@ -81,15 +61,20 @@ async function validateParallel() {
completedTasks++;
results.push(result);

const relativeFilePath = path.relative(process.cwd(), result.filePath);

if (!result.isValid) {
allTestsPassed = false;
multibar.log(`❌ ${path.relative(process.cwd(), result.filePath)}\n${result.message.trim()}\n\n`);
console.log(`❌ (${completedTasks} of ${targets.length}) ${relativeFilePath}`);
// Print error messages with indentation
const errorLines = result.message.trim().split("\n");
errorLines.forEach((line) => {
console.log(`- ${line}`);
});
} else {
console.log(`✅ (${completedTasks} of ${targets.length}) ${relativeFilePath}`);
}

overallBar.increment(1, {
status: path.basename(result.filePath),
});

if (taskQueue.length > 0) {
const nextTask = taskQueue.shift();
worker.postMessage({ filePath: nextTask, workerId });
Expand Down
12 changes: 1 addition & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,6 @@ __metadata:
languageName: node
linkType: hard

"cli-progress@npm:^3.12.0":
version: 3.12.0
resolution: "cli-progress@npm:3.12.0"
dependencies:
string-width: "npm:^4.2.3"
checksum: 10c0/f464cb19ebde2f3880620a2adfaeeefaec6cb15c8e610c8a659ca1047ee90d69f3bf2fdabbb1fe33ac408678e882e3e0eecdb84ab5df0edf930b269b8a72682d
languageName: node
linkType: hard

"cliui@npm:^5.0.0":
version: 5.0.0
resolution: "cliui@npm:5.0.0"
Expand Down Expand Up @@ -2640,7 +2631,6 @@ __metadata:
"@shopify/prettier-plugin-liquid": "npm:^1.9.3"
better-sqlite3: "npm:^12.2.0"
cheerio: "npm:^1.1.2"
cli-progress: "npm:^3.12.0"
css: "npm:^3.0.0"
front-matter: "npm:^4.0.2"
glob: "npm:^11.0.3"
Expand Down Expand Up @@ -2832,7 +2822,7 @@ __metadata:
languageName: node
linkType: hard

"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^4.1.0, string-width@npm:^4.2.3":
"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^4.1.0":
version: 4.2.3
resolution: "string-width@npm:4.2.3"
dependencies:
Expand Down
Loading