{"id":21948722,"url":"https://github.com/nemtsov/sinon-lazy-stub","last_synced_at":"2026-05-17T15:08:00.461Z","repository":{"id":17569679,"uuid":"20373084","full_name":"nemtsov/sinon-lazy-stub","owner":"nemtsov","description":"Sinon.JS lazy (and efficient) stub creator","archived":false,"fork":false,"pushed_at":"2014-07-11T03:01:25.000Z","size":136,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-03T23:27:16.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"CyanogenMod/android_device_lge_ms910","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nemtsov.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-06-01T07:48:29.000Z","updated_at":"2019-09-25T18:43:47.000Z","dependencies_parsed_at":"2022-08-31T02:50:40.823Z","dependency_job_id":null,"html_url":"https://github.com/nemtsov/sinon-lazy-stub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nemtsov/sinon-lazy-stub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fsinon-lazy-stub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fsinon-lazy-stub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fsinon-lazy-stub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fsinon-lazy-stub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nemtsov","download_url":"https://codeload.github.com/nemtsov/sinon-lazy-stub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nemtsov%2Fsinon-lazy-stub/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267552097,"owners_count":24106000,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-29T05:17:28.513Z","updated_at":"2025-10-15T01:26:00.310Z","avatar_url":"https://github.com/nemtsov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sinon.js lazy stub\n\nWhen using `sinon` you sometimes need to stub an object that has many\nmethods. This can be taxing on performance, especially if you\nre-create the stub before every test (for a clean test).\n\nThis module solves this problem by lazily creating the stubs of the\nmethods of an object, only when they're used.\n\n\n## Usage\n\n**Simple:**\n```javascript\nvar lazyStub = require('sinon-lazy-stub');\n  api = {get: function () {}},\n  createStub = lazyStub(api),\n  stubA, stubB;\n\nstubA = createStub();\nstubB = createStub();\n\nstubA.get.returns(7);\nassert.equal(stub.get())\n```\n\n**Recommended:**\n```javascript\n// api-test.js\nvar stubs = require('./my_stubs');\n\ndescribe('API', function () {\n  var api;\n\n  beforeEach(function () {\n    api = stubs.api();\n  });\n\n  it('should be great', function () {\n    //...\n  });\n});\n\n// my_stubs.js\nvar lazyStub = require('sinon-lazy-stub'),\n  api = require('...');\n\nmodule.exports = {\n  api: lazyStub(api)\n};\n```\n\nAs you see in the case above, I recommend creating a separate\nfile in your project with the stubs. That way they're all in\na single known place.\n\n\n## License\n\nMIT. See LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemtsov%2Fsinon-lazy-stub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnemtsov%2Fsinon-lazy-stub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnemtsov%2Fsinon-lazy-stub/lists"}