All Projects → 500tech → Mimic

500tech / Mimic

Licence: mit
Seamless client side mocking

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Mimic

Msw
Seamless REST/GraphQL API mocking library for browser and Node.js.
Stars: ✭ 7,830 (+1960.53%)
Mutual labels:  mock, mocking, mocking-framework
Prig
Prig is a lightweight framework for test indirections in .NET Framework.
Stars: ✭ 106 (-72.11%)
Mutual labels:  test, mock, mocking
Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+3177.11%)
Mutual labels:  mock, mocking, mocking-framework
Kakapo.js
🐦 Next generation mocking framework in Javascript
Stars: ✭ 535 (+40.79%)
Mutual labels:  mock, mocking, mocking-framework
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (-81.58%)
Mutual labels:  mock, test, mocking
Fake Xrm Easy
The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
Stars: ✭ 216 (-43.16%)
Mutual labels:  mock, mocking, mocking-framework
Hippolyte
HTTP Stubbing in Swift
Stars: ✭ 109 (-71.32%)
Mutual labels:  mock, test, mocking
Nsubstitute
A friendly substitute for .NET mocking libraries.
Stars: ✭ 1,646 (+333.16%)
Mutual labels:  test, mock, mocking
Mockolo
Efficient Mock Generator for Swift
Stars: ✭ 327 (-13.95%)
Mutual labels:  mock, mocking, mocking-framework
Mocktopus
Mocking framework for Rust
Stars: ✭ 179 (-52.89%)
Mutual labels:  test, mock, mocking
umock-c
A pure C mocking library
Stars: ✭ 29 (-92.37%)
Mutual labels:  mock, mocking, mocking-framework
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (-73.95%)
Mutual labels:  mock, test, mocking
Fakerest
Patch fetch/XMLHttpRequest to fake a REST API server in the browser, based on JSON data.
Stars: ✭ 350 (-7.89%)
Mutual labels:  test, mock, frontend
Retromock
Java library for mocking responses in a Retrofit service.
Stars: ✭ 48 (-87.37%)
Mutual labels:  mock, mocking
elixir mock
Creates clean, concurrent, inspectable mocks from elixir modules
Stars: ✭ 21 (-94.47%)
Mutual labels:  mock, mocking
skywalking-infra-e2e
Apache SkyWalking Infra E2E
Stars: ✭ 30 (-92.11%)
Mutual labels:  tools, test
mock-inspect
Mocks network requests and allows you to make assertions about how these requests happened. Supports auto-mocking of graphQL requests given a valid schema.
Stars: ✭ 19 (-95%)
Mutual labels:  mocking, mocking-framework
mswjs.io
Official website and documentation for the Mock Service Worker library.
Stars: ✭ 77 (-79.74%)
Mutual labels:  mock, mocking
stub-server
Stub server for REST APIs
Stars: ✭ 14 (-96.32%)
Mutual labels:  mock, test
automock
A library for testing classes with auto mocking capabilities using jest-mock-extended
Stars: ✭ 26 (-93.16%)
Mutual labels:  mock, mocking

Mimic

Build Status npm version Known Vulnerabilities

Seamless client side mocking https://mimic.js.org

short introduction

What is mimic?

Mimic is a tool for mocking server responses on the client side.

Using Mimic in your project

Add to your packages:

npm install mimic --save

Import in your app:

import 'mimic';

Once you reload the application, the Mimic logo will appear in bottom right corner.

Enjoy!

Loading Mimic only in development environments

To load mimic only in development environments your application will need to be aware if it runs in development or production mode.

If you are using webpack the most common way is to use the DefinePlugin to define NODE_ENV environment variable. Please see webpack DefinePlugin for more information.

If you are using create react app this is applied by default which you can read more about it here.

Once your application is aware of the environment you need to add a conditional require or import statement to load Mimic. For example:

if (process.env.NODE_ENV === 'development') {
  require('mimic');
}

Or using the dynamic import spec (you must have babel and babel-plugin-syntax-dynamic-import installed to use this syntax).

if (process.env.NODE_ENV === 'development') {
  import('mimic');
}

Using Mocks tracked by git

If you want to use mocks which will be committed into git and you're using webpack you can use the following code to import the mocks on application start:

import mimic from 'mimic';
const mocks = require.context(__dirname + '/mocks', true, /\.json$/);
mocks.keys().forEach((key) => mimic.import(JSON.stringify(mocks(key))));

This assumes your mocks are placed in the mocks directory which is located at the root of the project. In the mocks directory you have exports for either complete scenarios or separate mock requests.

Guides

Other Usages

The main and the most obvious use case for mimic is when the API for a UI feature is not ready or incomplete, but it can be helpful in more situations. For example:

  • You have a demo of the product, but the API server is unstable or you need to use fake data.
  • You want to work on a feature outside of company's VPN
  • You need access to API, but don't have an internet connection or it is unstable.

In the cases above, you can use the "recording" feature to record all the real responses from server by hand and then use them for your needs in the future.

Contributing to Mimic

  1. Clone the repo

  2. Install dependencies (at the root of the repo):

    npm install
    
  3. Run the project

    npm start
    
  4. Build for deployment

    npm run build
    
  5. Please submit PRs to the next branch, as we keep master as the latest version of mimic.

Acknowledgements

Thanks Ilya Birman for the new UI for Mimic 2.0

License

The MIT License (MIT)

Copyright (c) 2015 500Tech

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].