{"id":15023066,"url":"https://github.com/vdsabev/sneer","last_synced_at":"2025-10-25T13:30:46.798Z","repository":{"id":57364701,"uuid":"126030064","full_name":"vdsabev/sneer","owner":"vdsabev","description":"Type-safe mocking utilities for reliable unit tests","archived":false,"fork":false,"pushed_at":"2019-03-14T14:29:33.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T06:03:19.164Z","etag":null,"topics":["mocking","testing","typescript","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vdsabev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-20T14:26:26.000Z","updated_at":"2020-07-29T18:27:18.000Z","dependencies_parsed_at":"2022-09-13T21:01:11.941Z","dependency_job_id":null,"html_url":"https://github.com/vdsabev/sneer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdsabev%2Fsneer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdsabev%2Fsneer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdsabev%2Fsneer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdsabev%2Fsneer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vdsabev","download_url":"https://codeload.github.com/vdsabev/sneer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238147540,"owners_count":19424276,"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":["mocking","testing","typescript","unit-testing"],"created_at":"2024-09-24T19:58:41.918Z","updated_at":"2025-10-25T13:30:46.471Z","avatar_url":"https://github.com/vdsabev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![downloads][downloads-badge]][npmcharts]\n[![version][version-badge]][package]\n[![MIT License][license-badge]][license]\n\n\u003ch1 align=\"center\"\u003e\n  Sneer 😏\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003eType-safe mocking utilities\u003c/p\u003e\n\n## Why?\nYou want to write test mocks in TypeScript while preserving type safety and getting meaningful type errors.\n\n## Installation\n```\nnpm install sneer -D\n```\n\n## Usage\n```ts\nimport {\n  mockPartial,\n  mockPartialArray,\n  mockRecursivePartial,\n  mockRecursivePartialArray,\n} from 'sneer';\n```\n\n### `mockPartial`\n### `mockPartialArray`\nCasts an object (or array of objects) to a type `T` while only requiring a partial implementation of the type to be passed. This allows us to easily mock an object while writing tests without having to define all of the properties of an object.\n\nExample:\n```ts\nconst store = mockPartial\u003cStore\u003cState\u003e\u003e({\n  select: jest.fn((selector: (state: State) =\u003e any) =\u003e Observable.of(selector(state))),\n});\n```\n\n### `mockRecursivePartial`\n### `mockRecursivePartialArray`\nSame as `mockPartial` and `mockPartialArray`, but recursively partial 🙃\n\nExample:\n```ts\nconst svg = mockRecursivePartial\u003cSVGSVGElement\u003e({\n  x: {\n    baseVal: { value: 1 }\n  }\n});\n```\n\n[version-badge]: https://img.shields.io/npm/v/sneer.svg?style=flat-square\n[package]: https://www.npmjs.com/package/sneer\n[downloads-badge]: https://img.shields.io/npm/dm/sneer.svg?style=flat-square\n[npmcharts]: https://npmcharts.com/compare/sneer\n[license-badge]: https://img.shields.io/npm/l/sneer.svg?style=flat-square\n[license]: https://github.com/vdsabev/sneer/blob/master/LICENSE.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdsabev%2Fsneer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdsabev%2Fsneer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdsabev%2Fsneer/lists"}