Files
spiceflow/e2e/global-teardown.ts

29 lines
799 B
TypeScript

import { stopServers } from './server-utils.js';
import { unlinkSync } from 'fs';
import { homedir } from 'os';
import { join } from 'path';
function cleanupTestFiles() {
const testFile = join(homedir(), 'foo.md');
try {
unlinkSync(testFile);
console.log('Cleaned up test file:', testFile);
} catch {
// File doesn't exist, ignore
}
}
export default async function globalTeardown() {
// Clean up test files
cleanupTestFiles();
// Skip if servers are managed externally (e.g., by scripts/test)
if (process.env.SKIP_SERVER_SETUP) {
console.log('\n=== Skipping server teardown (SKIP_SERVER_SETUP is set) ===\n');
return;
}
console.log('\n=== Stopping E2E Test Environment ===\n');
stopServers();
console.log('\n=== E2E Test Environment Stopped ===\n');
}