diff --git a/CHANGELOG.md b/CHANGELOG.md index d12dd850e..593997e53 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] +### Removed +- Remove Cucumber Reports suggestion ([#2311](https://github.com/cucumber/cucumber-js/pull/2311)) + ### Fixed - Fix type import from cucumber-expressions ([#2310](https://github.com/cucumber/cucumber-js/pull/2310)) diff --git a/cucumber.json b/cucumber.json index 80ce73c44..401715dd1 100644 --- a/cucumber.json +++ b/cucumber.json @@ -11,7 +11,6 @@ "html:reports/html-formatter.html" ], "retry": 2, - "retryTagFilter": "@flaky", - "publishQuiet": true + "retryTagFilter": "@flaky" } } diff --git a/docs/configuration.md b/docs/configuration.md index 678801631..cf5c87f7d 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -93,7 +93,6 @@ These options can be used in a configuration file (see [above](#files)) or on th | `order` | `string` | No | `--order` | Run in the order defined, or in a random order | defined | | `parallel` | `number` | No | `--parallel` | Run tests in parallel with the given number of worker processes - see [Parallel](./parallel.md) | 0 | | `publish` | `boolean` | No | `--publish` | Publish a report of your test run to | false | -| `publishQuiet` | `boolean` | No | `--publish-quiet` | Don't show info about publishing reports | false | | `require` | `string[]` | Yes | `--require`, `-r` | Paths to where your support code is, for CommonJS - see [below](#finding-your-code) | [] | | `requireModule` | `string[]` | Yes | `--require-module` | Names of transpilation modules to load, loaded via `require()` - see [Transpiling](./transpiling.md) | [] | | `retry` | `number` | No | `--retry` | Retry failing tests up to the given number of times - see [Retry](./retry.md) | 0 | diff --git a/docs/deprecations.md b/docs/deprecations.md index 1eb328994..ab1bac884 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -46,6 +46,14 @@ The `Runtime` class is used internally to represent an instance of the serial te To adapt, pivot to the `runCucumber` function from the [JavaScript API](./javascript_api.md), or raise an issue if you feel your use case isn't catered for. +### publishQuiet + +Deprecated in `9.4.0`. Will be removed in `11.0.0` or later. + +The `publishQuiet` option (or `--publish-quiet` on the CLI) was used to hide the banner suggesting to use Cucumber Reports. The banner has since been removed, so the option now does nothing. + +To adapt, remove the option from your configuration files and CLI commands (especially the latter, since the CLI will fail on unrecognised options). + ## Previous deprecations For deprecations that have been completed (i.e. the functionality removed), see [UPGRADING.md](../UPGRADING.md). diff --git a/features/publish.feature b/features/publish.feature index 1267dac87..a15e0be51 100644 --- a/features/publish.feature +++ b/features/publish.feature @@ -85,24 +85,6 @@ Feature: Publish reports └──────────────────────────────────────────────────────────────────────────┘ """ - @spawn - Scenario: when results are not published, a banner explains how to publish - When I run cucumber-js - Then the error output contains the text: - """ - ┌──────────────────────────────────────────────────────────────────────────────┐ - │ Share your Cucumber Report with your team at https://reports.cucumber.io │ - │ │ - │ Command line option: --publish │ - │ Environment variable: CUCUMBER_PUBLISH_ENABLED=true │ - │ │ - │ More information at https://cucumber.io/docs/cucumber/environment-variables/ │ - │ │ - │ To disable this message, add this to your ./cucumber.js: │ - │ module.exports = { default: '--publish-quiet' } │ - └──────────────────────────────────────────────────────────────────────────────┘ - """ - @spawn Scenario: when results are not published due to an error raised by the server, the banner is displayed When I run cucumber-js with env `CUCUMBER_PUBLISH_TOKEN=keyboardcat` @@ -115,30 +97,3 @@ Feature: Publish reports Unexpected http status 401 from GET http://localhost:9987 """ - - @spawn - Scenario: the publication banner is not shown when publication is done - When I run cucumber-js with arguments `` and env `` - Then the error output does not contain the text: - """ - Share your Cucumber Report with your team at https://reports.cucumber.io - """ - - Examples: - | args | env | - | --publish | | - | | CUCUMBER_PUBLISH_ENABLED=true | - | | CUCUMBER_PUBLISH_TOKEN=f318d9ec-5a3d-4727-adec-bd7b69e2edd3 | - - @spawn - Scenario: the publication banner is not shown when publication is disabled - When I run cucumber-js with arguments `` and env `` - Then the error output does not contain the text: - """ - Share your Cucumber Report with your team at https://reports.cucumber.io - """ - - Examples: - | args | env | - | --publish-quiet | | - | | CUCUMBER_PUBLISH_QUIET=true | diff --git a/src/api/load_configuration.ts b/src/api/load_configuration.ts index 13163311f..b77d8476f 100644 --- a/src/api/load_configuration.ts +++ b/src/api/load_configuration.ts @@ -43,7 +43,7 @@ export async function loadConfiguration( options.provided ) logger.debug('Resolved configuration:', original) - validateConfiguration(original) + validateConfiguration(original, logger) const runnable = await convertConfiguration(original, env) return { useConfiguration: original, diff --git a/src/cli/index.ts b/src/cli/index.ts index 78f737d3c..e090e4228 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,4 +1,4 @@ -import { ArgvParser, isTruthyString } from '../configuration' +import { ArgvParser } from '../configuration' import { IFormatterStream } from '../formatter' import { loadConfiguration, runCucumber } from '../api' import { getKeywords, getLanguages } from './i18n' @@ -6,7 +6,6 @@ import { validateInstall } from './install_validator' import debug from 'debug' export interface ICliRunResult { - shouldAdvertisePublish: boolean shouldExitImmediately: boolean success: boolean } @@ -49,7 +48,6 @@ export default class Cli { if (options.i18nLanguages) { this.stdout.write(getLanguages()) return { - shouldAdvertisePublish: false, shouldExitImmediately: true, success: true, } @@ -57,7 +55,6 @@ export default class Cli { if (options.i18nKeywords) { this.stdout.write(getKeywords(options.i18nKeywords)) return { - shouldAdvertisePublish: false, shouldExitImmediately: true, success: true, } @@ -81,10 +78,6 @@ export default class Cli { ) const { success } = await runCucumber(runConfiguration, environment) return { - shouldAdvertisePublish: - !runConfiguration.formats.publish && - !configuration.publishQuiet && - !isTruthyString(this.env.CUCUMBER_PUBLISH_QUIET), shouldExitImmediately: configuration.forceExit, success, } diff --git a/src/cli/publish_banner.ts b/src/cli/publish_banner.ts deleted file mode 100644 index 890ddff0b..000000000 --- a/src/cli/publish_banner.ts +++ /dev/null @@ -1,40 +0,0 @@ -import chalk from 'chalk' -import Table from 'cli-table3' - -const chalkInstance = chalk.stderr - -const underlineBoldCyan = (x: string): string => - chalkInstance.underline(chalkInstance.bold(chalkInstance.cyan(x))) - -const formattedReportUrl = underlineBoldCyan('https://reports.cucumber.io') -const formattedEnv = - chalkInstance.cyan('CUCUMBER_PUBLISH_ENABLED') + - '=' + - chalkInstance.cyan('true') -const formattedMoreInfoUrl = underlineBoldCyan( - 'https://cucumber.io/docs/cucumber/environment-variables/' -) - -const text = `\ -Share your Cucumber Report with your team at ${formattedReportUrl} - -Command line option: ${chalkInstance.cyan('--publish')} -Environment variable: ${formattedEnv} - -More information at ${formattedMoreInfoUrl} - -To disable this message, add this to your ${chalkInstance.bold( - './cucumber.js' -)}: -${chalkInstance.bold("module.exports = { default: '--publish-quiet' }")}` - -const table = new Table({ - style: { - head: [], - border: chalkInstance.supportsColor ? ['green'] : [], - }, -}) - -table.push([text]) - -export default table.toString() diff --git a/src/cli/run.ts b/src/cli/run.ts index 99c02b0bf..f529f615b 100644 --- a/src/cli/run.ts +++ b/src/cli/run.ts @@ -3,7 +3,6 @@ * but other code abstracts those to remain composable and testable. */ import Cli, { ICliRunResult } from './' import VError from 'verror' -import publishBanner from './publish_banner' import { validateNodeEngineVersion } from './validate_node_engine_version' function logErrorMessageAndExit(message: string): void { @@ -11,10 +10,6 @@ function logErrorMessageAndExit(message: string): void { process.exit(1) } -function displayPublishAdvertisementBanner(): void { - console.error(publishBanner) -} - export default async function run(): Promise { validateNodeEngineVersion( process.version, @@ -40,10 +35,6 @@ export default async function run(): Promise { logErrorMessageAndExit(VError.fullStack(error)) } - if (result.shouldAdvertisePublish) { - displayPublishAdvertisementBanner() - } - const exitCode = result.success ? 0 : 1 if (result.shouldExitImmediately) { process.exit(exitCode) diff --git a/src/configuration/types.ts b/src/configuration/types.ts index 208f431cd..cdc75b1d7 100644 --- a/src/configuration/types.ts +++ b/src/configuration/types.ts @@ -15,6 +15,9 @@ export interface IConfiguration { paths: string[] parallel: number publish: boolean + /** + * @deprecated no longer needed; see + */ publishQuiet: boolean require: string[] requireModule: string[] diff --git a/src/configuration/validate_configuration.ts b/src/configuration/validate_configuration.ts index 05fdbd825..f75a2fd07 100644 --- a/src/configuration/validate_configuration.ts +++ b/src/configuration/validate_configuration.ts @@ -1,6 +1,15 @@ import { IConfiguration } from './types' +import { ILogger } from '../logger' -export function validateConfiguration(configuration: IConfiguration): void { +export function validateConfiguration( + configuration: IConfiguration, + logger: ILogger +): void { + if (configuration.publishQuiet) { + logger.warn( + '`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md' + ) + } if (configuration.retryTagFilter && !configuration.retry) { throw new Error( 'a positive `retry` count must be specified when setting `retryTagFilter`'