Skip to content

Commit 81ea97b

Browse files
committed
Update @cucumber dependencies to latest
1 parent e450dc1 commit 81ea97b

File tree

12 files changed

+161
-140
lines changed

12 files changed

+161
-140
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Unreleased
6+
7+
- Updated all `@cucumber/*` dependencies.
8+
59
## v11.5.1
610

711
- Expose member `getStepDefinitionPatterns`.

docs/tags.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Tests can be filtered using the (Cypress-) [environment variable](https://docs.c
55
A feature or scenario can have as many tags as you like, separated by spaces. Tags can be placed above the following Gherkin elements.
66

77
* `Feature`
8-
* `scenario`
8+
* `Rule`
9+
* `Scenario`
910
* `Scenario Outline`
1011
* `Examples`
1112

features/parse_error.feature

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ Feature: parse errors
55
"""
66
Feature: a feature name
77
@tag
8-
Rule: a rule name
8+
Background: a backgrund name
99
"""
1010
When I run cypress
1111
Then it fails
1212
And the output should contain
1313
"""
14-
(3:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: a rule name'
14+
(3:3): expected: #TagLine, #RuleLine, #Comment, #Empty, got 'Background: a backgrund name'
1515
"""
16-

lib/add-cucumber-preprocessor-plugin.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import child_process from "child_process";
66

77
import chalk from "chalk";
88

9-
import { messages } from "@cucumber/messages";
9+
import messages, { IdGenerator, SourceMediaType } from "@cucumber/messages";
1010

1111
import parse from "@cucumber/tag-expressions";
1212

1313
import { generateMessages } from "@cucumber/gherkin";
1414

15-
import { IdGenerator } from "@cucumber/messages";
16-
1715
import {
1816
getTestFiles,
1917
ICypressConfiguration,
@@ -62,7 +60,7 @@ function memoize<T extends (...args: any[]) => any>(
6260
const resolve = memoize(origResolve);
6361

6462
let currentTestStepStartedId: string;
65-
let currentSpecMessages: messages.IEnvelope[];
63+
let currentSpecMessages: messages.Envelope[];
6664

6765
export async function beforeRunHandler(config: Cypress.PluginConfigOptions) {
6866
const preprocessor = await resolve(config, config.env);
@@ -201,13 +199,13 @@ export async function afterScreenshotHandler(
201199
return details;
202200
}
203201

204-
const message: messages.IEnvelope = {
202+
const message: messages.Envelope = {
205203
attachment: {
206204
testStepId: currentTestStepStartedId,
207205
body: buffer.toString("base64"),
208206
mediaType: "image/png",
209207
contentEncoding:
210-
"BASE64" as unknown as messages.Attachment.ContentEncoding,
208+
"BASE64" as unknown as messages.AttachmentContentEncoding.BASE64,
211209
},
212210
};
213211

@@ -256,7 +254,7 @@ export default async function addCucumberPreprocessorPlugin(
256254
}
257255

258256
on("task", {
259-
[TASK_APPEND_MESSAGES]: (messages: messages.IEnvelope[]) => {
257+
[TASK_APPEND_MESSAGES]: (messages: messages.Envelope[]) => {
260258
if (!currentSpecMessages) {
261259
return true;
262260
}
@@ -281,7 +279,7 @@ export default async function addCucumberPreprocessorPlugin(
281279
return true;
282280
}
283281

284-
const message: messages.IEnvelope = {
282+
const message: messages.Envelope = {
285283
attachment: {
286284
testStepId: currentTestStepStartedId,
287285
body: data,
@@ -315,7 +313,12 @@ export default async function addCucumberPreprocessorPlugin(
315313
newId: IdGenerator.incrementing(),
316314
};
317315

318-
const envelopes = generateMessages(content, testFile, options);
316+
const envelopes = generateMessages(
317+
content,
318+
testFile,
319+
SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_PLAIN,
320+
options
321+
);
319322

320323
const pickles = envelopes
321324
.map((envelope) => envelope.pickle)

lib/ast-helpers.ts

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { messages } from "@cucumber/messages";
1+
import messages from "@cucumber/messages";
22

33
import { assertAndReturn } from "./assertions";
44

55
export function* traverseGherkinDocument(
6-
gherkinDocument: messages.IGherkinDocument
6+
gherkinDocument: messages.GherkinDocument
77
) {
88
yield gherkinDocument;
99

@@ -12,7 +12,7 @@ export function* traverseGherkinDocument(
1212
}
1313
}
1414

15-
function* traverseFeature(feature: messages.GherkinDocument.IFeature) {
15+
function* traverseFeature(feature: messages.Feature) {
1616
yield feature;
1717

1818
if (feature.location) {
@@ -32,9 +32,7 @@ function* traverseFeature(feature: messages.GherkinDocument.IFeature) {
3232
}
3333
}
3434

35-
function* traverseFeatureChild(
36-
featureChild: messages.GherkinDocument.Feature.IFeatureChild
37-
) {
35+
function* traverseFeatureChild(featureChild: messages.FeatureChild) {
3836
yield featureChild;
3937

4038
if (featureChild.rule) {
@@ -50,9 +48,7 @@ function* traverseFeatureChild(
5048
}
5149
}
5250

53-
function* traverseFeatureRule(
54-
rule: messages.GherkinDocument.Feature.FeatureChild.IRule
55-
) {
51+
function* traverseFeatureRule(rule: messages.Rule) {
5652
yield rule;
5753

5854
if (rule.location) {
@@ -66,9 +62,7 @@ function* traverseFeatureRule(
6662
}
6763
}
6864

69-
function* traverseRuleChild(
70-
ruleChild: messages.GherkinDocument.Feature.FeatureChild.IRuleChild
71-
) {
65+
function* traverseRuleChild(ruleChild: messages.RuleChild) {
7266
yield ruleChild;
7367

7468
if (ruleChild.background) {
@@ -80,9 +74,7 @@ function* traverseRuleChild(
8074
}
8175
}
8276

83-
function* traverseBackground(
84-
backgorund: messages.GherkinDocument.Feature.IBackground
85-
) {
77+
function* traverseBackground(backgorund: messages.Background) {
8678
yield backgorund;
8779

8880
if (backgorund.location) {
@@ -96,9 +88,7 @@ function* traverseBackground(
9688
}
9789
}
9890

99-
function* traverseScenario(
100-
scenario: messages.GherkinDocument.Feature.IScenario
101-
) {
91+
function* traverseScenario(scenario: messages.Scenario) {
10292
yield scenario;
10393

10494
if (scenario.location) {
@@ -118,7 +108,7 @@ function* traverseScenario(
118108
}
119109
}
120110

121-
function* traverseStep(step: messages.GherkinDocument.Feature.IStep) {
111+
function* traverseStep(step: messages.Step) {
122112
yield step;
123113

124114
if (step.location) {
@@ -134,19 +124,15 @@ function* traverseStep(step: messages.GherkinDocument.Feature.IStep) {
134124
}
135125
}
136126

137-
function* traverseDocString(
138-
docString: messages.GherkinDocument.Feature.Step.IDocString
139-
) {
127+
function* traverseDocString(docString: messages.DocString) {
140128
yield docString;
141129

142130
if (docString.location) {
143131
yield docString.location;
144132
}
145133
}
146134

147-
function* traverseDataTable(
148-
dataTable: messages.GherkinDocument.Feature.Step.IDataTable
149-
) {
135+
function* traverseDataTable(dataTable: messages.DataTable) {
150136
yield dataTable;
151137

152138
if (dataTable.location) {
@@ -160,7 +146,7 @@ function* traverseDataTable(
160146
}
161147
}
162148

163-
function* traverseRow(row: messages.GherkinDocument.Feature.ITableRow) {
149+
function* traverseRow(row: messages.TableRow) {
164150
yield row;
165151

166152
if (row.location) {
@@ -174,19 +160,15 @@ function* traverseRow(row: messages.GherkinDocument.Feature.ITableRow) {
174160
}
175161
}
176162

177-
function* traverseCell(
178-
cell: messages.GherkinDocument.Feature.TableRow.ITableCell
179-
) {
163+
function* traverseCell(cell: messages.TableCell) {
180164
yield cell;
181165

182166
if (cell.location) {
183167
yield cell.location;
184168
}
185169
}
186170

187-
function* traverseExample(
188-
example: messages.GherkinDocument.Feature.Scenario.IExamples
189-
) {
171+
function* traverseExample(example: messages.Examples) {
190172
yield example;
191173

192174
if (example.location) {
@@ -205,7 +187,7 @@ function* traverseExample(
205187
}
206188

207189
export function collectTagNames(
208-
tags: messages.GherkinDocument.Feature.ITag[] | null | undefined
190+
tags: readonly (messages.Tag | messages.PickleTag)[] | null | undefined
209191
) {
210192
return (
211193
tags?.map((tag) =>

0 commit comments

Comments
 (0)