vitest-cucumber-plugin 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CONTRIBUTING.md +42 -0
  2. package/LICENSE +21 -0
  3. package/README.md +113 -0
  4. package/RELEASE_NOTES.md +9 -0
  5. package/package.json +34 -0
  6. package/rollup-nearley.js +10 -0
  7. package/run-tests +8 -0
  8. package/src/generate/example.js +20 -0
  9. package/src/generate/examples.js +47 -0
  10. package/src/generate/feature.js +45 -0
  11. package/src/generate/index.js +13 -0
  12. package/src/generate/scenarioOutline.js +18 -0
  13. package/src/generate/tests.js +23 -0
  14. package/src/generate/util.js +10 -0
  15. package/src/gherkin.js +171 -0
  16. package/src/gherkin.ne +130 -0
  17. package/src/gherkin.umd.js +118 -0
  18. package/src/index.js +65 -0
  19. package/src/logger.js +7 -0
  20. package/src/parameterize.js +7 -0
  21. package/src/parse.js +21 -0
  22. package/src/steps.js +42 -0
  23. package/tests/background/features/background.feature +25 -0
  24. package/tests/background/features/step_definitions/steps.js +30 -0
  25. package/tests/background/package-lock.json +1967 -0
  26. package/tests/background/package.json +11 -0
  27. package/tests/background/vite.config.js +9 -0
  28. package/tests/comments/features/is-it-friday.feature +10 -0
  29. package/tests/comments/features/step_definitions/stepdefs.js +15 -0
  30. package/tests/comments/package-lock.json +1967 -0
  31. package/tests/comments/package.json +11 -0
  32. package/tests/comments/vite.config.js +9 -0
  33. package/tests/data-tables/features/data-tables.feature +25 -0
  34. package/tests/data-tables/features/step_definitions/data-tables.js +21 -0
  35. package/tests/data-tables/package-lock.json +1967 -0
  36. package/tests/data-tables/package.json +11 -0
  37. package/tests/data-tables/vite.config.js +9 -0
  38. package/tests/data-tables/vite.config.js.timestamp-1682359000824-3876ac2e9095b.mjs +13 -0
  39. package/tests/is-it-friday/features/is-it-friday.feature +7 -0
  40. package/tests/is-it-friday/features/step_definitions/stepdefs.js +15 -0
  41. package/tests/is-it-friday/package-lock.json +1967 -0
  42. package/tests/is-it-friday/package.json +11 -0
  43. package/tests/is-it-friday/vite.config.js +9 -0
  44. package/tests/is-it-friday-scenario-outline/features/is-it-friday.feature +13 -0
  45. package/tests/is-it-friday-scenario-outline/features/step_definitions/stepdefs.js +15 -0
  46. package/tests/is-it-friday-scenario-outline/package-lock.json +1967 -0
  47. package/tests/is-it-friday-scenario-outline/package.json +11 -0
  48. package/tests/is-it-friday-scenario-outline/vite.config.js +9 -0
  49. package/tests/is-it-friday-two-scenarios/features/is-it-friday.feature +12 -0
  50. package/tests/is-it-friday-two-scenarios/features/step_definitions/stepdefs.js +19 -0
  51. package/tests/is-it-friday-two-scenarios/package-lock.json +1967 -0
  52. package/tests/is-it-friday-two-scenarios/package.json +11 -0
  53. package/tests/is-it-friday-two-scenarios/vite.config.js +9 -0
  54. package/tests/is-it-friday-two-scenarios-multiple-feature-files/features/friday.feature +7 -0
  55. package/tests/is-it-friday-two-scenarios-multiple-feature-files/features/step_definitions/stepdefs.js +19 -0
  56. package/tests/is-it-friday-two-scenarios-multiple-feature-files/features/sunday.feature +8 -0
  57. package/tests/is-it-friday-two-scenarios-multiple-feature-files/package-lock.json +1967 -0
  58. package/tests/is-it-friday-two-scenarios-multiple-feature-files/package.json +11 -0
  59. package/tests/is-it-friday-two-scenarios-multiple-feature-files/vite.config.js +9 -0
  60. package/tests/keyword-aliases/features/scenario-outline.feature +20 -0
  61. package/tests/keyword-aliases/features/scenario.feature +14 -0
  62. package/tests/keyword-aliases/features/step_definitions/steps.js +30 -0
  63. package/tests/keyword-aliases/features/steps.feature +28 -0
  64. package/tests/keyword-aliases/package-lock.json +1967 -0
  65. package/tests/keyword-aliases/package.json +11 -0
  66. package/tests/keyword-aliases/vite.config.js +9 -0
  67. package/tests/tags/features/skip.feature +9 -0
  68. package/tests/tags/features/step_definitions/steps.js +30 -0
  69. package/tests/tags/features/tags-scenario-outline.feature +30 -0
  70. package/tests/tags/features/tags.feature +26 -0
  71. package/tests/tags/package-lock.json +1967 -0
  72. package/tests/tags/package.json +11 -0
  73. package/tests/tags/vite.config.js +12 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "type" : "module",
