{"id":13538321,"url":"https://github.com/morsdyce/mimic","last_synced_at":"2025-04-05T12:06:12.157Z","repository":{"id":42117016,"uuid":"46858990","full_name":"morsdyce/mimic","owner":"morsdyce","description":"Seamless client side mocking","archived":false,"fork":false,"pushed_at":"2023-03-01T22:32:42.000Z","size":7331,"stargazers_count":395,"open_issues_count":59,"forks_count":37,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-29T23:35:54.594Z","etag":null,"topics":["frontend","mock","mocking","mocking-framework","mocking-library","mocking-utility","test","testing","tools"],"latest_commit_sha":null,"homepage":"https://mimic.js.org","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morsdyce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-11-25T12:00:23.000Z","updated_at":"2024-08-26T16:23:26.000Z","dependencies_parsed_at":"2023-07-23T01:51:32.371Z","dependency_job_id":null,"html_url":"https://github.com/morsdyce/mimic","commit_stats":{"total_commits":1169,"total_committers":24,"mean_commits":"48.708333333333336","dds":0.5192472198460223,"last_synced_commit":"0e9076db3bf76a19ce0f761f2199522ff781966f"},"previous_names":["500tech/mimic","500tech/bdsm"],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morsdyce%2Fmimic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morsdyce%2Fmimic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morsdyce%2Fmimic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morsdyce%2Fmimic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morsdyce","download_url":"https://codeload.github.com/morsdyce/mimic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244217952,"owners_count":20417677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frontend","mock","mocking","mocking-framework","mocking-library","mocking-utility","test","testing","tools"],"created_at":"2024-08-01T09:01:09.807Z","updated_at":"2025-03-22T10:04:48.866Z","avatar_url":"https://github.com/morsdyce.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"Mimic\n==========\n\n[![Build Status](https://travis-ci.org/500tech/mimic.svg?branch=master)](https://travis-ci.org/morsdyce/mimic)\n[![npm version](https://badge.fury.io/js/mimic.svg)](https://badge.fury.io/js/mimic)\n[![Known Vulnerabilities](https://snyk.io/test/github/500tech/mimic/badge.svg)](https://snyk.io/test/github/morsdyce/mimic)\n\nSeamless client side mocking [https://mimic.js.org](https://mimic.js.org)\n\n![short introduction](https://mimic.js.org/assets/images/mimic_screenshot.png)\n\n### What is mimic?\nMimic is a tool for mocking server responses on the client side.\n\nUsing Mimic in your project\n--------------------------\n\nAdd to your packages:\n\n    npm install mimic --save-dev\n\nImport in your app:\n\n    import 'mimic';\n\nOnce you reload the application, the Mimic logo will appear in bottom\nright corner.\n\nEnjoy!\n\nLoading Mimic only in development environments\n--------------------------\n\nTo load mimic only in development environments your application will need to be aware if it runs in development or production mode.\n\nIf you are using webpack the most common way is to use the DefinePlugin to define NODE_ENV environment variable.\nPlease see [webpack DefinePlugin](https://webpack.js.org/plugins/define-plugin/) for more information.\n\nIf you are using create react app this is applied by default which you can read more about it [here](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-custom-environment-variables).\n\nOnce your application is aware of the environment you need to add a conditional require or import statement to load Mimic.\nFor example:\n\n```js\nif (process.env.NODE_ENV === 'development') {\n  require('mimic');\n}\n```\n\nOr using the dynamic import spec (you must have babel and [babel-plugin-syntax-dynamic-import](https://babeljs.io/docs/plugins/syntax-dynamic-import/) installed to use this syntax).\n\n```js\nif (process.env.NODE_ENV === 'development') {\n  import('mimic');\n}\n```\n\nUsing Mocks tracked by git\n--------------------------\nIf 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:\n\n```\nimport mimic from 'mimic';\nconst mocks = require.context(__dirname + '/mocks', true, /\\.json$/);\nmocks.keys().forEach((key) =\u003e mimic.import(JSON.stringify(mocks(key))));\n```\n\nThis assumes your mocks are placed in the mocks directory which is located at the root of the project.\nIn the mocks directory you have exports for either complete scenarios or separate mock requests.\n\n\nGuides\n-------------\n\n* [Using mimic with React Native](https://github.com/500tech/mimic/blob/master/docs/react-native.md)\n* [Using mimic with NativeScript](https://github.com/500tech/mimic/blob/master/docs/nativescript.md)\n\n\nOther Usages\n------------\nThe main and the most obvious use case for mimic is when the API for a UI feature is not ready or incomplete,\nbut it can be helpful in more situations. For example:\n\n* You have a demo of the product, but the API server is unstable or you need to use fake data.\n* You want to work on a feature outside of company's VPN\n* You need access to API, but don't have an internet connection or it is unstable.\n\nIn the cases above, you can use the \"recording\" feature to record all the real responses from server\nby hand and then use them for your needs in the future.\n\n\nContributing to Mimic\n--------------------\n\n\n1. Clone the repo\n1. Install dependencies (at the root of the repo):\n\n    ```\n    npm install\n    ```\n\n1. Run the project\n\n    ```\n    npm start\n    ```\n\n1. Build for deployment\n\n    ```\n    npm run build\n    ```\n\n1. Please submit PRs to the `next` branch, as we keep master as the latest version of mimic.\n\nAcknowledgements\n-------\nThanks [Ilya Birman](http://ilyabirman.net) for the new UI for Mimic 2.0\n\n\nLicense\n-------\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Maayan Glikser\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorsdyce%2Fmimic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorsdyce%2Fmimic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorsdyce%2Fmimic/lists"}