Skip to content

A parameter type registered only via import (not glob-discovered) produces a misleading "stale oath transform" error #124

Description

@mlevison

varar 0.8.1, @varar/vitest.

Repro:

  • steps.ts file A is discovered by the project's configured step-file glob and uses {date} in one of its expressions.
  • The date parameter type is registered by a separate file, dateParam.ts, which is not named to match the glob — it's reached only via a plain import './dateParam.ts' from A.
  • dateParam.ts contains nothing but steps().param('date', /\d{4}-\d{2}-\d{2}/).

Result: the suite fails with

stale oath transform: expected example #0 of <doc>.md to be named "<sensor trigger sentence>", found "<stimulus sentence>". The step definitions changed after this oath was transformed — re-run the suite.

Re-running does not clear it, and neither does clearing node_modules/.vite or running with VARAR_UPDATE=1.

Fix found by trial: renaming dateParam.ts to dateParam.steps.ts — so it's independently matched and discovered by the same step-file glob, with no other change — makes the failure disappear immediately and permanently.

Possible fix:

  • Treat a steps() call reached via a plain import from a glob-discovered file the same as one found directly by the glob.
  • Would let shared vocabulary (a parameter type several oaths need) live in an ordinary, explicitly-imported helper module instead of masquerading as its own step file.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions