{"id":28089524,"url":"https://github.com/typescript-tdd/jasmine-ts-auto-mock","last_synced_at":"2025-07-30T05:06:13.087Z","repository":{"id":36338875,"uuid":"165530172","full_name":"Typescript-TDD/jasmine-ts-auto-mock","owner":"Typescript-TDD","description":"Jasmine test utility with automatic mock creation for interfaces and classes","archived":false,"fork":false,"pushed_at":"2023-01-07T12:13:57.000Z","size":2823,"stargazers_count":9,"open_issues_count":53,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T14:44:48.081Z","etag":null,"topics":["fake","jasmine","mock","mock-interface","mock-typescript","testing","typescript-transformer"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Typescript-TDD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-13T16:51:27.000Z","updated_at":"2021-04-12T07:10:05.000Z","dependencies_parsed_at":"2023-01-17T00:36:39.162Z","dependency_job_id":null,"html_url":"https://github.com/Typescript-TDD/jasmine-ts-auto-mock","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/Typescript-TDD%2Fjasmine-ts-auto-mock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Typescript-TDD%2Fjasmine-ts-auto-mock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Typescript-TDD%2Fjasmine-ts-auto-mock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Typescript-TDD%2Fjasmine-ts-auto-mock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Typescript-TDD","download_url":"https://codeload.github.com/Typescript-TDD/jasmine-ts-auto-mock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948407,"owners_count":21988953,"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":["fake","jasmine","mock","mock-interface","mock-typescript","testing","typescript-transformer"],"created_at":"2025-05-13T12:59:32.191Z","updated_at":"2025-05-13T12:59:32.839Z","avatar_url":"https://github.com/Typescript-TDD.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jasmine Ts Auto Mock\n\n[![Actions Status](https://github.com/Typescript-TDD/jasmine-ts-auto-mock/workflows/Master/badge.svg)](https://github.com/Typescript-TDD/jasmine-ts-auto-mock/actions) \n\nThis is a library that extend [ts-auto-mock](https://github.com/uittorio/ts-auto-mock) to be used with jasmine\n\nThe intention of the library is to automatically assign spies to mocks giving you type safety\n\n## Requirements\n`\ntypescript@^3.2.2\n`\n\n## Installation\n\n- A Transformer needs to be provided at compile time. There are different ways to do it.\n[Please read the following guide to find your configuration](https://github.com/Typescript-TDD/ts-auto-mock/blob/master/docs/TRANSFORMER.md)\n\n- provide jasmine-ts-auto-mock before your test\n[Please read the following guide to find your configuration](docs/CONFIG.md)\n\n## Examples\n- [jasmine-karma-webpack](examples/karma-webpack)\n- [angular-cli-tspatch](examples/angular-cli-tspatch)\n\nIf you are using angular with typescript 3.7 you need to follow the solution in this issue:\n\nhttps://github.com/angular/angular-cli/issues/16071\n\nAdd this in the polyfill until angular support typescript 3.7\n```ts\n// @ts-ignore\nwindow.__importDefault = function(mod) {\n    return mod \u0026\u0026 mod.__esModule ? mod : { default: mod };\n};\n```\n\n\n## Usage\n1) create an interface\n```ts\ninterface Interface {\n    methodToMock: () =\u003e string\n}\n```\n2) create a mock\n```ts\nconst mock: Interface = createMock\u003cInterface\u003e();\n```\n3) get the method mock \n\nYou can get the method spy in 2 different ways\n\nThrough method\n```ts\nimport { On, method } from \"ts-auto-mock/extension\";\nconst mockMethod: jasmine.Spy = On(mock).get(method(mock =\u003e mock.methodToMock));\n```\n\nThrough string\n```ts\nimport { On, method } from \"ts-auto-mock/extension\";\nconst mockMethod: jasmine.Spy = On(mock).get(method('methodToMock'));\n```\n\n4) trigger the method\n```ts\nsomeMethodThatWillTriggerInterfacemethodToMock();\nexpect(mockMethod).toHaveBeenCalled();\n```\n\n## Authors\n\n* [**Vittorio Guerriero**](https://github.com/uittorio)\n* [**Giulio Caprino**](https://github.com/pmyl)\n\n## License\n\nThis project is licensed under the MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescript-tdd%2Fjasmine-ts-auto-mock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypescript-tdd%2Fjasmine-ts-auto-mock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescript-tdd%2Fjasmine-ts-auto-mock/lists"}