Skip to content

Commit

Permalink
tone down global install warning (#2285)
Browse files Browse the repository at this point in the history
* update documentation

* soften message a little

* only do check when debug enabled

* update CHANGELOG.md
  • Loading branch information
davidjgoss committed May 7, 2023
1 parent 728fe26 commit dc6ae91
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
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

0 comments on commit dc6ae91

Please sign in to comment.