-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-cli.js
More file actions
executable file
·64 lines (54 loc) · 1.47 KB
/
test-cli.js
File metadata and controls
executable file
·64 lines (54 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env node
// Test script to validate the CLI works locally before publishing
const { execSync } = require('child_process');
const path = require('path');
const cliPath = path.join(__dirname, 'bin', 'cli.js');
console.log('🧪 Testing Claude Dev Workflow CLI\n');
const tests = [
{
name: 'CLI executable',
command: `node ${cliPath} --version`,
expectSuccess: true
},
{
name: 'Help command',
command: `node ${cliPath} help`,
expectSuccess: true
},
{
name: 'Labels list command',
command: `node ${cliPath} labels --list`,
expectSuccess: true
},
{
name: 'Validate command (may fail without proper setup)',
command: `node ${cliPath} validate`,
expectSuccess: false // This will likely fail in most environments
}
];
let passed = 0;
let failed = 0;
for (const test of tests) {
process.stdout.write(`Testing ${test.name}... `);
try {
execSync(test.command, { stdio: 'pipe' });
console.log('✅ PASS');
passed++;
} catch (error) {
if (test.expectSuccess) {
console.log('❌ FAIL');
console.log(` Error: ${error.message}`);
failed++;
} else {
console.log('⚠️ EXPECTED FAIL');
passed++;
}
}
}
console.log(`\n📊 Test Results: ${passed} passed, ${failed} failed`);
if (failed === 0) {
console.log('🎉 All tests passed! CLI is ready for publishing.');
} else {
console.log('❌ Some tests failed. Fix issues before publishing.');
process.exit(1);
}