amiceli / vitest-cucumber

Use gherkin in your unit tests with vitest
https://vitest-cucumber.miceli.click
25 stars 2 forks source link

Examples of how to use the package #20

Closed ReevMich closed 5 months ago

ReevMich commented 5 months ago

Is this a plugin or is it standalone? How does a vite project look with this package in use? Also can this be used with e2e tests?

amiceli commented 5 months ago

Aboutvitest, vitest can be used without vite. So you can use vitest-cucumber in any project using vitest.

vitest-cucumber is just a tool, not a plugin. When you run unit tests with that, it uses vitest :

Main goal is to follow Gherkin rules in unit tests : don't forget a Scenario or Examples for a Scenario Outline etc.

For tests e2e I will commit an example, I will post a message in this issue when it's done.

amiceli commented 5 months ago

@ReevMich I did some research for e2e tests. Like I read, vitest isn't used for e2e tests rather than Cypress for example.

But searching in vitest doc I found a page for browser mode. I never used it maybe it can be useful 😉

Maybe a day I will make a cypress-cucumber 😄

reinerBa commented 5 months ago

Would you please add an example folder in this repository or create an example-repository? I would like to see how it all likes to be ready.

amiceli commented 5 months ago

Yes I can make an examples folder, I will do it. Before start which informations are missing in README ? It's useful for me to know it ;).

reinerBa commented 5 months ago

An information how the test can be started would be usefull. Like the additional lines in the scripts section in package.json. Are any additional config files necessary? Are there any naming conventions for the unit-test-files? Which additional files are necessary for your plugin, feature files, test files, run files?

amiceli commented 5 months ago

vitest-cucumber is a tool not a plugin, so you don't need to add or update a config file. You just have to run your tests with vitest, in package.json a script like "test:unit": "vitest" is enough ;). I will update README for that ;)

You must have a .feature file with your Gherkin scenario, feature, etc. I will show it in examples folder. I'm working on it ;). I'm working on a side project using vitest-cucumber, I will make public asap. It will be a good example ;).

amiceli commented 5 months ago

@reinerBa I added an example folder : https://github.com/amiceli/vitest-cucumber/tree/main/examples. I hope you like it ;).

I've updated README following your messages, thank you ;)