{"id":16175901,"url":"https://github.com/elaichenkov/cypress-plugin-init","last_synced_at":"2026-03-05T16:40:14.968Z","repository":{"id":148613403,"uuid":"620489002","full_name":"elaichenkov/cypress-plugin-init","owner":"elaichenkov","description":"This library simplifies the process of setting up multiple Cypress plugins in your project","archived":false,"fork":false,"pushed_at":"2024-09-30T11:44:48.000Z","size":1070,"stargazers_count":5,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-11T04:46:41.985Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elaichenkov.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":"2023-03-28T19:31:46.000Z","updated_at":"2024-10-03T10:08:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"856a55ee-92ea-4d70-a93f-1ae5cf799d5d","html_url":"https://github.com/elaichenkov/cypress-plugin-init","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elaichenkov%2Fcypress-plugin-init","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elaichenkov%2Fcypress-plugin-init/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elaichenkov%2Fcypress-plugin-init/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elaichenkov%2Fcypress-plugin-init/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elaichenkov","download_url":"https://codeload.github.com/elaichenkov/cypress-plugin-init/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221662734,"owners_count":16859737,"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":"2024-10-10T04:46:42.482Z","updated_at":"2026-03-05T16:40:14.935Z","avatar_url":"https://github.com/elaichenkov.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cypress-plugin-init\n\nThis library was designed to overcome the limitations of the Cypress plugin system to have multiple listeners. So, it allows you to initialize all needed plugins in one place. Futhermore, this allows you to use the Cypress plugin system to its full potential.\n\n## Motivation\n\nThe Cypress plugin system is a great way to extend the Cypress functionality. However, it has some limitations. One of them is that you can only have one listener for a specific event. This means that if you want to use multiple plugins that listen to the same event, you can't do it. This library was designed to overcome this limitation. \n\nFor instance, if you have two plugins that are listening to the `before:run` event, you can initialize both of them with this library.\n\n```ts\nimport { defineConfig } from 'cypress';\nimport { initPlugins } from 'cypress-plugin-init';\n\nconst plugin1 = (on: Cypress.PluginEvents) =\u003e {\n  on('before:run', (_) =\u003e console.log('[Plugin #1] Running before:run'));\n};\n\nconst plugin2 = (on: Cypress.PluginEvents) =\u003e {\n  on('before:run', (_) =\u003e console.log('[Plugin #2] Running before:run'));\n};\n\nexport default defineConfig({\n  e2e: {\n    setupNodeEvents(on, config) {\n      initPlugins(on, [plugin1, plugin2]);\n    },\n  },\n});\n```\n\nThe output of the code above will be:\n\n```bash\n(Run Starting)\n...\n[Plugin #1] Running before:run\n[Plugin #2] Running before:run\n...\n(Run Finished)\n```\n\nIf you run the same code without this library, the output will be:\n\n```bash\n(Run Starting)\n...\n[Plugin #2] Running before:run\n...\n(Run Finished)\n```\n\nHence, you can see that the only the last one will be executed.\n\n## Installation\n\n```bash\nnpm install cypress-plugin-init\n```\n\n## Usage\n\nIt's pretty simple to use. Just import the `initPlugins` function and call the `initPlugins` function with the plugins you want to initialize in your `cypress.config.ts` file.\n\n```ts\nimport { initPlugins } from 'cypress-plugin-init';\n\nexport default defineConfig({\n  e2e: {\n    // ...\n\n    setupNodeEvents(on, config) {\n      // Initialize all plugins you want to use in your project\n      initPlugins(on, [plugin1, plugin2]);\n    },\n\n    // ...\n  },\n});\n\n```\n\nIf any of the plugins you want to initialize is expecting `config` as a parameter, you can pass it as a third parameter to the `initPlugins` function.\n\n```ts\nimport { initPlugins } from 'cypress-plugin-init';\n\nexport default defineConfig({\n  e2e: {\n    // ...\n\n    setupNodeEvents(on, config) {\n      // Initialize all plugins you want to use in your project\n      initPlugins(on, [plugin1, plugin2], config);\n    },\n\n    // ...\n  },\n});\n```\n\n## License\n\n[MIT](LICENSE)\n\n## Author\n\nYevhen Laichenkov \u003celaichenkov@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felaichenkov%2Fcypress-plugin-init","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felaichenkov%2Fcypress-plugin-init","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felaichenkov%2Fcypress-plugin-init/lists"}