chore: fix use-tag e2e test

This commit is contained in:
Ralph Khreish
2025-07-12 00:38:49 +03:00
parent e580e5d7c0
commit 3204582885
7 changed files with 187 additions and 173 deletions

View File

@@ -3,17 +3,27 @@
* Runs once before all test suites
*/
const { execSync } = require('child_process');
const { existsSync } = require('fs');
const { join } = require('path');
import { execSync } from 'child_process';
import { existsSync } from 'fs';
import { join } from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
module.exports = async () => {
console.log('\n🚀 Setting up E2E test environment...\n');
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default async () => {
// Silent mode for cleaner output
if (!process.env.JEST_SILENT_REPORTER) {
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...');
if (!process.env.JEST_SILENT_REPORTER) {
console.log('📦 Linking task-master globally...');
}
execSync('npm link', {
cwd: projectRoot,
stdio: 'inherit'
@@ -26,13 +36,17 @@ module.exports = async () => {
'⚠️ Warning: .env file not found. Some tests may fail without API keys.'
);
} else {
console.log('✅ .env file found');
if (!process.env.JEST_SILENT_REPORTER) {
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');
if (!process.env.JEST_SILENT_REPORTER) {
console.log('✅ task-master command is available\n');
}
} catch (error) {
throw new Error(
'task-master command not found. Please ensure npm link succeeded.'

View File

@@ -3,8 +3,11 @@
* Runs once after all test suites
*/
module.exports = async () => {
console.log('\n🧹 Cleaning up E2E test environment...\n');
export default async () => {
// Silent mode for cleaner output
if (!process.env.JEST_SILENT_REPORTER) {
console.log('\n🧹 Cleaning up E2E test environment...\n');
}
// Any global cleanup needed
// Note: Individual test directories are cleaned up in afterEach hooks