Skip to content

Commit

Permalink
feat(deps): upgrade @cucumber/gherkin to v28
Browse files Browse the repository at this point in the history
  • Loading branch information
ychavoya committed May 10, 2024
1 parent 311570d commit f814610
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 141 deletions.
158 changes: 31 additions & 127 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"homepage": "https://github.com/bencompton/jest-cucumber#readme",
"dependencies": {
"@cucumber/gherkin": "^17.0.0",
"@cucumber/gherkin": "^28.0.0",
"callsites": "^3.0.0",
"glob": "^10.3.10",
"uuid": "^9.0.1"
Expand Down
22 changes: 9 additions & 13 deletions src/parsed-feature-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { readFileSync } from 'fs';
import { sync as globSync } from 'glob';
import { dirname, resolve } from 'path';
import callsites from 'callsites';
import { Parser, AstBuilder, Dialect, dialects } from '@cucumber/gherkin';
import { Parser, AstBuilder, Dialect, dialects, GherkinClassicTokenMatcher } from '@cucumber/gherkin';
import { v4 as uuidv4 } from 'uuid';

import { getJestCucumberConfiguration, Options } from './configuration';
Expand Down Expand Up @@ -41,18 +41,13 @@ const parseDataTable = (astDataTable: any, astDataTableHeader?: any) => {
};

const parseStepArgument = (astStep: any) => {
if (astStep) {
switch (astStep.argument) {
case 'dataTable':
return parseDataTable(astStep.dataTable);
case 'docString':
return astStep.docString.content;
default:
return null;
}
} else {
return null;
if (astStep?.dataTable) {
return parseDataTable(astStep.dataTable);
}
if (astStep?.docString) {
return astStep.docString.content;
}
return null;
};

const parseStep = (astStep: any) => {
Expand Down Expand Up @@ -323,7 +318,8 @@ export const parseFeature = (featureText: string, options?: Options): ParsedFeat

try {
const builder = new AstBuilder(uuidv4 as any);
ast = new Parser(builder).parse(featureText);
const tokenMatcher = new GherkinClassicTokenMatcher();
ast = new Parser(builder, tokenMatcher).parse(featureText);
} catch (err) {
throw new Error(`Error parsing feature Gherkin: ${err.message}`);
}
Expand Down

0 comments on commit f814610

Please sign in to comment.