Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix-2178-format-opt…
Browse files Browse the repository at this point in the history
…ion-splitter
  • Loading branch information
yusuke-noda committed Aug 21, 2023
2 parents 1946a0b + 85b1e5e commit 6d8182c
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 113 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ Please see [CONTRIBUTING.md](./CONTRIBUTING.md) on how to contribute to Cucumber

## [Unreleased]

## [9.4.0] - 2023-08-12
### Fixed
- Fix type import from cucumber-expressions ([#2310](https://github.com/cucumber/cucumber-js/pull/2310))

### Removed
- Remove Cucumber Reports suggestion ([#2311](https://github.com/cucumber/cucumber-js/pull/2311))

## [9.3.0] - 2023-07-14
### Added
- Support attachments with filenames ([#2297](https://github.com/cucumber/cucumber-js/pull/2297))
Expand Down Expand Up @@ -1514,7 +1521,8 @@ this.Given(), this.When(), this.Then() and this.defineStep() ([#2](https://githu

## 0.0.1

[Unreleased]: https://github.com/cucumber/cucumber-js/compare/v9.3.0...HEAD
[Unreleased]: https://github.com/cucumber/cucumber-js/compare/v9.4.0...HEAD
[9.4.0]: https://github.com/cucumber/cucumber-js/compare/v9.3.0...v9.4.0
[9.3.0]: https://github.com/cucumber/cucumber-js/compare/v9.2.0...v9.3.0
[9.2.0]: https://github.com/cucumber/cucumber-js/compare/v9.1.2...v9.2.0
[9.1.2]: https://github.com/cucumber/cucumber-js/compare/v9.1.1...v9.1.2
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).
1 change: 1 addition & 0 deletions docs/support_files/api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The built in parameter types are:
Defines a hook which is run after each scenario.

* `options`: An object with the following keys:
* `name`: An optional name for this hook
* `tags`: String tag expression used to apply this hook to only specific scenarios. See [cucumber-tag-expressions](https://github.com/cucumber/tag-expressions) for more information.
* `timeout`: A hook-specific timeout, to override the default timeout.
* `fn`: A function, defined as follows:
Expand Down
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 |
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"gherkin",
"tests"
],
"version": "9.3.0",
"version": "9.4.0",
"homepage": "https://github.com/cucumber/cucumber-js",
"author": "Julien Biezemans <[email protected]>",
"contributors": [
Expand Down
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions'
import ParameterType from '@cucumber/cucumber-expressions/dist/cjs/src/ParameterType'
import {
ParameterType,
ParameterTypeRegistry,
} from '@cucumber/cucumber-expressions'
import { ILineAndUri } from '../types'

export class SourcedParameterTypeRegistry extends ParameterTypeRegistry {
Expand Down

0 comments on commit 6d8182c

Please sign in to comment.