Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

When using non-English Gherkin dialects, missing or mismatched # language: directives between calling and called feature files cause scenario call expansion to fail silently, as the parser defaults to English keywords.

Changes

Validation

  • Added ValidateLanguageDirectives() to detect missing directives in called features and language mismatches
  • Added HasExplicitLanguageDirective() to distinguish explicit directives from defaults
  • Warnings are injected inline where scenario calls are expanded

Robustness

  • Enhanced FindFeatureFileContent() to try common language dialects (en, nl, de, fr, es) when feature name extraction fails
  • Enables feature discovery even when directives are missing, allowing validation warnings to display

Example output

When a Dutch feature calls another without a language directive:

Scenario: Nieuw gebruikersaccount aanmaken
    # WARNING: Language directive missing in called feature 'Authenticatie'. Add '# language: nl' at the top of the feature file.
    # Warning: Could not expand scenario call (likely due to language directive issue)

When languages mismatch:

# WARNING: Language mismatch: calling feature uses 'nl' but called feature 'Authentifizierung' uses 'de'. Both feature files should use the same language directive.
Original prompt

This section details on the original issue you should resolve

<issue_title>Language comment must be present at the top of both feature files for non-English dialects</issue_title>
<issue_description>When using a language other than English (for example, Dutch), the language comment (e.g. # language: nl) must be placed at the top of the feature file.

Current situation:

  • If the # language: directive is missing, parsing and/or keyword matching can fall back to English expectations, which can break scenario call detection and expansion.
  • This affects both:
    1. the feature file that contains the scenario call, and
    2. the feature file that defines the called scenario.

Why this matters for scenario calls:

  • The plugin parses/rewrites feature text (pre-processing) and needs consistent dialect recognition in both files involved in the call chain. A missing or mismatched dialect line can lead to scenario calls not being recognized/expanded.

References (code/tests/docs):

Expected functionality:

  • Either:
    • Automatically ensure the correct # language: <code> directive is present at the top of both the calling and called feature files, OR
    • Provide a clear warning/error explaining that the directive is required (and in which file(s) it is missing) when a scenario call involves non-English feature files.

Implementation hint:

  • Add validation during preprocessing: if detected language/dialect differs or is missing in either side of a scenario call, emit an explicit diagnostic comment (or fail the build, depending on configuration).</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits December 19, 2025 08:19
Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Co-authored-by: jgerits <6541449+jgerits@users.noreply.github.com>
Copilot AI changed the title [WIP] Add language comment validation for feature files Add language directive validation for multi-language scenario calls Dec 19, 2025
Copilot AI requested a review from jgerits December 19, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language comment must be present at the top of both feature files for non-English dialects

2 participants