{"id":31645766,"url":"https://github.com/atlassian-labs/unstoppable-mockery","last_synced_at":"2025-10-07T05:16:38.433Z","repository":{"id":315557461,"uuid":"1048116885","full_name":"atlassian-labs/unstoppable-mockery","owner":"atlassian-labs","description":"Unstoppable Mockery is a lightweight utility for creating type-safe, fully mocked classes and interfaces for Jest tests. Unlike jest.mock('\u003cmodule-path\u003e'), it allows you to mock classes and interfaces directly, with full TypeScript support and without relying on module boundaries. ","archived":false,"fork":false,"pushed_at":"2025-09-17T02:04:14.000Z","size":73,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-19T10:28:01.904Z","etag":null,"topics":["jest","mocking","mockito","testing","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atlassian-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-01T00:18:57.000Z","updated_at":"2025-09-17T20:52:11.000Z","dependencies_parsed_at":"2025-09-19T10:28:37.954Z","dependency_job_id":"5321f1db-e5b1-4c63-a2fc-9503ac5b9f34","html_url":"https://github.com/atlassian-labs/unstoppable-mockery","commit_stats":null,"previous_names":["atlassian-labs/unstoppable-mockery"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/atlassian-labs/unstoppable-mockery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian-labs%2Funstoppable-mockery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian-labs%2Funstoppable-mockery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian-labs%2Funstoppable-mockery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian-labs%2Funstoppable-mockery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atlassian-labs","download_url":"https://codeload.github.com/atlassian-labs/unstoppable-mockery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian-labs%2Funstoppable-mockery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722757,"owners_count":26034463,"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-10-07T02:00:06.786Z","response_time":59,"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":["jest","mocking","mockito","testing","unit-testing"],"created_at":"2025-10-07T05:16:15.986Z","updated_at":"2025-10-07T05:16:38.428Z","avatar_url":"https://github.com/atlassian-labs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unstoppable-mockery\n\n[![Atlassian license](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat-square)](LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](CONTRIBUTING.md)\n\nUnstoppable Mockery is a lightweight utility for creating type-safe, fully mocked classes and interfaces for Jest tests. Unlike `jest.mock('\u003cmodule-path\u003e')`, it allows you to mock classes and interfaces directly, with full TypeScript support and without relying on module boundaries. This makes your tests more maintainable, readable, and less brittle to refactoring.\n\n## Usage\n\n### Mocking Classes\n\n```typescript\nimport { mockClass } from 'unstoppable-mockery';\n\nclass MyService {\n  doSomething() { /* ... */ }\n  getValue() { return 42; }\n}\n\nconst mock = mockClass(MyService, { getValue: () =\u003e 100 });\n\n// All prototype methods are jest.fn()\nexpect(jest.isMockFunction(mock.doSomething)).toBe(true);\n\n// Overridden property\nexpect(mock.getValue()).toBe(100);\n```\n\n### Mocking Interfaces\n\n```typescript\nimport { mockInterface } from 'unstoppable-mockery';\n\ninterface ApiClient {\n  fetchData: (id: string) =\u003e Promise\u003cany\u003e;\n  isConnected: boolean;\n}\n\nconst mockApi = mockInterface\u003cApiClient\u003e({ isConnected: true });\n\n// Dynamically created jest.fn() for interface methods\nmockApi.fetchData.mockResolvedValue({ data: 'test' });\n\n// Override property is used\nexpect(mockApi.isConnected).toBe(true);\n\n// Any property access creates a mock function\nexpect(jest.isMockFunction(mockApi.fetchData)).toBe(true);\n```\n\n### Why use unstoppable-mockery instead of jest.mock?\n\n- **Type Safety:** Directly mock classes and interfaces with full TypeScript support.\n- **No Module Boundaries:** Mock any class/interface, even if not exported from a module.\n- **Refactor-Friendly:** Your tests won't break if you move or rename files/classes.\n- **Fine-Grained Control:** Override specific methods/properties easily.\n- **Cleaner Tests:** No need for manual mock implementations or resetting modules.\n\n## Installation\n\n```sh\nnpm install unstoppable-mockery --save-dev\n```\n\n## Documentation\n\nSee the source code and TSDoc comments for API details. For advanced usage, refer to the examples in the repository.\n\n## Tests\n\nTo run tests:\n\n```sh\nnpm test\n```\n\n## Contributions\n\nContributions to unstoppable-mockery are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## License\n\nCopyright (c) 2025 Atlassian US., Inc.\nApache 2.0 licensed, see [LICENSE](LICENSE) file.\n\n[![With ❤️ from Atlassian](https://raw.githubusercontent.com/atlassian-internal/oss-assets/master/banner-cheers.png)](https://www.atlassian.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassian-labs%2Funstoppable-mockery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatlassian-labs%2Funstoppable-mockery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassian-labs%2Funstoppable-mockery/lists"}