{"id":15383151,"url":"https://github.com/jhildenbiddle/karma-file-fixtures-preprocessor","last_synced_at":"2026-02-02T12:15:08.631Z","repository":{"id":47197801,"uuid":"164008057","full_name":"jhildenbiddle/karma-file-fixtures-preprocessor","owner":"jhildenbiddle","description":"A Karma plugin that makes file content accessible within test environments","archived":false,"fork":false,"pushed_at":"2024-02-07T03:04:01.000Z","size":279,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-02T12:12:11.665Z","etag":null,"topics":["css","file","files","fixture","fixtures","html","json","karma","karma-plugin","karma-preprocessor","text","txt"],"latest_commit_sha":null,"homepage":"","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/jhildenbiddle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"jhildenbiddle"}},"created_at":"2019-01-03T18:21:15.000Z","updated_at":"2022-10-09T14:19:21.000Z","dependencies_parsed_at":"2024-06-20T23:39:52.873Z","dependency_job_id":null,"html_url":"https://github.com/jhildenbiddle/karma-file-fixtures-preprocessor","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":"0.22807017543859653","last_synced_commit":"93801e04d038fd2f8c407ce968c0a0f3c87d821c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jhildenbiddle/karma-file-fixtures-preprocessor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhildenbiddle%2Fkarma-file-fixtures-preprocessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhildenbiddle%2Fkarma-file-fixtures-preprocessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhildenbiddle%2Fkarma-file-fixtures-preprocessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhildenbiddle%2Fkarma-file-fixtures-preprocessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhildenbiddle","download_url":"https://codeload.github.com/jhildenbiddle/karma-file-fixtures-preprocessor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhildenbiddle%2Fkarma-file-fixtures-preprocessor/sbom","scorecard":{"id":518887,"data":{"date":"2025-08-11","repo":{"name":"github.com/jhildenbiddle/karma-file-fixtures-preprocessor","commit":"93801e04d038fd2f8c407ce968c0a0f3c87d821c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"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":"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":5,"reason":"dependency not pinned by hash detected -- score normalized to 5","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/jhildenbiddle/karma-file-fixtures-preprocessor/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/jhildenbiddle/karma-file-fixtures-preprocessor/test.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"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":"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":"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":"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":"Vulnerabilities","score":0,"reason":"17 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-7x7c-qm48-pq9c","Warn: Project is vulnerable to: GHSA-rc3x-jf5g-xvc5","Warn: Project is vulnerable to: GHSA-6vfc-qv3f-vr6c","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T02:27:43.540Z","repository_id":47197801,"created_at":"2025-08-20T02:27:43.540Z","updated_at":"2025-08-20T02:27:43.540Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29012346,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T10:37:29.253Z","status":"ssl_error","status_checked_at":"2026-02-02T10:37:28.644Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["css","file","files","fixture","fixtures","html","json","karma","karma-plugin","karma-preprocessor","text","txt"],"created_at":"2024-10-01T14:35:32.446Z","updated_at":"2026-02-02T12:15:08.614Z","avatar_url":"https://github.com/jhildenbiddle.png","language":"JavaScript","funding_links":["https://github.com/sponsors/jhildenbiddle"],"categories":[],"sub_categories":[],"readme":"# karma-file-fixtures-preprocessor \u003c!-- omit in toc --\u003e\n\n[![NPM](https://img.shields.io/npm/v/karma-file-fixtures-preprocessor.svg?style=flat-square)](https://www.npmjs.com/package/karma-file-fixtures-preprocessor)\n[![GitHub Workflow Status (master)](https://img.shields.io/github/actions/workflow/status/jhildenbiddle/karma-file-fixtures-preprocessor/test.yml?branch=master\u0026label=checks\u0026style=flat-square)](https://github.com/jhildenbiddle/karma-file-fixtures-preprocessor/actions?query=branch%3Amaster+)\n[![Codacy](https://img.shields.io/codacy/grade/566f77fd4e5c4aa1b70c2279d32243d0/master?style=flat-square)](https://app.codacy.com/gh/jhildenbiddle/karma-file-fixtures-preprocessor/dashboard?branch=master)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://github.com/jhildenbiddle/karma-file-fixtures-preprocessor/blob/master/LICENSE)\n[![Sponsor this project](https://img.shields.io/static/v1?style=flat-square\u0026label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86)](https://github.com/sponsors/jhildenbiddle)\n\nA Karma plugin that makes file content accessible within test environments.\n\n## Installation\n\n```bash\nnpm install karma-file-fixtures-preprocessor --save-dev\n```\n\n## Usage\n\nGiven the following directory structure:\n\n\u003c!-- markdownlint-disable-next-line MD040 --\u003e\n```\napp\n├── tests\n│   ├── fixtures\n│   │   ├── fixture.css\n│   │   ├── fixture.html\n│   │   ├── fixture.json\n│   │   └── fixture.txt\n│   └── app.test.js\n├── karma.conf.js\n└── package.json\n```\n\nSpecify fixture files using Karma's [`preprocessors`](http://karma-runner.github.io/3.0/config/preprocessors.html) configuration and plugin [options](#options) as a `fileFixtures` object:\n\n```javascript\n// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    // ...\n    files: [\n      'app/tests/*.test.js'\n    ],\n    preprocessors: {\n      'app/tests/fixtures/*': ['file-fixtures']\n    },\n    fileFixtures: {\n      // Options...\n    }\n  });\n};\n```\n\nFixture content is stored as a global object accessible in your test environment:\n\n```javascript\n// app.test.js\nconsole.log(window.__FIXTURES__);\n```\n\n```javascript\n// Output\n{\n  \"tests/fixtures/fixture.css\": \"body { color: red; }\",\n  \"tests/fixtures/fixture.html\": \"\u003cp\u003eHello\u003c/p\u003e\",\n  \"tests/fixtures/fixture.json\": \"{ \\\"a\\\": 1 }\",\n  \"tests/fixtures/fixture.txt\": \"Some Text\"\n}\n```\n\nFixtures can be used directly in test assertions:\n\n```javascript\nvar assert = require('assert');\nvar txt = window.__FIXTURES__['tests/fixtures/fixture.txt'];\n\n// Assertion\nassert.strictEqual(txt, 'Some Text', 'Text content matches!');\n```\n\nOr injected, parsed, and modified as needed:\n\n```javascript\nvar css  = window.__FIXTURES__['tests/fixtures/fixture.css'];\nvar html = window.__FIXTURES__['tests/fixtures/fixture.html'];\nvar json = window.__FIXTURES__['tests/fixtures/fixture.json'];\n\n// Injecting / Parsing\nbefore(function() {\n  // Inject CSS\n  document.body.insertAdjacentHTML('beforeend', '\u003cstyle\u003e' + css + '\u003c/style\u003e');\n  console.log(getComputedStyle(document.body).color);\n\n  // Inject HTML\n  document.body.insertAdjacentHTML('beforeend', html);\n  console.log(document.querySelector('p').textContent);\n\n  // Parse JSON\n  json = JSON.parse(json);\n  console.log(json.a);\n});\n```\n\n```javascript\n// Output\n\"rgb(255, 0, 0)\"\n\"Hello\"\n1\n```\n\n## Options\n\n### globalName \u003c!-- omit in toc --\u003e\n\n- Type: `string`\n- Default: `'__FIXTURES__'`\n\nSets the name of the global fixtures object.\n\n**Example**\n\n```javascript\n// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    // ...\n    fileFixtures: {\n      globalName: '__FIXTURES__' // default\n    }\n  });\n};\n```\n\n### stripPrefix \u003c!-- omit in toc --\u003e\n\n- Type: `string`\n- Default: `null`\n\nRemoves the specified string from each fixture key.\n\n**Example**\n\n```javascript\n// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    // ...\n    fileFixtures: {\n      stripPrefix: null // default\n    }\n  });\n};\n```\n\n### transformKey \u003c!-- omit in toc --\u003e\n\n- Type: `function`\n- Arguments:\n  1. **path**: The path of the current fixture file\n\nCallback after each fixture file is loaded. Allows modifying the object key used to access the file content in the global fixtures object.\n\n**Example**\n\n```javascript\n// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    fileFixtures: {\n      transformKey: function(path) {\n        return path;\n      },\n    }\n  });\n};\n```\n\n### transformContent \u003c!-- omit in toc --\u003e\n\n- Type: `function`\n- Arguments:\n  1. **path**: The path of the current fixture file\n  1. **content**: The text content of the current fixture file\n\nCallback after each fixture file is loaded. Allows modifying the file content stored in the global fixtures object.\n\n**Example**\n\n```javascript\n// karma.conf.js\nmodule.exports = function(config) {\n  config.set({\n    fileFixtures: {\n      transformContent: function(path, content) {\n        return content;\n      }\n    }\n  });\n};\n```\n\n## Sponsorship\n\nA [sponsorship](https://github.com/sponsors/jhildenbiddle) is more than just a way to show appreciation for the open-source authors and projects we rely on; it can be the spark that ignites the next big idea, the inspiration to create something new, and the motivation to share so that others may benefit.\n\nIf you benefit from this project, please consider lending your support and encouraging future efforts by [becoming a sponsor](https://github.com/sponsors/jhildenbiddle).\n\nThank you! 🙏🏻\n\n## Contact \u0026 Support\n\n- Follow 👨🏻‍💻 **@jhildenbiddle** on [Twitter](https://twitter.com/jhildenbiddle) and [GitHub](https://github.com/jhildenbiddle) for announcements\n- Create a 💬 [GitHub issue](https://github.com/jhildenbiddle/karma-file-fixtures-preprocessor/issues) for bug reports, feature requests, or questions\n- Add a ⭐️ [star on GitHub](https://github.com/jhildenbiddle/karma-file-fixtures-preprocessor) and 🐦 [tweet](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fjhildenbiddle%2Fkarma-file-fixtures-preprocessor\u0026hashtags=karma,developers,frontend,javascript) to promote the project\n- Become a 💖 [sponsor](https://github.com/sponsors/jhildenbiddle) to support the project and future efforts\n\n## License\n\nThis project is licensed under the MIT License. See the [MIT LICENSE](https://github.com/jhildenbiddle/karma-file-fixtures-preprocessor/blob/master/LICENSE) for details.\n\nCopyright (c) John Hildenbiddle ([@jhildenbiddle](https://twitter.com/jhildenbiddle))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhildenbiddle%2Fkarma-file-fixtures-preprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhildenbiddle%2Fkarma-file-fixtures-preprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhildenbiddle%2Fkarma-file-fixtures-preprocessor/lists"}