{"id":17287988,"url":"https://github.com/omermorad/jest-gherkin","last_synced_at":"2025-07-30T22:32:05.574Z","repository":{"id":48419978,"uuid":"389774376","full_name":"omermorad/jest-gherkin","owner":"omermorad","description":"Jest Gherkin Plugin (For BDD Testing)","archived":false,"fork":false,"pushed_at":"2021-07-27T13:29:10.000Z","size":142,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-14T14:27:54.868Z","etag":null,"topics":["bdd","bdd-framework","integration-testing","jest","jest-plugin","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omermorad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-26T21:37:50.000Z","updated_at":"2023-05-25T16:49:04.000Z","dependencies_parsed_at":"2022-09-22T00:54:12.792Z","dependency_job_id":null,"html_url":"https://github.com/omermorad/jest-gherkin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermorad%2Fjest-gherkin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermorad%2Fjest-gherkin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermorad%2Fjest-gherkin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omermorad%2Fjest-gherkin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omermorad","download_url":"https://codeload.github.com/omermorad/jest-gherkin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228193144,"owners_count":17882913,"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":["bdd","bdd-framework","integration-testing","jest","jest-plugin","unit-testing"],"created_at":"2024-10-15T10:07:08.102Z","updated_at":"2024-12-04T21:20:50.647Z","avatar_url":"https://github.com/omermorad.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jest Gherkin Plugin\n\nThis is a plugin for Jest that helps you write your tests more easily\nwith the awesome Gherkin language (by Cucumber).\n\nThis plugin is not a replacement for cucumber, it is just uses the same vocabulary of Cucumber and the Gherkin language\n\n## Installation\n```bash\nnpm i -D jest-gherkin\n```\n\n## How is it different from `jest-cucumber`?\n`jest-cucumber` is looking for feature files that needs to be defined for the test to run.\nBesides, it suggests a weird syntax which is not nested like you can see in the following example.\n\nYou can see the full example of `jest-cucumber` here and see if it works for you\nhttps://www.npmjs.com/package/jest-cucumber.\n\n\n### A word about Cucumber tests\nIt's a bit difficult to work fully with Cucumber's testing system.\nThe tests carry with them state between different methods, and many IDEs have difficulty providing a holistic solution, which also makes it difficult to debug.\nBottom line is Cucumber tests can be complicated to maintain and to work with.\n\n## Example\n```js\nimport { PasswordValidator } from './password-validator';\n\ndescribe('The title of you test', () =\u003e {\n  let passwordValidator = new PasswordValidator();\n  let accessGranted = false;\n\n  beforeEach(() =\u003e {\n    passwordValidator = new PasswordValidator();\n  });\n\n  scenario('Entering a correct password', () =\u003e {\n    given('I have previously created a password', () =\u003e {\n      passwordValidator.setPassword('1234');\n\n      when('I enter my password correctly', () =\u003e {\n        accessGranted = passwordValidator.validatePassword('1234');\n\n        then('I should be granted access', () =\u003e {\n          expect(accessGranted).toBeTruthy();\n        });\n      });\n    });\n  });\n});\n```\n\n## Setup\nIn your jest config file add the following property:\n\n```json\n\"setupFiles\": [\n  \"jest-gherkin\",\n]\n```\n\nIf you are using TypeScript you have to add the following to add the types:\n\n`tsconfig.json` file:\n```json\n{\n  \"compilerOptions\": {\n    ...,\n    \"types\": [\n      ...,\n      \"jest\",\n      \"jest-gherkin\"\n    ]\n  }\n}\n```\n\n## Acknowledgements\n[Gherkin Reference](https://cucumber.io/docs/gherkin/reference/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomermorad%2Fjest-gherkin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomermorad%2Fjest-gherkin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomermorad%2Fjest-gherkin/lists"}