About angular-jest
A testing skill for Angular projects using Jest and jest-preset-angular. It covers Jest setup and component unit-test patterns.
Key features
- 01Install Jest testing dependencies
- 02Configure jest-preset-angular
- 03Write component unit tests
Use cases
- 01Set up Jest in an Angular project
- 02Test Angular components with TestBed
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ oguzhan18/ angular-ecosystem-skills --skill angular-jestAfter installing, type/angular-jestin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/discussions/_INDEX.mdreferences/docs/_INDEX.mdreferences/issues/_INDEX.mdreferences/releases/_INDEX.mdDetails
From the project READMEAngular + Jest
Version: Jest 29.x (2025) Tags: Jest, Testing, Unit Tests
References: Jest • jest-preset-angular
Best Practices
- Install Jest
npm install --save-dev jest @types/jest jest-preset-angular
- Configure Jest
// jest.config.js
module.exports = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
testPathIgnorePatterns: ['<rootDir>/node_modules/'],
};
- Write test
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MyComponent } from './my.component';
describe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture<MyComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [MyComponent]
}).compileComponents();
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Comments
Markdown supported