{"id":17484625,"url":"https://github.com/brentlintner/mimus","last_synced_at":"2025-04-22T15:21:12.690Z","repository":{"id":17558072,"uuid":"20361018","full_name":"brentlintner/mimus","owner":"brentlintner","description":"A test runner agnostic stubbing library for NodeJS, supporting dependency injection and auto stubbing","archived":false,"fork":false,"pushed_at":"2018-08-31T17:51:51.000Z","size":57,"stargazers_count":3,"open_issues_count":10,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T22:06:21.478Z","etag":null,"topics":["coffeescript","dependency-injection","javascript","mock","nodejs","stub","testing"],"latest_commit_sha":null,"homepage":"http://npmjs.org/mimus","language":"CoffeeScript","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/brentlintner.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}},"created_at":"2014-05-31T17:24:31.000Z","updated_at":"2018-08-31T17:51:48.000Z","dependencies_parsed_at":"2022-09-26T21:31:31.526Z","dependency_job_id":null,"html_url":"https://github.com/brentlintner/mimus","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentlintner%2Fmimus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentlintner%2Fmimus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentlintner%2Fmimus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentlintner%2Fmimus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brentlintner","download_url":"https://codeload.github.com/brentlintner/mimus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249525624,"owners_count":21286062,"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":["coffeescript","dependency-injection","javascript","mock","nodejs","stub","testing"],"created_at":"2024-10-19T01:04:56.474Z","updated_at":"2025-04-22T15:21:12.119Z","avatar_url":"https://github.com/brentlintner.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mimus [![Circle CI](https://circleci.com/gh/brentlintner/mimus.svg?style=shield)](https://circleci.com/gh/brentlintner/mimus) [![score-badge](https://vile.io/api/v0/projects/mimus/badges/score?token=USryyHar5xQs7cBjNUdZ)](https://vile.io/~brentlintner/mimus) [![coverage-badge](https://vile.io/api/v0/projects/mimus/badges/coverage?token=USryyHar5xQs7cBjNUdZ)](https://vile.io/~brentlintner/mimus) [![dependency-badge](https://vile.io/api/v0/projects/mimus/badges/dependency?token=USryyHar5xQs7cBjNUdZ)](https://vile.io/~brentlintner/mimus) [![NPM version](https://badge.fury.io/js/mimus.svg)](http://badge.fury.io/js/mimus)\n\nA stubbing library with a focus on having:\n\n* A simple API.\n* Dependency injection and auto stubbing.\n* A decoupled relationship with test runners.\n\nNote: Currently this project is using [Sinon](http://sinonjs.org) and [Rewire](https://www.npmjs.org/package/rewire). Check them out!\n\n## Installation\n\n    npm install mimus\n\n## Usage\n\n```javascript\n  var mimus = require('mimus')\n```\n\n### mimus.require\n\nThis is the main method that you will use. It will require only the module\nyou want to test against, while stubbing any specified internal modules,\nthat can be retrieved with other methods.\n\nRequire a stubbed `db` module and also stub the `mongodb` and `zlib` module.\n\n```javascript\n  var db = mimus.require('./lib/db', __dirname, ['mongodb', 'zlib'])\n```\nWhy the whitelist approach?\n\nThis way, unexpected clashes with mocking low level modules can be controlled by the user.\n\n### mimus.get\n\nGet an internal variable.\n\nUses `rewire.__get__`.\n\n```javascript\n  mimus.get(required_module, 'internal_var_name')\n```\n\n### mimus.set\n\nSet an internal variable.\n\nUses `rewire.__set__`.\n\n```javascript\n  mimus.set(required_module, 'internal_var_name', 'value')\n```\n\n### mimus.stub\n\nCreate a (Sinon.JS) stub.\n\n```javascript\n  var stub = mimus.stub()\n  stub.returns...\n```\n\n### mimus.spy\n\nCreate a (Sinon.JS) spy.\n\n```javascript\n  var spy = mimus.spy()\n```\n\n### mimus.reset\n\nCalls reset on every (Sinon.JS) stub/spy.\n\n```javascript\n  mimus.reset()\n```\n\n### mimus.restore\n\nCalls restore on every (Sinon.JS) stub.\n\n```javascript\n  mimus.restore()\n```\n\n## Examples\n\nSee the [system tests](test/system/example.coffee).\n\n## Contributing\n\nCurrent list of [contributors](https://github.com/brentlintner/mimus/graphs/contributors).\n\nAny contributions are welcome. Please consider tests and code quality before submitting.\n\n### Code Of Conduct\n\nSee [bantik's contributor covenant](https://github.com/Bantik/contributor_covenant/blob/master/CODE_OF_CONDUCT.md)!\n\n### Issues\n\nCurrent issue tracker is on [github](https://github.com/brentlintner/mimus/issues).\n\nPlease read any docs available before opening an issue.\n\n## Hacking\n\n    git clone git@github.com:brentlintner/mimus.git\n    cd mimus\n    npm install\n\n### Testing\n\n    npm run test\n    npm run test-cov\n\n### Code Quality\n\n    npm run lint\n    npm run lint-cov\n\n### Auto Compiling CoffeeScript\n\n    npm run dev \u0026\n\n## Architectural Notes\n\nThe top level API's main goal is to be a one method level interface with the object\nreturned via `mimus.require` being passed around by reference. This keeps api methods off\nof the main object, and also provides a more functional way to interact with mimus.\n\n## Versioning\n\nThis project ascribes to [semantic versioning](http://semver.org).\n\n## Kudos!\n\n* [Sinon](http://sinonjs.org) is currently used underneath.\n* For dependency injection, [Rewire](https://www.npmjs.org/package/rewire) is used.\n* Inspiration could not have happened with seeing [Jest](http://facebook.github.io/jest/) in action.\n\nAlso, see all other [deps](package.json).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentlintner%2Fmimus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrentlintner%2Fmimus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentlintner%2Fmimus/lists"}