{"id":26092093,"url":"https://github.com/placdev/fixture-lite","last_synced_at":"2025-04-12T07:11:30.364Z","repository":{"id":271558973,"uuid":"913542020","full_name":"placDev/fixture-lite","owner":"placDev","description":"fixturies-manager","archived":false,"fork":false,"pushed_at":"2025-02-02T08:52:43.000Z","size":210,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T02:23:06.715Z","etag":null,"topics":[],"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/placDev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-07T22:13:52.000Z","updated_at":"2025-02-02T08:52:47.000Z","dependencies_parsed_at":"2025-01-08T15:32:36.812Z","dependency_job_id":null,"html_url":"https://github.com/placDev/fixture-lite","commit_stats":null,"previous_names":["placdev/fixturies-manager","placdev/fixtures-manager","placdev/fixture-manager"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placDev%2Ffixture-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placDev%2Ffixture-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placDev%2Ffixture-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/placDev%2Ffixture-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/placDev","download_url":"https://codeload.github.com/placDev/fixture-lite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248530575,"owners_count":21119600,"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":"2025-03-09T10:41:48.253Z","updated_at":"2025-04-12T07:11:30.324Z","avatar_url":"https://github.com/placDev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fixture-lite \u003c!-- omit in toc --\u003e\n\n**fixture-lite** A lightweight, flexible and powerful tool that allows you to conveniently create the data needed for unit, integration and e2e tests.  \nThe library can work without using any ORMs by creating objects of specified prototypes. If necessary, you can use the ready-made integration with **TypeORM**.\n\n# Documentation \u003c!-- omit in toc --\u003e\n\n- [Installation](#installation)\n- [Simple using](#simple-using)\n- [Glossary](#glossary)\n- [Factories](#factories)\n- [Generator](#generator)\n- [Transform](#transform)\n- [Use without a database](#without-database)\n- [Use with TypeORM](#simple-using)\n- [Examples](#examples)\n\n# Installation\n\nInstall `fixture-lite`:\n\n```sh\nnpm i fixture-lite\n```\n\n# Simple using\n1) Setting up the factory assembly in the project.\n\nAt the very beginning, we need to configure the factory function manager, with which the library will be able to assemble all the factories in your project for future use.\n```ts\n// setup-files/setup-factories.ts\nFixtureManager.factories.load({\n    srcPath: path.join(__dirname, '..', '..', 'src'),\n    filePrefix: '.factory.ts'\n})\n```\nThis code must be executed before running all tests, for example in the files specified in the **setupFiles** (if you use **Jest**).  \nYou can skip this step and register factories right before running the tests (for example in **beforeEach**)\n\nNote that using **load**, the library builds factories for the entire project, rather than a specific module, so you don't have to call it several times before running tests.\n\n2) Create a factory\n\nNow we need to create a file that will store a factory with which **fixture-lite** will create instances of the class you need in the tests in the future.\n```ts\n// ../../src/module/tests/factories/user.factory.ts\nFixtureManager.factories.add(UserEntity, async (faker, generator) =\u003e {\n    return {\n        id: uuid(),\n        name: faker.person.fullName(),\n        email: faker.internet.email(),\n        profile: await generator.entity(ProfileEntity).single(),\n    };\n});\n```\n\nInside the factory function, we also have access to **Faker** for convenient generation of fake entity data and **generator** with which we can create nested entities.\n\n3) Test preparation","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplacdev%2Ffixture-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplacdev%2Ffixture-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplacdev%2Ffixture-lite/lists"}