angular-jest

Installation
SKILL.md

Angular + Jest

Version: Jest 29.x (2025) Tags: Jest, Testing, Unit Tests

References: Jestjest-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();
  });
});
Related skills
Installs
126
GitHub Stars
6
First Seen
Apr 2, 2026