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

tone down global install warning #2285

Merged
merged 5 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber.

## [Unreleased]
### Changed
- Only show global install warning in debug mode ([#2285](https://github.com/cucumber/cucumber-js/pull/2285))

### Fixed
- Export `ISupportCodeLibrary` type on `/api` entry point ([#2284](https://github.com/cucumber/cucumber-js/pull/2284))

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Unlike many libraries, Cucumber is _stateful_; you call functions to register yo

Some libraries with a command-line interface are designed to be installed globally. Not Cucumber though - for the reasons above, you need to install it as a dependency in your project.

We'll emit a warning if it looks like Cucumber is installed globally.
We'll emit a warning when in [debug mode](./debugging.md) if it looks like Cucumber is installed globally.

### Duplicate dependency

Expand Down
8 changes: 6 additions & 2 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export default class Cli {
}

async run(): Promise<ICliRunResult> {
await validateInstall()
const debugEnabled = debug.enabled('cucumber')
if (debugEnabled) {
await validateInstall()
}
const { options, configuration: argvConfiguration } = ArgvParser.parse(
this.argv
)
Expand All @@ -59,12 +62,13 @@ export default class Cli {
success: true,
}
}

const environment = {
cwd: this.cwd,
stdout: this.stdout,
stderr: this.stderr,
env: this.env,
debug: debug.enabled('cucumber'),
debug: debugEnabled,
}
const { useConfiguration: configuration, runConfiguration } =
await loadConfiguration(
Expand Down
2 changes: 1 addition & 1 deletion src/cli/install_validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function validateInstall(): Promise<void> {
console.warn(
`
It looks like you're running Cucumber from a global installation.
This won't work - you need to have Cucumber installed as a local dependency in your project.
If so, you'll likely see issues - you need to have Cucumber installed as a local dependency in your project.
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations
`
)
Expand Down