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.
- package/CONTRIBUTING.md +42 -0
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/RELEASE_NOTES.md +9 -0
- package/package.json +34 -0
- package/rollup-nearley.js +10 -0
- package/run-tests +8 -0
- package/src/generate/example.js +20 -0
- package/src/generate/examples.js +47 -0
- package/src/generate/feature.js +45 -0
- package/src/generate/index.js +13 -0
- package/src/generate/scenarioOutline.js +18 -0
- package/src/generate/tests.js +23 -0
- package/src/generate/util.js +10 -0
- package/src/gherkin.js +171 -0
- package/src/gherkin.ne +130 -0
- package/src/gherkin.umd.js +118 -0
- package/src/index.js +65 -0
- package/src/logger.js +7 -0
- package/src/parameterize.js +7 -0
- package/src/parse.js +21 -0
- package/src/steps.js +42 -0
- package/tests/background/features/background.feature +25 -0
- package/tests/background/features/step_definitions/steps.js +30 -0
- package/tests/background/package-lock.json +1967 -0
- package/tests/background/package.json +11 -0
- package/tests/background/vite.config.js +9 -0
- package/tests/comments/features/is-it-friday.feature +10 -0
- package/tests/comments/features/step_definitions/stepdefs.js +15 -0
- package/tests/comments/package-lock.json +1967 -0
- package/tests/comments/package.json +11 -0
- package/tests/comments/vite.config.js +9 -0
- package/tests/data-tables/features/data-tables.feature +25 -0
- package/tests/data-tables/features/step_definitions/data-tables.js +21 -0
- package/tests/data-tables/package-lock.json +1967 -0
- package/tests/data-tables/package.json +11 -0
- package/tests/data-tables/vite.config.js +9 -0
- package/tests/data-tables/vite.config.js.timestamp-1682359000824-3876ac2e9095b.mjs +13 -0
- package/tests/is-it-friday/features/is-it-friday.feature +7 -0
- package/tests/is-it-friday/features/step_definitions/stepdefs.js +15 -0
- package/tests/is-it-friday/package-lock.json +1967 -0
- package/tests/is-it-friday/package.json +11 -0
- package/tests/is-it-friday/vite.config.js +9 -0
- package/tests/is-it-friday-scenario-outline/features/is-it-friday.feature +13 -0
- package/tests/is-it-friday-scenario-outline/features/step_definitions/stepdefs.js +15 -0
- package/tests/is-it-friday-scenario-outline/package-lock.json +1967 -0
- package/tests/is-it-friday-scenario-outline/package.json +11 -0
- package/tests/is-it-friday-scenario-outline/vite.config.js +9 -0
- package/tests/is-it-friday-two-scenarios/features/is-it-friday.feature +12 -0
- package/tests/is-it-friday-two-scenarios/features/step_definitions/stepdefs.js +19 -0
- package/tests/is-it-friday-two-scenarios/package-lock.json +1967 -0
- package/tests/is-it-friday-two-scenarios/package.json +11 -0
- package/tests/is-it-friday-two-scenarios/vite.config.js +9 -0
- package/tests/is-it-friday-two-scenarios-multiple-feature-files/features/friday.feature +7 -0
- package/tests/is-it-friday-two-scenarios-multiple-feature-files/features/step_definitions/stepdefs.js +19 -0
- package/tests/is-it-friday-two-scenarios-multiple-feature-files/features/sunday.feature +8 -0
- package/tests/is-it-friday-two-scenarios-multiple-feature-files/package-lock.json +1967 -0
- package/tests/is-it-friday-two-scenarios-multiple-feature-files/package.json +11 -0
- package/tests/is-it-friday-two-scenarios-multiple-feature-files/vite.config.js +9 -0
- package/tests/keyword-aliases/features/scenario-outline.feature +20 -0
- package/tests/keyword-aliases/features/scenario.feature +14 -0
- package/tests/keyword-aliases/features/step_definitions/steps.js +30 -0
- package/tests/keyword-aliases/features/steps.feature +28 -0
- package/tests/keyword-aliases/package-lock.json +1967 -0
- package/tests/keyword-aliases/package.json +11 -0
- package/tests/keyword-aliases/vite.config.js +9 -0
- package/tests/tags/features/skip.feature +9 -0
- package/tests/tags/features/step_definitions/steps.js +30 -0
- package/tests/tags/features/tags-scenario-outline.feature +30 -0
- package/tests/tags/features/tags.feature +26 -0
- package/tests/tags/package-lock.json +1967 -0
- package/tests/tags/package.json +11 -0
- package/tests/tags/vite.config.js +12 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Feature: Scenario is an alias for Example
|
|
2
|
+
Scenario Outline: This is the Scenario Outline keyword
|
|
3
|
+
Given there are <start> cucumbers
|
|
4
|
+
When I eat <eat> cucumbers
|
|
5
|
+
Then I should have <left> cucumbers
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
| start | eat | left |
|
|
9
|
+
| 12 | 5 | 7 |
|
|
10
|
+
| 20 | 5 | 15 |
|
|
11
|
+
|
|
12
|
+
Scenario Template: This is the Scenario Template keyword
|
|
13
|
+
Given there are <start> cucumbers
|
|
14
|
+
When I eat <eat> cucumbers
|
|
15
|
+
Then I should have <left> cucumbers
|
|
16
|
+
|
|
17
|
+
Scenarios:
|
|
18
|
+
| start | eat | left |
|
|
19
|
+
| 12 | 5 | 7 |
|
|
20
|
+
| 20 | 5 | 15 |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: Scenario is an alias for Example
|
|
2
|
+
Example: This is the Example keyword
|
|
3
|
+
Given I have a "apple"
|
|
4
|
+
When I get a "orange"
|
|
5
|
+
Then I have the following items:
|
|
6
|
+
| apple |
|
|
7
|
+
| orange |
|
|
8
|
+
|
|
9
|
+
Scenario: This is the Scenario keyword
|
|
10
|
+
Given I have a "apple"
|
|
11
|
+
When I get a "orange"
|
|
12
|
+
Then I have the following items:
|
|
13
|
+
| apple |
|
|
14
|
+
| orange |
|
|
@@ -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,28 @@
|
|
|
1
|
+
Feature: Scenario is an alias for Example
|
|
2
|
+
Example: This example just uses steps
|
|
3
|
+
Given I have a "apple"
|
|
4
|
+
Given I have a "grape"
|
|
5
|
+
Given I have a "cherry"
|
|
6
|
+
When I get a "orange"
|
|
7
|
+
When I get a "pear"
|
|
8
|
+
Then I have the following items:
|
|
9
|
+
| apple |
|
|
10
|
+
| grape |
|
|
11
|
+
| cherry |
|
|
12
|
+
| orange |
|
|
13
|
+
| pear |
|
|
14
|
+
Then I don't have a "pizza"
|
|
15
|
+
|
|
16
|
+
Example: This example uses step aliases
|
|
17
|
+
Given I have a "apple"
|
|
18
|
+
And I have a "grape"
|
|
19
|
+
* I have a "cherry"
|
|
20
|
+
When I get a "orange"
|
|
21
|
+
And I get a "pear"
|
|
22
|
+
Then I have the following items:
|
|
23
|
+
| apple |
|
|
24
|
+
| grape |
|
|
25
|
+
| cherry |
|
|
26
|
+
| orange |
|
|
27
|
+
| pear |
|
|
28
|
+
But I don't have a "pizza"
|