smart-commits-ai
Version:
AI-powered Git commit message generator - Pure Node.js implementation (no Python required)
48 lines (39 loc) โข 1.5 kB
JavaScript
/**
* Test script for smart-commits-ai NPM package
*/
const { spawn } = require('cross-spawn');
async function runTest() {
console.log('๐งช Testing Smart Commits AI NPM Package');
console.log('=====================================');
try {
// Test 1: Check if the binary works
console.log('Test 1: Binary execution...');
const result = spawn.sync('node', ['bin/smart-commits-ai.js', '--help'], {
stdio: 'pipe',
encoding: 'utf8'
});
if (result.status === 0 || result.status === 1) {
console.log('โ
Binary execution test passed');
} else {
console.log('โ Binary execution test failed');
console.log('Error:', result.stderr);
}
// Test 2: Check installer
console.log('\nTest 2: Installer module...');
const SmartCommitsInstaller = require('./install.js');
if (typeof SmartCommitsInstaller === 'function') {
console.log('โ
Installer module test passed');
} else {
console.log('โ Installer module test failed');
}
console.log('\n๐ All tests completed!');
console.log('\nTo test manually:');
console.log('1. npm install -g .');
console.log('2. smart-commits-ai --version');
} catch (error) {
console.error('โ Test failed:', error.message);
process.exit(1);
}
}
runTest();