timjroberts / cucumber-js-tsflow

Provides 'specflow' like bindings for Cucumber.js in TypeScript 1.7+.
MIT License
133 stars 34 forks source link

Bindings break when importing steps into other steps #52

Closed justinbhopper closed 4 years ago

justinbhopper commented 4 years ago

It seems that the binding registration of steps no longer work properly if a step file is imported by other step files.

From what I can tell, this issue occurs when:

  1. Step file A imports step file B
  2. Step file A comes alphabetically before step file B

Repo: https://github.com/justinbhopper/tsflow-issue

In this repo, there is a test that purposefully fails. However, the tests do not fail and it appears the test that was meant to fail never gets run and is completely ignored by cucumber.

My best guess is something is going wrong in the binding registry. Perhaps the FormSteps class is being registered twice? Or perhaps its registration is being corrupted having been loaded into memory before tsflow expects?

justinbhopper commented 4 years ago

Turns out the issue was indeed that the steps were being registered twice. No errors were produced, however, due to a bug where a "Ambiguous step definitions" error was being returned instead of thrown.

53 should fix this