Skip to content

Commit cc27fb2

Browse files
Merge branch 'main' into 1648-replace-any
2 parents 676fb7e + dd62cbb commit cc27fb2

File tree

7 files changed

+373
-317
lines changed

7 files changed

+373
-317
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@
241241
"mustache": "4.2.0",
242242
"nyc": "15.1.0",
243243
"prettier": "2.3.2",
244+
"reindent-template-literals": "^1.0.0",
244245
"semver": "7.3.5",
245246
"sinon": "11.1.1",
246247
"sinon-chai": "3.7.0",

src/formatter/helpers/gherkin_document_parser_spec.ts

+60-51
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from '../../../test/gherkin_helpers'
1313
import * as messages from '@cucumber/messages'
1414
import IGherkinDocument = messages.GherkinDocument
15+
import { reindent } from 'reindent-template-literals'
1516

1617
describe('GherkinDocumentParser', () => {
1718
describe('getGherkinStepMap', () => {
@@ -315,64 +316,72 @@ async function parseGherkinDocument(data: string): Promise<IGherkinDocument> {
315316
}
316317

317318
async function withBackgroundAndScenario(): Promise<IGherkinDocument> {
318-
return await parseGherkinDocument(`\
319-
Feature: a feature
320-
Background:
321-
Given a setup step
322-
323-
Scenario:
324-
When a regular step
325-
`)
319+
return await parseGherkinDocument(
320+
reindent(`
321+
Feature: a feature
322+
Background:
323+
Given a setup step
324+
325+
Scenario:
326+
When a regular step
327+
`)
328+
)
326329
}
327330

328331
async function withBackgroundAndScenarioOutline(): Promise<IGherkinDocument> {
329-
return await parseGherkinDocument(`\
330-
Feature: a feature
331-
Background:
332-
Given a setup step
333-
334-
Scenario Outline:
335-
When a templated step with <word>
336-
Examples:
337-
| word |
338-
| foo |
339-
| bar |
340-
`)
332+
return await parseGherkinDocument(
333+
reindent(`
334+
Feature: a feature
335+
Background:
336+
Given a setup step
337+
338+
Scenario Outline:
339+
When a templated step with <word>
340+
Examples:
341+
| word |
342+
| foo |
343+
| bar |
344+
`)
345+
)
341346
}
342347

343348
async function withBackgroundAndRuleWithExamples(): Promise<IGherkinDocument> {
344-
return await parseGherkinDocument(`\
345-
Feature: a feature
346-
Background:
347-
Given a setup step
348-
349-
Rule: a rule
350-
Example: an example
351-
When a regular step
352-
Then an assertion
353-
354-
Example: another example
355-
When a regular step
356-
Then an assertion
357-
`)
349+
return await parseGherkinDocument(
350+
reindent(`
351+
Feature: a feature
352+
Background:
353+
Given a setup step
354+
355+
Rule: a rule
356+
Example: an example
357+
When a regular step
358+
Then an assertion
359+
360+
Example: another example
361+
When a regular step
362+
Then an assertion
363+
`)
364+
)
358365
}
359366

360367
async function withBackgroundAndRuleWithBackgroundAndExamples(): Promise<IGherkinDocument> {
361-
return await parseGherkinDocument(`\
362-
Feature: a feature
363-
Background:
364-
Given a feature-level setup step
365-
366-
Rule: a rule
367-
Background:
368-
Given a rule-level setup step
369-
370-
Example: an example
371-
When a regular step
372-
Then an assertion
373-
374-
Example: another example
375-
When a regular step
376-
Then an assertion
377-
`)
368+
return await parseGherkinDocument(
369+
reindent(`
370+
Feature: a feature
371+
Background:
372+
Given a feature-level setup step
373+
374+
Rule: a rule
375+
Background:
376+
Given a rule-level setup step
377+
378+
Example: an example
379+
When a regular step
380+
Then an assertion
381+
382+
Example: another example
383+
When a regular step
384+
Then an assertion
385+
`)
386+
)
378387
}

0 commit comments

Comments
 (0)