UNPKG

claudes-office

Version:

CLI tool to initialize Claude's office in your project

83 lines (68 loc) 2.22 kB
#!/usr/bin/env node const { spawn } = require('child_process'); const chalk = require('chalk'); const path = require('path'); // Utility function to run a test script async function runTestScript(scriptName) { console.log(chalk.bold.magenta(`\n\n=== Running ${scriptName} ===\n`)); return new Promise((resolve, reject) => { const scriptPath = path.join(__dirname, scriptName); const child = spawn('node', [scriptPath], { stdio: 'inherit' }); child.on('close', (code) => { if (code === 0) { resolve(true); } else { console.log(chalk.red(`\n${scriptName} failed with exit code ${code}`)); resolve(false); } }); child.on('error', (err) => { console.error(chalk.red(`Error running ${scriptName}: ${err.message}`)); reject(err); }); }); } // Run all test scripts async function runAllTests() { console.log(chalk.bold.cyan(`\n=== CLAUDE'S OFFICE CLI TESTING SUITE ===\n`)); // Define all test scripts to run const testScripts = [ 'test.js', // Basic installation test 'test_suite.js', // Main test suite 'test_edge_cases.js', // Edge case tests ]; const results = []; for (const script of testScripts) { try { const passed = await runTestScript(script); results.push({ script, passed }); } catch (error) { results.push({ script, passed: false, error }); } } // Print summary console.log(chalk.bold.cyan(`\n\n=== TEST SUITE SUMMARY ===\n`)); let passedCount = 0; let failedCount = 0; for (const result of results) { if (result.passed) { console.log(chalk.green(`✓ ${result.script} passed`)); passedCount++; } else { console.log(chalk.red(`✗ ${result.script} failed`)); failedCount++; } } console.log(chalk.bold.cyan(`\nTotal Results: ${results.length} test scripts`)); console.log(chalk.green(`Passed: ${passedCount}`)); if (failedCount > 0) { console.log(chalk.red(`Failed: ${failedCount}`)); process.exit(1); } else { console.log(chalk.bold.green(`\nAll test scripts passed successfully! 🎉\n`)); } } // Run all tests runAllTests();