@cucumber/cucumber 8.6.0 → 8.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/helpers.d.ts +0 -2
- package/lib/cli/helpers.js +0 -2
- package/lib/cli/helpers.js.map +1 -1
- package/lib/index.d.ts +25 -8
- package/lib/index.js +27 -13
- package/lib/index.js.map +1 -1
- package/lib/support_code_library_builder/index.js +1 -2
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib/wrapper.mjs +6 -8
- package/package.json +13 -13
package/lib/cli/helpers.d.ts
CHANGED
|
@@ -20,8 +20,6 @@ interface IParseGherkinMessageStreamRequest {
|
|
|
20
20
|
/**
|
|
21
21
|
* Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids
|
|
22
22
|
*
|
|
23
|
-
* @deprecated use `loadSources` instead
|
|
24
|
-
*
|
|
25
23
|
* @param eventBroadcaster
|
|
26
24
|
* @param eventDataCollector
|
|
27
25
|
* @param gherkinMessageStream
|
package/lib/cli/helpers.js
CHANGED
|
@@ -38,8 +38,6 @@ const version_1 = require("../version");
|
|
|
38
38
|
/**
|
|
39
39
|
* Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids
|
|
40
40
|
*
|
|
41
|
-
* @deprecated use `loadSources` instead
|
|
42
|
-
*
|
|
43
41
|
* @param eventBroadcaster
|
|
44
42
|
* @param eventDataCollector
|
|
45
43
|
* @param gherkinMessageStream
|
package/lib/cli/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAA0C;AAI1C,oDAAgD;AAChD,oDAAiD;AAEjD,4CAAmB;AACnB,6DAA8C;AAE9C,8EAA0D;AA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ACD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;AACN,CAAC;AAED,SAAgB,uBAAuB,CAAC,EACtC,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,GAKN;IACC,kBAAkB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,2BAA2B,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACjE,mBAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import shuffle from 'knuth-shuffle-seeded'\nimport { EventEmitter } from 'events'\nimport PickleFilter from '../pickle_filter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { doesHaveValue } from '../value_checker'\nimport { OptionSplitter } from '../configuration'\nimport { Readable } from 'stream'\nimport os from 'os'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { PickleOrder } from '../models/pickle_order'\nimport { builtinParameterTypes } from '../support_code_library_builder'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\n\ninterface IParseGherkinMessageStreamRequest {\n cwd?: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\n/**\n * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids\n *\n * @deprecated use `loadSources` instead\n *\n * @param eventBroadcaster\n * @param eventDataCollector\n * @param gherkinMessageStream\n * @param order\n * @param pickleFilter\n */\nexport async function parseGherkinMessageStream({\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickles(result, order, console)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: PickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = OptionSplitter.split(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nfunction emitParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (builtinParameterTypes.includes(parameterType.name)) {\n continue\n }\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: {\n uri: stepDefinition.uri,\n location: {\n line: stepDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: {\n uri: testCaseHookDefinition.uri,\n location: {\n line: testCaseHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: {\n uri: testRunHookDefinition.uri,\n location: {\n line: testRunHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: ISupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gFAA0C;AAI1C,oDAAgD;AAChD,oDAAiD;AAEjD,4CAAmB;AACnB,6DAA8C;AAE9C,8EAA0D;AAK1D,kFAAuE;AACvE,wCAAoC;AAYpC;;;;;;;;GAQG;AACI,KAAK,UAAU,yBAAyB,CAAC,EAC9C,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,EACL,YAAY,GACsB;IAClC,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,QAA2B,EAAE,EAAE;YAC9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C,CAAA;IACzD,iBAAiB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;IACvD,gBAAgB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACxD,CAAC;AAdD,0DAcC","sourcesContent":["import shuffle from 'knuth-shuffle-seeded'\nimport { EventEmitter } from 'events'\nimport PickleFilter from '../pickle_filter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { doesHaveValue } from '../value_checker'\nimport { OptionSplitter } from '../configuration'\nimport { Readable } from 'stream'\nimport os from 'os'\nimport * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport detectCiEnvironment from '@cucumber/ci-environment'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { PickleOrder } from '../models/pickle_order'\nimport { builtinParameterTypes } from '../support_code_library_builder'\nimport { version } from '../version'\nimport { ILogger } from '../logger'\n\ninterface IParseGherkinMessageStreamRequest {\n cwd?: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n gherkinMessageStream: Readable\n order: string\n pickleFilter: PickleFilter\n}\n\n/**\n * Process a stream of envelopes from Gherkin and resolve to an array of filtered, ordered pickle Ids\n *\n * @param eventBroadcaster\n * @param eventDataCollector\n * @param gherkinMessageStream\n * @param order\n * @param pickleFilter\n */\nexport async function parseGherkinMessageStream({\n eventBroadcaster,\n eventDataCollector,\n gherkinMessageStream,\n order,\n pickleFilter,\n}: IParseGherkinMessageStreamRequest): Promise<string[]> {\n return await new Promise<string[]>((resolve, reject) => {\n const result: string[] = []\n gherkinMessageStream.on('data', (envelope: messages.Envelope) => {\n eventBroadcaster.emit('envelope', envelope)\n if (doesHaveValue(envelope.pickle)) {\n const pickle = envelope.pickle\n const pickleId = pickle.id\n const gherkinDocument = eventDataCollector.getGherkinDocument(\n pickle.uri\n )\n if (pickleFilter.matches({ gherkinDocument, pickle })) {\n result.push(pickleId)\n }\n }\n })\n gherkinMessageStream.on('end', () => {\n orderPickles(result, order, console)\n resolve(result)\n })\n gherkinMessageStream.on('error', reject)\n })\n}\n\n// Orders the pickleIds in place - morphs input\nexport function orderPickles<T = string>(\n pickleIds: T[],\n order: PickleOrder,\n logger: ILogger\n): void {\n const [type, seed] = OptionSplitter.split(order)\n switch (type) {\n case 'defined':\n break\n case 'random':\n if (seed === '') {\n const newSeed = Math.floor(Math.random() * 1000 * 1000).toString()\n logger.warn(`Random order using seed: ${newSeed}`)\n shuffle(pickleIds, newSeed)\n } else {\n shuffle(pickleIds, seed)\n }\n break\n default:\n throw new Error(\n 'Unrecgonized order type. Should be `defined` or `random`'\n )\n }\n}\n\nexport async function emitMetaMessage(\n eventBroadcaster: EventEmitter,\n env: NodeJS.ProcessEnv\n): Promise<void> {\n const meta: messages.Meta = {\n protocolVersion: messages.version,\n implementation: {\n version,\n name: 'cucumber-js',\n },\n cpu: {\n name: os.arch(),\n },\n os: {\n name: os.platform(),\n version: os.release(),\n },\n runtime: {\n name: 'node.js',\n version: process.versions.node,\n },\n ci: detectCiEnvironment(env),\n }\n eventBroadcaster.emit('envelope', {\n meta,\n })\n}\n\nfunction emitParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId\n): void {\n for (const parameterType of supportCodeLibrary.parameterTypeRegistry\n .parameterTypes) {\n if (builtinParameterTypes.includes(parameterType.name)) {\n continue\n }\n const envelope: messages.Envelope = {\n parameterType: {\n id: newId(),\n name: parameterType.name,\n preferForRegularExpressionMatch: parameterType.preferForRegexpMatch,\n regularExpressions: parameterType.regexpStrings,\n useForSnippets: parameterType.useForSnippets,\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitUndefinedParameterTypes(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n for (const undefinedParameterType of supportCodeLibrary.undefinedParameterTypes) {\n const envelope: messages.Envelope = {\n undefinedParameterType,\n }\n eventBroadcaster.emit('envelope', envelope)\n }\n}\n\nfunction emitStepDefinitions(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n supportCodeLibrary.stepDefinitions.forEach((stepDefinition) => {\n const envelope: messages.Envelope = {\n stepDefinition: {\n id: stepDefinition.id,\n pattern: {\n source: stepDefinition.pattern.toString(),\n type:\n typeof stepDefinition.pattern === 'string'\n ? messages.StepDefinitionPatternType.CUCUMBER_EXPRESSION\n : messages.StepDefinitionPatternType.REGULAR_EXPRESSION,\n },\n sourceReference: {\n uri: stepDefinition.uri,\n location: {\n line: stepDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestCaseHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestCaseHookDefinitions,\n supportCodeLibrary.afterTestCaseHookDefinitions\n )\n .forEach((testCaseHookDefinition: TestCaseHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testCaseHookDefinition.id,\n name: testCaseHookDefinition.name,\n tagExpression: testCaseHookDefinition.tagExpression,\n sourceReference: {\n uri: testCaseHookDefinition.uri,\n location: {\n line: testCaseHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nfunction emitTestRunHooks(\n supportCodeLibrary: ISupportCodeLibrary,\n eventBroadcaster: EventEmitter\n): void {\n ;[]\n .concat(\n supportCodeLibrary.beforeTestRunHookDefinitions,\n supportCodeLibrary.afterTestRunHookDefinitions\n )\n .forEach((testRunHookDefinition: TestRunHookDefinition) => {\n const envelope: messages.Envelope = {\n hook: {\n id: testRunHookDefinition.id,\n sourceReference: {\n uri: testRunHookDefinition.uri,\n location: {\n line: testRunHookDefinition.line,\n },\n },\n },\n }\n eventBroadcaster.emit('envelope', envelope)\n })\n}\n\nexport function emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n}: {\n eventBroadcaster: EventEmitter\n supportCodeLibrary: ISupportCodeLibrary\n newId: IdGenerator.NewId\n}): void {\n emitParameterTypes(supportCodeLibrary, eventBroadcaster, newId)\n emitUndefinedParameterTypes(supportCodeLibrary, eventBroadcaster)\n emitStepDefinitions(supportCodeLibrary, eventBroadcaster)\n emitTestCaseHooks(supportCodeLibrary, eventBroadcaster)\n emitTestRunHooks(supportCodeLibrary, eventBroadcaster)\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { default as _Cli } from './cli';
|
|
2
|
+
import * as cliHelpers from './cli/helpers';
|
|
1
3
|
import * as formatterHelpers from './formatter/helpers';
|
|
4
|
+
import { default as _PickleFilter } from './pickle_filter';
|
|
2
5
|
import * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_helpers';
|
|
6
|
+
import { default as _Runtime } from './runtime';
|
|
3
7
|
import * as messages from '@cucumber/messages';
|
|
4
|
-
export { default as Cli } from './cli';
|
|
5
|
-
export { parseGherkinMessageStream } from './cli/helpers';
|
|
6
|
-
export { default as PickleFilter } from './pickle_filter';
|
|
7
|
-
export { default as Runtime, INewRuntimeOptions, IRuntimeOptions, } from './runtime';
|
|
8
8
|
export { default as supportCodeLibraryBuilder } from './support_code_library_builder';
|
|
9
9
|
export { default as DataTable } from './models/data_table';
|
|
10
10
|
export { default as TestCaseHookDefinition } from './models/test_case_hook_definition';
|
|
@@ -26,10 +26,6 @@ export declare const Before: (<WorldType = import("./support_code_library_builde
|
|
|
26
26
|
export declare const BeforeAll: ((code: Function) => void) & ((options: import("./support_code_library_builder/types").IDefineTestRunHookOptions, code: Function) => void);
|
|
27
27
|
export declare const BeforeStep: (<WorldType = import("./support_code_library_builder/world").IWorld<any>>(code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType>) => void) & (<WorldType_1 = import("./support_code_library_builder/world").IWorld<any>>(tags: string, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_1>) => void) & (<WorldType_2 = import("./support_code_library_builder/world").IWorld<any>>(options: import("./support_code_library_builder/types").IDefineTestStepHookOptions, code: import("./support_code_library_builder/types").TestStepHookFunction<WorldType_2>) => void);
|
|
28
28
|
export declare const defineParameterType: (options: import("./support_code_library_builder/types").IParameterTypeDefinition<any>) => void;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/issues/2043>
|
|
31
|
-
*/
|
|
32
|
-
export declare const defineStep: import("./support_code_library_builder/types").IDefineStep;
|
|
33
29
|
export declare const Given: import("./support_code_library_builder/types").IDefineStep;
|
|
34
30
|
export declare const setDefaultTimeout: (milliseconds: number) => void;
|
|
35
31
|
export declare const setDefinitionFunctionWrapper: (fn: Function) => void;
|
|
@@ -42,3 +38,24 @@ export { parallelCanAssignHelpers };
|
|
|
42
38
|
export { ITestCaseHookParameter, ITestStepHookParameter, } from './support_code_library_builder/types';
|
|
43
39
|
export declare const Status: typeof messages.TestStepResultStatus;
|
|
44
40
|
export { wrapPromiseWithTimeout } from './time';
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
43
|
+
*/
|
|
44
|
+
export declare const Cli: typeof _Cli;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
47
|
+
*/
|
|
48
|
+
export declare const defineStep: import("./support_code_library_builder/types").IDefineStep;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
51
|
+
*/
|
|
52
|
+
export declare const parseGherkinMessageStream: typeof cliHelpers.parseGherkinMessageStream;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
55
|
+
*/
|
|
56
|
+
export declare const PickleFilter: typeof _PickleFilter;
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
59
|
+
*/
|
|
60
|
+
export declare const Runtime: typeof _Runtime;
|
|
61
|
+
export { INewRuntimeOptions, IRuntimeOptions } from './runtime';
|
package/lib/index.js
CHANGED
|
@@ -26,22 +26,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = exports.World = exports.When = exports.Then = exports.setParallelCanAssign = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.
|
|
29
|
+
exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.defineStep = exports.Cli = exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = exports.World = exports.When = exports.Then = exports.setParallelCanAssign = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.version = exports.TestCaseHookDefinition = exports.DataTable = exports.supportCodeLibraryBuilder = void 0;
|
|
30
|
+
const cli_1 = __importDefault(require("./cli"));
|
|
31
|
+
const cliHelpers = __importStar(require("./cli/helpers"));
|
|
30
32
|
const formatterHelpers = __importStar(require("./formatter/helpers"));
|
|
31
33
|
exports.formatterHelpers = formatterHelpers;
|
|
34
|
+
const pickle_filter_1 = __importDefault(require("./pickle_filter"));
|
|
32
35
|
const parallelCanAssignHelpers = __importStar(require("./support_code_library_builder/parallel_can_assign_helpers"));
|
|
33
36
|
exports.parallelCanAssignHelpers = parallelCanAssignHelpers;
|
|
37
|
+
const runtime_1 = __importDefault(require("./runtime"));
|
|
34
38
|
const support_code_library_builder_1 = __importDefault(require("./support_code_library_builder"));
|
|
35
39
|
const messages = __importStar(require("@cucumber/messages"));
|
|
40
|
+
const util_1 = require("util");
|
|
36
41
|
// Top level
|
|
37
|
-
var cli_1 = require("./cli");
|
|
38
|
-
Object.defineProperty(exports, "Cli", { enumerable: true, get: function () { return __importDefault(cli_1).default; } });
|
|
39
|
-
var helpers_1 = require("./cli/helpers");
|
|
40
|
-
Object.defineProperty(exports, "parseGherkinMessageStream", { enumerable: true, get: function () { return helpers_1.parseGherkinMessageStream; } });
|
|
41
|
-
var pickle_filter_1 = require("./pickle_filter");
|
|
42
|
-
Object.defineProperty(exports, "PickleFilter", { enumerable: true, get: function () { return __importDefault(pickle_filter_1).default; } });
|
|
43
|
-
var runtime_1 = require("./runtime");
|
|
44
|
-
Object.defineProperty(exports, "Runtime", { enumerable: true, get: function () { return __importDefault(runtime_1).default; } });
|
|
45
42
|
var support_code_library_builder_2 = require("./support_code_library_builder");
|
|
46
43
|
Object.defineProperty(exports, "supportCodeLibraryBuilder", { enumerable: true, get: function () { return __importDefault(support_code_library_builder_2).default; } });
|
|
47
44
|
var data_table_1 = require("./models/data_table");
|
|
@@ -78,10 +75,6 @@ exports.Before = methods.Before;
|
|
|
78
75
|
exports.BeforeAll = methods.BeforeAll;
|
|
79
76
|
exports.BeforeStep = methods.BeforeStep;
|
|
80
77
|
exports.defineParameterType = methods.defineParameterType;
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/issues/2043>
|
|
83
|
-
*/
|
|
84
|
-
exports.defineStep = methods.defineStep;
|
|
85
78
|
exports.Given = methods.Given;
|
|
86
79
|
exports.setDefaultTimeout = methods.setDefaultTimeout;
|
|
87
80
|
exports.setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper;
|
|
@@ -95,4 +88,25 @@ exports.Status = messages.TestStepResultStatus;
|
|
|
95
88
|
// Time helpers
|
|
96
89
|
var time_1 = require("./time");
|
|
97
90
|
Object.defineProperty(exports, "wrapPromiseWithTimeout", { enumerable: true, get: function () { return time_1.wrapPromiseWithTimeout; } });
|
|
91
|
+
// Deprecated
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
94
|
+
*/
|
|
95
|
+
exports.Cli = (0, util_1.deprecate)(cli_1.default, '`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
98
|
+
*/
|
|
99
|
+
exports.defineStep = (0, util_1.deprecate)(methods.defineStep, '`defineStep` is deprecated, use `Given`, `When` or `Then` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
102
|
+
*/
|
|
103
|
+
exports.parseGherkinMessageStream = (0, util_1.deprecate)(cliHelpers.parseGherkinMessageStream, '`parseGherkinMessageStream` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
106
|
+
*/
|
|
107
|
+
exports.PickleFilter = (0, util_1.deprecate)(pickle_filter_1.default, '`PickleFilter` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
|
|
110
|
+
*/
|
|
111
|
+
exports.Runtime = (0, util_1.deprecate)(runtime_1.default, '`Runtime` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
|
|
98
112
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAuD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAuC;AACvC,0DAA2C;AAC3C,sEAAuD;AAwB9C,4CAAgB;AAvBzB,oEAA0D;AAC1D,qHAAsG;AA6C7F,4DAAwB;AA5CjC,wDAA+C;AAC/C,kGAAsE;AACtE,6DAA8C;AAC9C,+BAAgC;AAEhC,YAAY;AACZ,+EAAqF;AAA5E,0JAAA,OAAO,OAA6B;AAC7C,kDAA0D;AAAjD,wHAAA,OAAO,OAAa;AAC7B,gFAAsF;AAA7E,oJAAA,OAAO,OAA0B;AAC1C,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAEhB,aAAa;AACb,yCAAqE;AAA5D,uHAAA,OAAO,OAAa;AAC7B,+CAAiE;AAAxD,4HAAA,OAAO,OAAoB;AACpC,6DAAqE;AAA5D,gIAAA,OAAO,OAAiB;AACjC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,+DAAuE;AAA9D,kIAAA,OAAO,OAAkB;AAClC,qEAA6E;AAApE,wIAAA,OAAO,OAAqB;AACrC,mEAA2E;AAAlE,sIAAA,OAAO,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AAA,yBAAyB,GAAG,IAAA,gBAAS,EAChD,UAAU,CAAC,yBAAyB,EACpC,kJAAkJ,CACnJ,CAAA;AACD;;GAEG;AACU,QAAA,YAAY,GAAG,IAAA,gBAAS,EACnC,uBAAa,EACb,qIAAqI,CACtI,CAAA;AACD;;GAEG;AACU,QAAA,OAAO,GAAG,IAAA,gBAAS,EAC9B,iBAAQ,EACR,gIAAgI,CACjI,CAAA","sourcesContent":["import { default as _Cli } from './cli'\nimport * as cliHelpers from './cli/helpers'\nimport * as formatterHelpers from './formatter/helpers'\nimport { default as _PickleFilter } from './pickle_filter'\nimport * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_helpers'\nimport { default as _Runtime } from './runtime'\nimport supportCodeLibraryBuilder from './support_code_library_builder'\nimport * as messages from '@cucumber/messages'\nimport { deprecate } from 'util'\n\n// Top level\nexport { default as supportCodeLibraryBuilder } from './support_code_library_builder'\nexport { default as DataTable } from './models/data_table'\nexport { default as TestCaseHookDefinition } from './models/test_case_hook_definition'\nexport { version } from './version'\n\n// Formatters\nexport { default as Formatter, IFormatterOptions } from './formatter'\nexport { default as FormatterBuilder } from './formatter/builder'\nexport { default as JsonFormatter } from './formatter/json_formatter'\nexport { default as ProgressFormatter } from './formatter/progress_formatter'\nexport { default as RerunFormatter } from './formatter/rerun_formatter'\nexport { default as SnippetsFormatter } from './formatter/snippets_formatter'\nexport { default as SummaryFormatter } from './formatter/summary_formatter'\nexport { default as UsageFormatter } from './formatter/usage_formatter'\nexport { default as UsageJsonFormatter } from './formatter/usage_json_formatter'\nexport { formatterHelpers }\n\n// Support Code Functions\nconst { methods } = supportCodeLibraryBuilder\nexport const After = methods.After\nexport const AfterAll = methods.AfterAll\nexport const AfterStep = methods.AfterStep\nexport const Before = methods.Before\nexport const BeforeAll = methods.BeforeAll\nexport const BeforeStep = methods.BeforeStep\nexport const defineParameterType = methods.defineParameterType\nexport const Given = methods.Given\nexport const setDefaultTimeout = methods.setDefaultTimeout\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper\nexport const setWorldConstructor = methods.setWorldConstructor\nexport const setParallelCanAssign = methods.setParallelCanAssign\nexport const Then = methods.Then\nexport const When = methods.When\nexport {\n default as World,\n IWorld,\n IWorldOptions,\n} from './support_code_library_builder/world'\nexport { parallelCanAssignHelpers }\n\nexport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n} from './support_code_library_builder/types'\nexport const Status = messages.TestStepResultStatus\n\n// Time helpers\nexport { wrapPromiseWithTimeout } from './time'\n\n// Deprecated\n/**\n * @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const Cli = deprecate(\n _Cli,\n '`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const defineStep = deprecate(\n methods.defineStep,\n '`defineStep` is deprecated, use `Given`, `When` or `Then` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const parseGherkinMessageStream = deprecate(\n cliHelpers.parseGherkinMessageStream,\n '`parseGherkinMessageStream` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const PickleFilter = deprecate(\n _PickleFilter,\n '`PickleFilter` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n/**\n * @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>\n */\nexport const Runtime = deprecate(\n _Runtime,\n '`Runtime` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\nexport { INewRuntimeOptions, IRuntimeOptions } from './runtime'\n"]}
|
|
@@ -12,7 +12,6 @@ const test_run_hook_definition_1 = __importDefault(require("../models/test_run_h
|
|
|
12
12
|
const step_definition_1 = __importDefault(require("../models/step_definition"));
|
|
13
13
|
const helpers_1 = require("../formatter/helpers");
|
|
14
14
|
const validate_arguments_1 = __importDefault(require("./validate_arguments"));
|
|
15
|
-
const util_1 = require("util");
|
|
16
15
|
const util_arity_1 = __importDefault(require("util-arity"));
|
|
17
16
|
const cucumber_expressions_1 = require("@cucumber/cucumber-expressions");
|
|
18
17
|
const value_checker_1 = require("../value_checker");
|
|
@@ -40,7 +39,7 @@ class SupportCodeLibraryBuilder {
|
|
|
40
39
|
BeforeAll: this.defineTestRunHook(() => this.beforeTestRunHookDefinitionConfigs),
|
|
41
40
|
BeforeStep: this.defineTestStepHook(() => this.beforeTestStepHookDefinitionConfigs),
|
|
42
41
|
defineParameterType: this.defineParameterType.bind(this),
|
|
43
|
-
defineStep:
|
|
42
|
+
defineStep: this.defineStep('Unknown', () => this.stepDefinitionConfigs),
|
|
44
43
|
Given: this.defineStep('Given', () => this.stepDefinitionConfigs),
|
|
45
44
|
setDefaultTimeout: (milliseconds) => {
|
|
46
45
|
this.defaultTimeout = milliseconds;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/support_code_library_builder/index.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA2D;AAC3D,+EAAuE;AAGvE,oGAAwE;AACxE,oGAAwE;AACxE,kGAAsE;AACtE,gFAAsD;AACtD,kDAAqD;AACrD,8EAAoD;AACpD,+BAAgC;AAChC,4DAA8B;AAE9B,yEAIuC;AACvC,oDAAkE;AAgBlE,oDAA2B;AAkCd,QAAA,qBAAqB,GAAG;IACnC,YAAY;IACZ,YAAY;IACZ,MAAM;IACN,QAAQ;IACR,OAAO;IACP,KAAK;IACL,MAAM;I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qB,EAAE,CAAA;QACxD,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAA;QAC/B,IAAI,CAAC,iBAAiB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;QACnC,IAAI,CAAC,KAAK,GAAG,eAAK,CAAA;IACpB,CAAC;CACF;AA1ZD,8DA0ZC;AAED,kBAAe,IAAI,yBAAyB,EAAE,CAAA","sourcesContent":["import { buildParameterType } from './build_parameter_type'\nimport { getDefinitionLineAndUri } from './get_definition_line_and_uri'\nimport { IdGenerator } from '@cucumber/messages'\nimport * as messages from '@cucumber/messages'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestStepHookDefinition from '../models/test_step_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport StepDefinition from '../models/step_definition'\nimport { formatLocation } from '../formatter/helpers'\nimport validateArguments from './validate_arguments'\nimport { deprecate } from 'util'\nimport arity from 'util-arity'\n\nimport {\n CucumberExpression,\n ParameterTypeRegistry,\n RegularExpression,\n} from '@cucumber/cucumber-expressions'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport {\n DefineStepPattern,\n IDefineStepOptions,\n IDefineSupportCodeMethods,\n IDefineTestCaseHookOptions,\n IDefineTestStepHookOptions,\n IDefineTestRunHookOptions,\n IParameterTypeDefinition,\n ISupportCodeLibrary,\n TestCaseHookFunction,\n TestStepHookFunction,\n ParallelAssignmentValidator,\n ISupportCodeCoordinates,\n IDefineStep,\n} from './types'\nimport World from './world'\nimport { ICanonicalSupportCodeIds } from '../runtime/parallel/command_types'\nimport { GherkinStepKeyword } from '../models/gherkin_step_keyword'\n\ninterface IStepDefinitionConfig {\n code: any\n line: number\n options: any\n keyword: GherkinStepKeyword\n pattern: string | RegExp\n uri: string\n}\n\ninterface ITestCaseHookDefinitionConfig {\n code: any\n line: number\n options: any\n uri: string\n}\n\ninterface ITestStepHookDefinitionConfig {\n code: any\n line: number\n options: any\n uri: string\n}\n\ninterface ITestRunHookDefinitionConfig {\n code: any\n line: number\n options: any\n uri: string\n}\n\nexport const builtinParameterTypes = [\n 'bigdecimal',\n 'biginteger',\n 'byte',\n 'double',\n 'float',\n 'int',\n 'long',\n 'short',\n 'string',\n 'word',\n '',\n]\n\nexport class SupportCodeLibraryBuilder {\n public readonly methods: IDefineSupportCodeMethods\n\n private originalCoordinates: ISupportCodeCoordinates\n private afterTestCaseHookDefinitionConfigs: ITestCaseHookDefinitionConfig[]\n private afterTestRunHookDefinitionConfigs: ITestRunHookDefinitionConfig[]\n private afterTestStepHookDefinitionConfigs: ITestStepHookDefinitionConfig[]\n private beforeTestCaseHookDefinitionConfigs: ITestCaseHookDefinitionConfig[]\n private beforeTestRunHookDefinitionConfigs: ITestRunHookDefinitionConfig[]\n private beforeTestStepHookDefinitionConfigs: ITestStepHookDefinitionConfig[]\n private cwd: string\n private defaultTimeout: number\n private definitionFunctionWrapper: any\n private newId: IdGenerator.NewId\n private parameterTypeRegistry: ParameterTypeRegistry\n private stepDefinitionConfigs: IStepDefinitionConfig[]\n private World: any\n private parallelCanAssign: ParallelAssignmentValidator\n\n constructor() {\n const methods: IDefineSupportCodeMethods = {\n After: this.defineTestCaseHook(\n () => this.afterTestCaseHookDefinitionConfigs\n ),\n AfterAll: this.defineTestRunHook(\n () => this.afterTestRunHookDefinitionConfigs\n ),\n AfterStep: this.defineTestStepHook(\n () => this.afterTestStepHookDefinitionConfigs\n ),\n Before: this.defineTestCaseHook(\n () => this.beforeTestCaseHookDefinitionConfigs\n ),\n BeforeAll: this.defineTestRunHook(\n () => this.beforeTestRunHookDefinitionConfigs\n ),\n BeforeStep: this.defineTestStepHook(\n () => this.beforeTestStepHookDefinitionConfigs\n ),\n defineParameterType: this.defineParameterType.bind(this),\n defineStep: deprecate(\n this.defineStep('Unknown', () => this.stepDefinitionConfigs),\n '`defineStep` is deprecated, use `Given`, `When` or `Then` instead; see https://github.com/cucumber/cucumber-js/issues/2043'\n ),\n Given: this.defineStep('Given', () => this.stepDefinitionConfigs),\n setDefaultTimeout: (milliseconds) => {\n this.defaultTimeout = milliseconds\n },\n setDefinitionFunctionWrapper: (fn) => {\n this.definitionFunctionWrapper = fn\n },\n setWorldConstructor: (fn) => {\n this.World = fn\n },\n setParallelCanAssign: (fn: ParallelAssignmentValidator): void => {\n this.parallelCanAssign = fn\n },\n Then: this.defineStep('Then', () => this.stepDefinitionConfigs),\n When: this.defineStep('When', () => this.stepDefinitionConfigs),\n }\n const checkInstall = (method: string) => {\n if (doesNotHaveValue(this.cwd)) {\n throw new Error(\n `\n You're calling functions (e.g. \"${method}\") on an instance of Cucumber that isn't running.\n This means you have an invalid installation, mostly likely due to:\n - Cucumber being installed globally\n - A project structure where your support code is depending on a different instance of Cucumber\n Either way, you'll need to address this in order for Cucumber to work.\n See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations\n `\n )\n }\n }\n this.methods = new Proxy(methods, {\n get(\n target: IDefineSupportCodeMethods,\n method: keyof IDefineSupportCodeMethods\n ): any {\n return (...args: any[]) => {\n checkInstall(method)\n // @ts-expect-error difficult to type this correctly\n return target[method](...args)\n }\n },\n })\n }\n\n defineParameterType(options: IParameterTypeDefinition<any>): void {\n const parameterType = buildParameterType(options)\n this.parameterTypeRegistry.defineParameterType(parameterType)\n }\n\n defineStep(\n keyword: GherkinStepKeyword,\n getCollection: () => IStepDefinitionConfig[]\n ): IDefineStep {\n return (\n pattern: DefineStepPattern,\n options: IDefineStepOptions | Function,\n code?: Function\n ) => {\n if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, pattern, options },\n fnName: 'defineStep',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n keyword,\n pattern,\n uri,\n })\n }\n }\n\n defineTestCaseHook(\n getCollection: () => ITestCaseHookDefinitionConfig[]\n ): <WorldType>(\n options:\n | string\n | IDefineTestCaseHookOptions\n | TestCaseHookFunction<WorldType>,\n code?: TestCaseHookFunction<WorldType>\n ) => void {\n return <WorldType>(\n options:\n | string\n | IDefineTestCaseHookOptions\n | TestCaseHookFunction<WorldType>,\n code?: TestCaseHookFunction<WorldType>\n ) => {\n if (typeof options === 'string') {\n options = { tags: options }\n } else if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, options },\n fnName: 'defineTestCaseHook',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n uri,\n })\n }\n }\n\n defineTestStepHook(\n getCollection: () => ITestStepHookDefinitionConfig[]\n ): <WorldType>(\n options:\n | string\n | IDefineTestStepHookOptions\n | TestStepHookFunction<WorldType>,\n code?: TestStepHookFunction<WorldType>\n ) => void {\n return <WorldType>(\n options:\n | string\n | IDefineTestStepHookOptions\n | TestStepHookFunction<WorldType>,\n code?: TestStepHookFunction<WorldType>\n ) => {\n if (typeof options === 'string') {\n options = { tags: options }\n } else if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, options },\n fnName: 'defineTestStepHook',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n uri,\n })\n }\n }\n\n defineTestRunHook(\n getCollection: () => ITestRunHookDefinitionConfig[]\n ): (options: IDefineTestRunHookOptions | Function, code?: Function) => void {\n return (options: IDefineTestRunHookOptions | Function, code?: Function) => {\n if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, options },\n fnName: 'defineTestRunHook',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n uri,\n })\n }\n }\n\n wrapCode({\n code,\n wrapperOptions,\n }: {\n code: Function\n wrapperOptions: any\n }): Function {\n if (doesHaveValue(this.definitionFunctionWrapper)) {\n const codeLength = code.length\n const wrappedCode = this.definitionFunctionWrapper(code, wrapperOptions)\n if (wrappedCode !== code) {\n return arity(codeLength, wrappedCode)\n }\n return wrappedCode\n }\n return code\n }\n\n buildTestCaseHookDefinitions(\n configs: ITestCaseHookDefinitionConfig[],\n canonicalIds?: string[]\n ): TestCaseHookDefinition[] {\n return configs.map(({ code, line, options, uri }, index) => {\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n return new TestCaseHookDefinition({\n code: wrappedCode,\n id: canonicalIds ? canonicalIds[index] : this.newId(),\n line,\n options,\n unwrappedCode: code,\n uri,\n })\n })\n }\n\n buildTestStepHookDefinitions(\n configs: ITestStepHookDefinitionConfig[]\n ): TestStepHookDefinition[] {\n return configs.map(({ code, line, options, uri }) => {\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n return new TestStepHookDefinition({\n code: wrappedCode,\n id: this.newId(),\n line,\n options,\n unwrappedCode: code,\n uri,\n })\n })\n }\n\n buildTestRunHookDefinitions(\n configs: ITestRunHookDefinitionConfig[]\n ): TestRunHookDefinition[] {\n return configs.map(({ code, line, options, uri }) => {\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n return new TestRunHookDefinition({\n code: wrappedCode,\n id: this.newId(),\n line,\n options,\n unwrappedCode: code,\n uri,\n })\n })\n }\n\n buildStepDefinitions(canonicalIds?: string[]): {\n stepDefinitions: StepDefinition[]\n undefinedParameterTypes: messages.UndefinedParameterType[]\n } {\n const stepDefinitions: StepDefinition[] = []\n const undefinedParameterTypes: messages.UndefinedParameterType[] = []\n this.stepDefinitionConfigs.forEach(\n ({ code, line, options, keyword, pattern, uri }, index) => {\n let expression\n if (typeof pattern === 'string') {\n try {\n expression = new CucumberExpression(\n pattern,\n this.parameterTypeRegistry\n )\n } catch (e) {\n if (doesHaveValue(e.undefinedParameterTypeName)) {\n undefinedParameterTypes.push({\n name: e.undefinedParameterTypeName,\n expression: pattern,\n })\n return\n }\n throw e\n }\n } else {\n expression = new RegularExpression(\n pattern,\n this.parameterTypeRegistry\n )\n }\n\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n stepDefinitions.push(\n new StepDefinition({\n code: wrappedCode,\n expression,\n id: canonicalIds ? canonicalIds[index] : this.newId(),\n line,\n options,\n keyword,\n pattern,\n unwrappedCode: code,\n uri,\n })\n )\n }\n )\n return { stepDefinitions, undefinedParameterTypes }\n }\n\n finalize(canonicalIds?: ICanonicalSupportCodeIds): ISupportCodeLibrary {\n const stepDefinitionsResult = this.buildStepDefinitions(\n canonicalIds?.stepDefinitionIds\n )\n return {\n originalCoordinates: this.originalCoordinates,\n afterTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(\n this.afterTestCaseHookDefinitionConfigs,\n canonicalIds?.afterTestCaseHookDefinitionIds\n ),\n afterTestRunHookDefinitions: this.buildTestRunHookDefinitions(\n this.afterTestRunHookDefinitionConfigs\n ),\n afterTestStepHookDefinitions: this.buildTestStepHookDefinitions(\n this.afterTestStepHookDefinitionConfigs\n ),\n beforeTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(\n this.beforeTestCaseHookDefinitionConfigs,\n canonicalIds?.beforeTestCaseHookDefinitionIds\n ),\n beforeTestRunHookDefinitions: this.buildTestRunHookDefinitions(\n this.beforeTestRunHookDefinitionConfigs\n ),\n beforeTestStepHookDefinitions: this.buildTestStepHookDefinitions(\n this.beforeTestStepHookDefinitionConfigs\n ),\n defaultTimeout: this.defaultTimeout,\n parameterTypeRegistry: this.parameterTypeRegistry,\n undefinedParameterTypes: stepDefinitionsResult.undefinedParameterTypes,\n stepDefinitions: stepDefinitionsResult.stepDefinitions,\n World: this.World,\n parallelCanAssign: this.parallelCanAssign,\n }\n }\n\n reset(\n cwd: string,\n newId: IdGenerator.NewId,\n originalCoordinates: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n }\n ): void {\n this.cwd = cwd\n this.newId = newId\n this.originalCoordinates = originalCoordinates\n this.afterTestCaseHookDefinitionConfigs = []\n this.afterTestRunHookDefinitionConfigs = []\n this.afterTestStepHookDefinitionConfigs = []\n this.beforeTestCaseHookDefinitionConfigs = []\n this.beforeTestRunHookDefinitionConfigs = []\n this.beforeTestStepHookDefinitionConfigs = []\n this.definitionFunctionWrapper = null\n this.defaultTimeout = 5000\n this.parameterTypeRegistry = new ParameterTypeRegistry()\n this.stepDefinitionConfigs = []\n this.parallelCanAssign = () => true\n this.World = World\n }\n}\n\nexport default new SupportCodeLibraryBuilder()\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/support_code_library_builder/index.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA2D;AAC3D,+EAAuE;AAGvE,oGAAwE;AACxE,oGAAwE;AACxE,kGAAsE;AACtE,gFAAsD;AACtD,kDAAqD;AACrD,8EAAoD;AACpD,4DAA8B;AAE9B,yEAIuC;AACvC,oDAAkE;AAgBlE,oDAA2B;AAkCd,QAAA,qBAAqB,GAAG;IACnC,YAAY;IACZ,YAAY;IACZ,MAAM;IACN,QAAQ;IACR,OAAO;IACP,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,EAAE;CACH,CAAA;AAED,MAAa,yBAAyB;IAmBpC;QACE,MAAM,OAAO,GAA8B;YACzC,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAC5B,GAAG,EAAE,CAAC,IAAI,CAAC,kCAAkC,CAC9C;YACD,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAC9B,GAAG,EAAE,CAAC,IAAI,CAAC,iCAAiC,CAC7C;YACD,SAAS,EAAE,IAAI,CAAC,kBAAkB,CAChC,GAAG,EAAE,CAAC,IAAI,CAAC,kCAAkC,CAC9C;YACD,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAC7B,GAAG,EAAE,CAAC,IAAI,CAAC,mCAAmC,CAC/C;YACD,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAC/B,GAAG,EAAE,CAAC,IAAI,C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,CACH,GAAW,EACX,KAAwB,EACxB,sBAA+C;QAC7C,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE;KAChB;QAED,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;QAC9C,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAA;QAC5C,IAAI,CAAC,iCAAiC,GAAG,EAAE,CAAA;QAC3C,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAA;QAC5C,IAAI,CAAC,mCAAmC,GAAG,EAAE,CAAA;QAC7C,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAA;QAC5C,IAAI,CAAC,mCAAmC,GAAG,EAAE,CAAA;QAC7C,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAA;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;QAC1B,IAAI,CAAC,qBAAqB,GAAG,IAAI,4CAAqB,EAAE,CAAA;QACxD,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAA;QAC/B,IAAI,CAAC,iBAAiB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;QACnC,IAAI,CAAC,KAAK,GAAG,eAAK,CAAA;IACpB,CAAC;CACF;AAvZD,8DAuZC;AAED,kBAAe,IAAI,yBAAyB,EAAE,CAAA","sourcesContent":["import { buildParameterType } from './build_parameter_type'\nimport { getDefinitionLineAndUri } from './get_definition_line_and_uri'\nimport { IdGenerator } from '@cucumber/messages'\nimport * as messages from '@cucumber/messages'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestStepHookDefinition from '../models/test_step_hook_definition'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport StepDefinition from '../models/step_definition'\nimport { formatLocation } from '../formatter/helpers'\nimport validateArguments from './validate_arguments'\nimport arity from 'util-arity'\n\nimport {\n CucumberExpression,\n ParameterTypeRegistry,\n RegularExpression,\n} from '@cucumber/cucumber-expressions'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport {\n DefineStepPattern,\n IDefineStepOptions,\n IDefineSupportCodeMethods,\n IDefineTestCaseHookOptions,\n IDefineTestStepHookOptions,\n IDefineTestRunHookOptions,\n IParameterTypeDefinition,\n ISupportCodeLibrary,\n TestCaseHookFunction,\n TestStepHookFunction,\n ParallelAssignmentValidator,\n ISupportCodeCoordinates,\n IDefineStep,\n} from './types'\nimport World from './world'\nimport { ICanonicalSupportCodeIds } from '../runtime/parallel/command_types'\nimport { GherkinStepKeyword } from '../models/gherkin_step_keyword'\n\ninterface IStepDefinitionConfig {\n code: any\n line: number\n options: any\n keyword: GherkinStepKeyword\n pattern: string | RegExp\n uri: string\n}\n\ninterface ITestCaseHookDefinitionConfig {\n code: any\n line: number\n options: any\n uri: string\n}\n\ninterface ITestStepHookDefinitionConfig {\n code: any\n line: number\n options: any\n uri: string\n}\n\ninterface ITestRunHookDefinitionConfig {\n code: any\n line: number\n options: any\n uri: string\n}\n\nexport const builtinParameterTypes = [\n 'bigdecimal',\n 'biginteger',\n 'byte',\n 'double',\n 'float',\n 'int',\n 'long',\n 'short',\n 'string',\n 'word',\n '',\n]\n\nexport class SupportCodeLibraryBuilder {\n public readonly methods: IDefineSupportCodeMethods\n\n private originalCoordinates: ISupportCodeCoordinates\n private afterTestCaseHookDefinitionConfigs: ITestCaseHookDefinitionConfig[]\n private afterTestRunHookDefinitionConfigs: ITestRunHookDefinitionConfig[]\n private afterTestStepHookDefinitionConfigs: ITestStepHookDefinitionConfig[]\n private beforeTestCaseHookDefinitionConfigs: ITestCaseHookDefinitionConfig[]\n private beforeTestRunHookDefinitionConfigs: ITestRunHookDefinitionConfig[]\n private beforeTestStepHookDefinitionConfigs: ITestStepHookDefinitionConfig[]\n private cwd: string\n private defaultTimeout: number\n private definitionFunctionWrapper: any\n private newId: IdGenerator.NewId\n private parameterTypeRegistry: ParameterTypeRegistry\n private stepDefinitionConfigs: IStepDefinitionConfig[]\n private World: any\n private parallelCanAssign: ParallelAssignmentValidator\n\n constructor() {\n const methods: IDefineSupportCodeMethods = {\n After: this.defineTestCaseHook(\n () => this.afterTestCaseHookDefinitionConfigs\n ),\n AfterAll: this.defineTestRunHook(\n () => this.afterTestRunHookDefinitionConfigs\n ),\n AfterStep: this.defineTestStepHook(\n () => this.afterTestStepHookDefinitionConfigs\n ),\n Before: this.defineTestCaseHook(\n () => this.beforeTestCaseHookDefinitionConfigs\n ),\n BeforeAll: this.defineTestRunHook(\n () => this.beforeTestRunHookDefinitionConfigs\n ),\n BeforeStep: this.defineTestStepHook(\n () => this.beforeTestStepHookDefinitionConfigs\n ),\n defineParameterType: this.defineParameterType.bind(this),\n defineStep: this.defineStep('Unknown', () => this.stepDefinitionConfigs),\n Given: this.defineStep('Given', () => this.stepDefinitionConfigs),\n setDefaultTimeout: (milliseconds) => {\n this.defaultTimeout = milliseconds\n },\n setDefinitionFunctionWrapper: (fn) => {\n this.definitionFunctionWrapper = fn\n },\n setWorldConstructor: (fn) => {\n this.World = fn\n },\n setParallelCanAssign: (fn: ParallelAssignmentValidator): void => {\n this.parallelCanAssign = fn\n },\n Then: this.defineStep('Then', () => this.stepDefinitionConfigs),\n When: this.defineStep('When', () => this.stepDefinitionConfigs),\n }\n const checkInstall = (method: string) => {\n if (doesNotHaveValue(this.cwd)) {\n throw new Error(\n `\n You're calling functions (e.g. \"${method}\") on an instance of Cucumber that isn't running.\n This means you have an invalid installation, mostly likely due to:\n - Cucumber being installed globally\n - A project structure where your support code is depending on a different instance of Cucumber\n Either way, you'll need to address this in order for Cucumber to work.\n See https://github.com/cucumber/cucumber-js/blob/main/docs/installation.md#invalid-installations\n `\n )\n }\n }\n this.methods = new Proxy(methods, {\n get(\n target: IDefineSupportCodeMethods,\n method: keyof IDefineSupportCodeMethods\n ): any {\n return (...args: any[]) => {\n checkInstall(method)\n // @ts-expect-error difficult to type this correctly\n return target[method](...args)\n }\n },\n })\n }\n\n defineParameterType(options: IParameterTypeDefinition<any>): void {\n const parameterType = buildParameterType(options)\n this.parameterTypeRegistry.defineParameterType(parameterType)\n }\n\n defineStep(\n keyword: GherkinStepKeyword,\n getCollection: () => IStepDefinitionConfig[]\n ): IDefineStep {\n return (\n pattern: DefineStepPattern,\n options: IDefineStepOptions | Function,\n code?: Function\n ) => {\n if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, pattern, options },\n fnName: 'defineStep',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n keyword,\n pattern,\n uri,\n })\n }\n }\n\n defineTestCaseHook(\n getCollection: () => ITestCaseHookDefinitionConfig[]\n ): <WorldType>(\n options:\n | string\n | IDefineTestCaseHookOptions\n | TestCaseHookFunction<WorldType>,\n code?: TestCaseHookFunction<WorldType>\n ) => void {\n return <WorldType>(\n options:\n | string\n | IDefineTestCaseHookOptions\n | TestCaseHookFunction<WorldType>,\n code?: TestCaseHookFunction<WorldType>\n ) => {\n if (typeof options === 'string') {\n options = { tags: options }\n } else if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, options },\n fnName: 'defineTestCaseHook',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n uri,\n })\n }\n }\n\n defineTestStepHook(\n getCollection: () => ITestStepHookDefinitionConfig[]\n ): <WorldType>(\n options:\n | string\n | IDefineTestStepHookOptions\n | TestStepHookFunction<WorldType>,\n code?: TestStepHookFunction<WorldType>\n ) => void {\n return <WorldType>(\n options:\n | string\n | IDefineTestStepHookOptions\n | TestStepHookFunction<WorldType>,\n code?: TestStepHookFunction<WorldType>\n ) => {\n if (typeof options === 'string') {\n options = { tags: options }\n } else if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, options },\n fnName: 'defineTestStepHook',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n uri,\n })\n }\n }\n\n defineTestRunHook(\n getCollection: () => ITestRunHookDefinitionConfig[]\n ): (options: IDefineTestRunHookOptions | Function, code?: Function) => void {\n return (options: IDefineTestRunHookOptions | Function, code?: Function) => {\n if (typeof options === 'function') {\n code = options\n options = {}\n }\n const { line, uri } = getDefinitionLineAndUri(this.cwd)\n validateArguments({\n args: { code, options },\n fnName: 'defineTestRunHook',\n location: formatLocation({ line, uri }),\n })\n getCollection().push({\n code,\n line,\n options,\n uri,\n })\n }\n }\n\n wrapCode({\n code,\n wrapperOptions,\n }: {\n code: Function\n wrapperOptions: any\n }): Function {\n if (doesHaveValue(this.definitionFunctionWrapper)) {\n const codeLength = code.length\n const wrappedCode = this.definitionFunctionWrapper(code, wrapperOptions)\n if (wrappedCode !== code) {\n return arity(codeLength, wrappedCode)\n }\n return wrappedCode\n }\n return code\n }\n\n buildTestCaseHookDefinitions(\n configs: ITestCaseHookDefinitionConfig[],\n canonicalIds?: string[]\n ): TestCaseHookDefinition[] {\n return configs.map(({ code, line, options, uri }, index) => {\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n return new TestCaseHookDefinition({\n code: wrappedCode,\n id: canonicalIds ? canonicalIds[index] : this.newId(),\n line,\n options,\n unwrappedCode: code,\n uri,\n })\n })\n }\n\n buildTestStepHookDefinitions(\n configs: ITestStepHookDefinitionConfig[]\n ): TestStepHookDefinition[] {\n return configs.map(({ code, line, options, uri }) => {\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n return new TestStepHookDefinition({\n code: wrappedCode,\n id: this.newId(),\n line,\n options,\n unwrappedCode: code,\n uri,\n })\n })\n }\n\n buildTestRunHookDefinitions(\n configs: ITestRunHookDefinitionConfig[]\n ): TestRunHookDefinition[] {\n return configs.map(({ code, line, options, uri }) => {\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n return new TestRunHookDefinition({\n code: wrappedCode,\n id: this.newId(),\n line,\n options,\n unwrappedCode: code,\n uri,\n })\n })\n }\n\n buildStepDefinitions(canonicalIds?: string[]): {\n stepDefinitions: StepDefinition[]\n undefinedParameterTypes: messages.UndefinedParameterType[]\n } {\n const stepDefinitions: StepDefinition[] = []\n const undefinedParameterTypes: messages.UndefinedParameterType[] = []\n this.stepDefinitionConfigs.forEach(\n ({ code, line, options, keyword, pattern, uri }, index) => {\n let expression\n if (typeof pattern === 'string') {\n try {\n expression = new CucumberExpression(\n pattern,\n this.parameterTypeRegistry\n )\n } catch (e) {\n if (doesHaveValue(e.undefinedParameterTypeName)) {\n undefinedParameterTypes.push({\n name: e.undefinedParameterTypeName,\n expression: pattern,\n })\n return\n }\n throw e\n }\n } else {\n expression = new RegularExpression(\n pattern,\n this.parameterTypeRegistry\n )\n }\n\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n stepDefinitions.push(\n new StepDefinition({\n code: wrappedCode,\n expression,\n id: canonicalIds ? canonicalIds[index] : this.newId(),\n line,\n options,\n keyword,\n pattern,\n unwrappedCode: code,\n uri,\n })\n )\n }\n )\n return { stepDefinitions, undefinedParameterTypes }\n }\n\n finalize(canonicalIds?: ICanonicalSupportCodeIds): ISupportCodeLibrary {\n const stepDefinitionsResult = this.buildStepDefinitions(\n canonicalIds?.stepDefinitionIds\n )\n return {\n originalCoordinates: this.originalCoordinates,\n afterTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(\n this.afterTestCaseHookDefinitionConfigs,\n canonicalIds?.afterTestCaseHookDefinitionIds\n ),\n afterTestRunHookDefinitions: this.buildTestRunHookDefinitions(\n this.afterTestRunHookDefinitionConfigs\n ),\n afterTestStepHookDefinitions: this.buildTestStepHookDefinitions(\n this.afterTestStepHookDefinitionConfigs\n ),\n beforeTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(\n this.beforeTestCaseHookDefinitionConfigs,\n canonicalIds?.beforeTestCaseHookDefinitionIds\n ),\n beforeTestRunHookDefinitions: this.buildTestRunHookDefinitions(\n this.beforeTestRunHookDefinitionConfigs\n ),\n beforeTestStepHookDefinitions: this.buildTestStepHookDefinitions(\n this.beforeTestStepHookDefinitionConfigs\n ),\n defaultTimeout: this.defaultTimeout,\n parameterTypeRegistry: this.parameterTypeRegistry,\n undefinedParameterTypes: stepDefinitionsResult.undefinedParameterTypes,\n stepDefinitions: stepDefinitionsResult.stepDefinitions,\n World: this.World,\n parallelCanAssign: this.parallelCanAssign,\n }\n }\n\n reset(\n cwd: string,\n newId: IdGenerator.NewId,\n originalCoordinates: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n }\n ): void {\n this.cwd = cwd\n this.newId = newId\n this.originalCoordinates = originalCoordinates\n this.afterTestCaseHookDefinitionConfigs = []\n this.afterTestRunHookDefinitionConfigs = []\n this.afterTestStepHookDefinitionConfigs = []\n this.beforeTestCaseHookDefinitionConfigs = []\n this.beforeTestRunHookDefinitionConfigs = []\n this.beforeTestStepHookDefinitionConfigs = []\n this.definitionFunctionWrapper = null\n this.defaultTimeout = 5000\n this.parameterTypeRegistry = new ParameterTypeRegistry()\n this.stepDefinitionConfigs = []\n this.parallelCanAssign = () => true\n this.World = World\n }\n}\n\nexport default new SupportCodeLibraryBuilder()\n"]}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "8.
|
|
1
|
+
export declare const version = "8.7.0";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '8.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,OAAO,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '8.7.0'\n"]}
|
package/lib/wrapper.mjs
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import cucumber from './index.js'
|
|
2
2
|
|
|
3
|
-
export const Cli = cucumber.Cli
|
|
4
|
-
export const parseGherkinMessageStream = cucumber.parseGherkinMessageStream
|
|
5
|
-
export const PickleFilter = cucumber.PickleFilter
|
|
6
|
-
export const Runtime = cucumber.Runtime
|
|
7
3
|
export const supportCodeLibraryBuilder = cucumber.supportCodeLibraryBuilder
|
|
8
4
|
export const Status = cucumber.Status
|
|
9
5
|
export const DataTable = cucumber.DataTable
|
|
@@ -28,10 +24,6 @@ export const Before = cucumber.Before
|
|
|
28
24
|
export const BeforeAll = cucumber.BeforeAll
|
|
29
25
|
export const BeforeStep = cucumber.BeforeStep
|
|
30
26
|
export const defineParameterType = cucumber.defineParameterType
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated use `Given`, `When` or `Then` instead; see <https://github.com/cucumber/cucumber-js/issues/2043>
|
|
33
|
-
*/
|
|
34
|
-
export const defineStep = cucumber.defineStep
|
|
35
27
|
export const Given = cucumber.Given
|
|
36
28
|
export const setDefaultTimeout = cucumber.setDefaultTimeout
|
|
37
29
|
export const setDefinitionFunctionWrapper = cucumber.setDefinitionFunctionWrapper
|
|
@@ -43,3 +35,9 @@ export const parallelCanAssignHelpers = cucumber.parallelCanAssignHelpers
|
|
|
43
35
|
|
|
44
36
|
export const wrapPromiseWithTimeout = cucumber.wrapPromiseWithTimeout
|
|
45
37
|
|
|
38
|
+
// Deprecated
|
|
39
|
+
export const Cli = cucumber.Cli
|
|
40
|
+
export const defineStep = cucumber.defineStep
|
|
41
|
+
export const parseGherkinMessageStream = cucumber.parseGherkinMessageStream
|
|
42
|
+
export const PickleFilter = cucumber.PickleFilter
|
|
43
|
+
export const Runtime = cucumber.Runtime
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"gherkin",
|
|
9
9
|
"tests"
|
|
10
10
|
],
|
|
11
|
-
"version": "8.
|
|
11
|
+
"version": "8.7.0",
|
|
12
12
|
"homepage": "https://github.com/cucumber/cucumber-js",
|
|
13
13
|
"author": "Julien Biezemans <jb@jbpros.com>",
|
|
14
14
|
"contributors": [
|
|
@@ -201,14 +201,14 @@
|
|
|
201
201
|
"@cucumber/gherkin": "24.0.0",
|
|
202
202
|
"@cucumber/gherkin-streams": "5.0.1",
|
|
203
203
|
"@cucumber/gherkin-utils": "8.0.0",
|
|
204
|
-
"@cucumber/html-formatter": "20.
|
|
204
|
+
"@cucumber/html-formatter": "20.1.0",
|
|
205
205
|
"@cucumber/message-streams": "4.0.1",
|
|
206
|
-
"@cucumber/messages": "19.1.
|
|
206
|
+
"@cucumber/messages": "19.1.4",
|
|
207
207
|
"@cucumber/tag-expressions": "4.1.0",
|
|
208
208
|
"assertion-error-formatter": "^3.0.0",
|
|
209
209
|
"capital-case": "^1.0.4",
|
|
210
210
|
"chalk": "^4.1.2",
|
|
211
|
-
"cli-table3": "0.6.
|
|
211
|
+
"cli-table3": "0.6.3",
|
|
212
212
|
"commander": "^9.0.0",
|
|
213
213
|
"debug": "^4.3.4",
|
|
214
214
|
"duration": "^0.2.2",
|
|
@@ -239,10 +239,10 @@
|
|
|
239
239
|
"@cucumber/compatibility-kit": "11.0.1",
|
|
240
240
|
"@cucumber/query": "12.0.0",
|
|
241
241
|
"@microsoft/api-documenter": "7.19.1",
|
|
242
|
-
"@microsoft/api-extractor": "7.
|
|
242
|
+
"@microsoft/api-extractor": "7.32.0",
|
|
243
243
|
"@sinonjs/fake-timers": "9.1.2",
|
|
244
244
|
"@types/chai": "4.3.3",
|
|
245
|
-
"@types/debug": "
|
|
245
|
+
"@types/debug": "4.1.7",
|
|
246
246
|
"@types/dirty-chai": "2.0.2",
|
|
247
247
|
"@types/express": "4.17.13",
|
|
248
248
|
"@types/fs-extra": "9.0.13",
|
|
@@ -250,10 +250,10 @@
|
|
|
250
250
|
"@types/has-ansi": "5.0.0",
|
|
251
251
|
"@types/lodash.merge": "4.6.7",
|
|
252
252
|
"@types/lodash.mergewith": "4.6.7",
|
|
253
|
-
"@types/mocha": "
|
|
253
|
+
"@types/mocha": "10.0.0",
|
|
254
254
|
"@types/mustache": "4.2.1",
|
|
255
255
|
"@types/mz": "2.7.4",
|
|
256
|
-
"@types/node": "16.11.
|
|
256
|
+
"@types/node": "16.11.62",
|
|
257
257
|
"@types/progress": "2.0.5",
|
|
258
258
|
"@types/semver": "7.3.12",
|
|
259
259
|
"@types/sinon-chai": "3.2.8",
|
|
@@ -261,14 +261,14 @@
|
|
|
261
261
|
"@types/stream-buffers": "3.0.4",
|
|
262
262
|
"@types/tmp": "0.2.3",
|
|
263
263
|
"@types/verror": "1.10.6",
|
|
264
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
265
|
-
"@typescript-eslint/parser": "5.
|
|
264
|
+
"@typescript-eslint/eslint-plugin": "5.38.1",
|
|
265
|
+
"@typescript-eslint/parser": "5.38.1",
|
|
266
266
|
"chai": "4.3.6",
|
|
267
267
|
"chai-exclude": "2.1.0",
|
|
268
268
|
"coffeescript": "2.7.0",
|
|
269
269
|
"dependency-lint": "7.1.0",
|
|
270
270
|
"dirty-chai": "2.0.1",
|
|
271
|
-
"eslint": "8.
|
|
271
|
+
"eslint": "8.24.0",
|
|
272
272
|
"eslint-config-prettier": "8.5.0",
|
|
273
273
|
"eslint-plugin-import": "2.26.0",
|
|
274
274
|
"eslint-plugin-node": "11.1.0",
|
|
@@ -288,8 +288,8 @@
|
|
|
288
288
|
"stream-buffers": "3.0.2",
|
|
289
289
|
"stream-to-string": "1.2.0",
|
|
290
290
|
"ts-node": "10.9.1",
|
|
291
|
-
"tsd": "0.
|
|
292
|
-
"typescript": "4.8.
|
|
291
|
+
"tsd": "0.24.1",
|
|
292
|
+
"typescript": "4.8.4"
|
|
293
293
|
},
|
|
294
294
|
"overrides": {
|
|
295
295
|
"ansi-regex": "^5.0.1"
|