@cucumber/cucumber 12.2.0 → 12.3.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/README.md +1 -1
- package/lib/api/run_cucumber.js +1 -0
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/cli/helpers.js +11 -1
- package/lib/cli/helpers.js.map +1 -1
- package/lib/configuration/argv_parser.js +1 -1
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/filter/types.d.ts +2 -1
- package/lib/filter/types.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +1 -0
- package/lib/formatter/step_definition_snippet_builder/index.js +14 -0
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/models/test_run_hook_definition.d.ts +6 -1
- package/lib/models/test_run_hook_definition.js +5 -0
- package/lib/models/test_run_hook_definition.js.map +1 -1
- package/lib/runtime/coordinator.d.ts +2 -1
- package/lib/runtime/coordinator.js +6 -5
- package/lib/runtime/coordinator.js.map +1 -1
- package/lib/runtime/make_runtime.d.ts +4 -3
- package/lib/runtime/make_runtime.js +20 -5
- package/lib/runtime/make_runtime.js.map +1 -1
- package/lib/runtime/make_suggestion.d.ts +7 -0
- package/lib/runtime/make_suggestion.js +31 -0
- package/lib/runtime/make_suggestion.js.map +1 -0
- package/lib/runtime/parallel/adapter.d.ts +4 -1
- package/lib/runtime/parallel/adapter.js +9 -1
- package/lib/runtime/parallel/adapter.js.map +1 -1
- package/lib/runtime/parallel/types.d.ts +3 -0
- package/lib/runtime/parallel/types.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +1 -1
- package/lib/runtime/parallel/worker.js +9 -2
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/serial/adapter.d.ts +2 -1
- package/lib/runtime/serial/adapter.js +2 -2
- package/lib/runtime/serial/adapter.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +4 -1
- package/lib/runtime/test_case_runner.js +12 -1
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/runtime/worker.d.ts +14 -6
- package/lib/runtime/worker.js +106 -14
- package/lib/runtime/worker.js.map +1 -1
- package/lib/support_code_library_builder/index.d.ts +1 -1
- package/lib/support_code_library_builder/index.js +6 -6
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +3 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +26 -26
- package/lib/runtime/run_test_run_hooks.d.ts +0 -4
- package/lib/runtime/run_test_run_hooks.js +0 -29
- package/lib/runtime/run_test_run_hooks.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/runtime/worker.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/runtime/worker.ts"],"names":[],"mappings":";;;;;;AACA,iDAK2B;AAG3B,2EAAgD;AAChD,oDAAgE;AAEhE,kDAAqD;AAErD,uCAAgE;AAChE,0EAA+C;AAC/C,mCAA2C;AAC3C,iDAA4C;AAC5C,2CAA+C;AAQ/C,MAAa,MAAM;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;IAPnB,YACmB,gBAAwB,EACxB,QAA4B,EAC5B,gBAA8B,EAC9B,KAAwB,EACxB,OAAuB,EACvB,kBAAsC,EACtC,cAA4C;QAN5C,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,aAAQ,GAAR,QAAQ,CAAoB;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,YAAO,GAAP,OAAO,CAAgB;QACvB,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,mBAAc,GAAd,cAAc,CAA8B;IAC5D,CAAC;IAEI,KAAK,CAAC,cAA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f,GAAG,IAAI,CAAC,kBAAkB,CAAC,2BAA2B;SACvD,CAAC,OAAO,EAAE,CAAA;QACX,KAAK,MAAM,cAAc,IAAI,QAAQ,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;YACxD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YACpB,IAAI,IAAA,6BAAa,EAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,MAAM,MAAM,CAAC,KAAK,CAAA;YACpB,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAvJD,wBAuJC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport {\n Envelope,\n IdGenerator,\n TestStepResult,\n TestStepResultStatus,\n} from '@cucumber/messages'\nimport { AssembledTestCase } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport UserCodeRunner from '../user_code_runner'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { formatLocation } from '../formatter/helpers'\nimport StepDefinitionSnippetBuilder from '../formatter/step_definition_snippet_builder'\nimport { retriesForPickle, shouldCauseFailure } from './helpers'\nimport TestCaseRunner from './test_case_runner'\nimport { runInTestRunScope } from './scope'\nimport { formatError } from './format_error'\nimport { create, timestamp } from './stopwatch'\nimport { RuntimeOptions } from './types'\n\nexport interface RunHookResult {\n result: TestStepResult\n error?: any\n}\n\nexport class Worker {\n constructor(\n private readonly testRunStartedId: string,\n private readonly workerId: string | undefined,\n private readonly eventBroadcaster: EventEmitter,\n private readonly newId: IdGenerator.NewId,\n private readonly options: RuntimeOptions,\n private readonly supportCodeLibrary: SupportCodeLibrary,\n private readonly snippetBuilder: StepDefinitionSnippetBuilder\n ) {}\n\n private async runTestRunHook(\n hookDefinition: TestRunHookDefinition\n ): Promise<RunHookResult> {\n const testRunHookStartedId = this.newId()\n this.eventBroadcaster.emit('envelope', {\n testRunHookStarted: {\n testRunStartedId: this.testRunStartedId,\n workerId: this.workerId,\n id: testRunHookStartedId,\n hookId: hookDefinition.id,\n timestamp: timestamp(),\n },\n } satisfies Envelope)\n\n let result: TestStepResult\n let error: any\n if (this.options.dryRun) {\n result = {\n duration: {\n seconds: 0,\n nanos: 0,\n },\n status: TestStepResultStatus.SKIPPED,\n }\n } else {\n const stopwatch = create().start()\n const context = { parameters: this.options.worldParameters }\n const { error: rawError } = await runInTestRunScope({ context }, () =>\n UserCodeRunner.run({\n argsArray: [],\n fn: hookDefinition.code,\n thisArg: context,\n timeoutInMilliseconds: valueOrDefault(\n hookDefinition.options.timeout,\n this.supportCodeLibrary.defaultTimeout\n ),\n })\n )\n const duration = stopwatch.stop().duration()\n\n if (doesHaveValue(rawError)) {\n result = {\n duration,\n status: TestStepResultStatus.FAILED,\n ...formatError(rawError, this.options.filterStacktraces),\n }\n error = this.wrapTestRunHookError(\n 'a BeforeAll',\n formatLocation(hookDefinition),\n rawError\n )\n } else {\n result = {\n duration,\n status: TestStepResultStatus.PASSED,\n }\n }\n }\n\n this.eventBroadcaster.emit('envelope', {\n testRunHookFinished: {\n testRunHookStartedId,\n result,\n timestamp: timestamp(),\n },\n } satisfies Envelope)\n\n return {\n result,\n error,\n }\n }\n\n private wrapTestRunHookError(\n name: string,\n location: string,\n error: any\n ): any | undefined {\n if (!doesHaveValue(error)) {\n return undefined\n }\n let message = `${name} hook errored`\n if (this.workerId) {\n message += ` on worker ${this.workerId}`\n }\n message += `, process exiting: ${location}`\n return new Error(message, { cause: error })\n }\n\n async runBeforeAllHooks(): Promise<RunHookResult[]> {\n const results: RunHookResult[] = []\n for (const hookDefinition of this.supportCodeLibrary\n .beforeTestRunHookDefinitions) {\n const result = await this.runTestRunHook(hookDefinition)\n results.push(result)\n if (doesHaveValue(result.error)) {\n throw result.error\n }\n }\n return results\n }\n\n async runTestCase(\n { gherkinDocument, pickle, testCase }: AssembledTestCase,\n failing: boolean\n ): Promise<boolean> {\n const testCaseRunner = new TestCaseRunner({\n workerId: this.workerId,\n eventBroadcaster: this.eventBroadcaster,\n newId: this.newId,\n gherkinDocument,\n pickle,\n testCase,\n retries: retriesForPickle(pickle, this.options),\n skip: this.options.dryRun || (this.options.failFast && failing),\n filterStackTraces: this.options.filterStacktraces,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.options.worldParameters,\n snippetBuilder: this.snippetBuilder,\n })\n\n const status = await testCaseRunner.run()\n\n return !shouldCauseFailure(status, this.options)\n }\n\n async runAfterAllHooks(): Promise<RunHookResult[]> {\n const results: RunHookResult[] = []\n const reversed = [\n ...this.supportCodeLibrary.afterTestRunHookDefinitions,\n ].reverse()\n for (const hookDefinition of reversed) {\n const result = await this.runTestRunHook(hookDefinition)\n results.push(result)\n if (doesHaveValue(result.error)) {\n throw result.error\n }\n }\n return results\n }\n}\n"]}
|
|
@@ -62,7 +62,7 @@ export declare class SupportCodeLibraryBuilder {
|
|
|
62
62
|
}): Function;
|
|
63
63
|
buildTestCaseHookDefinitions(configs: ITestCaseHookDefinitionConfig[], canonicalIds?: string[]): TestCaseHookDefinition[];
|
|
64
64
|
buildTestStepHookDefinitions(configs: ITestStepHookDefinitionConfig[]): TestStepHookDefinition[];
|
|
65
|
-
buildTestRunHookDefinitions(configs: ITestRunHookDefinitionConfig[]): TestRunHookDefinition[];
|
|
65
|
+
buildTestRunHookDefinitions(configs: ITestRunHookDefinitionConfig[], canonicalIds?: string[]): TestRunHookDefinition[];
|
|
66
66
|
buildStepDefinitions(canonicalIds?: string[]): {
|
|
67
67
|
stepDefinitions: StepDefinition[];
|
|
68
68
|
undefinedParameterTypes: messages.UndefinedParameterType[];
|
|
@@ -219,17 +219,17 @@ class SupportCodeLibraryBuilder {
|
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
buildTestRunHookDefinitions(configs) {
|
|
223
|
-
return configs.map(({ code, line, options, uri }) => {
|
|
222
|
+
buildTestRunHookDefinitions(configs, canonicalIds) {
|
|
223
|
+
return configs.map(({ code, line, options, uri }, index) => {
|
|
224
224
|
const wrappedCode = this.wrapCode({
|
|
225
225
|
code,
|
|
226
226
|
wrapperOptions: options.wrapperOptions,
|
|
227
227
|
});
|
|
228
228
|
return new test_run_hook_definition_1.default({
|
|
229
229
|
code: wrappedCode,
|
|
230
|
-
id: this.newId(),
|
|
230
|
+
id: canonicalIds ? canonicalIds[index] : this.newId(),
|
|
231
231
|
line,
|
|
232
|
-
options,
|
|
232
|
+
options: options,
|
|
233
233
|
unwrappedCode: code,
|
|
234
234
|
uri,
|
|
235
235
|
});
|
|
@@ -282,10 +282,10 @@ class SupportCodeLibraryBuilder {
|
|
|
282
282
|
return {
|
|
283
283
|
originalCoordinates: this.originalCoordinates,
|
|
284
284
|
afterTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(this.afterTestCaseHookDefinitionConfigs, canonicalIds?.afterTestCaseHookDefinitionIds),
|
|
285
|
-
afterTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.afterTestRunHookDefinitionConfigs),
|
|
285
|
+
afterTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.afterTestRunHookDefinitionConfigs, canonicalIds?.afterTestRunHookDefinitionIds),
|
|
286
286
|
afterTestStepHookDefinitions: this.buildTestStepHookDefinitions(this.afterTestStepHookDefinitionConfigs),
|
|
287
287
|
beforeTestCaseHookDefinitions: this.buildTestCaseHookDefinitions(this.beforeTestCaseHookDefinitionConfigs, canonicalIds?.beforeTestCaseHookDefinitionIds),
|
|
288
|
-
beforeTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.beforeTestRunHookDefinitionConfigs),
|
|
288
|
+
beforeTestRunHookDefinitions: this.buildTestRunHookDefinitions(this.beforeTestRunHookDefinitionConfigs, canonicalIds?.beforeTestRunHookDefinitionIds),
|
|
289
289
|
beforeTestStepHookDefinitions: this.buildTestStepHookDefinitions(this.beforeTestStepHookDefinitionConfigs),
|
|
290
290
|
defaultTimeout: this.defaultTimeout,
|
|
291
291
|
parameterTypeRegistry: this.parameterTypeRegistry,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/support_code_library_builder/index.ts"],"names":[],"mappings":";;;;;;AAEA,4DAA8B;AAC9B,yEAGuC;AACvC,oGAAwE;AACxE,oGAAwE;AACxE,kGAAsE;AACtE,gFAAsD;AACtD,kDAAqD;AACrD,oDAAgD;AAEhD,8EAAoD;AAkBpD,oDAA2B;AAC3B,+EAAuE;AACvE,iEAA2D;AAC3D,uFAAgF;AAkChF,MAAa,yBAAyB;IACpB,OAAO,CAA2B;IAC1C,mBAAmB,CAAyB;IAC5C,kCAAkC,CAAiC;IACnE,iCAAiC,CAAgC;IACjE,kCAAkC,CAAiC;IACnE,mCAAmC,CAAiC;IACpE,kCAAkC,CAAgC;IAClE,mCAAmC,CAAiC;IACpE,GAAG,CAAQ;IACX,cAAc,CAAQ;IACtB,yBAAyB,CAAK;IAC9B,KAAK,CAAmB;IACxB,qBAAqB,CAA8B;IACnD,qBAAqB,CAAyB;IAC9C,KAAK,CAAK;IACV,iBAAiB,CAA6B;IAC9C,MAAM,GAAkB,SAAS,CAAA;IAEzC;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,CAAC,kCAAkC,CA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util-arity'\nimport {\n CucumberExpression,\n RegularExpression,\n} from '@cucumber/cucumber-expressions'\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 { doesHaveValue } from '../value_checker'\nimport { GherkinStepKeyword } from '../models/gherkin_step_keyword'\nimport validateArguments from './validate_arguments'\n\nimport {\n DefineStepPattern,\n IDefineStepOptions,\n IDefineSupportCodeMethods,\n IDefineTestCaseHookOptions,\n IDefineTestStepHookOptions,\n IDefineTestRunHookOptions,\n IParameterTypeDefinition,\n SupportCodeLibrary,\n TestCaseHookFunction,\n TestStepHookFunction,\n ParallelAssignmentValidator,\n ISupportCodeCoordinates,\n IDefineStep,\n CanonicalSupportCodeIds,\n} from './types'\nimport World from './world'\nimport { getDefinitionLineAndUri } from './get_definition_line_and_uri'\nimport { buildParameterType } from './build_parameter_type'\nimport { SourcedParameterTypeRegistry } from './sourced_parameter_type_registry'\n\ninterface IStepDefinitionConfig {\n code: Function\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: Function\n line: number\n options: any\n uri: string\n}\n\ninterface ITestRunHookDefinitionConfig {\n code: Function\n line: number\n options: any\n uri: string\n}\n\ntype LibraryStatus = 'PENDING' | 'OPEN' | 'FINALIZED'\n\nexport class SupportCodeLibraryBuilder {\n public readonly methods: IDefineSupportCodeMethods\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: SourcedParameterTypeRegistry\n private stepDefinitionConfigs: IStepDefinitionConfig[]\n private World: any\n private parallelCanAssign: ParallelAssignmentValidator\n private status: LibraryStatus = 'PENDING'\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 (this.status === 'PENDING') {\n throw new Error(\n `\n You're calling functions (e.g. \"${method}\") on an instance of Cucumber that isn't running (status: ${this.status}).\n This means you may have an invalid installation, potentially 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 const source = getDefinitionLineAndUri(this.cwd)\n this.parameterTypeRegistry.defineSourcedParameterType(parameterType, source)\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?: CanonicalSupportCodeIds): SupportCodeLibrary {\n this.status = 'FINALIZED'\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 loaders: [],\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 SourcedParameterTypeRegistry()\n this.stepDefinitionConfigs = []\n this.parallelCanAssign = () => true\n this.World = World\n this.status = 'OPEN'\n }\n}\n\nexport default new SupportCodeLibraryBuilder()\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/support_code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messages from '@cucumber/messages'\nimport arity from 'util-arity'\nimport {\n CucumberExpression,\n RegularExpression,\n} from '@cucumber/cucumber-expressions'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestStepHookDefinition from '../models/test_step_hook_definition'\nimport TestRunHookDefinition, {\n ITestRunHookDefinitionOptions,\n} from '../models/test_run_hook_definition'\nimport StepDefinition from '../models/step_definition'\nimport { formatLocation } from '../formatter/helpers'\nimport { doesHaveValue } from '../value_checker'\nimport { GherkinStepKeyword } from '../models/gherkin_step_keyword'\nimport validateArguments from './validate_arguments'\n\nimport {\n DefineStepPattern,\n IDefineStepOptions,\n IDefineSupportCodeMethods,\n IDefineTestCaseHookOptions,\n IDefineTestStepHookOptions,\n IDefineTestRunHookOptions,\n IParameterTypeDefinition,\n SupportCodeLibrary,\n TestCaseHookFunction,\n TestStepHookFunction,\n ParallelAssignmentValidator,\n ISupportCodeCoordinates,\n IDefineStep,\n CanonicalSupportCodeIds,\n} from './types'\nimport World from './world'\nimport { getDefinitionLineAndUri } from './get_definition_line_and_uri'\nimport { buildParameterType } from './build_parameter_type'\nimport { SourcedParameterTypeRegistry } from './sourced_parameter_type_registry'\n\ninterface IStepDefinitionConfig {\n code: Function\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: Function\n line: number\n options: any\n uri: string\n}\n\ninterface ITestRunHookDefinitionConfig {\n code: Function\n line: number\n options: any\n uri: string\n}\n\ntype LibraryStatus = 'PENDING' | 'OPEN' | 'FINALIZED'\n\nexport class SupportCodeLibraryBuilder {\n public readonly methods: IDefineSupportCodeMethods\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: SourcedParameterTypeRegistry\n private stepDefinitionConfigs: IStepDefinitionConfig[]\n private World: any\n private parallelCanAssign: ParallelAssignmentValidator\n private status: LibraryStatus = 'PENDING'\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 (this.status === 'PENDING') {\n throw new Error(\n `\n You're calling functions (e.g. \"${method}\") on an instance of Cucumber that isn't running (status: ${this.status}).\n This means you may have an invalid installation, potentially 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 const source = getDefinitionLineAndUri(this.cwd)\n this.parameterTypeRegistry.defineSourcedParameterType(parameterType, source)\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 canonicalIds?: string[]\n ): TestRunHookDefinition[] {\n return configs.map(({ code, line, options, uri }, index) => {\n const wrappedCode = this.wrapCode({\n code,\n wrapperOptions: options.wrapperOptions,\n })\n return new TestRunHookDefinition({\n code: wrappedCode,\n id: canonicalIds ? canonicalIds[index] : this.newId(),\n line,\n options: options as ITestRunHookDefinitionOptions,\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?: CanonicalSupportCodeIds): SupportCodeLibrary {\n this.status = 'FINALIZED'\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 canonicalIds?.afterTestRunHookDefinitionIds\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 canonicalIds?.beforeTestRunHookDefinitionIds\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 loaders: [],\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 SourcedParameterTypeRegistry()\n this.stepDefinitionConfigs = []\n this.parallelCanAssign = () => true\n this.World = World\n this.status = 'OPEN'\n }\n}\n\nexport default new SupportCodeLibraryBuilder()\n"]}
|
|
@@ -45,6 +45,7 @@ export interface IDefineTestStepHookOptions {
|
|
|
45
45
|
timeout?: number;
|
|
46
46
|
}
|
|
47
47
|
export interface IDefineTestRunHookOptions {
|
|
48
|
+
name?: string;
|
|
48
49
|
timeout?: number;
|
|
49
50
|
}
|
|
50
51
|
export interface IParameterTypeDefinition<T> {
|
|
@@ -82,6 +83,8 @@ export interface CanonicalSupportCodeIds {
|
|
|
82
83
|
stepDefinitionIds: string[];
|
|
83
84
|
beforeTestCaseHookDefinitionIds: string[];
|
|
84
85
|
afterTestCaseHookDefinitionIds: string[];
|
|
86
|
+
beforeTestRunHookDefinitionIds: string[];
|
|
87
|
+
afterTestRunHookDefinitionIds: string[];
|
|
85
88
|
}
|
|
86
89
|
export interface SupportCodeLibrary {
|
|
87
90
|
readonly originalCoordinates: ISupportCodeCoordinates;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/support_code_library_builder/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { JsonObject } from 'type-fest'\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 { IWorld } from './world'\nimport { SourcedParameterTypeRegistry } from './sourced_parameter_type_registry'\n\nexport type DefineStepPattern = string | RegExp\nexport type ParallelAssignmentValidator = (\n pickle: messages.Pickle,\n runningPickles: messages.Pickle[]\n) => boolean\nexport interface ITestCaseHookParameter {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n result?: messages.TestStepResult\n error?: any\n willBeRetried?: boolean\n testCaseStartedId: string\n}\n\nexport interface ITestStepHookParameter {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n pickleStep: messages.PickleStep\n result: messages.TestStepResult\n error?: any\n testCaseStartedId: string\n testStepId: string\n}\n\nexport type TestRunHookFunction = (this: {\n parameters: JsonObject\n}) => any | Promise<any>\n\nexport type TestCaseHookFunction<WorldType> = (\n this: WorldType,\n arg: ITestCaseHookParameter\n) => any | Promise<any>\n\nexport type TestStepHookFunction<WorldType> = (\n this: WorldType,\n arg: ITestStepHookParameter\n) => any | Promise<any>\n\nexport type TestStepFunction<WorldType> = (\n this: WorldType,\n ...args: any[]\n) => any | Promise<any>\n\nexport interface IDefineStepOptions {\n timeout?: number\n wrapperOptions?: any\n}\n\nexport interface IDefineTestCaseHookOptions {\n name?: string\n tags?: string\n timeout?: number\n}\n\nexport interface IDefineTestStepHookOptions {\n tags?: string\n timeout?: number\n}\n\nexport interface IDefineTestRunHookOptions {\n timeout?: number\n}\n\nexport interface IParameterTypeDefinition<T> {\n name: string\n regexp: readonly RegExp[] | readonly string[] | RegExp | string\n transformer?: (...match: string[]) => T\n useForSnippets?: boolean\n preferForRegexpMatch?: boolean\n}\n\nexport type IDefineStep = (<WorldType = IWorld>(\n pattern: DefineStepPattern,\n code: TestStepFunction<WorldType>\n) => void) &\n (<WorldType = IWorld>(\n pattern: DefineStepPattern,\n options: IDefineStepOptions,\n code: TestStepFunction<WorldType>\n ) => void)\n\nexport interface IDefineSupportCodeMethods {\n defineParameterType: (options: IParameterTypeDefinition<any>) => void\n defineStep: IDefineStep\n setDefaultTimeout: (milliseconds: number) => void\n setDefinitionFunctionWrapper: (fn: Function) => void\n setParallelCanAssign: (fn: ParallelAssignmentValidator) => void\n setWorldConstructor: (fn: any) => void\n After: (<WorldType = IWorld>(code: TestCaseHookFunction<WorldType>) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestCaseHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestCaseHookOptions,\n code: TestCaseHookFunction<WorldType>\n ) => void)\n AfterStep: (<WorldType = IWorld>(\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestStepHookOptions,\n code: TestStepHookFunction<WorldType>\n ) => void)\n AfterAll: ((code: TestRunHookFunction) => void) &\n ((options: IDefineTestRunHookOptions, code: TestRunHookFunction) => void)\n Before: (<WorldType = IWorld>(\n code: TestCaseHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestCaseHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestCaseHookOptions,\n code: TestCaseHookFunction<WorldType>\n ) => void)\n BeforeStep: (<WorldType = IWorld>(\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestStepHookOptions,\n code: TestStepHookFunction<WorldType>\n ) => void)\n BeforeAll: ((code: TestRunHookFunction) => void) &\n ((options: IDefineTestRunHookOptions, code: TestRunHookFunction) => void)\n Given: IDefineStep\n Then: IDefineStep\n When: IDefineStep\n}\n\nexport interface ISupportCodeCoordinates {\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n loaders: string[]\n}\n\nexport interface CanonicalSupportCodeIds {\n stepDefinitionIds: string[]\n beforeTestCaseHookDefinitionIds: string[]\n afterTestCaseHookDefinitionIds: string[]\n}\n\nexport interface SupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n readonly afterTestCaseHookDefinitions: TestCaseHookDefinition[]\n readonly afterTestStepHookDefinitions: TestStepHookDefinition[]\n readonly afterTestRunHookDefinitions: TestRunHookDefinition[]\n readonly beforeTestCaseHookDefinitions: TestCaseHookDefinition[]\n readonly beforeTestStepHookDefinitions: TestStepHookDefinition[]\n readonly beforeTestRunHookDefinitions: TestRunHookDefinition[]\n readonly defaultTimeout: number\n readonly stepDefinitions: StepDefinition[]\n readonly undefinedParameterTypes: messages.UndefinedParameterType[]\n readonly parameterTypeRegistry: SourcedParameterTypeRegistry\n readonly World: any\n readonly parallelCanAssign: ParallelAssignmentValidator\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/support_code_library_builder/types.ts"],"names":[],"mappings":"","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { JsonObject } from 'type-fest'\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 { IWorld } from './world'\nimport { SourcedParameterTypeRegistry } from './sourced_parameter_type_registry'\n\nexport type DefineStepPattern = string | RegExp\nexport type ParallelAssignmentValidator = (\n pickle: messages.Pickle,\n runningPickles: messages.Pickle[]\n) => boolean\nexport interface ITestCaseHookParameter {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n result?: messages.TestStepResult\n error?: any\n willBeRetried?: boolean\n testCaseStartedId: string\n}\n\nexport interface ITestStepHookParameter {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n pickleStep: messages.PickleStep\n result: messages.TestStepResult\n error?: any\n testCaseStartedId: string\n testStepId: string\n}\n\nexport type TestRunHookFunction = (this: {\n parameters: JsonObject\n}) => any | Promise<any>\n\nexport type TestCaseHookFunction<WorldType> = (\n this: WorldType,\n arg: ITestCaseHookParameter\n) => any | Promise<any>\n\nexport type TestStepHookFunction<WorldType> = (\n this: WorldType,\n arg: ITestStepHookParameter\n) => any | Promise<any>\n\nexport type TestStepFunction<WorldType> = (\n this: WorldType,\n ...args: any[]\n) => any | Promise<any>\n\nexport interface IDefineStepOptions {\n timeout?: number\n wrapperOptions?: any\n}\n\nexport interface IDefineTestCaseHookOptions {\n name?: string\n tags?: string\n timeout?: number\n}\n\nexport interface IDefineTestStepHookOptions {\n tags?: string\n timeout?: number\n}\n\nexport interface IDefineTestRunHookOptions {\n name?: string\n timeout?: number\n}\n\nexport interface IParameterTypeDefinition<T> {\n name: string\n regexp: readonly RegExp[] | readonly string[] | RegExp | string\n transformer?: (...match: string[]) => T\n useForSnippets?: boolean\n preferForRegexpMatch?: boolean\n}\n\nexport type IDefineStep = (<WorldType = IWorld>(\n pattern: DefineStepPattern,\n code: TestStepFunction<WorldType>\n) => void) &\n (<WorldType = IWorld>(\n pattern: DefineStepPattern,\n options: IDefineStepOptions,\n code: TestStepFunction<WorldType>\n ) => void)\n\nexport interface IDefineSupportCodeMethods {\n defineParameterType: (options: IParameterTypeDefinition<any>) => void\n defineStep: IDefineStep\n setDefaultTimeout: (milliseconds: number) => void\n setDefinitionFunctionWrapper: (fn: Function) => void\n setParallelCanAssign: (fn: ParallelAssignmentValidator) => void\n setWorldConstructor: (fn: any) => void\n After: (<WorldType = IWorld>(code: TestCaseHookFunction<WorldType>) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestCaseHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestCaseHookOptions,\n code: TestCaseHookFunction<WorldType>\n ) => void)\n AfterStep: (<WorldType = IWorld>(\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestStepHookOptions,\n code: TestStepHookFunction<WorldType>\n ) => void)\n AfterAll: ((code: TestRunHookFunction) => void) &\n ((options: IDefineTestRunHookOptions, code: TestRunHookFunction) => void)\n Before: (<WorldType = IWorld>(\n code: TestCaseHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestCaseHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestCaseHookOptions,\n code: TestCaseHookFunction<WorldType>\n ) => void)\n BeforeStep: (<WorldType = IWorld>(\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n tags: string,\n code: TestStepHookFunction<WorldType>\n ) => void) &\n (<WorldType = IWorld>(\n options: IDefineTestStepHookOptions,\n code: TestStepHookFunction<WorldType>\n ) => void)\n BeforeAll: ((code: TestRunHookFunction) => void) &\n ((options: IDefineTestRunHookOptions, code: TestRunHookFunction) => void)\n Given: IDefineStep\n Then: IDefineStep\n When: IDefineStep\n}\n\nexport interface ISupportCodeCoordinates {\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n loaders: string[]\n}\n\nexport interface CanonicalSupportCodeIds {\n stepDefinitionIds: string[]\n beforeTestCaseHookDefinitionIds: string[]\n afterTestCaseHookDefinitionIds: string[]\n beforeTestRunHookDefinitionIds: string[]\n afterTestRunHookDefinitionIds: string[]\n}\n\nexport interface SupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n readonly afterTestCaseHookDefinitions: TestCaseHookDefinition[]\n readonly afterTestStepHookDefinitions: TestStepHookDefinition[]\n readonly afterTestRunHookDefinitions: TestRunHookDefinition[]\n readonly beforeTestCaseHookDefinitions: TestCaseHookDefinition[]\n readonly beforeTestStepHookDefinitions: TestStepHookDefinition[]\n readonly beforeTestRunHookDefinitions: TestRunHookDefinition[]\n readonly defaultTimeout: number\n readonly stepDefinitions: StepDefinition[]\n readonly undefinedParameterTypes: messages.UndefinedParameterType[]\n readonly parameterTypeRegistry: SourcedParameterTypeRegistry\n readonly World: any\n readonly parallelCanAssign: ParallelAssignmentValidator\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/filter_stack_trace.ts","../src/index.ts","../src/pickle_filter.ts","../src/step_arguments.ts","../src/time.ts","../src/try_require.ts","../src/uncaught_exception_manager.ts","../src/user_code_runner.ts","../src/value_checker.ts","../src/version.ts","../src/api/convert_configuration.ts","../src/api/formatters.ts","../src/api/gherkin.ts","../src/api/index.ts","../src/api/load_configuration.ts","../src/api/load_sources.ts","../src/api/load_support.ts","../src/api/plugins.ts","../src/api/run_cucumber.ts","../src/api/support.ts","../src/api/test_helpers.ts","../src/api/types.ts","../src/assemble/assemble_test_cases.ts","../src/assemble/index.ts","../src/assemble/types.ts","../src/cli/helpers.ts","../src/cli/i18n.ts","../src/cli/index.ts","../src/cli/install_validator.ts","../src/cli/run.ts","../src/cli/validate_node_engine_version.ts","../src/configuration/argv_parser.ts","../src/configuration/check_schema.ts","../src/configuration/default_configuration.ts","../src/configuration/from_file.ts","../src/configuration/helpers.ts","../src/configuration/index.ts","../src/configuration/locate_file.ts","../src/configuration/merge_configurations.ts","../src/configuration/parse_configuration.ts","../src/configuration/split_format_descriptor.ts","../src/configuration/types.ts","../src/configuration/validate_configuration.ts","../src/environment/console_logger.ts","../src/environment/index.ts","../src/environment/make_environment.ts","../src/environment/types.ts","../src/filter/filter_plugin.ts","../src/filter/index.ts","../src/filter/types.ts","../src/formatter/builder.ts","../src/formatter/create_stream.ts","../src/formatter/find_class_or_plugin.ts","../src/formatter/get_color_fns.ts","../src/formatter/import_code.ts","../src/formatter/index.ts","../src/formatter/json_formatter.ts","../src/formatter/progress_bar_formatter.ts","../src/formatter/progress_formatter.ts","../src/formatter/rerun_formatter.ts","../src/formatter/resolve_implementation.ts","../src/formatter/snippets_formatter.ts","../src/formatter/summary_formatter.ts","../src/formatter/usage_formatter.ts","../src/formatter/usage_json_formatter.ts","../src/formatter/builtin/html.ts","../src/formatter/builtin/index.ts","../src/formatter/builtin/message.ts","../src/formatter/helpers/duration_helpers.ts","../src/formatter/helpers/event_data_collector.ts","../src/formatter/helpers/formatters.ts","../src/formatter/helpers/gherkin_document_parser.ts","../src/formatter/helpers/index.ts","../src/formatter/helpers/issue_helpers.ts","../src/formatter/helpers/keyword_type.ts","../src/formatter/helpers/location_helpers.ts","../src/formatter/helpers/pickle_parser.ts","../src/formatter/helpers/step_argument_formatter.ts","../src/formatter/helpers/summary_helpers.ts","../src/formatter/helpers/test_case_attempt_formatter.ts","../src/formatter/helpers/test_case_attempt_parser.ts","../src/formatter/helpers/usage_helpers/index.ts","../src/formatter/step_definition_snippet_builder/index.ts","../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts","../src/formatter/step_definition_snippet_builder/snippet_syntax.ts","../src/models/data_table.ts","../src/models/definition.ts","../src/models/gherkin_step_keyword.ts","../src/models/step_definition.ts","../src/models/test_case_hook_definition.ts","../src/models/test_run_hook_definition.ts","../src/models/test_step_hook_definition.ts","../src/paths/index.ts","../src/paths/paths.ts","../src/paths/types.ts","../src/plugin/events.ts","../src/plugin/index.ts","../src/plugin/plugin_manager.ts","../src/plugin/types.ts","../src/publish/index.ts","../src/publish/publish_plugin.ts","../src/publish/types.ts","../src/runtime/coordinator.ts","../src/runtime/format_error.ts","../src/runtime/helpers.ts","../src/runtime/index.ts","../src/runtime/make_runtime.ts","../src/runtime/
|
|
1
|
+
{"root":["../src/filter_stack_trace.ts","../src/index.ts","../src/pickle_filter.ts","../src/step_arguments.ts","../src/time.ts","../src/try_require.ts","../src/uncaught_exception_manager.ts","../src/user_code_runner.ts","../src/value_checker.ts","../src/version.ts","../src/api/convert_configuration.ts","../src/api/formatters.ts","../src/api/gherkin.ts","../src/api/index.ts","../src/api/load_configuration.ts","../src/api/load_sources.ts","../src/api/load_support.ts","../src/api/plugins.ts","../src/api/run_cucumber.ts","../src/api/support.ts","../src/api/test_helpers.ts","../src/api/types.ts","../src/assemble/assemble_test_cases.ts","../src/assemble/index.ts","../src/assemble/types.ts","../src/cli/helpers.ts","../src/cli/i18n.ts","../src/cli/index.ts","../src/cli/install_validator.ts","../src/cli/run.ts","../src/cli/validate_node_engine_version.ts","../src/configuration/argv_parser.ts","../src/configuration/check_schema.ts","../src/configuration/default_configuration.ts","../src/configuration/from_file.ts","../src/configuration/helpers.ts","../src/configuration/index.ts","../src/configuration/locate_file.ts","../src/configuration/merge_configurations.ts","../src/configuration/parse_configuration.ts","../src/configuration/split_format_descriptor.ts","../src/configuration/types.ts","../src/configuration/validate_configuration.ts","../src/environment/console_logger.ts","../src/environment/index.ts","../src/environment/make_environment.ts","../src/environment/types.ts","../src/filter/filter_plugin.ts","../src/filter/index.ts","../src/filter/types.ts","../src/formatter/builder.ts","../src/formatter/create_stream.ts","../src/formatter/find_class_or_plugin.ts","../src/formatter/get_color_fns.ts","../src/formatter/import_code.ts","../src/formatter/index.ts","../src/formatter/json_formatter.ts","../src/formatter/progress_bar_formatter.ts","../src/formatter/progress_formatter.ts","../src/formatter/rerun_formatter.ts","../src/formatter/resolve_implementation.ts","../src/formatter/snippets_formatter.ts","../src/formatter/summary_formatter.ts","../src/formatter/usage_formatter.ts","../src/formatter/usage_json_formatter.ts","../src/formatter/builtin/html.ts","../src/formatter/builtin/index.ts","../src/formatter/builtin/message.ts","../src/formatter/helpers/duration_helpers.ts","../src/formatter/helpers/event_data_collector.ts","../src/formatter/helpers/formatters.ts","../src/formatter/helpers/gherkin_document_parser.ts","../src/formatter/helpers/index.ts","../src/formatter/helpers/issue_helpers.ts","../src/formatter/helpers/keyword_type.ts","../src/formatter/helpers/location_helpers.ts","../src/formatter/helpers/pickle_parser.ts","../src/formatter/helpers/step_argument_formatter.ts","../src/formatter/helpers/summary_helpers.ts","../src/formatter/helpers/test_case_attempt_formatter.ts","../src/formatter/helpers/test_case_attempt_parser.ts","../src/formatter/helpers/usage_helpers/index.ts","../src/formatter/step_definition_snippet_builder/index.ts","../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts","../src/formatter/step_definition_snippet_builder/snippet_syntax.ts","../src/models/data_table.ts","../src/models/definition.ts","../src/models/gherkin_step_keyword.ts","../src/models/step_definition.ts","../src/models/test_case_hook_definition.ts","../src/models/test_run_hook_definition.ts","../src/models/test_step_hook_definition.ts","../src/paths/index.ts","../src/paths/paths.ts","../src/paths/types.ts","../src/plugin/events.ts","../src/plugin/index.ts","../src/plugin/plugin_manager.ts","../src/plugin/types.ts","../src/publish/index.ts","../src/publish/publish_plugin.ts","../src/publish/types.ts","../src/runtime/coordinator.ts","../src/runtime/format_error.ts","../src/runtime/helpers.ts","../src/runtime/index.ts","../src/runtime/make_runtime.ts","../src/runtime/make_suggestion.ts","../src/runtime/step_runner.ts","../src/runtime/stopwatch.ts","../src/runtime/test_case_runner.ts","../src/runtime/types.ts","../src/runtime/worker.ts","../src/runtime/attachment_manager/index.ts","../src/runtime/parallel/adapter.ts","../src/runtime/parallel/run_worker.ts","../src/runtime/parallel/types.ts","../src/runtime/parallel/worker.ts","../src/runtime/scope/index.ts","../src/runtime/scope/make_proxy.ts","../src/runtime/scope/test_case_scope.ts","../src/runtime/scope/test_run_scope.ts","../src/runtime/serial/adapter.ts","../src/sharding/index.ts","../src/sharding/sharding_plugin.ts","../src/support_code_library_builder/build_parameter_type.ts","../src/support_code_library_builder/context.ts","../src/support_code_library_builder/get_definition_line_and_uri.ts","../src/support_code_library_builder/index.ts","../src/support_code_library_builder/parallel_can_assign_helpers.ts","../src/support_code_library_builder/sourced_parameter_type_registry.ts","../src/support_code_library_builder/types.ts","../src/support_code_library_builder/validate_arguments.ts","../src/support_code_library_builder/world.ts","../src/types/index.ts","../src/types/assertion-error-formatter/index.d.ts","../src/types/is-generator/index.d.ts","../src/types/knuth-shuffle-seeded/index.d.ts","../src/types/stack-chain/index.d.ts","../src/types/supports-color/index.d.ts"],"version":"5.8.3"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "12.
|
|
1
|
+
export declare const version = "12.3.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,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '12.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '12.3.0'\n"]}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"gherkin",
|
|
9
9
|
"tests"
|
|
10
10
|
],
|
|
11
|
-
"version": "12.
|
|
11
|
+
"version": "12.3.0",
|
|
12
12
|
"funding": "https://opencollective.com/cucumber",
|
|
13
13
|
"homepage": "https://github.com/cucumber/cucumber-js",
|
|
14
14
|
"author": "Julien Biezemans <jb@jbpros.com>",
|
|
@@ -214,20 +214,20 @@
|
|
|
214
214
|
"node": "20 || 22 || >=24"
|
|
215
215
|
},
|
|
216
216
|
"enginesTested": {
|
|
217
|
-
"node": "20 || 22 || 24"
|
|
217
|
+
"node": "20 || 22 || 24 || 25"
|
|
218
218
|
},
|
|
219
219
|
"dependencies": {
|
|
220
|
-
"@cucumber/ci-environment": "
|
|
220
|
+
"@cucumber/ci-environment": "12.0.0",
|
|
221
221
|
"@cucumber/cucumber-expressions": "18.0.1",
|
|
222
|
-
"@cucumber/gherkin": "
|
|
223
|
-
"@cucumber/gherkin-streams": "
|
|
224
|
-
"@cucumber/gherkin-utils": "
|
|
225
|
-
"@cucumber/html-formatter": "
|
|
226
|
-
"@cucumber/junit-xml-formatter": "0.
|
|
222
|
+
"@cucumber/gherkin": "37.0.0",
|
|
223
|
+
"@cucumber/gherkin-streams": "6.0.0",
|
|
224
|
+
"@cucumber/gherkin-utils": "10.0.0",
|
|
225
|
+
"@cucumber/html-formatter": "22.2.0",
|
|
226
|
+
"@cucumber/junit-xml-formatter": "0.9.0",
|
|
227
227
|
"@cucumber/message-streams": "4.0.1",
|
|
228
|
-
"@cucumber/messages": "
|
|
228
|
+
"@cucumber/messages": "31.0.0",
|
|
229
229
|
"@cucumber/pretty-formatter": "1.0.1",
|
|
230
|
-
"@cucumber/tag-expressions": "
|
|
230
|
+
"@cucumber/tag-expressions": "8.1.0",
|
|
231
231
|
"assertion-error-formatter": "^3.0.0",
|
|
232
232
|
"capital-case": "^1.0.4",
|
|
233
233
|
"chalk": "^4.1.2",
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
"debug": "^4.3.4",
|
|
237
237
|
"error-stack-parser": "^2.1.4",
|
|
238
238
|
"figures": "^3.2.0",
|
|
239
|
-
"glob": "^
|
|
239
|
+
"glob": "^13.0.0",
|
|
240
240
|
"has-ansi": "^4.0.1",
|
|
241
241
|
"indent-string": "^4.0.0",
|
|
242
242
|
"is-installed-globally": "^0.4.0",
|
|
@@ -244,32 +244,32 @@
|
|
|
244
244
|
"knuth-shuffle-seeded": "^1.0.6",
|
|
245
245
|
"lodash.merge": "^4.6.2",
|
|
246
246
|
"lodash.mergewith": "^4.6.2",
|
|
247
|
-
"luxon": "3.7.
|
|
247
|
+
"luxon": "3.7.2",
|
|
248
248
|
"mime": "^3.0.0",
|
|
249
249
|
"mkdirp": "^3.0.0",
|
|
250
250
|
"mz": "^2.7.0",
|
|
251
251
|
"progress": "^2.0.3",
|
|
252
|
-
"read-package-up": "^
|
|
253
|
-
"semver": "7.7.
|
|
252
|
+
"read-package-up": "^12.0.0",
|
|
253
|
+
"semver": "7.7.3",
|
|
254
254
|
"string-argv": "0.3.1",
|
|
255
255
|
"supports-color": "^8.1.1",
|
|
256
256
|
"type-fest": "^4.41.0",
|
|
257
257
|
"util-arity": "^1.1.0",
|
|
258
258
|
"yaml": "^2.2.2",
|
|
259
|
-
"yup": "1.7.
|
|
259
|
+
"yup": "1.7.1"
|
|
260
260
|
},
|
|
261
261
|
"devDependencies": {
|
|
262
|
-
"@cucumber/compatibility-kit": "^
|
|
263
|
-
"@cucumber/query": "
|
|
264
|
-
"@eslint/compat": "^
|
|
262
|
+
"@cucumber/compatibility-kit": "^26.0.0",
|
|
263
|
+
"@cucumber/query": "14.6.0",
|
|
264
|
+
"@eslint/compat": "^2.0.0",
|
|
265
265
|
"@eslint/eslintrc": "^3.3.1",
|
|
266
266
|
"@eslint/js": "^9.29.0",
|
|
267
|
-
"@microsoft/api-extractor": "7.
|
|
268
|
-
"@sinonjs/fake-timers": "
|
|
267
|
+
"@microsoft/api-extractor": "7.55.1",
|
|
268
|
+
"@sinonjs/fake-timers": "15.0.0",
|
|
269
269
|
"@types/chai": "4.3.20",
|
|
270
270
|
"@types/debug": "4.1.12",
|
|
271
271
|
"@types/dirty-chai": "2.0.5",
|
|
272
|
-
"@types/express": "5.0.
|
|
272
|
+
"@types/express": "5.0.5",
|
|
273
273
|
"@types/fs-extra": "9.0.13",
|
|
274
274
|
"@types/has-ansi": "5.0.2",
|
|
275
275
|
"@types/lodash.merge": "4.6.9",
|
|
@@ -278,12 +278,12 @@
|
|
|
278
278
|
"@types/mocha": "10.0.10",
|
|
279
279
|
"@types/mustache": "4.2.6",
|
|
280
280
|
"@types/mz": "2.7.9",
|
|
281
|
-
"@types/node": "20.
|
|
281
|
+
"@types/node": "^20.11.25",
|
|
282
282
|
"@types/progress": "2.0.7",
|
|
283
|
-
"@types/semver": "7.7.
|
|
283
|
+
"@types/semver": "7.7.1",
|
|
284
284
|
"@types/sinon-chai": "3.2.12",
|
|
285
|
-
"@types/sinonjs__fake-timers": "
|
|
286
|
-
"@types/stream-buffers": "3.0.
|
|
285
|
+
"@types/sinonjs__fake-timers": "15.0.1",
|
|
286
|
+
"@types/stream-buffers": "3.0.8",
|
|
287
287
|
"@types/tmp": "0.2.6",
|
|
288
288
|
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
289
289
|
"@typescript-eslint/parser": "^8.34.0",
|
|
@@ -295,7 +295,7 @@
|
|
|
295
295
|
"eslint": "^9.29.0",
|
|
296
296
|
"eslint-plugin-import": "^2.31.0",
|
|
297
297
|
"eslint-plugin-n": "^17.20.0",
|
|
298
|
-
"eslint-plugin-unicorn": "^
|
|
298
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
299
299
|
"express": "^5.0.0",
|
|
300
300
|
"fs-extra": "10.1.0",
|
|
301
301
|
"genversion": "3.2.0",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { JsonObject } from 'type-fest';
|
|
2
|
-
import TestRunHookDefinition from '../models/test_run_hook_definition';
|
|
3
|
-
export type RunsTestRunHooks = (definitions: TestRunHookDefinition[], name: string) => Promise<void>;
|
|
4
|
-
export declare const makeRunTestRunHooks: (dryRun: boolean, defaultTimeout: number, worldParameters: JsonObject, errorMessage: (name: string, location: string) => string) => RunsTestRunHooks;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.makeRunTestRunHooks = void 0;
|
|
7
|
-
const user_code_runner_1 = __importDefault(require("../user_code_runner"));
|
|
8
|
-
const helpers_1 = require("../formatter/helpers");
|
|
9
|
-
const value_checker_1 = require("../value_checker");
|
|
10
|
-
const scope_1 = require("./scope");
|
|
11
|
-
const makeRunTestRunHooks = (dryRun, defaultTimeout, worldParameters, errorMessage) => dryRun
|
|
12
|
-
? async () => { }
|
|
13
|
-
: async (definitions, name) => {
|
|
14
|
-
const context = { parameters: worldParameters };
|
|
15
|
-
for (const hookDefinition of definitions) {
|
|
16
|
-
const { error } = await (0, scope_1.runInTestRunScope)({ context }, () => user_code_runner_1.default.run({
|
|
17
|
-
argsArray: [],
|
|
18
|
-
fn: hookDefinition.code,
|
|
19
|
-
thisArg: context,
|
|
20
|
-
timeoutInMilliseconds: (0, value_checker_1.valueOrDefault)(hookDefinition.options.timeout, defaultTimeout),
|
|
21
|
-
}));
|
|
22
|
-
if ((0, value_checker_1.doesHaveValue)(error)) {
|
|
23
|
-
const location = (0, helpers_1.formatLocation)(hookDefinition);
|
|
24
|
-
throw new Error(errorMessage(name, location), { cause: error });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.makeRunTestRunHooks = makeRunTestRunHooks;
|
|
29
|
-
//# sourceMappingURL=run_test_run_hooks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run_test_run_hooks.js","sourceRoot":"","sources":["../../src/runtime/run_test_run_hooks.ts"],"names":[],"mappings":";;;;;;AACA,2EAAgD;AAChD,kDAAqD;AACrD,oDAAgE;AAEhE,mCAA2C;AAOpC,MAAM,mBAAmB,GAAG,CACjC,MAAe,EACf,cAAsB,EACtB,eAA2B,EAC3B,YAAwD,EACtC,EAAE,CACpB,MAAM;IACJ,CAAC,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC;IAChB,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,EAAE,UAAU,EAAE,eAAe,EAAE,CAAA;QAC/C,KAAK,MAAM,cAAc,IAAI,WAAW,EAAE,CAAC;YACzC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAA,yBAAiB,EAAC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAC1D,0BAAc,CAAC,GAAG,CAAC;gBACjB,SAAS,EAAE,EAAE;gBACb,EAAE,EAAE,cAAc,CAAC,IAAI;gBACvB,OAAO,EAAE,OAAO;gBAChB,qBAAqB,EAAE,IAAA,8BAAc,EACnC,cAAc,CAAC,OAAO,CAAC,OAAO,EAC9B,cAAc,CACf;aACF,CAAC,CACH,CAAA;YACD,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,QAAQ,GAAG,IAAA,wBAAc,EAAC,cAAc,CAAC,CAAA;gBAC/C,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YACjE,CAAC;QACH,CAAC;IACH,CAAC,CAAA;AA3BM,QAAA,mBAAmB,uBA2BzB","sourcesContent":["import { JsonObject } from 'type-fest'\nimport UserCodeRunner from '../user_code_runner'\nimport { formatLocation } from '../formatter/helpers'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { runInTestRunScope } from './scope'\n\nexport type RunsTestRunHooks = (\n definitions: TestRunHookDefinition[],\n name: string\n) => Promise<void>\n\nexport const makeRunTestRunHooks = (\n dryRun: boolean,\n defaultTimeout: number,\n worldParameters: JsonObject,\n errorMessage: (name: string, location: string) => string\n): RunsTestRunHooks =>\n dryRun\n ? async () => {}\n : async (definitions, name) => {\n const context = { parameters: worldParameters }\n for (const hookDefinition of definitions) {\n const { error } = await runInTestRunScope({ context }, () =>\n UserCodeRunner.run({\n argsArray: [],\n fn: hookDefinition.code,\n thisArg: context,\n timeoutInMilliseconds: valueOrDefault(\n hookDefinition.options.timeout,\n defaultTimeout\n ),\n })\n )\n if (doesHaveValue(error)) {\n const location = formatLocation(hookDefinition)\n throw new Error(errorMessage(name, location), { cause: error })\n }\n }\n }\n"]}
|