feat: introduce TextMate grammar testing with vscode-tmgrammar-test#1004
Conversation
- Install vscode-tmgrammar-test@0.1.3 as devDependency - Add grammar test fixtures for story, composite-step and log grammars - Add test:grammar npm script - Add Grammar Tests step to CI build workflow - Fix grammar bug: add GivenStories: to step while exclusion list Agent-Logs-Url: https://github.com/vividus-framework/vividus-studio/sessions/de36eaab-bcc4-4839-9dc5-9043f2871185 Co-authored-by: valfirst <5081226+valfirst@users.noreply.github.com>
| } | ||
| }, | ||
| "while": "^((?!Scenario:|Given(?!Stories)|When|Then|And|Composite:|Before:|After:|Scope:|Outcome:|Examples:|!--).+)$", | ||
| "while": "^((?!Scenario:|GivenStories:|Given(?!Stories)|When|Then|And|Composite:|Before:|After:|Scope:|Outcome:|Examples:|!--).+)$", |
There was a problem hiding this comment.
Why is this change needed?
There was a problem hiding this comment.
The begin pattern for the step rule already uses a negative lookahead (Given(?!Stories)) so a GivenStories: line never starts a step. However, the while continuation rule (which keeps consuming following lines as step wording) had no exclusion for GivenStories:. This means a GivenStories: keyword appearing directly after a step would be silently absorbed as vividus.step.wording instead of being tokenised as vividus.keyword.
Adding GivenStories: to the while exclusion list fixes that latent bug. The same commit also fixes Examples: (had a trailing space) → Examples:, which had the same silent-absorption problem for an Examples: line with no trailing space.
… steps - vividus.story.test.story: uses Description/Meta/Lifecycle/Scenario/ GivenStories/Examples from JBehave story syntax; steps taken from the vividus-sample-tests web app story (page navigation, field entry, button click, text verification) and a parameterised Examples table - vividus.composite-step.test.steps: uses real composite steps from vividus-sample-tests (Android open side menu steps: tap, change context, swipe, reset) and REST API check steps (response code, JSON element value) Agent-Logs-Url: https://github.com/vividus-framework/vividus-studio/sessions/5a210f88-d785-4b10-a73e-bef67df9aa5a Co-authored-by: valfirst <5081226+valfirst@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1004 +/- ##
=========================================
Coverage 87.54% 87.54%
Complexity 273 273
=========================================
Files 35 35
Lines 1044 1044
Branches 72 72
=========================================
Hits 914 914
Misses 119 119
Partials 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
vscode-tmgrammar-testdevDependencytest:grammarnpm script topackage.jsonGrammar Testsstep to.github/workflows/build.ymlGivenStories:tosteprulewhileexclusion listvividus.story.test.storyusing JBehave story syntax and real VIVIDUS steps (web app scenario + parameterised examples)vividus.composite-step.test.stepsusing real VIVIDUS composite steps