{"id":19500587,"url":"https://github.com/naturalintelligence/cucumon","last_synced_at":"2026-02-27T01:31:03.092Z","repository":{"id":42766343,"uuid":"277112465","full_name":"NaturalIntelligence/cucumon","owner":"NaturalIntelligence","description":"Gherkin like feature file parser with a dash of lemon","archived":false,"fork":false,"pushed_at":"2024-09-06T09:59:09.000Z","size":267,"stargazers_count":3,"open_issues_count":8,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-21T06:08:11.460Z","etag":null,"topics":[],"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/NaturalIntelligence.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,"zenodo":null}},"created_at":"2020-07-04T13:12:23.000Z","updated_at":"2021-10-23T01:20:20.000Z","dependencies_parsed_at":"2025-04-21T06:02:08.599Z","dependency_job_id":"8bd46cc2-862a-4d80-b736-82d36ed98fa3","html_url":"https://github.com/NaturalIntelligence/cucumon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalIntelligence%2Fcucumon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalIntelligence%2Fcucumon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalIntelligence%2Fcucumon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NaturalIntelligence%2Fcucumon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NaturalIntelligence","download_url":"https://codeload.github.com/NaturalIntelligence/cucumon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250912660,"owners_count":21506865,"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-11-10T22:08:59.231Z","updated_at":"2026-02-27T01:31:03.057Z","avatar_url":"https://github.com/NaturalIntelligence.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cucumon\nGherkin like feature file parser with a dash of lemon.\n\n\n\n\u003cimg align=\"center\" src=\"assets/logo.png\" alt=\"cucumon logo\" /\u003e\n\n## How to use\n\n```bash\n$ npm install cucumon\n```\n\n```js\nconst Cucumon = require(\"cucumon\");\n\nconst options = {\n    tagExpression : \"\", //@focus\n    //clubBgSteps : true,\n}\nconst cucumonSlice = new Cucumon(options);\nconst output = cucumonSlice.parse(featureFileAsString);\n```\n\n## Documentation\n\n### Feature file format\n\nCucumon supports gherkin feature file format.\n\n```feature\n@tag @tag2\n@tag3\nFeature: statement\n\nDescription\n\nRule: some rule\n\n    Background: statement\n        Given some step\n    \n    Scenario: statment\n        When some step\n\n    Scenario Outline: statement \u003cheader\u003e\n        Then some step\n        And data table\n        #\u003e {}\n        |header|\u003cheader\u003e|\n        But doc string\n        #\u003e json\n        \"\"\"\n        { header: \"\u003cheader\u003e\" }\n        \"\"\"\n\n        Examples:\n        |header|\n        |val|\n\nRule: Other sub feature\n\n    Background: statement\n        Given some step\n    \n    Example: statment\n        When some step\n\n    @taghere\n    Scenario Template: statement \u003cheader\u003e\n        Then some step\n\n        Scenarios:\n        |header|\n        |val|\n```\n\nNote the **instruction statment** `#\u003e {}`. Instruction statments are special comments which can help parser to take some extra steps. Currently, they are supported with scenario, steps, docstring, and data table inputs.\n\n### Result format\n\n```js\n{\n    feature: {\n        \"keyword\": \"Feature\",\n        \"description\": \"\",\n        \"statement\": \"Special Characters\",\n        \"lineNumber\": 1,\n        \"tags\": [],\n        rules: [\n            {\n                \"keyword\": \"Rule\",\n                \"description\": \"\",\n                \"statement\": \"some rule\",\n                \"lineNumber\": 2,\n                \"hasBgSection\": true,\n                \"background\": {\n                    \"keyword\": \"Background\",\n                    \"statement\": \"one per rule\",\n                    \"description\": \"Background can have description\",\n                    \"lineNumber\": 14,\n                    \"id\": -1,\n                    \"steps\": [\n                        {\n                            \"keyword\": \"Given\",\n                            \"statement\": \"a string tokenizer\",\n                            \"lineNumber\": 17,\n                            \"arg\": null\n                        }\n                    ]\n                },\n                scenarios: [\n                    {\n                        \"keyword\": \"Scenario\",\n                        \"statement\": \"normal scenario\",\n                        \"description\": \"\",\n                        \"lineNumber\": 3,\n                        \"id\": 1,\n                        \"tags\": [],\n                        \"steps\": [\n                            {\n                                \"keyword\": \"Given\",\n                                \"statement\": \"an example\",\n                                \"lineNumber\": 4,\n                                \"arg\": {\n                                    \"content\": \"some docstring\",\n                                    \"type\": \"DocString\",\n                                    \"lineNumber\": 26,\n                                    \"instruction\": \"no format; single line;\"\n                                }\n                            }\n                        ]\n                    },{\n                        \"keyword\": \"Scenario Template\",\n                        \"statement\": \"scenario outline\",\n                        \"description\": \"\",\n                        \"lineNumber\": 3,\n                        \"id\": 1,\n                        \"tags\": [\"@wip\"],\n                        \"expanded\" : [\n                            {\n                                \"keyword\": \"Scenario Template\",\n                                \"statement\": \"scenario outline\",\n                                \"description\": \"\",\n                                \"lineNumber\": 3,\n                                \"id\": 1,\n                                \"steps\": [\n                                    {\n                                        \"keyword\": \"Given\",\n                                        \"statement\": \"an example\",\n                                        \"lineNumber\": 4,\n                                        \"arg\": null\n                                    }\n                                ],\n                                \"tags\": [ \"@wip\", \"@examples\" ],\n                                \"examplesLineNumber\": [ 19 ]\n                            }\n                        ],\n                        \"examples\": [\n                            {\n                                \"lineNumber\": 10,\n                                \"rows\": [\n                                    {\n                                        \"lineNumber\": 11,\n                                        \"regex\": [ {} ],\n                                        \"cells\": [ \"data\" ]\n                                    }, {\n                                        \"lineNumber\": 19,\n                                        \"cells\": [ \"\" ]\n                                    }\n                                ],\n                                \"instruction\": \"instruction\",\n                                \"tags\": [ \"@examples\" ]\n                            }\n                        ]\n                    }\n                ]\n            }\n        ]\n    }\n}\n```\n\n### Options\n\n```js\nnew Cucumon({clubBgSteps: false});\n```\n\nYou can set `clubBgSteps: true` to club background steps with scenario steps.\n\nCheck [sample](test/Inputs.json) parsed response for better idea;\n\n### Additional Features\n\n* Cucumon supports multiple examples\n* You can use your own logic to generate scenarios for scenario outline\n\n```feature\nFeature: Matrix Outliner\n\n    Scenario Template: Matrix example\n        Given an example \n        And I can Multiply \u003ca\u003e with \u003cb\u003e\n\n        #\u003e matrix: row 1\n        Examples:\n        | a |\n        | 3 |\n\n        #\u003e matrix: row 2\n        Examples:\n        | b |\n        | 4 |\n```\n\nNote that `#\u003e` is a special statment considered as instruction statement. You'll get it's value as `outline.examples[0].instruction`.\n\n```js\nconst cucumon = new Cucumon({clubBgSteps: false});\ncucumon.registerOutlineExpander((outline) =\u003e {});\n```\n\n### Other\n\n* Check [bexp](https://github.com/NaturalIntelligence/bexp/) to evaluate tag expression.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalintelligence%2Fcucumon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaturalintelligence%2Fcucumon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaturalintelligence%2Fcucumon/lists"}