{"id":14971499,"url":"https://github.com/amiceli/vitest-cucumber","last_synced_at":"2025-04-05T20:06:21.185Z","repository":{"id":184908065,"uuid":"672645455","full_name":"amiceli/vitest-cucumber","owner":"amiceli","description":"Use gherkin in your unit tests with vitest","archived":false,"fork":false,"pushed_at":"2024-10-29T21:59:08.000Z","size":594,"stargazers_count":41,"open_issues_count":7,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-29T23:43:49.086Z","etag":null,"topics":["gherkin","vitest"],"latest_commit_sha":null,"homepage":"https://vitest-cucumber.miceli.click","language":"TypeScript","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/amiceli.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-30T19:27:17.000Z","updated_at":"2024-10-28T08:15:08.000Z","dependencies_parsed_at":"2023-07-30T22:29:58.590Z","dependency_job_id":"148d4d25-97d9-4831-8c88-2bf53c45efed","html_url":"https://github.com/amiceli/vitest-cucumber","commit_stats":{"total_commits":111,"total_committers":5,"mean_commits":22.2,"dds":0.5585585585585586,"last_synced_commit":"9fb8713a50191e452b0ea6c7edfa4147dfa263f8"},"previous_names":["amiceli/vitest-cucumber"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiceli%2Fvitest-cucumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiceli%2Fvitest-cucumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiceli%2Fvitest-cucumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amiceli%2Fvitest-cucumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amiceli","download_url":"https://codeload.github.com/amiceli/vitest-cucumber/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393569,"owners_count":20931812,"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":["gherkin","vitest"],"created_at":"2024-09-24T13:45:17.601Z","updated_at":"2025-04-05T20:06:21.167Z","avatar_url":"https://github.com/amiceli.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://vitest-cucumber.miceli.click/_astro/logo.xz4thweI_1zN7IX.webp\" width=\"100\" /\u003e\n\u003c/p\u003e\n\n# [vitest-cucumber](https://vitest-cucumber.miceli.click/)\n\n## Overview\n\nvitest-cucumber is an **opiniated** [vitest](https://vitest.dev/) **tools** (not a plugin) inspired by [jest-cucumber](https://github.com/bencompton/jest-cucumber).\n\nGoal is to write unit test using Gherkin feature file and checking scenario name, missing scenario step etc.\n\n## Installation\n\n    npm install @amiceli/vitest-cucumber -D\n\nIt's enough you don't to add or update a config file.\n\nSince `v3.4.4` vitest-cucumber required vitest `\u003e=2.0.0`.\n\n## Examples\n\nYou can take a look on :\n\n- [vitest-cucumber-example](https://github.com/amiceli/vitest-cucumber-example). Is a `Vue` project example.\n- [vitest-cucumber_rtl_template](https://github.com/Agriculture-Intelligence/vitest-cucumber_rtl_template). Is a `React` project example.\n\n## How it works\n\n`Scenario` function use vitest `describe` function and all steps function like `Given`, `Then`\nuse vitest `test` function.\n\nSo you don't need to use `it` or `test` inside `Scenario` or scenario steps.\n\n## Usage\n\nFirst write your `feature` file. By example : \n\n~~~feature\nFeature: Improve my unit tests\n    Scenario: Use vitest-cucumber in my unit tests\n        Given Developer using feature file\n        And   Using vitest-cucumber\n        When  I run my unit tests\n        Then  I know if I forgot a scenario\n~~~\n\nNow you can write unit tests with **vitest-cucumber**.\n\nFoe example : \n\n~~~typescript\nimport { loadFeature, describeFeature } from '@amiceli/vitest-cucumber'\nimport { expect } from 'vitest'\n\nconst feature = await loadFeature('path/to/my/file.feature')\n\ndescribeFeature(feature, ({ Scenario }) =\u003e {\n            \n    Scenario('Use vitest-cucumber in my unit tests', ({ Given, When, Then, And }) =\u003e {\n        Given('Developer using feature file', () =\u003e {\n            expect(false).toBeFalsy()\n        })\n        And('sing vitest-cucumber', () =\u003e {\n            // ...\n        })\n        When('I run my unit tests', () =\u003e {\n            // ...\n        })\n        Then('I know if I forgot a scenario', () =\u003e {\n            // ...\n        })\n    })\n\n})\n~~~\n\nWhen you run your test with vitest, **vitest-cucumber** will check : \n\n- if you forget a Scenario or a Scenario Outline\n- if you use correct Scenario description\n- if you forgot a Scenario step\n- if you use a wrong Scenario step type\n- missing variables value in Scenario Outline\n- missing variables name in Scenario Outline steps\n\nFor example, if you forgot to write : \n\n~~~typescript\nWhen('I run my unit tests', () =\u003e {\n    // ...\n})\n~~~\n\nIt will throw **When I run my unit tests was not called**.\n\n### Generate spec file from feature file\n\nSince `3.4.1` vitest-cucumber provide a script to generate spec file from feature file.\n\nYou can use it like this : \n\n    npx @amiceli/vitest-cucumber \u003cpath-to-feature\u003e \u003cpath-to-spec\u003e\n\nAn example : \n\n    npx @amiceli/vitest-cucumber features/example.feature src/__tests__/example.spec.ts\n\nYou just have to format spec file after this script ;).\n\nCurrently it generates `TS` file, if you need more options open an issue ;).\n\n## [Docs](https://vitest-cucumber.miceli.click/)\n\n- [Configuration](https://vitest-cucumber.miceli.click/configuration)\n- [Vitest plugin to sync spec and feature files](https://vitest-cucumber.miceli.click/plugin)\n- [Background](https://vitest-cucumber.miceli.click/features/background)\n- [Scenario](https://vitest-cucumber.miceli.click/features/scenario)\n- [Scenario Outline and Examples](https://vitest-cucumber.miceli.click/features/scenario-outline)\n- [Scenario Outline mapped examples](https://vitest-cucumber.miceli.click/features/mapped-examples/)\n- [Rule](https://vitest-cucumber.miceli.click/features/rule)\n- [Scneario hooks](https://vitest-cucumber.miceli.click/features/hooks)\n- [Structure hooks](https://vitest-cucumber.miceli.click/features/structure-context)\n- [Predefine steps](https://vitest-cucumber.miceli.click/features/predefine-steps)\n- [`skip`, `only` with scenario, rule and background](https://vitest-cucumber.miceli.click/features/skip-only)\n- [Step sequentially and async](https://vitest-cucumber.miceli.click/features/sequentially-and-async)\n- [Gherkin tags](https://vitest-cucumber.miceli.click/features/gherkin-tags)\n- [Step with expression / parameter type](https://vitest-cucumber.miceli.click/features/step-expression)\n- [DocStrings](https://vitest-cucumber.miceli.click/features/doc-strings)\n- [DataTables](https://vitest-cucumber.miceli.click/features/data-tables)\n- [Spoken languages](https://vitest-cucumber.miceli.click/features/spoken-languages)\n\nDoc is maintain in this project [vitest-cucumber-docs](https://github.com/amiceli/vitest-cucumber-docs).\n\nDon't hesitate to open an issue on it if you want more details ;).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiceli%2Fvitest-cucumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famiceli%2Fvitest-cucumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famiceli%2Fvitest-cucumber/lists"}