💥 Kamehame - Angular Vitest Test Generator
Kamehame is a blazing-fast VS Code extension that auto-generates Vitest unit tests for Angular components, services, directives, and pipes.
No more boilerplate β just hit the command and let Kamehame do the heavy lifting! 🧪β¨
βΈ»
βοΈ Features
β
Supports Angular v14βv19
β
Generates tests for:
β’ 🧩 Components (with @Input() / @Output() binding tests)
β’ 🧭 Directives
β’ 🛠οΈ Services (with constructor dependency mocks)
β’ 🔁 Pipes (transform() logic)
β
Intelligent parameter mocking:
β’ string, number, boolean, functions, and nested objects
β
Uses Angularβs TestBed
β
Auto-calculates relative import paths
β
Optional code coverage reminder
β
Live spec preview before writing
β
File overwrite strategy (Overwrite / Cancel / Preview)
β
Workspace-level config via kamehame.config.json
β
Status bar success notification
βΈ»
🚀 How to Use
📁 From File Context Menu:
Right-click a .ts file in the Explorer and choose:
💥 Generate Vitest Test (Kamehame)
🔍 From Command Palette:
Cmd/Ctrl + Shift + P β Kamehame: Generate Test
βοΈ Workspace Configuration
Create a kamehame.config.json at your project root:
{
"enableCoverageComment": true,
"autoPreview": true
}
Option Description
enableCoverageComment Appends a code coverage comment block at the end
autoPreview Shows the generated spec in a preview tab before writing
🧪 Generated Test Preview
describe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [MyComponent]
}).compileComponents();
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create the component', () => {
expect(component).toBeTruthy();
});
/*
- 📊 Code Coverage: Aim for 100% method coverage.
- Auto-generated by Kamehame.
*/
});
📁 Supported File Types
File Type Coverage
.component.ts β
Full coverage (inputs/outputs)
.service.ts β
Dependency mocks & methods
.pipe.ts β
transform() logic testing
.directive.ts β
Inputs, outputs, and logic
💡 Smart Features
β’ 🎯 Detects and mocks method parameters
β’ 🧠 Special handling for ngOnInit()
β’ 🧱 Constructor dependency mocking
β’ 👀 Live spec preview before writing
β’ 🚫 Prevents test generation for .spec.ts files
βΈ»
👨β💻 Maintainer
Built with β€οΈ by Gokul Nair
MIT Licensed | Open Source