diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d30213ea..1e044cc26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/docs/installation.md b/docs/installation.md index 1da91bbeb..933c0ac81 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -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 diff --git a/src/cli/index.ts b/src/cli/index.ts index a9dacf3f4..78f737d3c 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -39,7 +39,10 @@ export default class Cli { } async run(): Promise { - await validateInstall() + const debugEnabled = debug.enabled('cucumber') + if (debugEnabled) { + await validateInstall() + } const { options, configuration: argvConfiguration } = ArgvParser.parse( this.argv ) @@ -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( diff --git a/src/cli/install_validator.ts b/src/cli/install_validator.ts index 94b2136e4..4baefe994 100644 --- a/src/cli/install_validator.ts +++ b/src/cli/install_validator.ts @@ -6,7 +6,7 @@ export async function validateInstall(): Promise { 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 ` )