-
-
Notifications
You must be signed in to change notification settings - Fork 686
Closed
Description
🤔 What's the problem you've observed?
I found an issue when I got pickles generated by javascript. The tags of a rule were missing when it had a scenario outline.
The first param of the function compileScenarioOutline should be tags, not featureTags.
However, I found the logic of the ruby's was ok.
Javascript: src/pickles/compile.ts:#L66
function compileRule(
featureTags: readonly messages.Tag[],
featureBackgroundSteps: readonly messages.Step[],
rule: messages.Rule,
language: string,
pickles: messages.Pickle[],
uri: string,
newId: messages.IdGenerator.NewId
) {
let ruleBackgroundSteps = [].concat(featureBackgroundSteps)
const tags = [].concat(featureTags).concat(rule.tags)
rule.children.forEach((stepsContainer) => {
if (stepsContainer.background) {
ruleBackgroundSteps = ruleBackgroundSteps.concat(stepsContainer.background.steps)
} else if (stepsContainer.scenario.examples.length === 0) {
compileScenario(
tags,
ruleBackgroundSteps,
stepsContainer.scenario,
language,
pickles,
uri,
newId
)
} else {
compileScenarioOutline(
featureTags,
ruleBackgroundSteps,
stepsContainer.scenario,
language,
pickles,
uri,
newId
)
}
})
}
Ruby: lib/gherkin/pickles/compiler.rb:#L42
def compile_rule(pickles, language, feature_tags, feature_background_steps, rule, source)
tags = [].concat(feature_tags).concat(rule.tags)
rule_background_steps = feature_background_steps.dup
rule.children.each do |child|
if child.background
rule_background_steps.concat(child.background.steps)
else
scenario = child.scenario
if scenario.examples.empty?
compile_scenario(tags, rule_background_steps, scenario, language, pickles, source)
else
compile_scenario_outline(tags, rule_background_steps, scenario, language, pickles, source)
end
end
end
end
✨ Do you have a proposal for making it better?
javascript side should be
compileScenarioOutline(
tags,
...
)
This text was originally generated from a template, then edited by hand. You can modify the template here.
Metadata
Metadata
Assignees
Labels
No labels