Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests skipped unless I compile with opt-level = 0 #347

Closed
Maximetinu opened this issue Oct 15, 2024 · 1 comment
Closed

Tests skipped unless I compile with opt-level = 0 #347

Maximetinu opened this issue Oct 15, 2024 · 1 comment
Assignees
Labels
bug Something isn't working k::UI/UX UI (user interface) and UX (user experience) changes upstream Dependent on upstream crate or tool wontfix This will not be worked on
Milestone

Comments

@Maximetinu
Copy link

Maximetinu commented Oct 15, 2024

Hello

I found a situation where some gherkin given/when/then steps that should be visible are instead skipped

If I compile the tests without optimization -O0, then they are visible.

It's like the optimizations are stripping them away?

I reproduced it in a minimal example here:

https://github.com/Maximetinu/cucumber-multicrate-setup/tree/reproducing-cucumber-bug-see-latest-commit

This must be a bug on cucumber, because I can reach those functions from my code, but cucumber cannot. I would expect the same visibility for both.

Update: I made another branch on that repo where I tried to find the smallest possible commit introducing the bug. It is this: Maximetinu/cucumber-multicrate-setup@139ecc2

I don't know what conclusions to extract from it. It seems that the steps and the world context must be in the same mod in order for cucumber to find them?

Update 2: I noticed that what I'm trying to do is the same that is discussed in this thread: #236

@ilslv shared a repository showcasing how to set that up. I've also been able to reproduce it in that repository: Maximetinu/cucumber-steps-as-library@3a06dda

So, this bug is apparently caused by a combination of:

  • using any opt-level > 0
  • defining the cucumber world in a different file, separated from the steps
@Maximetinu Maximetinu changed the title Tests skipped unless I compile with -O0 Tests skipped unless I compile with opt-level = 0 Oct 16, 2024
@tyranron tyranron added bug Something isn't working k::design Related to overall design and/or architecture labels Jan 20, 2025
@tyranron
Copy link
Member

@Maximetinu unfortunately, there is no much we can do from our side. We're just hitting the limitations of the upstream inventory crate we're using for collecting the defined step functions: dtolnay/inventory#50, dtolnay/inventory#52
Once they're resolved there, they will be automatically resolved in cucumber too.

Alternatives to the inventory crate were considered, but didn't solve the problem, since it rooted to the rustc/Cargo itself.

@tyranron tyranron self-assigned this Jan 20, 2025
@tyranron tyranron added this to the 0.22.0 milestone Jan 20, 2025
@tyranron tyranron added wontfix This will not be worked on upstream Dependent on upstream crate or tool k::UI/UX UI (user interface) and UX (user experience) changes and removed k::design Related to overall design and/or architecture labels Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working k::UI/UX UI (user interface) and UX (user experience) changes upstream Dependent on upstream crate or tool wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants