{"id":16487607,"url":"https://github.com/saeris/valimock","last_synced_at":"2025-08-01T22:33:07.859Z","repository":{"id":200596058,"uuid":"705959075","full_name":"Saeris/valimock","owner":"Saeris","description":"🃏 Generate mock data for Valibot schemas using Faker","archived":false,"fork":false,"pushed_at":"2024-05-01T14:11:19.000Z","size":3750,"stargazers_count":25,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-01T08:33:49.633Z","etag":null,"topics":["faker","mocking-library","testing","valibot"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/valimock","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/Saeris.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["saeris"]}},"created_at":"2023-10-17T03:17:16.000Z","updated_at":"2024-11-04T08:05:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"edae18e2-2be0-40f6-a72c-fabeea05bfac","html_url":"https://github.com/Saeris/valimock","commit_stats":null,"previous_names":["saeris/valimock"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saeris%2Fvalimock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saeris%2Fvalimock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saeris%2Fvalimock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Saeris%2Fvalimock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Saeris","download_url":"https://codeload.github.com/Saeris/valimock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228413945,"owners_count":17915919,"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":["faker","mocking-library","testing","valibot"],"created_at":"2024-10-11T13:35:24.460Z","updated_at":"2025-08-01T22:33:07.842Z","avatar_url":"https://github.com/Saeris.png","language":"TypeScript","funding_links":["https://github.com/sponsors/saeris"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 🃏 Valimock\n\n[![npm version][npm_badge]][npm]\n[![CI status][ci_badge]][ci]\n\nGenerate mock data for [Valibot][valibot] schemas using [Faker][faker]\n\n\u003c/div\u003e\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install --save-dev valimock @faker-js/faker\n```\n\n```bash\nyarn add -D valimock @faker-js/faker\n```\n\n## 🔧 Usage\n\nImport and optionally configure a new instance of the `Valimock` class, then pass along your `valibot` schema to `mock()`, that's it!\n\n```ts\nimport { parse, array, union, string, pipe, url, number, maxValue } from \"valibot\";\nimport { Valimock } from \"valimock\";\n\ndescribe(`example test`, () =\u003e {\n  it(`should generate valid mock data`, () =\u003e {\n    const schema = array(union([pipe(string(), url()), pipe(number(), maxValue(20))]));\n    const result = new Valimock().mock(schema);\n    expect(parse(schema, result)).toStrictEqual(result);\n  });\n});\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e For async schemas, you will need to use `parseAsync()`. Be aware that async schemas generate a `Promise` and may need to be `await`'ed depending on usage.\n\u003e\n\u003e Please see the [`__tests__`][tests] folder for more usage examples of different schema types.\n\n## API Coverage\n\n\u003e [!WARNING]\n\u003e\n\u003e At present, not all of `valibot`'s API is fully covered by `valimock`, however, any unimplemented schema type can be handled by a user-supplied map via the `customMocks` configuration option. The schema's `type` proerty is used as the property key for this map.\n\n|            | Implemented | Incomplete | Not Implemented | Unsupported |\n| ---------- | :---------: | :--------: | :-------------: | :---------: |\n| **Symbol** |     ✔      |     ⚠     |       ❌        |     ➖      |\n\n### Schemas\n\n|      Any       |      Array      |    Bigint     |     Blob      |   Boolean   |    Date     |      Enum       |\n| :------------: | :-------------: | :-----------: | :-----------: | :---------: | :---------: | :-------------: |\n|       ❌       |       ✔        |      ✔       |      ➖       |     ✔      |     ⚠      |       ✔        |\n|  **Instance**  |  **Intersect**  |  **Literal**  |    **Map**    |   **NaN**   |  **Never**  | **NonNullable** |\n|       ➖       |       ✔        |      ✔       |      ✔       |     ✔      |     ❌      |       ✔        |\n| **NonNullish** | **NonOptional** |   **Null**    | **Nullable**  | **Nullish** | **Number**  |   **Object**    |\n|       ✔       |       ✔        |      ✔       |      ✔       |     ✔      |     ⚠      |       ✔        |\n|  **Optional**  |  **Picklist**   |  **Record**   | **Recursive** |   **Set**   | **Special** |   **String**    |\n|       ✔       |       ✔        |      ✔       |      ✔       |     ✔      |     ➖      |       ⚠        |\n|   **Symbol**   |    **Tuple**    | **Undefined** |   **Union**   | **Unknown** | **Variant** |    **Void**     |\n|       ➖       |       ✔        |      ✔       |      ✔       |     ❌      |     ❌      |       ❌        |\n\n### Validations\n\nBelow is an incomplete list of supported validations for the given schemas.\n\n#### Array\n\n|     check     |    checkItems    |     empty     |   everyItem   |   excludes   |\n| :-----------: | :--------------: | :-----------: | :-----------: | :----------: |\n|      ❌       |        ❌        |      ✔       |      ❌       |      ❌      |\n| **includes**  |    **length**    | **maxLength** | **minLength** | **nonEmpty** |\n|      ❌       |        ✔        |      ✔       |      ✔       |      ✔      |\n| **notLength** | **partialCheck** | **rawCheck**  | **someItem**  |\n|      ❌       |        ❌        |      ❌       |      ❌       |\n\n#### BigInt\n\n|     check      |   gtValue    |    ltValue    |   maxValue   | minValue  |\n| :------------: | :----------: | :-----------: | :----------: | :-------: |\n|       ❌       |      ❌      |      ❌       |      ✔      |    ✔     |\n| **multipleOf** | **notValue** | **notValues** | **rawCheck** | **value** |\n|       ❌       |      ❌      |      ❌       |      ❌      |    ✔     |\n|   **values**   |\n|       ❌       |\n\n#### Date\n\n|    check     |    gtValue    |   ltValue    | maxValue  |  minValue  |\n| :----------: | :-----------: | :----------: | :-------: | :--------: |\n|      ❌      |      ❌       |      ❌      |    ✔     |     ✔     |\n| **notValue** | **notValues** | **rawCheck** | **value** | **values** |\n|      ❌      |      ❌       |      ❌      |    ✔     |     ❌     |\n\n#### Number\n\n|    check     |     finite      |    gtValue     |   integer    |    ltValue    |\n| :----------: | :-------------: | :------------: | :----------: | :-----------: |\n|      ❌      |       ❌        |       ❌       |      ✔      |      ❌       |\n| **maxValue** |  **minValue**   | **multipleOf** | **notValue** | **notValues** |\n|      ✔      |       ✔        |       ❌       |      ❌      |      ❌       |\n| **rawCheck** | **safeInteger** |   **value**    |  **values**  |\n|      ❌      |       ❌        |       ✔       |      ❌      |\n\n#### String\n\n|      base64      |        bic        |      bytes       |    creditCard    |      cuid2      |\n| :--------------: | :---------------: | :--------------: | :--------------: | :-------------: |\n|        ✔        |        ✔         |        ❌        |        ✔        |       ✔        |\n|      check       |      decimal      |    **digits**    |    **email**     |    **emoji**    |\n|        ❌        |        ✔         |        ✔        |        ✔        |       ✔        |\n|    **empty**     |   **endsWith**    |   **excludes**   |  **graphemes**   |   **gtValue**   |\n|        ✔        |        ❌         |        ❌        |        ❌        |       ❌        |\n|     **hash**     |  **hexadecimal**  |   **hexColor**   |     **imei**     |  **includes**   |\n|        ❌        |        ✔         |        ✔        |        ✔        |       ❌        |\n|      **ip**      |     **ipv4**      |     **ipv6**     |   **isoDate**    | **isoDateTime** |\n|        ✔        |        ✔         |        ✔        |        ✔        |       ✔        |\n|   **isoTime**    | **isoTimeSecond** | **isoTimestamp** |   **isoWeek**    |   **length**    |\n|        ✔        |        ✔         |        ✔        |        ❌        |       ✔        |\n|   **ltValue**    |      **mac**      |    **mac48**     |    **mac64**     |  **maxBytes**   |\n|        ❌        |        ✔         |        ❌        |        ❌        |       ❌        |\n| **maxGraphemes** |   **maxLength**   |   **maxValue**   |   **maxWords**   |  **minBytes**   |\n|        ❌        |        ✔         |        ❌        |        ❌        |       ❌        |\n| **minGraphemes** |   **minLength**   |   **minValue**   |   **minWords**   |   **nanoid**    |\n|        ❌        |        ✔         |        ❌        |        ❌        |       ✔        |\n|   **nonEmpty**   |   **notBytes**    |  **notEntries**  | **notGraphemes** |  **notLength**  |\n|        ✔        |        ❌         |        ❌        |        ❌        |       ❌        |\n|   **notValue**   |   **notValues**   |   **notWords**   |    **octal**     |  **rawCheck**   |\n|        ❌        |        ❌         |        ❌        |        ✔        |       ❌        |\n|    **regex**     |   **rfcEmail**    |     **slug**     |  **startsWith**  |    **ulid**     |\n|        ✔        |        ❌         |        ❌        |        ❌        |       ✔        |\n|     **url**      |     **uuid**      |    **value**     |    **values**    |    **words**    |\n|        ✔        |        ✔         |        ❌        |        ❌        |       ❌        |\n\n## 📣 Acknowledgements\n\nValimock's implementation is based on [`@anatine/zod-mock`][zod-mock]\n\n## 🥂 License\n\nReleased under the [MIT license][license] © [Drake Costa][personal-website].\n\n[npm_badge]: https://img.shields.io/npm/v/valimock.svg?style=flat\n[npm]: https://www.npmjs.com/package/valimock\n[ci_badge]: https://github.com/saeris/valimock/actions/workflows/ci.yml/badge.svg\n[ci]: https://github.com/saeris/valimock/actions/workflows/ci.yml\n[valibot]: https://github.com/fabian-hiller/valibot\n[faker]: https://github.com/faker-js/faker\n[tests]: ./src/__tests__/\n[zod-mock]: https://github.com/anatine/zod-plugins/tree/main/packages/zod-mock\n[license]: ./LICENSE.md\n[personal-website]: https://saeris.gg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaeris%2Fvalimock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaeris%2Fvalimock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaeris%2Fvalimock/lists"}