From a4716c0a06b6b42628aa70d9b4894bb6ab944a35 Mon Sep 17 00:00:00 2001 From: David Goss Date: Sun, 10 May 2020 00:39:38 +0100 Subject: [PATCH] remove typeName from options object for defineParameterType (#1319) --- CHANGELOG.md | 1 + src/support_code_library_builder/build_helpers.ts | 15 +-------------- src/support_code_library_builder/types.ts | 1 - 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 128306d9f..6faeb41ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO * `event-protocol` formatter has been removed and replaced with `message` * Custom formatters will need to migrate * `json` formatter is deprecated and will be removed in next major release. Custom formatters should migrate to use the `message` formatter, or the [standalone JSON formatter](https://github.com/cucumber/cucumber/tree/master/json-formatter) as a stopgap. +* Remove long-deprecated `typeName` from options object for `defineParameterType` in favour of `name` #### Bug fixes diff --git a/src/support_code_library_builder/build_helpers.ts b/src/support_code_library_builder/build_helpers.ts index c89825205..b5e086705 100644 --- a/src/support_code_library_builder/build_helpers.ts +++ b/src/support_code_library_builder/build_helpers.ts @@ -1,14 +1,9 @@ -import { deprecate } from 'util' import _ from 'lodash' import { ParameterType } from 'cucumber-expressions' import path from 'path' import StackTrace from 'stacktrace-js' import { isFileNameInCucumber } from '../stack_trace_filter' -import { - doesHaveValue, - doesNotHaveValue, - valueOrDefault, -} from '../value_checker' +import { doesHaveValue, valueOrDefault } from '../value_checker' import { ILineAndUri } from '../types' import { IParameterTypeDefinition } from './types' @@ -34,19 +29,11 @@ export function getDefinitionLineAndUri(cwd: string): ILineAndUri { export function buildParameterType({ name, - typeName, regexp, transformer, useForSnippets, preferForRegexpMatch, }: IParameterTypeDefinition): ParameterType { - const getTypeName = deprecate( - () => typeName, - 'Cucumber defineParameterType: Use name instead of typeName' - ) - if (doesNotHaveValue(name) && doesHaveValue(typeName)) { - name = getTypeName() - } if (typeof useForSnippets !== 'boolean') useForSnippets = true if (typeof preferForRegexpMatch !== 'boolean') preferForRegexpMatch = false return new ParameterType( diff --git a/src/support_code_library_builder/types.ts b/src/support_code_library_builder/types.ts index c1312e015..b5783e2f9 100644 --- a/src/support_code_library_builder/types.ts +++ b/src/support_code_library_builder/types.ts @@ -37,7 +37,6 @@ export interface IDefineTestRunHookOptions { export interface IParameterTypeDefinition { name: string - typeName: string regexp: RegExp transformer: (...match: string[]) => T useForSnippets: boolean