3
+ "devDependencies": {
4
+ "lodash": "^4.17.21",
5
+ "vitest": "^0.30.1",
6
+ "vitest-cucumber-plugin" : "../.."
7
+ },
8
+ "scripts" : {
9
+ "test" : "npx vitest run"
10
+ }
11
+ }
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from 'vitest/config'
2
+ import vitestCucumberPlugin from 'vitest-cucumber-plugin';
3
+
4
+ export default defineConfig({
5
+ plugins: [vitestCucumberPlugin()],
6
+ test: {
7
+ include : [ '**/*.feature' ]
8
+ },
9
+ })
@@ -0,0 +1,9 @@
1
+ @skip
2
+ Feature: Skip this entire feature
3
+ Scenario: It's another scenario!
4
+ Given I have a "apple"
5
+ When I get a "pea"
6
+ Then I have the following items:
7
+ | apple |
8
+ | bogus |
9
+
@@ -0,0 +1,30 @@
1
+ import { Given, When, Then, DataTable } from 'vitest-cucumber-plugin';
2
+ import { expect } from 'vitest'
3
+ import _ from 'lodash/fp';
4
+
5
+ const addItem = (state,[ item ],data) => { return { items : _.concat(state.items ? state.items : [],item) } };
6
+
7
+ Given('I have a {string}',addItem);
8
+ Then('I get a {string}',addItem);
9
+ Then('I have the following items:',(state,params,data) => {
10
+ const items = _.flatten(data);
11
+ expect(state.items).toEqual(items);
12
+ return state;
13
+ });
14
+ Then('I don\'t have a {string}',(state,[ item ],data) => {
15
+ expect(state.items).not.toContain(item);
16
+ return state;
17
+ });
18
+
19
+ Given('there are {int} cucumbers',(state,[ count ],data) => {
20
+ return _.set('cucumbers',count,state);
21
+ });
22
+
23
+ When('I eat {int} cucumbers',(state,[ count ],data) => {
24
+ return _.set('cucumbers',state.cucumbers - count,state);
25
+ });
26
+
27
+ Then('I should have {int} cucumbers',(state,[ count ],data) => {
28
+ expect(state.cucumbers).toEqual(count);
29
+ return state;
30
+ });
@@ -0,0 +1,30 @@
1
+ Feature: Tags support for Scenario Outlines
2
+ @good
3
+ Scenario Outline:
4
+ Given I have a '<item1>'
5
+ When I get a '<item2>'
6
+ Then I have the following items:
7
+ | apple |
8
+ | grape |
9
+
10
+ @good
11
+ Examples:
12
+ | item1 | item2 |
13
+ | apple | grape |
14
+
15
+ @skip
16
+ Examples:
17
+ | item1 | item2 |
18
+ | apple | bogus |
19
+
20
+ @skip
21
+ Scenario Outline:
22
+ Given I have a '<item1>'
23
+ When I get a '<item2>'
24
+ Then I have the following items:
25
+ | apple |
26
+ | grape |
27
+
28
+ Examples:
29
+ | item1 | item2 |
30
+ | bogus | grape |
@@ -0,0 +1,26 @@
1
+ @goodstuff @moregoodstuff
2
+ Feature: Tags support
3
+
4
+ @skip
5
+ Scenario: What's the scenario?
6
+ Given I have a "apple"
7
+ When I get a "pea"
8
+ Then I have the following items:
9
+ | bogus |
10
+ | pea |
11
+
12
+ @yuck
13
+ Scenario: It's another scenario!
14
+ Given I have a "apple"
15
+ When I get a "pea"
16
+ Then I have the following items:
17
+ | apple |
18
+ | bogus |
19
+
20
+ @good
21
+ Scenario: It's another scenario!
22
+ Given I have a "apple"
23
+ When I get a "pea"
24
+ Then I have the following items:
25
+ | apple |
26
+ | pea |