Skip to content

Commit

Permalink
Add source to messages to onParse callback
Browse files Browse the repository at this point in the history
Co-authored-by: Julien Biezemans <jb@jbpros.com>
  • Loading branch information
cbohiptest and jbpros committed Jan 28, 2021
1 parent 55cd62d commit 56d77d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/lib/gherkin-linter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class GherkinLinter {
const messages = generateMessages(
this.getContentToLint(gherkin),
'',
this.options
{ includeSource: !!this.onParse, ...this.options }
)

this.lintingErrors = messages
Expand Down
6 changes: 4 additions & 2 deletions test/lib/gherkin-linter/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,11 @@ describe('GherkinLinter', () => {
it('calls back with the cucumber message envelopes', () => {
let messages
const gherkinLinter = new GherkinLinter(msgs => (messages = msgs))
gherkinLinter.parse('Feature: our feature\n')
const source = 'Feature: our feature\n'
gherkinLinter.parse(source)
expect(messages.length).toBeGreaterThan(0)
expect(messages[0].gherkinDocument.feature.name).toEqual('our feature')
expect(messages[0].source.data).toEqual(source)
expect(messages[1].gherkinDocument.feature.name).toEqual('our feature')
})
})
})

0 comments on commit 56d77d6

Please sign in to comment.