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

rework handling and docs for invalid installations #2089

Merged
merged 17 commits into from Jul 19, 2022

Conversation

davidjgoss
Copy link
Contributor

@davidjgoss davidjgoss commented Jul 18, 2022

🤔 What's changed?

This PR improves the way we deal with invalid installations - that is, where the Cucumber instance that gets run isn't the one imported by the support code (see the new installation.md doc for a more expansive intro).

For global installations, we had a check early in the CLI that would throw if it looked like a global installation (one of the ways you can be invalid). However this is prone to some false positives depending on users' platform tooling etc. The logic has been replaced by the is-installed-globally library which takes a different approach that should avoid those false positives. Also, it warns rather than throws, which is a hedge in case it has issues, but I could be talked out of that.

Before, with an invalid installation (e.g. with a duplicate dependency, or linking), you'd hit a rather cryptic error (The "from" argument must be of type string. Received type undefined), from which astute/lucky users could Google their way to our FAQ doc. We now intentionally detect the condition for that error (i.e. the support code library builder hasn't been initialised because it's not the instance of Cucumber that's actually running) and throw a descriptive message that links to a more useful installation doc. This will happen for global installs now too (as well as the warning).

For testing, the existing feature test remains but is tweaked. The setup of the invalid installation moves from being a tagged hook to a "Given" step - just felt right from a Gherkin perspective.

⚡️ What's your motivation?

Fixes #1883.

🏷️ What kind of change is this?

  • 🏦 Refactoring/debt/DX (improvement to code design, tooling, documentation etc. without changing behaviour)
  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

Using a proxy to wrap all the support methods in the check. Seemed like the cleanest and most maintainable way.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@coveralls
Copy link

coveralls commented Jul 18, 2022

Coverage Status

Coverage increased (+0.03%) to 93.132% when pulling 367902b on fix/install-validator-rework into 88de2e8 on main.

Copy link
Contributor

@aurelien-reeves aurelien-reeves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks pretty good!

Regarding the installation document, in the "duplicate" paragraph, it is emphased the use of external support code. I would also emphasize the use of third parties. And I would also mention the use of an old cucumber alongside the new @cucumber/cucumber one

@davidjgoss
Copy link
Contributor Author

Great points @aurelien-reeves - I've pushed some changes to address those.

Copy link
Contributor

@aurelien-reeves aurelien-reeves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great :)

docs/installation.md Outdated Show resolved Hide resolved
davidjgoss and others added 2 commits July 19, 2022 08:55
Co-authored-by: Aurélien Reeves <aurelien.reeves@smartbear.com>
@davidjgoss davidjgoss merged commit c4697e6 into main Jul 19, 2022
@davidjgoss davidjgoss deleted the fix/install-validator-rework branch July 19, 2022 08:50
@davidjgoss davidjgoss mentioned this pull request May 7, 2023
7 tasks
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.

false positives with install validator
3 participants