Files
shopify-ai-backup/chat/src/test/run-all-tests.js
Developer 98c3b5f040
Some checks are pending
Build Android App (Capacitor) / Build Android APK (push) Waiting to run
fix security
2026-02-21 10:07:02 +00:00

103 lines
2.8 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Comprehensive Test Suite Runner
* Runs all tests for the Chat Application
*
* Usage: node src/test/run-all-tests.js
*/
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
console.log('╔════════════════════════════════════════════════════════╗');
console.log('║ COMPREHENSIVE CHAT APPLICATION TEST SUITE ║');
console.log('╚════════════════════════════════════════════════════════╝\n');
const testFiles = [
'encryption.test.js',
'userRepository.test.js',
'sessionRepository.test.js',
'authentication.test.js',
'accountManagement.test.js',
'payments.test.js',
'modelRouting.test.js',
'security.test.js'
];
const results = {
passed: [],
failed: [],
skipped: []
};
function runTest(testFile) {
const testPath = path.join(__dirname, testFile);
console.log(`\n${'─'.repeat(60)}`);
console.log(`Running: ${testFile}`);
console.log(`${'─'.repeat(60)}`);
try {
const output = execSync(`node "${testPath}"`, {
encoding: 'utf8',
timeout: 30000,
stdio: 'pipe'
});
console.log(output);
results.passed.push(testFile);
return true;
} catch (error) {
console.log(error.stdout || error.message);
results.failed.push({ file: testFile, error: error.message });
return false;
}
}
function printSummary() {
console.log('\n' + '═'.repeat(60));
console.log(' TEST SUMMARY');
console.log('═'.repeat(60));
console.log(`\n✓ Passed: ${results.passed.length} test files`);
results.passed.forEach(file => {
console.log(`${file}`);
});
if (results.failed.length > 0) {
console.log(`\n✗ Failed: ${results.failed.length} test files`);
results.failed.forEach(({ file, error }) => {
console.log(`${file}`);
});
}
if (results.skipped.length > 0) {
console.log(`\n⊘ Skipped: ${results.skipped.length} test files`);
results.skipped.forEach(file => {
console.log(`${file}`);
});
}
console.log('\n' + '═'.repeat(60));
console.log(`Total: ${testFiles.length} test files`);
console.log(`Success Rate: ${Math.round((results.passed.length / testFiles.length) * 100)}%`);
console.log('═'.repeat(60));
if (results.failed.length === 0) {
console.log('\n🎉 All tests passed! 🎉\n');
process.exit(0);
} else {
console.log('\n⚠ Some tests failed. Please review the output above.\n');
process.exit(1);
}
}
// Run all tests
console.log(`Running ${testFiles.length} test files...\n`);
for (const testFile of testFiles) {
runTest(testFile);
}
printSummary();