{"id":20473527,"url":"https://github.com/xpl/chai-spies-decorators","last_synced_at":"2025-09-10T00:41:39.636Z","repository":{"id":57196633,"uuid":"65968999","full_name":"xpl/chai-spies-decorators","owner":"xpl","description":"Chai Spies + ES7 decorators","archived":false,"fork":false,"pushed_at":"2017-05-26T10:12:03.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-14T05:03:26.625Z","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":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xpl.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":"2016-08-18T05:52:25.000Z","updated_at":"2017-07-19T16:47:44.000Z","dependencies_parsed_at":"2022-09-01T06:02:18.698Z","dependency_job_id":null,"html_url":"https://github.com/xpl/chai-spies-decorators","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xpl/chai-spies-decorators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpl%2Fchai-spies-decorators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpl%2Fchai-spies-decorators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpl%2Fchai-spies-decorators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpl%2Fchai-spies-decorators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xpl","download_url":"https://codeload.github.com/xpl/chai-spies-decorators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpl%2Fchai-spies-decorators/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259763076,"owners_count":22907407,"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":[],"created_at":"2024-11-15T14:25:45.116Z","updated_at":"2025-06-14T05:04:36.280Z","avatar_url":"https://github.com/xpl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chai-spies-decorators\n\n```bash\nnpm install chai-spies-decorators\n```\n\nProvides ES7 decorators interface for [`chai-spies`](https://github.com/chaijs/chai-spies), allowing to set execution contracts on class methods in a nice declarative way. Requires [Mocha](https://mochajs.org/).\n\n```javascript\nimport 'chai-spies-decorators'\n\ndescribe ('example', () =\u003e {\n\n\tit ('works', () =\u003e {\n\n\t\tconst foo = new (class Foo {\n\n\t\t\t@will.have.been.called.with (42).once\n\t\t\tbar () { }\n\n\t\t\t@will.have.been.called.twice\n\t\t\tzap () { }\n\t\t})\n\n\t\tfoo.bar (42)\n\t\tfoo.zap (); foo.zap ()\n\t})\n\n})\n```\n\n## How it works\n\nI've written an article on Medium explaining it: [Wiring ES7 decorators to Chai Spies for declarative contracts on class methods: A metaprogramming case study](https://medium.com/@xpl/wiring-es7-decorators-to-chai-spies-for-declarative-contracts-on-class-methods-957d6a8c27e9#.30sh22os4).\n\n## Warning\n\nIt is not very well tested with asynchronous tests. Should work with Promises, but not with `done` callback (not implemented).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpl%2Fchai-spies-decorators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpl%2Fchai-spies-decorators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpl%2Fchai-spies-decorators/lists"}