{"_id":"@atlassian/unstoppable-mockery","_rev":"2-b0400ec4890074e426a9c18d32b24f83","name":"@atlassian/unstoppable-mockery","dist-tags":{"latest":"1.2.1"},"versions":{"1.2.0":{"name":"@atlassian/unstoppable-mockery","version":"1.2.0","keywords":["jest","mock","testing","typescript","typescript-mock","typescript-mockito","mockito"],"author":{"name":"Atlassian"},"license":"Apache-2.0","_id":"@atlassian/unstoppable-mockery@1.2.0","maintainers":[{"name":"atlassianartifactteam","email":"eng-development-tooling-artifacts@atlassian.com"}],"contributors":[{"url":"https://github.com/DanielHreben","name":"Daniel Hreben","email":"dhreben@atlassian.com"},{"url":"https://github.com/Myrannas","name":"Michael Oates","email":"moates@atlassian.com"},{"name":"Samuel Zhang","email":"szhang@atlassian.com"}],"homepage":"https://github.com/atlassian-labs/unstoppable-mockery/","bugs":{"url":"https://github.com/atlassian-labs/unstoppable-mockery/issues"},"dist":{"shasum":"79731478af37adeffa69565977a9333feedaad39","tarball":"https://registry.npmjs.org/@atlassian/unstoppable-mockery/-/unstoppable-mockery-1.2.0.tgz","fileCount":19,"integrity":"sha512-AEtTPeddipB/H+3mxyVK1ncpPsP0Sy3xOtuUL2ydys3At3fDkZgBZFWw6TZehm/LC5XFGPcs4KPhyS/BTevyIw==","signatures":[{"sig":"MEUCIQCEsAKxGF9HSut615BAw0N7Tb0iMo9H53DuENUIt3GvGQIgPbNm3LBRXpkDkG83+7kUS5K6N6zPkW9kdgrNxU5RgDc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25769},"main":"dist/index.js","_from":"file:/tmp/package-1-69de1858-6623dc5fbe76f1475da5b254-1.tgz","types":"dist/index.d.ts","private":false,"scripts":{"lint":"eslint ./src --config eslint.config.mts --ext .ts","test":"jest --config jest.config.json","build":"tsc --project tsconfig.json","release":"yarn build && changeset publish"},"_npmUser":{"name":"atlassianartifactteam","email":"eng-development-tooling-artifacts@atlassian.com"},"_resolved":"/tmp/package-1-69de1858-6623dc5fbe76f1475da5b254-1.tgz","_integrity":"sha512-AEtTPeddipB/H+3mxyVK1ncpPsP0Sy3xOtuUL2ydys3At3fDkZgBZFWw6TZehm/LC5XFGPcs4KPhyS/BTevyIw==","repository":{"url":"git+ssh://git@github.com/atlassian-labs/unstoppable-mockery.git","type":"git"},"_npmVersion":"10.8.2","description":"Lightweight utility for creating type-safe, fully mocked classes and interfaces for Jest tests","directories":{},"_nodeVersion":"20.20.0","dependencies":{"type-fest":"^5.0.1"},"enginesStrict":{"node":">=20.0.0"},"publishConfig":{"access":"public","registry":"https://packages.atlassian.com/api/npm/npm-public/"},"_hasShrinkwrap":false,"packageManager":"yarn@1.22.22","devDependencies":{"jest":"^30.0.5","jiti":"^2.5.1","eslint":"^9.32.0","ts-jest":"^29.4.1","prettier":"^3.6.2","typescript":"^5.9.2","@types/jest":"^30.0.0","@changesets/cli":"^2.30.0","typescript-eslint":"^8.39.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-simple-import-sort":"^12.1.1"},"_npmOperationalInternal":{"tmp":"tmp/unstoppable-mockery_1.2.0_1776162907215_0.7410482308777107","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@atlassian/unstoppable-mockery","version":"1.2.1","main":"dist/index.js","types":"dist/index.d.ts","license":"Apache-2.0","description":"Lightweight utility for creating type-safe, fully mocked classes and interfaces for Jest tests","author":{"name":"Atlassian"},"keywords":["jest","mock","testing","typescript","typescript-mock","typescript-mockito","mockito"],"private":false,"publishConfig":{"registry":"https://packages.atlassian.com/api/npm/npm-public/","access":"public"},"contributors":[{"name":"Daniel Hreben","email":"dhreben@atlassian.com","url":"https://github.com/DanielHreben"},{"name":"Michael Oates","email":"moates@atlassian.com","url":"https://github.com/Myrannas"},{"name":"Samuel Zhang","email":"szhang@atlassian.com"}],"repository":{"type":"git","url":"git+ssh://git@github.com/atlassian-labs/unstoppable-mockery.git"},"homepage":"https://github.com/atlassian-labs/unstoppable-mockery/","scripts":{"release":"yarn build && changeset publish","test":"jest --config jest.config.json","build":"tsc --project tsconfig.json","lint":"eslint ./src --config eslint.config.mts --ext .ts"},"packageManager":"yarn@1.22.22","enginesStrict":{"node":">=20.0.0"},"devDependencies":{"@changesets/cli":"^2.30.0","@types/jest":"^30.0.0","eslint":"^9.32.0","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4","eslint-plugin-simple-import-sort":"^12.1.1","jest":"^30.0.5","jiti":"^2.5.1","prettier":"^3.6.2","ts-jest":"^29.4.1","typescript":"^5.9.2","typescript-eslint":"^8.39.0"},"dependencies":{"type-fest":"^5.0.1"},"_id":"@atlassian/unstoppable-mockery@1.2.1","bugs":{"url":"https://github.com/atlassian-labs/unstoppable-mockery/issues"},"_integrity":"sha512-R4r1gD9Z8gw9LIQv6/GvAoMJu0WrVz7couRmxCbC5rXhRuq1ZEO6yMHoRCxepRmo0xtzKZTeDmowD/UkAG38+A==","_resolved":"/tmp/package-1-69de1cb2-c262d2eb40730a1f38c24f0f-1.tgz","_from":"file:/tmp/package-1-69de1cb2-c262d2eb40730a1f38c24f0f-1.tgz","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-R4r1gD9Z8gw9LIQv6/GvAoMJu0WrVz7couRmxCbC5rXhRuq1ZEO6yMHoRCxepRmo0xtzKZTeDmowD/UkAG38+A==","shasum":"835f56242dfd41d10cf28f6f344b3568c4db6d2e","tarball":"https://registry.npmjs.org/@atlassian/unstoppable-mockery/-/unstoppable-mockery-1.2.1.tgz","fileCount":19,"unpackedSize":25769,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCLkNli54/vHzdKxZ5lSQBRSsewLCSWyvB7QSFiCo9HgAIgb0oLHCEJTJID/wd6a8BegBOEQrWG3VYieGJnYTerAbU="}]},"_npmUser":{"name":"atlassianartifactteam","email":"eng-development-tooling-artifacts@atlassian.com"},"directories":{},"maintainers":[{"name":"atlassianartifactteam","email":"eng-development-tooling-artifacts@atlassian.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/unstoppable-mockery_1.2.1_1776164021481_0.6623511083114346"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-14T10:35:07.138Z","modified":"2026-04-14T10:53:41.723Z","1.2.0":"2026-04-14T10:35:07.383Z","1.2.1":"2026-04-14T10:53:41.611Z"},"bugs":{"url":"https://github.com/atlassian-labs/unstoppable-mockery/issues"},"author":{"name":"Atlassian"},"license":"Apache-2.0","homepage":"https://github.com/atlassian-labs/unstoppable-mockery/","keywords":["jest","mock","testing","typescript","typescript-mock","typescript-mockito","mockito"],"repository":{"type":"git","url":"git+ssh://git@github.com/atlassian-labs/unstoppable-mockery.git"},"description":"Lightweight utility for creating type-safe, fully mocked classes and interfaces for Jest tests","contributors":[{"name":"Daniel Hreben","email":"dhreben@atlassian.com","url":"https://github.com/DanielHreben"},{"name":"Michael Oates","email":"moates@atlassian.com","url":"https://github.com/Myrannas"},{"name":"Samuel Zhang","email":"szhang@atlassian.com"}],"maintainers":[{"name":"atlassianartifactteam","email":"eng-development-tooling-artifacts@atlassian.com"}],"readme":"# @atlassian/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('<module-path>')`, 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 '@atlassian/unstoppable-mockery';\n\nclass MyService {\n  doSomething() { /* ... */ }\n  getValue() { return 42; }\n}\n\nconst mock = mockClass(MyService, { getValue: () => 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 '@atlassian/unstoppable-mockery';\n\ninterface ApiClient {\n  fetchData: (id: string) => Promise<any>;\n  isConnected: boolean;\n}\n\nconst mockApi = mockInterface<ApiClient>({ 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 @atlassian/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## Releasing\n\nReleases are published to [Artifactory npm-public](https://packages.atlassian.com/api/npm/npm-public/) and forwarded to npmjs.org using [Changesets](https://github.com/changesets/changesets).\n\n### How to release\n\n1. In your PR branch, run `yarn changeset` and follow the prompts to describe your changes and select a version bump type (patch/minor/major). This creates a changeset file — commit it with your PR.\n2. Merge your PR to `main`.\n3. The [Release workflow](.github/workflows/release.yml) will automatically open a **\"Version Packages\" PR** that bumps the version and updates the CHANGELOG.\n4. Review and merge the \"Version Packages\" PR — the workflow will then publish the new version to Artifactory automatically.\n\n> **Note:** Publishing uses [`atlassian-labs/artifact-publish-token`](https://github.com/atlassian-labs/artifact-publish-token) for authentication — no manual npm credentials are required.\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","readmeFilename":"README.md"}