Intermock is a TypeScript utility developed by Google that automatically generates mock objects and JSON data for TypeScript interfaces using the Faker library. It simplifies frontend and API testing by creating realistic, schema-compliant mock data directly from interface definitions, eliminating the need for manual mock creation. Intermock supports a wide range of TypeScript constructs including interfaces, unions, generics, mapped types, and tuples, ensuring comprehensive type coverage. It can be used both via a command-line interface (CLI) and programmatically through its API, making it suitable for integration into build pipelines or development environments. The tool also allows fine-grained control over output format—object, JSON, or string—and supports JSDoc annotations to define custom Faker data generators. By leveraging Intermock, developers can quickly generate realistic mock datasets for testing, prototyping, and documentation purposes without writing boilerplate code.
Features
- Automatically generates mock objects and JSON from TypeScript interfaces
- Supports complex TypeScript features like unions, generics, and mapped types
- Integrates with Faker for realistic, randomized data generation
- Offers both CLI and programmatic API usage for flexible integration
- Allows custom Faker data types via JSDoc annotations
- Supports optional properties and nested interface relationships