RepositoryTypeScriptDEĐức
help-me-mom

help-me-mom/ng-mocks

Angular testing library for mocking components, directives, pipes, services and facilitating TestBed setup

1.2ksao
122fork
14issue
3lượt xem

Thành tựu nổi bật

Những danh hiệu mới nhất của dự án

1
TINIX TRENDING·Chủ đề: directive

#1 Repository của tuần

2
TINIX TRENDING·Chủ đề: pipe

#2 Repository của tuần

3
TINIX TRENDING·Chủ đề: test

#3 Repository của tuần

🧪 Mock mọi thứ trong Angular test chỉ bằng vài dòng

Giảm boilerplate, tăng tốc test Angular với ng-mocks.

ng-mocks là thư viện hỗ trợ test Angular, giúp mock nhanh các Component, Directive, Pipe, Module, Service và Token. Được hỗ trợ trên cả Jasmine và Jest, tương thích với Angular từ phiên bản 5 đến 22.

✨ Điểm nổi bật

  • Mock toàn diện: Hỗ trợ mock Component, Directive, Pipe, Module, Service, Token.
  • Giảm cấu hình: Sử dụng MockBuilder để thay thế TestBed.configureTestingModule.
  • Tự động spy: Cấu hình ngMocks.autoSpy() để tự động spy các phương thức mock.
  • Cấu hình toàn cục: Dùng ngMocks.defaultMock() để thiết lập mock mặc định.
  • Hỗ trợ Ivy & Standalone: Tương thích với Angular Ivy, standalone components và signals.
  • MockRender nâng cao: Phiên bản nâng cấp của TestBed.createComponent, hỗ trợ lifecycle hooks và change detection.
  • Tương thích đa nền tảng: Hỗ trợ Jasmine, Jest, Ivy, standalone, signals.

💡 Vì sao đáng chú ý

Không cần viết thủ công các mock phức tạp hay cấu hình TestBed dài dằng dày. Chỉ với MockBuilder và MockRender, bạn có thể thiết lập môi trường test nhanh chóng và rõ ràng. Phù hợp cho dự án Angular lớn cần test nhanhiu module và service.


#Angular #Testing #Mocking #OpenSource #TiniX

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryJavaScript
goldbergyoni/javascript-testing-best-practices

📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (August 2025)

24.6k
Jun 27, 2024
RepositoryJava
mockito/mockito

Most popular Mocking framework for unit tests written in Java

15.5k
Nov 26, 2026
RepositoryC#
nsubstitute/NSubstitute

A friendly substitute for .NET mocking libraries.

3.0k
Nov 16, 2026
RepositoryTypeScript
mswjs/msw

The industry standard for API mocking in JavaScript.

18.4k
Nov 26, 2026
RepositoryTypeScript
smocker-dev/smocker

Smocker is a simple and efficient HTTP mock server and proxy

1.3k
Nov 28, 2026
RepositoryTypeScript
ihym/ngx-timeago

⏰ Live updating timestamps in Angular

80
Feb 5, 2026
RepositoryGo
stretchr/testify

A toolkit with common assertions and mocks that plays nicely with the standard library

26.3k
Nov 20, 2026
RepositoryJavaScript
mochajs/mocha

☕️ Classic, reliable, trusted test framework for Node.js and the browser

22.9k
Dec 2, 2026
RepositoryGo
keploy/keploy

Open-source platform for creating safe, isolated production sandboxes for API, integration, and E2E testing.

20.0k
Dec 1, 2026