test: harden mcp health port readiness

This commit is contained in:
Affaan Mustafa
2026-05-11 22:31:22 -04:00
committed by Affaan Mustafa
parent 6d613f67dd
commit 67a8b914ee

View File

@@ -128,7 +128,10 @@ function waitForFile(filePath, timeoutMs = 5000) {
const started = Date.now();
while (Date.now() - started < timeoutMs) {
if (fs.existsSync(filePath)) {
return fs.readFileSync(filePath, 'utf8');
const content = fs.readFileSync(filePath, 'utf8');
if (content.trim()) {
return content;
}
}
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 25);
}