Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-mocks

Package Overview
Dependencies
Maintainers
0
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-mocks

An Angular testing library for creating mock services, components, directives, pipes and modules in unit tests. It provides shallow rendering, precise stubs to fake child dependencies. ng-mocks works with Angular 5 6 7 8 9 10 11 12 13 14 15 16 17 18, jasm

  • 14.13.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
359K
decreased by-11.25%
Maintainers
0
Weekly downloads
 
Created

What is ng-mocks?

ng-mocks is a powerful library for Angular that simplifies the process of creating mock components, directives, pipes, and services for unit testing. It helps developers to isolate the unit of work and test it without dependencies on other parts of the application.

What are ng-mocks's main functionalities?

Mock Components

This feature allows you to create mock versions of Angular components. This is useful for isolating the component under test from its child components.

import { MockComponent } from 'ng-mocks';
import { MyComponent } from './my-component';

TestBed.configureTestingModule({
  declarations: [MockComponent(MyComponent)]
});

Mock Directives

This feature allows you to create mock versions of Angular directives. This is useful for isolating the component under test from its directives.

import { MockDirective } from 'ng-mocks';
import { MyDirective } from './my-directive';

TestBed.configureTestingModule({
  declarations: [MockDirective(MyDirective)]
});

Mock Pipes

This feature allows you to create mock versions of Angular pipes. This is useful for isolating the component under test from its pipes.

import { MockPipe } from 'ng-mocks';
import { MyPipe } from './my-pipe';

TestBed.configureTestingModule({
  declarations: [MockPipe(MyPipe)]
});

Mock Services

This feature allows you to create mock versions of Angular services. This is useful for isolating the component under test from its services.

import { MockProvider } from 'ng-mocks';
import { MyService } from './my-service';

TestBed.configureTestingModule({
  providers: [MockProvider(MyService)]
});

Other packages similar to ng-mocks

Keywords

FAQs

Package last updated on 25 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc