Socket
Socket
Sign inDemoInstall

gherkin

Package Overview
Dependencies
Maintainers
4
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gherkin - npm Package Compare versions

Comparing version 8.2.0 to 8.2.1

dist/src/cli/createLocation.d.ts

43

dist/src/AstBuilder.js

@@ -21,2 +21,3 @@ "use strict";

var Errors_1 = require("./Errors");
var createLocation_1 = __importDefault(require("./cli/createLocation"));
var AstBuilder = /** @class */ (function () {

@@ -44,3 +45,3 @@ function AstBuilder(newId) {

if (token.matchedType === Parser_1.TokenType.Comment) {
this.comments.push(cucumber_messages_1.messages.GherkinDocument.Comment.fromObject({
this.comments.push(cucumber_messages_1.messages.GherkinDocument.Comment.create({
location: this.getLocation(token),

@@ -63,3 +64,3 @@ text: token.matchedText,

? token.location
: cucumber_messages_1.messages.Location.fromObject({ line: token.location.line, column: column });
: createLocation_1.default({ line: token.location.line, column: column });
};

@@ -80,6 +81,6 @@ AstBuilder.prototype.getTags = function (node) {

var tagItem = _d.value;
tags.push(cucumber_messages_1.messages.GherkinDocument.Feature.Tag.fromObject({
tags.push(cucumber_messages_1.messages.GherkinDocument.Feature.Tag.create({
location: this.getLocation(token, tagItem.column),
name: tagItem.text,
id: this.newId()
id: this.newId(),
}));

@@ -109,3 +110,3 @@ }

return tableRowToken.matchedItems.map(function (cellItem) {
return cucumber_messages_1.messages.GherkinDocument.Feature.TableRow.TableCell.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.TableRow.TableCell.create({
location: _this.getLocation(tableRowToken, cellItem.column),

@@ -125,3 +126,3 @@ value: cellItem.text,

var rows = node.getTokens(Parser_1.TokenType.TableRow).map(function (token) {
return cucumber_messages_1.messages.GherkinDocument.Feature.TableRow.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.TableRow.create({
id: _this.newId(),

@@ -153,3 +154,3 @@ location: _this.getLocation(token),

var docString = node.getSingle(Parser_1.RuleType.DocString);
return cucumber_messages_1.messages.GherkinDocument.Feature.Step.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.Step.create({
id: this.newId(),

@@ -170,3 +171,3 @@ location: this.getLocation(stepLine),

var content = lineTokens.map(function (t) { return t.matchedText; }).join('\n');
var result = cucumber_messages_1.messages.GherkinDocument.Feature.Step.DocString.fromObject({
var result = cucumber_messages_1.messages.GherkinDocument.Feature.Step.DocString.create({
location: this.getLocation(separatorToken),

@@ -184,3 +185,3 @@ content: content,

var rows = this.getTableRows(node);
return cucumber_messages_1.messages.GherkinDocument.Feature.Step.DataTable.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.Step.DataTable.create({
location: rows[0].location,

@@ -194,3 +195,3 @@ rows: rows,

var steps = this.getSteps(node);
return cucumber_messages_1.messages.GherkinDocument.Feature.Background.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.Background.create({
location: this.getLocation(backgroundLine),

@@ -210,3 +211,3 @@ keyword: backgroundLine.matchedKeyword,

var examples = scenarioNode.getItems(Parser_1.RuleType.ExamplesDefinition);
return cucumber_messages_1.messages.GherkinDocument.Feature.Scenario.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.Scenario.create({
id: this.newId(),

@@ -228,3 +229,3 @@ tags: tags,

var exampleTable = examplesNode.getSingle(Parser_1.RuleType.ExamplesTable);
return cucumber_messages_1.messages.GherkinDocument.Feature.Scenario.Examples.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.Scenario.Examples.create({
tags: tags,

@@ -265,3 +266,3 @@ location: this.getLocation(examplesLine),

if (background) {
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.fromObject({
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.create({
background: background,

@@ -273,3 +274,3 @@ }));

var scenario = _e.value;
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.fromObject({
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.create({
scenario: scenario,

@@ -289,3 +290,3 @@ }));

var rule = _g.value;
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.fromObject({
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.create({
rule: rule,

@@ -304,3 +305,3 @@ }));

var language = featureLine.matchedGherkinDialect;
return cucumber_messages_1.messages.GherkinDocument.Feature.fromObject({
return cucumber_messages_1.messages.GherkinDocument.Feature.create({
tags: tags,

@@ -320,3 +321,2 @@ location: this.getLocation(featureLine),

}
var tags = this.getTags(header);
var ruleLine = header.getToken(Parser_1.TokenType.RuleLine);

@@ -329,3 +329,3 @@ if (!ruleLine) {

if (background) {
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.fromObject({
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.create({
background: background,

@@ -337,3 +337,3 @@ }));

var scenario = _j.value;
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.fromObject({
children.push(cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.create({
scenario: scenario,

@@ -351,4 +351,3 @@ }));

var description = this.getDescription(header);
return cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.Rule.fromObject({
tags: tags,
return cucumber_messages_1.messages.GherkinDocument.Feature.FeatureChild.Rule.create({
location: this.getLocation(ruleLine),

@@ -363,3 +362,3 @@ keyword: ruleLine.matchedKeyword,

var feature = node.getSingle(Parser_1.RuleType.Feature);
return cucumber_messages_1.messages.GherkinDocument.fromObject({
return cucumber_messages_1.messages.GherkinDocument.create({
feature: feature,

@@ -366,0 +365,0 @@ comments: this.comments,

@@ -15,4 +15,7 @@ "use strict";

})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var cucumber_messages_1 = require("cucumber-messages");
var createLocation_1 = __importDefault(require("./cli/createLocation"));
var GherkinException = /** @class */ (function (_super) {

@@ -35,3 +38,4 @@ __extends(GherkinException, _super);

GherkinException._create = function (location, message) {
var m = "(" + location.line + ":" + location.column + "): " + message;
var column = location.column || 0;
var m = "(" + location.line + ":" + column + "): " + message;
var err = new this(m);

@@ -72,8 +76,3 @@ err.location = location;

var message = "expected: " + expectedTokenTypes.join(', ') + ", got '" + token.getTokenValue().trim() + "'";
var location = !token.location.column
? cucumber_messages_1.messages.Location.fromObject({
line: token.location.line,
column: token.line.indent + 1,
})
: token.location;
var location = tokenLocation(token);
return this._create(location, message);

@@ -91,8 +90,3 @@ };

var message = "unexpected end of file, expected: " + expectedTokenTypes.join(', ');
var location = token.location && token.line
? cucumber_messages_1.messages.Location.fromObject({
line: token.location.line,
column: token.line.indent + 1,
})
: token.location;
var location = tokenLocation(token);
return this._create(location, message);

@@ -126,2 +120,10 @@ };

exports.NoSuchLanguageException = NoSuchLanguageException;
function tokenLocation(token) {
return token.location && token.location.line && token.line && token.line.indent !== undefined
? createLocation_1.default({
line: token.location.line,
column: token.line.indent + 1,
})
: token.location;
}
//# sourceMappingURL=Errors.js.map
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var countSymbols_1 = __importDefault(require("../countSymbols"));
var cucumber_messages_1 = require("cucumber-messages");

@@ -16,15 +12,15 @@ function compile(gherkinDocument, uri, newId) {

var featureTags = feature.tags;
var backgroundSteps = [];
var featureBackgroundSteps = [];
feature.children.forEach(function (stepsContainer) {
if (stepsContainer.background) {
backgroundSteps = pickleSteps(stepsContainer.background, [], null, newId);
featureBackgroundSteps = [].concat(stepsContainer.background.steps);
}
else if (stepsContainer.rule) {
compileRule(featureTags, backgroundSteps, stepsContainer.rule, language, pickles, uri, newId);
compileRule(featureTags, featureBackgroundSteps, stepsContainer.rule, language, pickles, uri, newId);
}
else if (stepsContainer.scenario.examples.length === 0) {
compileScenario(featureTags, backgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
compileScenario(featureTags, featureBackgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
}
else {
compileScenarioOutline(featureTags, backgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
compileScenarioOutline(featureTags, featureBackgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
}

@@ -35,13 +31,13 @@ });

exports.default = compile;
function compileRule(featureTags, inheritedBackgroundSteps, rule, language, pickles, uri, newId) {
var backgroundSteps = [].concat(inheritedBackgroundSteps);
function compileRule(featureTags, featureBackgroundSteps, rule, language, pickles, uri, newId) {
var ruleBackgroundSteps = [].concat(featureBackgroundSteps);
rule.children.forEach(function (stepsContainer) {
if (stepsContainer.background) {
backgroundSteps = backgroundSteps.concat(pickleSteps(stepsContainer.background, [], null, newId));
ruleBackgroundSteps = ruleBackgroundSteps.concat(stepsContainer.background.steps);
}
else if (stepsContainer.scenario.examples.length === 0) {
compileScenario(featureTags, backgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
compileScenario(featureTags, ruleBackgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
}
else {
compileScenarioOutline(featureTags, backgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
compileScenarioOutline(featureTags, ruleBackgroundSteps, stepsContainer.scenario, language, pickles, uri, newId);
}

@@ -51,6 +47,6 @@ });

function compileScenario(featureTags, backgroundSteps, scenario, language, pickles, uri, newId) {
var steps = scenario.steps.length === 0 ? [] : [].concat(backgroundSteps);
var steps = scenario.steps.length === 0 ? [] : backgroundSteps.map(function (step) { return pickleStep(step, [], null, newId); });
var tags = [].concat(featureTags).concat(scenario.tags);
scenario.steps.forEach(function (step) { return steps.push(pickleStep(step, [], null, newId)); });
var pickle = cucumber_messages_1.messages.Pickle.fromObject({
var pickle = cucumber_messages_1.messages.Pickle.create({
id: newId(),

@@ -62,3 +58,2 @@ uri: uri,

language: language,
locations: [scenario.location],
steps: steps,

@@ -74,3 +69,4 @@ });

examples.tableBody.forEach(function (valuesRow) {
var steps = scenario.steps.length === 0 ? [] : [].concat(backgroundSteps);
var steps = scenario.steps.length === 0 ?
[] : backgroundSteps.map(function (step) { return pickleStep(step, [], null, newId); });
var tags = []

@@ -84,3 +80,3 @@ .concat(featureTags)

});
pickles.push(cucumber_messages_1.messages.Pickle.fromObject({
pickles.push(cucumber_messages_1.messages.Pickle.create({
id: newId(),

@@ -93,3 +89,2 @@ uri: uri,

tags: pickleTags(tags),
locations: [scenario.location, valuesRow.location],
}));

@@ -120,4 +115,3 @@ });

var argument = step.docString;
var docString = cucumber_messages_1.messages.PickleStepArgument.PickleDocString.fromObject({
location: argument.location,
var docString = cucumber_messages_1.messages.PickleStepArgument.PickleDocString.create({
content: interpolate(argument.content, variableCells, valueCells),

@@ -153,16 +147,9 @@ });

var valueCells = valuesRow ? valuesRow.cells : [];
return cucumber_messages_1.messages.Pickle.PickleStep.fromObject({
return cucumber_messages_1.messages.Pickle.PickleStep.create({
id: newId(),
text: interpolate(step.text, variableCells, valueCells),
argument: createPickleArguments(step, variableCells, valueCells),
locations: [pickleStepLocation(step)],
sourceIds: sourceIds,
});
}
function pickleStepLocation(step) {
return cucumber_messages_1.messages.Location.fromObject({
line: step.location.line,
column: step.location.column + (step.keyword ? countSymbols_1.default(step.keyword) : 0),
});
}
function pickleTags(tags) {

@@ -172,3 +159,3 @@ return tags.map(pickleTag);

function pickleTag(tag) {
return cucumber_messages_1.messages.Pickle.PickleTag.fromObject({
return cucumber_messages_1.messages.Pickle.PickleTag.create({
name: tag.name,

@@ -175,0 +162,0 @@ sourceId: tag.id,

@@ -56,3 +56,3 @@ "use strict";

if (options.includeGherkinDocument) {
result.push(cucumber_messages_1.messages.Envelope.fromObject({
result.push(cucumber_messages_1.messages.Envelope.create({
gherkinDocument: __assign(__assign({}, gherkinDocument), { uri: uri }),

@@ -66,3 +66,3 @@ }));

var pickle = pickles_1_1.value;
result.push(cucumber_messages_1.messages.Envelope.fromObject({
result.push(cucumber_messages_1.messages.Envelope.create({
pickle: pickle,

@@ -90,3 +90,3 @@ }));

}
result.push(cucumber_messages_1.messages.Envelope.fromObject({
result.push(cucumber_messages_1.messages.Envelope.create({
attachment: {

@@ -93,0 +93,0 @@ source: {

@@ -8,3 +8,3 @@ "use strict";

var GherkinLine_1 = __importDefault(require("./GherkinLine"));
var cucumber_messages_1 = require("cucumber-messages");
var createLocation_1 = __importDefault(require("./cli/createLocation"));
/**

@@ -28,6 +28,6 @@ * The scanner reads a gherkin doc (typically read from a .feature file) and creates a token for each line.

var line = this.lines[this.lineNumber++];
var location = cucumber_messages_1.messages.Location.fromObject({
var location = createLocation_1.default({
line: this.lineNumber,
column: 0,
});
location.column = undefined;
return line == null

@@ -34,0 +34,0 @@ ? new Token_1.default(null, location)

{
"name": "gherkin",
"version": "8.2.0",
"version": "8.2.1",
"description": "Gherkin parser",

@@ -34,3 +34,3 @@ "main": "dist/src/index.js",

"@types/mocha": "^5.2.7",
"@types/node": "^12.12.7",
"@types/node": "^12.12.11",
"@types/uuid": "^3.4.6",

@@ -40,3 +40,3 @@ "mocha": "^6.2.2",

"prettier": "^1.19.1",
"ts-node": "^8.5.0",
"ts-node": "^8.5.2",
"tslint": "^5.20.1",

@@ -43,0 +43,0 @@ "tslint-config-prettier": "^1.18.0",

@@ -7,2 +7,3 @@ import AstNode from './AstNode'

import { NewId } from './types'
import createLocation from './cli/createLocation'

@@ -40,3 +41,3 @@ export default class AstBuilder {

this.comments.push(
messages.GherkinDocument.Comment.fromObject({
messages.GherkinDocument.Comment.create({
location: this.getLocation(token),

@@ -62,3 +63,3 @@ text: token.matchedText,

? token.location
: messages.Location.fromObject({ line: token.location.line, column })
: createLocation({ line: token.location.line, column })
}

@@ -76,6 +77,6 @@

tags.push(
messages.GherkinDocument.Feature.Tag.fromObject({
messages.GherkinDocument.Feature.Tag.create({
location: this.getLocation(token, tagItem.column),
name: tagItem.text,
id: this.newId()
id: this.newId(),
})

@@ -90,3 +91,3 @@ )

return tableRowToken.matchedItems.map(cellItem =>
messages.GherkinDocument.Feature.TableRow.TableCell.fromObject({
messages.GherkinDocument.Feature.TableRow.TableCell.create({
location: this.getLocation(tableRowToken, cellItem.column),

@@ -108,3 +109,3 @@ value: cellItem.text,

const rows = node.getTokens(TokenType.TableRow).map(token =>
messages.GherkinDocument.Feature.TableRow.fromObject({
messages.GherkinDocument.Feature.TableRow.create({
id: this.newId(),

@@ -142,3 +143,3 @@ location: this.getLocation(token),

return messages.GherkinDocument.Feature.Step.fromObject({
return messages.GherkinDocument.Feature.Step.create({
id: this.newId(),

@@ -161,9 +162,7 @@ location: this.getLocation(stepLine),

const result = messages.GherkinDocument.Feature.Step.DocString.fromObject(
{
location: this.getLocation(separatorToken),
content,
delimiter: separatorToken.line.trimmedLineText.substring(0, 3),
}
)
const result = messages.GherkinDocument.Feature.Step.DocString.create({
location: this.getLocation(separatorToken),
content,
delimiter: separatorToken.line.trimmedLineText.substring(0, 3),
})
// conditionally add this like this (needed to make tests pass on node 0.10 as well as 4.0)

@@ -177,3 +176,3 @@ if (contentType) {

const rows = this.getTableRows(node)
return messages.GherkinDocument.Feature.Step.DataTable.fromObject({
return messages.GherkinDocument.Feature.Step.DataTable.create({
location: rows[0].location,

@@ -188,3 +187,3 @@ rows,

return messages.GherkinDocument.Feature.Background.fromObject({
return messages.GherkinDocument.Feature.Background.create({
location: this.getLocation(backgroundLine),

@@ -204,3 +203,3 @@ keyword: backgroundLine.matchedKeyword,

const examples = scenarioNode.getItems(RuleType.ExamplesDefinition)
return messages.GherkinDocument.Feature.Scenario.fromObject({
return messages.GherkinDocument.Feature.Scenario.create({
id: this.newId(),

@@ -225,3 +224,3 @@ tags,

return messages.GherkinDocument.Feature.Scenario.Examples.fromObject({
return messages.GherkinDocument.Feature.Scenario.Examples.create({
tags,

@@ -266,3 +265,3 @@ location: this.getLocation(examplesLine),

children.push(
messages.GherkinDocument.Feature.FeatureChild.fromObject({
messages.GherkinDocument.Feature.FeatureChild.create({
background,

@@ -274,3 +273,3 @@ })

children.push(
messages.GherkinDocument.Feature.FeatureChild.fromObject({
messages.GherkinDocument.Feature.FeatureChild.create({
scenario,

@@ -282,3 +281,3 @@ })

children.push(
messages.GherkinDocument.Feature.FeatureChild.fromObject({
messages.GherkinDocument.Feature.FeatureChild.create({
rule,

@@ -292,3 +291,3 @@ })

return messages.GherkinDocument.Feature.fromObject({
return messages.GherkinDocument.Feature.create({
tags,

@@ -309,3 +308,2 @@ location: this.getLocation(featureLine),

}
const tags = this.getTags(header)
const ruleLine = header.getToken(TokenType.RuleLine)

@@ -319,3 +317,3 @@ if (!ruleLine) {

children.push(
messages.GherkinDocument.Feature.FeatureChild.fromObject({
messages.GherkinDocument.Feature.FeatureChild.create({
background,

@@ -327,3 +325,3 @@ })

children.push(
messages.GherkinDocument.Feature.FeatureChild.fromObject({
messages.GherkinDocument.Feature.FeatureChild.create({
scenario,

@@ -335,4 +333,3 @@ })

return messages.GherkinDocument.Feature.FeatureChild.Rule.fromObject({
tags,
return messages.GherkinDocument.Feature.FeatureChild.Rule.create({
location: this.getLocation(ruleLine),

@@ -348,3 +345,3 @@ keyword: ruleLine.matchedKeyword,

return messages.GherkinDocument.fromObject({
return messages.GherkinDocument.create({
feature,

@@ -351,0 +348,0 @@ comments: this.comments,

import { messages } from 'cucumber-messages'
import Token from './Token'
import createLocation from './cli/createLocation'

@@ -23,3 +24,4 @@ class GherkinException extends Error {

protected static _create<T>(location: messages.ILocation, message: string) {
const m = `(${location.line}:${location.column}): ${message}`
const column = location.column || 0
const m = `(${location.line}:${column}): ${message}`
const err = new this(m)

@@ -52,8 +54,3 @@ err.location = location

const location = !token.location.column
? messages.Location.fromObject({
line: token.location.line,
column: token.line.indent + 1,
})
: token.location
const location = tokenLocation(token)

@@ -73,9 +70,3 @@ return this._create(location, message)

)}`
const location =
token.location && token.line
? messages.Location.fromObject({
line: token.location.line,
column: token.line.indent + 1,
})
: token.location
const location = tokenLocation(token)

@@ -98,1 +89,10 @@ return this._create(location, message)

}
function tokenLocation(token: Token) {
return token.location && token.location.line && token.line && token.line.indent !== undefined
? createLocation({
line: token.location.line,
column: token.line.indent + 1,
})
: token.location
}

@@ -1,2 +0,1 @@

import countSymbols from '../countSymbols'
import { messages } from 'cucumber-messages'

@@ -20,11 +19,11 @@ import IGherkinDocument = messages.IGherkinDocument

const featureTags = feature.tags
let backgroundSteps: messages.GherkinDocument.Feature.IStep[] = []
let featureBackgroundSteps: messages.GherkinDocument.Feature.IStep[] = []
feature.children.forEach(stepsContainer => {
if (stepsContainer.background) {
backgroundSteps = pickleSteps(stepsContainer.background, [], null, newId)
featureBackgroundSteps = [].concat(stepsContainer.background.steps)
} else if (stepsContainer.rule) {
compileRule(
featureTags,
backgroundSteps,
featureBackgroundSteps,
stepsContainer.rule,

@@ -39,3 +38,3 @@ language,

featureTags,
backgroundSteps,
featureBackgroundSteps,
stepsContainer.scenario,

@@ -50,3 +49,3 @@ language,

featureTags,
backgroundSteps,
featureBackgroundSteps,
stepsContainer.scenario,

@@ -65,3 +64,3 @@ language,

featureTags: messages.GherkinDocument.Feature.ITag[],
inheritedBackgroundSteps: messages.GherkinDocument.Feature.IStep[],
featureBackgroundSteps: messages.GherkinDocument.Feature.IStep[],
rule: messages.GherkinDocument.Feature.FeatureChild.IRule,

@@ -73,13 +72,11 @@ language: string,

) {
let backgroundSteps = [].concat(inheritedBackgroundSteps)
let ruleBackgroundSteps = [].concat(featureBackgroundSteps)
rule.children.forEach(stepsContainer => {
if (stepsContainer.background) {
backgroundSteps = backgroundSteps.concat(
pickleSteps(stepsContainer.background, [], null, newId)
)
ruleBackgroundSteps = ruleBackgroundSteps.concat(stepsContainer.background.steps)
} else if (stepsContainer.scenario.examples.length === 0) {
compileScenario(
featureTags,
backgroundSteps,
ruleBackgroundSteps,
stepsContainer.scenario,

@@ -94,3 +91,3 @@ language,

featureTags,
backgroundSteps,
ruleBackgroundSteps,
stepsContainer.scenario,

@@ -115,3 +112,3 @@ language,

) {
const steps = scenario.steps.length === 0 ? [] : [].concat(backgroundSteps)
const steps = scenario.steps.length === 0 ? [] : backgroundSteps.map(step => pickleStep(step, [], null, newId))

@@ -122,3 +119,3 @@ const tags = [].concat(featureTags).concat(scenario.tags)

const pickle = messages.Pickle.fromObject({
const pickle = messages.Pickle.create({
id: newId(),

@@ -130,3 +127,2 @@ uri,

language,
locations: [scenario.location],
steps,

@@ -151,4 +147,4 @@ })

examples.tableBody.forEach(valuesRow => {
const steps =
scenario.steps.length === 0 ? [] : [].concat(backgroundSteps)
const steps = scenario.steps.length === 0 ?
[] : backgroundSteps.map(step => pickleStep(step, [], null, newId))
const tags = []

@@ -170,3 +166,3 @@ .concat(featureTags)

pickles.push(
messages.Pickle.fromObject({
messages.Pickle.create({
id: newId(),

@@ -179,3 +175,2 @@ uri,

tags: pickleTags(tags),
locations: [scenario.location, valuesRow.location],
})

@@ -211,4 +206,3 @@ )

const argument = step.docString
const docString = messages.PickleStepArgument.PickleDocString.fromObject({
location: argument.location,
const docString = messages.PickleStepArgument.PickleDocString.create({
content: interpolate(argument.content, variableCells, valueCells),

@@ -266,7 +260,6 @@ })

return messages.Pickle.PickleStep.fromObject({
return messages.Pickle.PickleStep.create({
id: newId(),
text: interpolate(step.text, variableCells, valueCells),
argument: createPickleArguments(step, variableCells, valueCells),
locations: [pickleStepLocation(step)],
sourceIds,

@@ -276,10 +269,2 @@ })

function pickleStepLocation(step: messages.GherkinDocument.Feature.IStep) {
return messages.Location.fromObject({
line: step.location.line,
column:
step.location.column + (step.keyword ? countSymbols(step.keyword) : 0),
})
}
function pickleTags(tags: messages.GherkinDocument.Feature.ITag[]) {

@@ -290,3 +275,3 @@ return tags.map(pickleTag)

function pickleTag(tag: messages.GherkinDocument.Feature.ITag) {
return messages.Pickle.PickleTag.fromObject({
return messages.Pickle.PickleTag.create({
name: tag.name,

@@ -293,0 +278,0 @@ sourceId: tag.id,

@@ -44,3 +44,3 @@ import Parser from '../Parser'

result.push(
messages.Envelope.fromObject({
messages.Envelope.create({
gherkinDocument: { ...gherkinDocument, uri },

@@ -55,3 +55,3 @@ })

result.push(
messages.Envelope.fromObject({
messages.Envelope.create({
pickle,

@@ -70,3 +70,3 @@ })

result.push(
messages.Envelope.fromObject({
messages.Envelope.create({
attachment: {

@@ -73,0 +73,0 @@ source: {

import Token from './Token'
import GherkinLine from './GherkinLine'
import { messages } from 'cucumber-messages'
import createLocation from './cli/createLocation'

@@ -28,6 +29,6 @@ /**

const line = this.lines[this.lineNumber++]
const location = messages.Location.fromObject({
const location = createLocation({
line: this.lineNumber,
column: 0,
})
location.column = undefined
return line == null

@@ -34,0 +35,0 @@ ? new Token(null, location)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc