Skip to content

Commit dc6ae91

Browse files
authored
tone down global install warning (#2285)
* update documentation * soften message a little * only do check when debug enabled * update CHANGELOG.md
1 parent 728fe26 commit dc6ae91

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
88
Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber.
99

1010
## [Unreleased]
11+
### Changed
12+
- Only show global install warning in debug mode ([#2285](https://github.com/cucumber/cucumber-js/pull/2285))
13+
1114
### Fixed
1215
- Export `ISupportCodeLibrary` type on `/api` entry point ([#2284](https://github.com/cucumber/cucumber-js/pull/2284))
1316

docs/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Unlike many libraries, Cucumber is _stateful_; you call functions to register yo
3030

3131
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.
3232

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

3535
### Duplicate dependency
3636

src/cli/index.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ export default class Cli {
3939
}
4040

4141
async run(): Promise<ICliRunResult> {
42-
await validateInstall()
42+
const debugEnabled = debug.enabled('cucumber')
43+
if (debugEnabled) {
44+
await validateInstall()
45+
}
4346
const { options, configuration: argvConfiguration } = ArgvParser.parse(
4447
this.argv
4548
)
@@ -59,12 +62,13 @@ export default class Cli {
5962
success: true,
6063
}
6164
}
65+
6266
const environment = {
6367
cwd: this.cwd,
6468
stdout: this.stdout,
6569
stderr: this.stderr,
6670
env: this.env,
67-
debug: debug.enabled('cucumber'),
71+
debug: debugEnabled,
6872
}
6973
const { useConfiguration: configuration, runConfiguration } =
7074
await loadConfiguration(

src/cli/install_validator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export async function validateInstall(): Promise<void> {
66
console.warn(
77
`
88
It looks like you're running Cucumber from a global installation.
9-
This won't work - you need to have Cucumber installed as a local dependency in your project.
9+
If so, you'll likely see issues - you need to have Cucumber installed as a local dependency in your project.
1010
See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations
1111
`
1212
)

0 commit comments

Comments
 (0)