{"id":13599991,"url":"https://github.com/google/intermock","last_synced_at":"2025-05-14T23:04:41.368Z","repository":{"id":37693150,"uuid":"165928879","full_name":"google/intermock","owner":"google","description":"Mocking library to create mock objects with fake data for TypeScript interfaces","archived":false,"fork":false,"pushed_at":"2024-06-10T23:18:41.000Z","size":4124,"stargazers_count":1153,"open_issues_count":48,"forks_count":71,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-11T11:39:01.581Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://google.github.io/intermock/","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/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2019-01-15T21:49:16.000Z","updated_at":"2025-05-03T08:23:28.000Z","dependencies_parsed_at":"2024-01-07T21:06:58.719Z","dependency_job_id":"a2d4d454-dd32-40b6-85ac-a237e8f14875","html_url":"https://github.com/google/intermock","commit_stats":{"total_commits":198,"total_committers":12,"mean_commits":16.5,"dds":"0.19191919191919193","last_synced_commit":"d57fa4b07d0b1b333f2716d039418aa60f467589"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fintermock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fintermock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fintermock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fintermock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/intermock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254243358,"owners_count":22038046,"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-08-01T17:01:23.698Z","updated_at":"2025-05-14T23:04:36.355Z","avatar_url":"https://github.com/google.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# intermock [![Build Status](https://api.travis-ci.org/google/intermock.svg?branch=master)](https://travis-ci.org/google/intermock)\nMocking library to create mock objects and JSON for TypeScript interfaces via Faker.\n\n**This is not an officially supported Google product.**\n\n## Installation\n```\nnpm install intermock\n```\n\n## CLI\nIntermock exposes a CLI, **which is the recommended way to use the tool**. The following subsections show an example file, command, and output to demonstrate using the CLI.\n\n### Example file\n```typescript\ninterface Admin extends User {\n   adminRecord: AdminRecord;\n}\n\ninterface Student extends User {\n   schoolRecord: SchoolRecord;\n}\n\ninterface User {\n   firstName: string;\n   lastName: string;\n   username: string;\n   emailAddress: string;\n}\n\ninterface AdminRecord {\n   studentsPassedEachYear: number[];\n}\n\ninterface SchoolRecord {\n   startDate: string;\n   endDate: string;\n   isActive: boolean;\n   grades: number[];\n}\n```\n\n### Example command\n```bash\nnode ./node_modules/intermock/build/src/cli/index.js --files ./example-file.ts --interfaces \"Admin\"\n```\n\n### Example output\n```json\n{\n  \"Admin\": {\n    \"firstName\": \"Willa\",\n    \"lastName\": \"Walker\",\n    \"username\": \"Shyann_Mante\",\n    \"emailAddress\": \"Cristobal_Rutherford73@gmail.com\",\n    \"adminRecord\": {\n      \"studentsPassedEachYear\": [\n        80342,\n        23404,\n        12854,\n        74937,\n        38185,\n        73316\n      ]\n    }\n  },\n```\n\n## API Usage\nIntermock’s API exports only one function, as seen below:\n\n### Function\n```typescript\n// Returns an object or string based on `output` property specified in `Options`\nmock(options: Options): object|string\n```\n\n### Options\n```typescript\nexport interface Options {\n // Array of file tuples. (filename, data)\n files?: Array\u003c[string, string]\u003e;\n\n // TypeScript is currently the only supported language\n language?: SupportedLanguage;\n\n // Specific interfaces to write to output\n interfaces?: string[];\n\n // Used for testing mode,\n isFixedMode?: boolean;\n\n // One of object|json|string. Strings have their object's functions\n // stringified.\n output?: OutputType;\n\n // Should optional properties always be enabled\n isOptionalAlwaysEnabled?: boolean;\n}\n```\n\n## Type Support\nThe following TypeScript features are supported:\n- Interfaces\n- Interfaces with properties of primitive types\n- Interfaces with property references to other complex types\n- Interfaces with extensions\n- Unions\n- Type aliases\n- Arrays\n- Namespaces\n- Tuples\n- Mapped types\n- Generics\n- Functions (stringified output!)\n- Optional properties\n- Type imports\n- Specific [Faker](https://github.com/marak/Faker.js/#api-methods) data types (via JSDoc comment)\n  ```ts\n  interface Host {\n    /** @mockType {internet.ipv6} */\n    addr: string;\n  }\n  ```\n\n\n## Building\n`npm run build`\n\n## Development\nIf you want to run the build script and tests after you save a file while developing,\nrun the following command:\n`npm run test-watch`\n\n## Docs\n### Developing Docs\nTo develop documentation run the following commands:\n```\nnpm run build\nnpm run docs-serve\n```\n\nEdit the files in `docs/` and Webpack's Dev Server should auto-reload when there are changes\n\n### Statically Building Docs\nTo build the docs statically run the following command:\n```\nnpm run build\nnpm run docs-build\n```\n\n## Contributing\n1. Read **all** of `CONTRIBUTING.md` in this repo\n1. Sign the CLA\n1. In a terminal, run `npm run ci`\n1. Fix any linting, formatting, and/or compiling errors. (Note: Format errors can be fixed by `npm run format`. DO NOT fix linting errors by disabling the linter on a line and/or block)\n1. Create a Pull Request\n1. Address all comments, if any\n1. If everything looks good after comments are addressed, your PR will be merged!\n\n## License\nSee `LICENSE` in this repo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fintermock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fintermock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fintermock/lists"}