vitest-cucumber-plugin 0.1.4 → 0.1.5
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 +12 -7
- package/README.md +0 -1
- package/RELEASE_NOTES.md +1 -0
- package/package.json +2 -2
- package/src/gherkin.js +28 -10
- package/src/gherkin.ne +27 -9
- package/src/gherkin.umd.js +24 -9
- package/tests/background/package-lock.json +580 -20
- package/tests/comments/package-lock.json +580 -20
- package/tests/data-tables/features/data-tables-escaping.feature +27 -0
- package/tests/data-tables/package-lock.json +580 -20
- package/tests/is-it-friday/package-lock.json +580 -20
- package/tests/is-it-friday-scenario-outline/package-lock.json +580 -20
- package/tests/is-it-friday-two-scenarios/package-lock.json +580 -20
- package/tests/is-it-friday-two-scenarios-multiple-feature-files/package-lock.json +580 -20
- package/tests/keyword-aliases/package-lock.json +580 -20
- package/tests/tags/package-lock.json +580 -20
- package/tests/data-tables/vite.config.js.timestamp-1682359000824-3876ac2e9095b.mjs +0 -13
package/CONTRIBUTING.md
CHANGED
|
@@ -37,10 +37,15 @@ branching model. The 'main' branch the release branch and is only pushed to dur
|
|
|
37
37
|
## Doing a release
|
|
38
38
|
|
|
39
39
|
1. ```$ VERSION=<version>```
|
|
40
|
-
1. ```$ git flow release start $VERSION```
|
|
41
|
-
1.
|
|
42
|
-
1.
|
|
43
|
-
1.
|
|
44
|
-
|
|
45
|
-
1.
|
|
46
|
-
|
|
40
|
+
1. ```$ git flow release start v$VERSION```
|
|
41
|
+
1. ```$ npm pkg set version=$VERSION```
|
|
42
|
+
1. ```$ sed -i "1s/^/* v$VERSION : \!\!\! ADD RELEASE NOTE HERE \!\!\!\n/" RELEASE_NOTES.md```
|
|
43
|
+
1. ```$ emacs -nw RELEASE_NOTES.md```
|
|
44
|
+
2. ```$ npm test```
|
|
45
|
+
1. ```$ git add . ; git commit -m v$VERSION```
|
|
46
|
+
3. ```$ git flow release finish v$VERSION```
|
|
47
|
+
4. ```$ git push```
|
|
48
|
+
5. ```$ git checkout main```
|
|
49
|
+
6. ```$ git push```
|
|
50
|
+
7. ```$ git push origin v$VERSION```
|
|
51
|
+
8. ```$ npm publish```
|
package/README.md
CHANGED
|
@@ -109,5 +109,4 @@ work, but this configuration isn't tested.
|
|
|
109
109
|
This plugin is not yet feature complete. Here is the list of features from Cucumber which aren't yet implemented:
|
|
110
110
|
* Rule keyword
|
|
111
111
|
* Doc strings
|
|
112
|
-
* Data Table escape characters
|
|
113
112
|
* Boolean expression support for tags
|
package/RELEASE_NOTES.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-cucumber-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Plugin for Vitest which allows for tests to be written in Cucumber format.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vite",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"@types/lodash": "^4.14.194",
|
|
31
31
|
"rollup": "^3.20.7"
|
|
32
32
|
},
|
|
33
|
-
"repository"
|
|
33
|
+
"repository": "https://github.com/SamZiegler/vitest-cucumber-plugin.git"
|
|
34
34
|
}
|
package/src/gherkin.js
CHANGED
|
@@ -40,9 +40,12 @@ const log = pino();
|
|
|
40
40
|
|
|
41
41
|
log.level = 'warn';
|
|
42
42
|
|
|
43
|
+
const setLogLevel = (logLevel) => { log.level = logLevel; };
|
|
44
|
+
|
|
43
45
|
var logger = /*#__PURE__*/Object.freeze({
|
|
44
46
|
__proto__: null,
|
|
45
|
-
log: log
|
|
47
|
+
log: log,
|
|
48
|
+
setLogLevel: setLogLevel
|
|
46
49
|
});
|
|
47
50
|
|
|
48
51
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(logger);
|
|
@@ -63,10 +66,12 @@ var require$$2 = /*@__PURE__*/getAugmentedNamespace(logger);
|
|
|
63
66
|
colon : ':',
|
|
64
67
|
step : '*',
|
|
65
68
|
pipe : '|',
|
|
66
|
-
|
|
69
|
+
escapedPipe : '\\|',
|
|
70
|
+
escapedNewline : '\\n',
|
|
71
|
+
escapedBackSlash : '\\\\',
|
|
67
72
|
scenarioOutline : ['Scenario Outline','Scenario Template'],
|
|
68
73
|
word : {
|
|
69
|
-
match : /[^ \t\n
|
|
74
|
+
match : /[^ \t\n\:\|\@\*]+/,
|
|
70
75
|
type : moo.keywords({
|
|
71
76
|
feature : 'Feature',
|
|
72
77
|
examples : ['Examples','Scenarios'],
|
|
@@ -127,7 +132,15 @@ var require$$2 = /*@__PURE__*/getAugmentedNamespace(logger);
|
|
|
127
132
|
{"name": "dataTable", "symbols": ["dataTable", "dataTableRow"], "postprocess": data => fp.concat(data[0],[data[1]])},
|
|
128
133
|
{"name": "dataTableRow", "symbols": ["_", (lexer.has("pipe") ? {type: "pipe"} : pipe), "dataTableColumns", (lexer.has("newline") ? {type: "newline"} : newline)], "postprocess": data => data[2]},
|
|
129
134
|
{"name": "dataTableColumns", "symbols": [], "postprocess": data => []},
|
|
130
|
-
{"name": "dataTableColumns", "symbols": ["dataTableColumns", "
|
|
135
|
+
{"name": "dataTableColumns", "symbols": ["dataTableColumns", "dataTableColumnText", (lexer.has("pipe") ? {type: "pipe"} : pipe)], "postprocess": data => fp.concat(data[0],data[1].trim())},
|
|
136
|
+
{"name": "dataTableColumnText", "symbols": [], "postprocess": data => ''},
|
|
137
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", "escapedColumnCharaters"], "postprocess": data => data[0]+data[1]},
|
|
138
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", "keywords"], "postprocess": data => data[0]+data[1]},
|
|
139
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", (lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[0]+data[1].value},
|
|
140
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", (lexer.has("ws") ? {type: "ws"} : ws)], "postprocess": data => data[0]+data[1].value},
|
|
141
|
+
{"name": "escapedColumnCharaters", "symbols": [(lexer.has("escapedPipe") ? {type: "escapedPipe"} : escapedPipe)], "postprocess": data => '|'},
|
|
142
|
+
{"name": "escapedColumnCharaters", "symbols": [(lexer.has("escapedBackSlash") ? {type: "escapedBackSlash"} : escapedBackSlash)], "postprocess": data => '\\'},
|
|
143
|
+
{"name": "escapedColumnCharaters", "symbols": [(lexer.has("escapedNewline") ? {type: "escapedNewline"} : escapedNewline)], "postprocess": data => '\n'},
|
|
131
144
|
{"name": "steps", "symbols": ["stepAndTable", "moreSteps"], "postprocess": data => fp.concat(data[0],data[1])},
|
|
132
145
|
{"name": "moreSteps", "symbols": [], "postprocess": data => []},
|
|
133
146
|
{"name": "moreSteps", "symbols": ["moreSteps", "stepAndTable"], "postprocess": data => fp.concat(data[0],data[1])},
|
|
@@ -138,12 +151,17 @@ var require$$2 = /*@__PURE__*/getAugmentedNamespace(logger);
|
|
|
138
151
|
{"name": "text", "symbols": [], "postprocess": data => ''},
|
|
139
152
|
{"name": "text", "symbols": ["text", (lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[0]+data[1].value},
|
|
140
153
|
{"name": "text", "symbols": ["text", (lexer.has("ws") ? {type: "ws"} : ws)], "postprocess": data => data[0]+data[1].value},
|
|
141
|
-
{"name": "text", "symbols": ["text",
|
|
142
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
143
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
144
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
145
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
146
|
-
{"name": "
|
|
154
|
+
{"name": "text", "symbols": ["text", "keywords"], "postprocess": data => data[0]+data[1]},
|
|
155
|
+
{"name": "text", "symbols": ["text", (lexer.has("pipe") ? {type: "pipe"} : pipe)], "postprocess": data => data[0]+data[1].value},
|
|
156
|
+
{"name": "text", "symbols": ["text", (lexer.has("escapedPipe") ? {type: "escapedPipe"} : escapedPipe)], "postprocess": data => data[0]+data[1].value},
|
|
157
|
+
{"name": "text", "symbols": ["text", (lexer.has("escapedNewline") ? {type: "escapedNewline"} : escapedNewline)], "postprocess": data => data[0]+data[1].value},
|
|
158
|
+
{"name": "text", "symbols": ["text", (lexer.has("escapedBackSlash") ? {type: "escapedBackSlash"} : escapedBackSlash)], "postprocess": data => data[0]+data[1].value},
|
|
159
|
+
{"name": "keywords", "symbols": [(lexer.has("step") ? {type: "step"} : step)], "postprocess": data => data[0].value},
|
|
160
|
+
{"name": "keywords", "symbols": [(lexer.has("colon") ? {type: "colon"} : colon)], "postprocess": data => data[0].value},
|
|
161
|
+
{"name": "keywords", "symbols": [(lexer.has("example") ? {type: "example"} : example)], "postprocess": data => data[0].value},
|
|
162
|
+
{"name": "keywords", "symbols": [(lexer.has("examples") ? {type: "examples"} : examples)], "postprocess": data => data[0].value},
|
|
163
|
+
{"name": "keywords", "symbols": [(lexer.has("scenarioOutline") ? {type: "scenarioOutline"} : scenarioOutline)], "postprocess": data => data[0].value},
|
|
164
|
+
{"name": "keywords", "symbols": [(lexer.has("background") ? {type: "background"} : background)], "postprocess": data => data[0].value},
|
|
147
165
|
{"name": "bolText", "symbols": [(lexer.has("ws") ? {type: "ws"} : ws), (lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[1].value},
|
|
148
166
|
{"name": "bolText", "symbols": [(lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[0].value},
|
|
149
167
|
{"name": "freeform", "symbols": [], "postprocess": data => ''},
|
package/src/gherkin.ne
CHANGED
|
@@ -10,10 +10,12 @@ const lexer = moo.compile({
|
|
|
10
10
|
colon : ':',
|
|
11
11
|
step : '*',
|
|
12
12
|
pipe : '|',
|
|
13
|
-
|
|
13
|
+
escapedPipe : '\\|',
|
|
14
|
+
escapedNewline : '\\n',
|
|
15
|
+
escapedBackSlash : '\\\\',
|
|
14
16
|
scenarioOutline : ['Scenario Outline','Scenario Template'],
|
|
15
17
|
word : {
|
|
16
|
-
match : /[^ \t\n
|
|
18
|
+
match : /[^ \t\n\:\|\@\*]+/,
|
|
17
19
|
type : moo.keywords({
|
|
18
20
|
feature : 'Feature',
|
|
19
21
|
examples : ['Examples','Scenarios'],
|
|
@@ -90,7 +92,17 @@ dataTable -> null {% data => [] %}
|
|
|
90
92
|
dataTableRow -> _ %pipe dataTableColumns %newline {% data => data[2] %}
|
|
91
93
|
|
|
92
94
|
dataTableColumns -> null {% data => [] %}
|
|
93
|
-
| dataTableColumns
|
|
95
|
+
| dataTableColumns dataTableColumnText %pipe {% data => fp.concat(data[0],data[1].trim()) %}
|
|
96
|
+
|
|
97
|
+
dataTableColumnText -> null {% data => '' %}
|
|
98
|
+
| dataTableColumnText escapedColumnCharaters {% data => data[0]+data[1] %}
|
|
99
|
+
| dataTableColumnText keywords {% data => data[0]+data[1] %}
|
|
100
|
+
| dataTableColumnText %word {% data => data[0]+data[1].value %}
|
|
101
|
+
| dataTableColumnText %ws {% data => data[0]+data[1].value %}
|
|
102
|
+
|
|
103
|
+
escapedColumnCharaters -> %escapedPipe {% data => '|' %}
|
|
104
|
+
| %escapedBackSlash {% data => '\\' %}
|
|
105
|
+
| %escapedNewline {% data => '\n' %}
|
|
94
106
|
|
|
95
107
|
steps -> stepAndTable moreSteps {% data => fp.concat(data[0],data[1]) %}
|
|
96
108
|
|
|
@@ -106,12 +118,18 @@ stepKeyword -> %step {% (data) => { return { type : 'step', name : data[0].value
|
|
|
106
118
|
text -> null {% data => '' %}
|
|
107
119
|
| text %word {% data => data[0]+data[1].value %}
|
|
108
120
|
| text %ws {% data => data[0]+data[1].value %}
|
|
109
|
-
| text
|
|
110
|
-
| text %
|
|
111
|
-
| text %
|
|
112
|
-
| text %
|
|
113
|
-
| text %
|
|
114
|
-
|
|
121
|
+
| text keywords {% data => data[0]+data[1] %}
|
|
122
|
+
| text %pipe {% data => data[0]+data[1].value %}
|
|
123
|
+
| text %escapedPipe {% data => data[0]+data[1].value %}
|
|
124
|
+
| text %escapedNewline {% data => data[0]+data[1].value %}
|
|
125
|
+
| text %escapedBackSlash {% data => data[0]+data[1].value %}
|
|
126
|
+
|
|
127
|
+
keywords -> %step {% data => data[0].value %}
|
|
128
|
+
| %colon {% data => data[0].value %}
|
|
129
|
+
| %example {% data => data[0].value %}
|
|
130
|
+
| %examples {% data => data[0].value %}
|
|
131
|
+
| %scenarioOutline {% data => data[0].value %}
|
|
132
|
+
| %background {% data => data[0].value %}
|
|
115
133
|
|
|
116
134
|
bolText -> %ws %word {% data => data[1].value %}
|
|
117
135
|
| %word {% data => data[0].value %}
|
package/src/gherkin.umd.js
CHANGED
|
@@ -14,10 +14,12 @@ const lexer = moo.compile({
|
|
|
14
14
|
colon : ':',
|
|
15
15
|
step : '*',
|
|
16
16
|
pipe : '|',
|
|
17
|
-
|
|
17
|
+
escapedPipe : '\\|',
|
|
18
|
+
escapedNewline : '\\n',
|
|
19
|
+
escapedBackSlash : '\\\\',
|
|
18
20
|
scenarioOutline : ['Scenario Outline','Scenario Template'],
|
|
19
21
|
word : {
|
|
20
|
-
match : /[^ \t\n
|
|
22
|
+
match : /[^ \t\n\:\|\@\*]+/,
|
|
21
23
|
type : moo.keywords({
|
|
22
24
|
feature : 'Feature',
|
|
23
25
|
examples : ['Examples','Scenarios'],
|
|
@@ -78,7 +80,15 @@ var grammar = {
|
|
|
78
80
|
{"name": "dataTable", "symbols": ["dataTable", "dataTableRow"], "postprocess": data => fp.concat(data[0],[data[1]])},
|
|
79
81
|
{"name": "dataTableRow", "symbols": ["_", (lexer.has("pipe") ? {type: "pipe"} : pipe), "dataTableColumns", (lexer.has("newline") ? {type: "newline"} : newline)], "postprocess": data => data[2]},
|
|
80
82
|
{"name": "dataTableColumns", "symbols": [], "postprocess": data => []},
|
|
81
|
-
{"name": "dataTableColumns", "symbols": ["dataTableColumns", "
|
|
83
|
+
{"name": "dataTableColumns", "symbols": ["dataTableColumns", "dataTableColumnText", (lexer.has("pipe") ? {type: "pipe"} : pipe)], "postprocess": data => fp.concat(data[0],data[1].trim())},
|
|
84
|
+
{"name": "dataTableColumnText", "symbols": [], "postprocess": data => ''},
|
|
85
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", "escapedColumnCharaters"], "postprocess": data => data[0]+data[1]},
|
|
86
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", "keywords"], "postprocess": data => data[0]+data[1]},
|
|
87
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", (lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[0]+data[1].value},
|
|
88
|
+
{"name": "dataTableColumnText", "symbols": ["dataTableColumnText", (lexer.has("ws") ? {type: "ws"} : ws)], "postprocess": data => data[0]+data[1].value},
|
|
89
|
+
{"name": "escapedColumnCharaters", "symbols": [(lexer.has("escapedPipe") ? {type: "escapedPipe"} : escapedPipe)], "postprocess": data => '|'},
|
|
90
|
+
{"name": "escapedColumnCharaters", "symbols": [(lexer.has("escapedBackSlash") ? {type: "escapedBackSlash"} : escapedBackSlash)], "postprocess": data => '\\'},
|
|
91
|
+
{"name": "escapedColumnCharaters", "symbols": [(lexer.has("escapedNewline") ? {type: "escapedNewline"} : escapedNewline)], "postprocess": data => '\n'},
|
|
82
92
|
{"name": "steps", "symbols": ["stepAndTable", "moreSteps"], "postprocess": data => fp.concat(data[0],data[1])},
|
|
83
93
|
{"name": "moreSteps", "symbols": [], "postprocess": data => []},
|
|
84
94
|
{"name": "moreSteps", "symbols": ["moreSteps", "stepAndTable"], "postprocess": data => fp.concat(data[0],data[1])},
|
|
@@ -89,12 +99,17 @@ var grammar = {
|
|
|
89
99
|
{"name": "text", "symbols": [], "postprocess": data => ''},
|
|
90
100
|
{"name": "text", "symbols": ["text", (lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[0]+data[1].value},
|
|
91
101
|
{"name": "text", "symbols": ["text", (lexer.has("ws") ? {type: "ws"} : ws)], "postprocess": data => data[0]+data[1].value},
|
|
92
|
-
{"name": "text", "symbols": ["text",
|
|
93
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
94
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
95
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
96
|
-
{"name": "text", "symbols": ["text", (lexer.has("
|
|
97
|
-
{"name": "
|
|
102
|
+
{"name": "text", "symbols": ["text", "keywords"], "postprocess": data => data[0]+data[1]},
|
|
103
|
+
{"name": "text", "symbols": ["text", (lexer.has("pipe") ? {type: "pipe"} : pipe)], "postprocess": data => data[0]+data[1].value},
|
|
104
|
+
{"name": "text", "symbols": ["text", (lexer.has("escapedPipe") ? {type: "escapedPipe"} : escapedPipe)], "postprocess": data => data[0]+data[1].value},
|
|
105
|
+
{"name": "text", "symbols": ["text", (lexer.has("escapedNewline") ? {type: "escapedNewline"} : escapedNewline)], "postprocess": data => data[0]+data[1].value},
|
|
106
|
+
{"name": "text", "symbols": ["text", (lexer.has("escapedBackSlash") ? {type: "escapedBackSlash"} : escapedBackSlash)], "postprocess": data => data[0]+data[1].value},
|
|
107
|
+
{"name": "keywords", "symbols": [(lexer.has("step") ? {type: "step"} : step)], "postprocess": data => data[0].value},
|
|
108
|
+
{"name": "keywords", "symbols": [(lexer.has("colon") ? {type: "colon"} : colon)], "postprocess": data => data[0].value},
|
|
109
|
+
{"name": "keywords", "symbols": [(lexer.has("example") ? {type: "example"} : example)], "postprocess": data => data[0].value},
|
|
110
|
+
{"name": "keywords", "symbols": [(lexer.has("examples") ? {type: "examples"} : examples)], "postprocess": data => data[0].value},
|
|
111
|
+
{"name": "keywords", "symbols": [(lexer.has("scenarioOutline") ? {type: "scenarioOutline"} : scenarioOutline)], "postprocess": data => data[0].value},
|
|
112
|
+
{"name": "keywords", "symbols": [(lexer.has("background") ? {type: "background"} : background)], "postprocess": data => data[0].value},
|
|
98
113
|
{"name": "bolText", "symbols": [(lexer.has("ws") ? {type: "ws"} : ws), (lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[1].value},
|
|
99
114
|
{"name": "bolText", "symbols": [(lexer.has("word") ? {type: "word"} : word)], "postprocess": data => data[0].value},
|
|
100
115
|
{"name": "freeform", "symbols": [], "postprocess": data => ''},
|