Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
28 lines
695 B
TypeScript
28 lines
695 B
TypeScript
import { execSync } from 'child_process';
|
|
|
|
function globalTeardown() {
|
|
console.log('🧹 Starting global teardown...');
|
|
|
|
const ports = [5678, 8080];
|
|
|
|
for (const port of ports) {
|
|
try {
|
|
// Find process ID using the port
|
|
const pid = execSync(`lsof -ti :${port}`, { encoding: 'utf-8' }).trim();
|
|
|
|
if (pid) {
|
|
console.log(`- Killing process ${pid} on port ${port}`);
|
|
execSync(`kill -9 ${pid}`);
|
|
}
|
|
} catch (error) {
|
|
// lsof returns non-zero exit code if no process is found
|
|
console.log(`- No process found on port ${port}`);
|
|
}
|
|
}
|
|
|
|
console.log('🏁 Global teardown completed');
|
|
}
|
|
|
|
// eslint-disable-next-line import-x/no-default-export
|
|
export default globalTeardown;
|