Skip to content

Commit

Permalink
fix(main): fix the long rendered lines in test.for implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dnotes committed Nov 8, 2024
1 parent 5105448 commit 5d20acc
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 59 deletions.
8 changes: 5 additions & 3 deletions packages/main/gherkin-example/example.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ Feature: QuickPickle's Comprehensive Gherkin Syntax Example
Given an initial context'
When an action is performed'
Then a verifiable outcome is achieved'

@concurrent
Scenario Outline: Parameterized scenario for <parameter>, '<another_parameter>'
Scenario Outline: Parameterized scenario for <parameter>, '<another_parameter>', "<expected_result>"
Given a 'precondition' with <parameter>
When an 'action' is taken with <another_parameter>
Then the 'outcome' is <expected_result>
When an "action" is taken with <another_parameter>
Then the `outcome` is <expected_result>

Examples:
| parameter | another_parameter | expected_result |
| value1' | value2' | result1' |
| value3` | value4` | result2` |
| value5" | value6" | result3" |

@data_table
Scenario: Scenario with various DataTable types
Expand Down
114 changes: 59 additions & 55 deletions packages/main/gherkin-example/example.feature.js

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

6 changes: 5 additions & 1 deletion packages/main/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ function renderScenario(child:FeatureChild, config:QuickPickleConfig, tags:strin
})

return `
${sp}test${attrs}.for(${JSON.stringify(paramValues)})(
${sp}test${attrs}.for([
${sp} ${paramValues?.map(line => {
return JSON.stringify(line)
}).join(',\n' + sp + ' ')}
${sp}])(
${sp} '${q(child.scenario?.keyword || '')}: ${describe}${tagTextForVitest}',
${sp} async ({ ${paramNames?.join(', ')} }, context) => {
${sp} let state = await ${initFn}(context, \`${name}\`, ['${tags.join("', '") || ''}'], [${examples?.map(s => '`'+s+'`').join(',')}]);
Expand Down

0 comments on commit 5d20acc

Please sign in to comment.