{"id":15285673,"url":"https://github.com/bbc/cucumber-slicer","last_synced_at":"2025-08-02T21:12:35.966Z","repository":{"id":33118517,"uuid":"142422039","full_name":"bbc/cucumber-slicer","owner":"bbc","description":"Split cucumber feature files into a separate file for each scenario","archived":false,"fork":false,"pushed_at":"2024-02-22T16:02:16.000Z","size":172,"stargazers_count":10,"open_issues_count":19,"forks_count":7,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-04-13T02:38:01.906Z","etag":null,"topics":["cps","dpub","innovation","library","node"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbc.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}},"created_at":"2018-07-26T09:52:35.000Z","updated_at":"2025-03-21T06:48:32.000Z","dependencies_parsed_at":"2024-02-22T17:27:35.776Z","dependency_job_id":"d5f883c2-c596-4838-9a04-0b7e84e0508c","html_url":"https://github.com/bbc/cucumber-slicer","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":"0.17391304347826086","last_synced_commit":"9063f760e235b552d16f163dbfa878c64593ea05"},"previous_names":["bbc/cucumber-slices"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fcucumber-slicer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fcucumber-slicer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fcucumber-slicer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbc%2Fcucumber-slicer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbc","download_url":"https://codeload.github.com/bbc/cucumber-slicer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657853,"owners_count":21140843,"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":["cps","dpub","innovation","library","node"],"created_at":"2024-09-30T15:07:05.923Z","updated_at":"2025-04-13T02:38:31.048Z","avatar_url":"https://github.com/bbc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cucumber-slicer\nSplit cucumber feature files into a separate file for each scenario.\n\n## Installation\n\n``` shell\nnpm install @bbc/cucumber-slicer --save\n```\n\n## Usage\n\n``` javascript\nconst glob = require('glob');\nconst cucumberSlicer = require('@bbc/cucumber-slicer');\n\nconst featureFiles = glob.sync('./features/**/*.feature');\nconst generatedFiles = cucumberSlicer(featureFiles,\n'./generatedFeatures');\n\nrunCucumberTests('./generatedFeatures/**/*.feature').then(() =\u003e {\n  removeGeneratedFeatures(generatedFiles);\n});\n\n```\n\n## How it works\n\nThe cucumberSlicer goes through each of the feature files and creates\na separate file out of each scenario. The generated files are meant to\nbe transient. They only include what is necessary to run the test --\nno comments or extra explanatory text. What is copied over are any\nfeature-level tags, the feature title, any background steps, any\nscenario-level tags (e.g., @wip) and the scenario with all of its\nsteps or table data.\n\nTo avoid creating too many files in a directory, the generator uses\nthe first feature-level tag (if any) as a subdirectory name.\n\nIf you don't want one or more of the feature files to be split, add\nthe tag `@nosplit` to the feature-level tags. All of the scenarios in\nthat file will be kept in the resulting generated one.\n\n\n## Why?\n\nMany test automation infrastructures, such as\n[Browserstack](https://www.browserstack.com/) or [Sauce Labs](https://saucelabs.com/), run the feature files\nin parallel. However, if you write Gherkin/cucumber files in the normal way, you'll have\nseveral scenarios per feature. This means those scenarios are run\nas a group. There are various ways to address this (see\n[parallel-cucumber](https://github.com/simondean/parallel-cucumber-js),\nfor example). The easiest way we found -- without having to change any\nof our other tools -- was to use cucumber in the\nnormal way and split the tests into individual scenarios when we\nwanted to run them on Browserstack or similar environment. We get the\nbenefit of managing feature files in the way we are used to, with\nscenarios grouped by major feature, while still getting reasonable\nperformance from automated tests.\n\nYou will need to write the scenarios so that they are capable of running\nin parallel, which is tricky if your tests access a shared database.\nThe `@nosplit` tag allows you to run some of your scenarios sequentially.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Fcucumber-slicer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbc%2Fcucumber-slicer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbc%2Fcucumber-slicer/lists"}