/** * Global setup for E2E tests * Runs once before all test suites */ const { execSync } = require('child_process'); const { existsSync } = require('fs'); const { join } = require('path'); module.exports = async () => { console.log('\nšŸš€ Setting up E2E test environment...\n'); try { // Ensure task-master is linked globally const projectRoot = join(__dirname, '../../..'); console.log('šŸ“¦ Linking task-master globally...'); execSync('npm link', { cwd: projectRoot, stdio: 'inherit' }); // Verify .env file exists const envPath = join(projectRoot, '.env'); if (!existsSync(envPath)) { console.warn( 'āš ļø Warning: .env file not found. Some tests may fail without API keys.' ); } else { console.log('āœ… .env file found'); } // Verify task-master command is available try { execSync('task-master --version', { stdio: 'pipe' }); console.log('āœ… task-master command is available\n'); } catch (error) { throw new Error( 'task-master command not found. Please ensure npm link succeeded.' ); } } catch (error) { console.error('āŒ Global setup failed:', error.message); throw error; } };