{"id":23569589,"url":"https://github.com/xpol/cypress-template-fixtures","last_synced_at":"2025-04-30T22:42:00.995Z","repository":{"id":145343172,"uuid":"355440403","full_name":"xpol/cypress-template-fixtures","owner":"xpol","description":"Allow using {{ENVIRONMENT_VARIABLE}} in Cypress fixture files.","archived":false,"fork":false,"pushed_at":"2022-12-02T09:46:12.000Z","size":76,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-24T23:07:02.840Z","etag":null,"topics":["cypress","environment-variables","fixtures","templates"],"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/xpol.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}},"created_at":"2021-04-07T06:45:19.000Z","updated_at":"2022-12-02T09:46:17.000Z","dependencies_parsed_at":"2023-09-28T04:08:44.745Z","dependency_job_id":null,"html_url":"https://github.com/xpol/cypress-template-fixtures","commit_stats":{"total_commits":9,"total_committers":2,"mean_commits":4.5,"dds":"0.11111111111111116","last_synced_commit":"60ffd2f9bc73951e3b02b20718a8ade3b340d365"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Fcypress-template-fixtures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Fcypress-template-fixtures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Fcypress-template-fixtures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpol%2Fcypress-template-fixtures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xpol","download_url":"https://codeload.github.com/xpol/cypress-template-fixtures/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231398047,"owners_count":18370775,"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":["cypress","environment-variables","fixtures","templates"],"created_at":"2024-12-26T19:15:39.889Z","updated_at":"2024-12-26T19:15:40.577Z","avatar_url":"https://github.com/xpol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cypress Template Fixtures\n\nAllow using `{{ENVIRONMENT_VARIABLE}}` in Cypress fixture files.\n\n## Setup\n\nInstall this package by run `npm i -D cypress-template-fixtures` or `yarn add -D cypress-template-fixtures`.\n\nAdd `require('cypress-template-fixtures')(on, config);` in the `cypress/plugins/index.js`. \n\n```js\nmodule.exports = (on, config) =\u003e {\n    require('cypress-template-fixtures')(on, config); // Add this line\n    return config;\n};\n```\n\nAlso add `cypress/fixtures.out/` into ignore list of you VCS. E.g. the `.gitignore` for Git. \n\n## Write Fixtures with variables\n\nWhen writing a fixture data in `cypress/fixtures`, you can use environment variables.\nPut the environment variable name in between `{{` and `}}`. Eg. `{{NODE_ENV}}` `{{MY_VARIABLE}}`.\n\n## Provide Environment Variables\n\nPlease refer to the [doc here](https://docs.cypress.io/guides/guides/environment-variables).\n\n1. From `env` field in `cypress.json`, don't have to use `CYPRESS_` or `cypress_` prefixes. \n2. From `cypress.env.json`, don't have to use `CYPRESS_` or `cypress_` prefixes.\n3. From command line or system environment variables, **have to** use `CYPRESS_` or `cypress_` prefixes.\n4. Using [cypress-dotenv](https://github.com/morficus/cypress-dotenv), **have to** use `CYPRESS_` or `cypress_` prefixes unless [set the `all` parameter to true](https://github.com/morficus/cypress-dotenv#options).\n\nNote, if you use cypress-dotenv make sure enable it before cypress-template-fixtures.\n\n```js\nmodule.exports = (on, config) =\u003e {\n    config = require('cypress-dotenv')(config); // load .env before cypress-template-fixtures\n    require('cypress-template-fixtures')(on, config);\n    return config\n};\n```\n\n## How it works\n\n1. When running `cypress run` or `cypress open` this plugin will copy all fixtures in `cypress/fixtures` into `cypress/fixtures.out` with sub-folders structure preserved.\n2. When copying text fixtures (`.json`, `.js`, `.coffee`, `.html`, `.txt`, `.csv`, `.yml`) the variables like `{{MY_VARIABLE}}` will be replaced with the related environment variable value like `MY_VARIABLE`.\n3. This plugin will also change the `fixturesFolder` config to `cypress/fixtures.out` so that cypress will use the fixtures there.\n\n## Limitations\n\nFor simplicity, change the fixtures after `cypress open` may not regenerated automatically, you should rerun `cypress open`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpol%2Fcypress-template-fixtures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpol%2Fcypress-template-fixtures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpol%2Fcypress-template-fixtures/lists"}