Skip to content

fix: remove cucumber reports suggestion #2311

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

Merged
merged 11 commits into from
Aug 12, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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]
### 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))

Expand Down
3 changes: 1 addition & 2 deletions cucumber.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"html:reports/html-formatter.html"
],
"retry": 2,
"retryTagFilter": "@flaky",
"publishQuiet": true
"retryTagFilter": "@flaky"
}
}
1 change: 0 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://reports.cucumber.io/> | 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 |
Expand Down
8 changes: 8 additions & 0 deletions docs/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
45 changes: 0 additions & 45 deletions features/publish.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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 `<args>` and env `<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 `<args>` and env `<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 |
2 changes: 1 addition & 1 deletion src/api/load_configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 1 addition & 8 deletions src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ArgvParser, isTruthyString } from '../configuration'
import { ArgvParser } from '../configuration'
import { IFormatterStream } from '../formatter'
import { loadConfiguration, runCucumber } from '../api'
import { getKeywords, getLanguages } from './i18n'
import { validateInstall } from './install_validator'
import debug from 'debug'

export interface ICliRunResult {
shouldAdvertisePublish: boolean
shouldExitImmediately: boolean
success: boolean
}
Expand Down Expand Up @@ -49,15 +48,13 @@ export default class Cli {
if (options.i18nLanguages) {
this.stdout.write(getLanguages())
return {
shouldAdvertisePublish: false,
shouldExitImmediately: true,
success: true,
}
}
if (options.i18nKeywords) {
this.stdout.write(getKeywords(options.i18nKeywords))
return {
shouldAdvertisePublish: false,
shouldExitImmediately: true,
success: true,
}
Expand All @@ -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,
}
Expand Down
40 changes: 0 additions & 40 deletions src/cli/publish_banner.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@
* 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 {
console.error(message)
process.exit(1)
}

function displayPublishAdvertisementBanner(): void {
console.error(publishBanner)
}

export default async function run(): Promise<void> {
validateNodeEngineVersion(
process.version,
Expand All @@ -40,10 +35,6 @@ export default async function run(): Promise<void> {
logErrorMessageAndExit(VError.fullStack(error))
}

if (result.shouldAdvertisePublish) {
displayPublishAdvertisementBanner()
}

const exitCode = result.success ? 0 : 1
if (result.shouldExitImmediately) {
process.exit(exitCode)
Expand Down
3 changes: 3 additions & 0 deletions src/configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export interface IConfiguration {
paths: string[]
parallel: number
publish: boolean
/**
* @deprecated no longer needed; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
*/
publishQuiet: boolean
require: string[]
requireModule: string[]
Expand Down
11 changes: 10 additions & 1 deletion src/configuration/validate_configuration.ts
Original file line number Diff line number Diff line change
@@ -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`'
Expand Down