{"id":18865285,"url":"https://github.com/jonathanprince/loopback-component-fixtures","last_synced_at":"2025-09-08T06:35:12.950Z","repository":{"id":71111079,"uuid":"43951092","full_name":"JonathanPrince/loopback-component-fixtures","owner":"JonathanPrince","description":"handle fixtures for testing clients against","archived":false,"fork":false,"pushed_at":"2017-07-16T18:18:42.000Z","size":45,"stargazers_count":12,"open_issues_count":4,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-15T15:45:55.753Z","etag":null,"topics":["fixture-data","fixtures","loopback","loopback-component-fixtures","tdd"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/JonathanPrince.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2015-10-09T11:20:15.000Z","updated_at":"2017-11-14T15:46:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f2ccb5c-9d8c-4e3c-ad1e-9ac4bff4751f","html_url":"https://github.com/JonathanPrince/loopback-component-fixtures","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/JonathanPrince/loopback-component-fixtures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanPrince%2Floopback-component-fixtures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanPrince%2Floopback-component-fixtures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanPrince%2Floopback-component-fixtures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanPrince%2Floopback-component-fixtures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonathanPrince","download_url":"https://codeload.github.com/JonathanPrince/loopback-component-fixtures/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonathanPrince%2Floopback-component-fixtures/sbom","scorecard":{"id":74167,"data":{"date":"2025-08-11","repo":{"name":"github.com/JonathanPrince/loopback-component-fixtures","commit":"5df08e5ee0e500efbacc9921026c863e8c46649b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":2,"reason":"Found 4/16 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-15T04:28:36.791Z","repository_id":71111079,"created_at":"2025-08-15T04:28:36.792Z","updated_at":"2025-08-15T04:28:36.792Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274146177,"owners_count":25230115,"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","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fixture-data","fixtures","loopback","loopback-component-fixtures","tdd"],"created_at":"2024-11-08T04:46:32.672Z","updated_at":"2025-09-08T06:35:12.927Z","avatar_url":"https://github.com/JonathanPrince.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# loopback-component-fixtures\n[![Build Status](https://travis-ci.org/JonathanPrince/loopback-component-fixtures.svg?branch=master)](https://travis-ci.org/JonathanPrince/loopback-component-fixtures)\n[![Coverage Status](https://coveralls.io/repos/github/JonathanPrince/loopback-component-fixtures/badge.svg?branch=master)](https://coveralls.io/github/JonathanPrince/loopback-component-fixtures?branch=master)\n\nThis component was conceived by the desire to test client side applications without needing to mock API requests. It doesn't make sense to mock an API when Loopback is already being used. Environment specific datasource configurations were already available, the only piece missing was an easy way to add and remove fixtures when required. Hopefully this component will be useful for others as well, if you have any suggestions to improve the usefulness of this component please let me know, or even better feel free to submit a pull request.\n\n# Usage\n\n**Installation**\n\n1. Install in you loopback project:\n\n  `npm install --save loopback-component-fixtures`\n\n2. Create a component-config.json file in your server folder (if you don't already have one)\n\n3. Configure options inside `component-config.json`. *(see configuration section)*\n\n  ```json\n  {\n    \"loopback-component-fixtures\": {\n      \"{option}\": \"{value}\"\n    }\n  }\n  ```\n\n4. Create a folder for storing test fixtures.\n\n  The default location is `/server/test-fixtures`. This can be set in `component-config.json` (see below)\n\n5. Create `datasources.{env}.json` file. This is the datasources definition that will be used depending on the value of NODE_ENV where you want to use fixture data. Example:\n  ```json\n  {\n    \"db\": {\n      \"name\": \"db\",\n      \"connector\": \"memory\"\n    }\n  }\n  ```\n\n**Configuration**\n\nOptions:\n\n - `loadFixturesOnStartup`\n\n  [Boolean] : Defines whether the fixture data should be loaded on startup. *(default: false)*\n\n - `errorOnSetupFailure`\n\n  [Boolean] : Defines whether the API shows/throws an error when fixtures fail to load.  *(default: false)*\n\n  If **true**:\n    - Bad fixtures loaded on startup will cause the application to fail with an error.\n    - Bad fixtures loaded via the REST endpoint will return a `500` status code and an `error` object with details about the specific fixture failures.\n\n  If **false**:\n    - App will continue running (but log an error) if bad fixtures are loaded on startup\n    - App will return a 200 with no error details if bad fixtures are loaded when calling the fixture setup REST endpoint, but will log an error to the console.\n\n - `environments`\n\n  [String/Array] : The name(s) of the environment(s) where the fixtures should be used. *(default: 'test')*\n\n - `fixturesPath`\n\n  [String] : The location of of the fixture definitions relative to the project root. *(default: '/server/test-fixtures/')*\n\n\n**Fixture Files**\n\nFixtures are stored in .json files and should have the same name as the loopback model definitions they correspond to. The content should be either an object (for a single item) or an array of objects for multiple items.\n\n**Setup/Teardown Fixtures**\n\nFixtures can be setup at startup by setting `loadFixturesOnStartup` to `true` in the component-config file. The fixtures can be setup manually by making a GET request to the endpoint `\u003capi-root\u003e/fixtures/setup` and a GET request to `\u003capi-root\u003e/fixtures/teardown` will clear all data.\n\nThese actions are also available on the server as `app.setupFixtures(callback)` and `app.teardownFixtures(callback)`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanprince%2Floopback-component-fixtures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanprince%2Floopback-component-fixtures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanprince%2Floopback-component-fixtures/lists"}