fix: clamp progressBar to prevent RangeError on overflow, add 10 tests

progressBar() in skill-create-output.js could crash with RangeError when
percent > 100 because repeat() received a negative count. Fixed by
clamping filled to [0, width].

New tests:
- progressBar edge cases: 0%, 100%, and >100% confidence
- Empty patterns/instincts arrays
- post-edit-format: null tool_input, missing file_path, prettier failure
- setup-package-manager: --detect output completeness, current marker
This commit is contained in:
Affaan Mustafa
2026-02-13 02:01:57 -08:00
parent 0e0319a1c2
commit 5398ac793d
4 changed files with 86 additions and 1 deletions

View File

@@ -159,6 +159,22 @@ function runTests() {
assert.ok(result.stdout.includes('pnpm'));
})) passed++; else failed++;
// --detect output completeness
console.log('\n--detect output completeness:');
if (test('shows all three command types in detection output', () => {
const result = run(['--detect']);
assert.strictEqual(result.code, 0);
assert.ok(result.stdout.includes('Install:'), 'Should show Install command');
assert.ok(result.stdout.includes('Run script:'), 'Should show Run script command');
assert.ok(result.stdout.includes('Execute binary:'), 'Should show Execute binary command');
})) passed++; else failed++;
if (test('shows current marker for active package manager', () => {
const result = run(['--detect']);
assert.ok(result.stdout.includes('(current)'), 'Should mark current PM');
})) passed++; else failed++;
// Summary
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);