@cucumber/cucumber 11.3.0 → 12.1.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.
Files changed (38) hide show
  1. package/lib/api/formatters.js +1 -1
  2. package/lib/api/formatters.js.map +1 -1
  3. package/lib/configuration/argv_parser.js +0 -1
  4. package/lib/configuration/argv_parser.js.map +1 -1
  5. package/lib/configuration/check_schema.js +0 -1
  6. package/lib/configuration/check_schema.js.map +1 -1
  7. package/lib/configuration/default_configuration.js +0 -1
  8. package/lib/configuration/default_configuration.js.map +1 -1
  9. package/lib/configuration/from_file.js +3 -3
  10. package/lib/configuration/from_file.js.map +1 -1
  11. package/lib/configuration/types.d.ts +0 -5
  12. package/lib/configuration/types.js.map +1 -1
  13. package/lib/configuration/validate_configuration.js +0 -3
  14. package/lib/configuration/validate_configuration.js.map +1 -1
  15. package/lib/formatter/builtin/index.d.ts +1 -0
  16. package/lib/formatter/builtin/index.js +2 -0
  17. package/lib/formatter/builtin/index.js.map +1 -1
  18. package/lib/formatter/create_stream.js +2 -2
  19. package/lib/formatter/create_stream.js.map +1 -1
  20. package/lib/plugin/plugin_manager.d.ts +1 -1
  21. package/lib/plugin/plugin_manager.js +2 -1
  22. package/lib/plugin/plugin_manager.js.map +1 -1
  23. package/lib/plugin/types.d.ts +1 -0
  24. package/lib/plugin/types.js.map +1 -1
  25. package/lib/runtime/step_runner.d.ts +5 -1
  26. package/lib/runtime/step_runner.js +6 -3
  27. package/lib/runtime/step_runner.js.map +1 -1
  28. package/lib/runtime/test_case_runner.d.ts +4 -3
  29. package/lib/runtime/test_case_runner.js +30 -13
  30. package/lib/runtime/test_case_runner.js.map +1 -1
  31. package/lib/support_code_library_builder/types.d.ts +2 -0
  32. package/lib/support_code_library_builder/types.js.map +1 -1
  33. package/lib/try_require.js +1 -1
  34. package/lib/try_require.js.map +1 -1
  35. package/lib/version.d.ts +1 -1
  36. package/lib/version.js +1 -1
  37. package/lib/version.js.map +1 -1
  38. package/package.json +29 -27
@@ -34,7 +34,7 @@ async function initializeFormatters({ env, cwd, stdout, logger, onStreamError, e
34
34
  cleanupFns.push(async () => formatter.finished());
35
35
  }
36
36
  else {
37
- await pluginManager.initFormatter(implementation, configuration.options, stream.write.bind(stream), directory);
37
+ await pluginManager.initFormatter(implementation, configuration.options, stream, stream.write.bind(stream), directory);
38
38
  if (stream !== stdout) {
39
39
  cleanupFns.push((0, node_util_1.promisify)(stream.end.bind(stream)));
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;AAaA,oDAsFC;AAlGD,yCAAqC;AAKrC,mEAAmD;AAEnD,8DAAyD;AACzD,gFAA2E;AAIpE,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,aAAa,GAad;IACC,MAAM,UAAU,GAA+B,EAAE,CAAA;IAEjD,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,SAA6B,EAC7B,MAAc,EACd,SAAiB;QAEjB,IAAI,SAAS,KAAK,cAAc,IAAI,CAAE,MAAyB,CAAC,KAAK,EAAE,CAAC;YACtE,MAAM,CAAC,IAAI,CACT,sDAAsD,MAAM,oDAAoD,CACjH,CAAA;YACD,SAAS,GAAG,UAAU,CAAA;QACxB,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,IAAA,8CAAqB,EAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QAClE,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE,CAAC;YACzC,MAAM,WAAW,GAAG;gBAClB,GAAG;gBACH,GAAG;gBACH,gBAAgB;gBAChB,kBAAkB;gBAClB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC9B,iBAAiB,EAAE,aAAa,CAAC,O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OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAC/D,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../environment'\nimport { createStream } from '../formatter/create_stream'\nimport { resolveImplementation } from '../formatter/resolve_implementation'\nimport { PluginManager } from '../plugin'\nimport { IRunOptionsFormats } from './types'\n\nexport async function initializeFormatters({\n env,\n cwd,\n stdout,\n logger,\n onStreamError,\n eventBroadcaster,\n eventDataCollector,\n configuration,\n supportCodeLibrary,\n pluginManager,\n}: {\n env: NodeJS.ProcessEnv\n cwd: string\n stdout: IFormatterStream\n stderr: IFormatterStream\n logger: ILogger\n onStreamError: () => void\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n configuration: IRunOptionsFormats\n supportCodeLibrary: SupportCodeLibrary\n pluginManager: PluginManager\n}): Promise<() => Promise<void>> {\n const cleanupFns: Array<() => Promise<void>> = []\n\n async function initializeFormatter(\n stream: IFormatterStream,\n directory: string | undefined,\n target: string,\n specifier: string\n ): Promise<void> {\n if (specifier === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {\n logger.warn(\n `Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`\n )\n specifier = 'progress'\n }\n const implementation = await resolveImplementation(specifier, cwd)\n if (typeof implementation === 'function') {\n const typeOptions = {\n env,\n cwd,\n eventBroadcaster,\n eventDataCollector,\n log: stream.write.bind(stream),\n parsedArgvOptions: configuration.options,\n stream,\n cleanup:\n stream === stdout\n ? async () => await Promise.resolve()\n : promisify<any>(stream.end.bind(stream)),\n supportCodeLibrary,\n }\n const formatter = await FormatterBuilder.build(\n implementation,\n typeOptions\n )\n cleanupFns.push(async () => formatter.finished())\n } else {\n await pluginManager.initFormatter(\n implementation,\n configuration.options,\n stream.write.bind(stream),\n directory\n )\n if (stream !== stdout) {\n cleanupFns.push(promisify<any>(stream.end.bind(stream)))\n }\n }\n }\n\n await initializeFormatter(stdout, undefined, 'stdout', configuration.stdout)\n for (const [target, specifier] of Object.entries(configuration.files)) {\n const { stream, directory } = await createStream(\n target,\n onStreamError,\n cwd,\n logger\n )\n await initializeFormatter(stream, directory, target, specifier)\n }\n\n return async function () {\n await Promise.all(cleanupFns.map((cleanupFn) => cleanupFn()))\n }\n}\n"]}
1
+ {"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;AAaA,oDAuFC;AAnGD,yCAAqC;AAKrC,mEAAmD;AAEnD,8DAAyD;AACzD,gFAA2E;AAIpE,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,aAAa,GAad;IACC,MAAM,UAAU,GAA+B,EAAE,CAAA;IAEjD,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,SAA6B,EAC7B,MAAc,EACd,SAAiB;QAEjB,IAAI,SAAS,KAAK,cAAc,IAAI,CAAE,MAAyB,CAAC,KAAK,EAAE,CAAC;YACtE,MAAM,CAAC,IAAI,CACT,sDAAsD,MAAM,oDAAoD,CACjH,CAAA;YACD,SAAS,GAAG,UAAU,CAAA;QACxB,CAAC;QACD,MAAM,cAAc,GAAG,MAAM,IAAA,8CAAqB,EAAC,SAAS,EAAE,GAAG,CAAC,CAAA;QAClE,IAAI,OAAO,cAAc,KAAK,UAAU,EAAE,CAAC;YACzC,MAAM,WAAW,GAAG;gBAClB,GAAG;gBACH,GAAG;gBACH,gBAAgB;gBAChB,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AA;QACD,MAAM,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;IACjE,CAAC;IAED,OAAO,KAAK;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAC/D,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../environment'\nimport { createStream } from '../formatter/create_stream'\nimport { resolveImplementation } from '../formatter/resolve_implementation'\nimport { PluginManager } from '../plugin'\nimport { IRunOptionsFormats } from './types'\n\nexport async function initializeFormatters({\n env,\n cwd,\n stdout,\n logger,\n onStreamError,\n eventBroadcaster,\n eventDataCollector,\n configuration,\n supportCodeLibrary,\n pluginManager,\n}: {\n env: NodeJS.ProcessEnv\n cwd: string\n stdout: IFormatterStream\n stderr: IFormatterStream\n logger: ILogger\n onStreamError: () => void\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n configuration: IRunOptionsFormats\n supportCodeLibrary: SupportCodeLibrary\n pluginManager: PluginManager\n}): Promise<() => Promise<void>> {\n const cleanupFns: Array<() => Promise<void>> = []\n\n async function initializeFormatter(\n stream: IFormatterStream,\n directory: string | undefined,\n target: string,\n specifier: string\n ): Promise<void> {\n if (specifier === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {\n logger.warn(\n `Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`\n )\n specifier = 'progress'\n }\n const implementation = await resolveImplementation(specifier, cwd)\n if (typeof implementation === 'function') {\n const typeOptions = {\n env,\n cwd,\n eventBroadcaster,\n eventDataCollector,\n log: stream.write.bind(stream),\n parsedArgvOptions: configuration.options,\n stream,\n cleanup:\n stream === stdout\n ? async () => await Promise.resolve()\n : promisify<any>(stream.end.bind(stream)),\n supportCodeLibrary,\n }\n const formatter = await FormatterBuilder.build(\n implementation,\n typeOptions\n )\n cleanupFns.push(async () => formatter.finished())\n } else {\n await pluginManager.initFormatter(\n implementation,\n configuration.options,\n stream,\n stream.write.bind(stream),\n directory\n )\n if (stream !== stdout) {\n cleanupFns.push(promisify<any>(stream.end.bind(stream)))\n }\n }\n }\n\n await initializeFormatter(stdout, undefined, 'stdout', configuration.stdout)\n for (const [target, specifier] of Object.entries(configuration.files)) {\n const { stream, directory } = await createStream(\n target,\n onStreamError,\n cwd,\n logger\n )\n await initializeFormatter(stream, directory, target, specifier)\n }\n\n return async function () {\n await Promise.all(cleanupFns.map((cleanupFn) => cleanupFn()))\n }\n}\n"]}
@@ -71,7 +71,6 @@ const ArgvParser = {
71
71
  .option('-p, --profile <NAME>', 'specify the profile to use (repeatable)', ArgvParser.collect, [])
72
72
  .option('--parallel <NUMBER_OF_WORKERS>', 'run in parallel with the given number of workers', (val) => ArgvParser.validateCountOption(val, '--parallel'))
73
73
  .option('--publish', 'Publish a report to https://reports.cucumber.io')
74
- .option('--publish-quiet', "Don't print information banner about publishing reports")
75
74
  .option('-r, --require <GLOB|DIR|FILE>', 'require files before executing features (repeatable)', ArgvParser.collect)
76
75
  .option('--require-module <NODE_MODULE>', 'require node modules before requiring files (repeatable)', ArgvParser.collect)
77
76
  .option('--retry <NUMBER_OF_RETRIES>', 'specify the number of times to retry failing test cases (default: 0)', (val) => ArgvParser.validateCountOption(val, '--retry'))
@@ -1 +1 @@
1
- {"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/configuration/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gEAAgC;AAChC,+CAA4C;AAC5C,wCAAoC;AACpC,kDAAoD;AAkBpD,MAAM,UAAU,GAAG;IACjB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,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,GAAG,YAAY,EAChB,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAA;QACnC,MAAM,aAAa,GAA4B,YAAY,CAAA;QAC3D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;QACpC,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACR;YACD,aAAa;SACd,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport { dialects } from '@cucumber/gherkin'\nimport { version } from '../version'\nimport { documentation } from '../formatter/builtin'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Object.entries(documentation).reduce(\n (previous, [key, description]) =>\n previous + ` ${key}: ${description}\\n`,\n ''\n ),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '-l, --loader <NODE_MODULE>',\n 'module specifier(s) for loaders to be registered ahead of loading support code',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '--publish-quiet',\n \"Don't print information banner about publishing reports\"\n )\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
1
+ {"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/configuration/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gEAAgC;AAChC,+CAA4C;AAC5C,wCAAoC;AACpC,kDAAoD;AAkBpD,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,E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nC,MAAM,aAAa,GAA4B,YAAY,CAAA;QAC3D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;QACpC,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACR;YACD,aAAa;SACd,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport { dialects } from '@cucumber/gherkin'\nimport { version } from '../version'\nimport { documentation } from '../formatter/builtin'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Object.entries(documentation).reduce(\n (previous, [key, description]) =>\n previous + ` ${key}: ${description}\\n`,\n ''\n ),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '-l, --loader <NODE_MODULE>',\n 'module specifier(s) for loaders to be registered ahead of loading support code',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
@@ -54,7 +54,6 @@ const schema = yup.object().shape({
54
54
  paths: yup.array().of(yup.string()),
55
55
  parallel: yup.number().integer().min(0),
56
56
  publish: yup.boolean(),
57
- publishQuiet: yup.boolean(),
58
57
  require: yup.array().of(yup.string()),
59
58
  requireModule: yup.array().of(yup.string()),
60
59
  retry: yup.number().integer().min(0),
@@ -1 +1 @@
1
- {"version":3,"file":"check_schema.js","sourceRoot":"","sources":["../../src/configuration/check_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,kCAMC;AA1CD,yCAA0B;AAC1B,+CAA4C;AAG5C,M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AC,OAAO,EAAE;IAC3B,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IACrC,aAAa,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC3C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE;IAC5B,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE;IACrB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE;IAClB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE;CAC9B,CAAC,CAAA;AAEF,SAAgB,WAAW,CAAC,aAAkB;IAC5C,OAAO,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE;QACxC,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,IAAI;KACnB,CAA4B,CAAA;AAC/B,CAAC","sourcesContent":["import * as yup from 'yup'\nimport { dialects } from '@cucumber/gherkin'\nimport { IConfiguration } from './types'\n\nconst schema = yup.object().shape({\n backtrace: yup.boolean(),\n dryRun: yup.boolean(),\n exit: yup.boolean(),\n failFast: yup.boolean(),\n format: yup\n .array()\n .of(\n yup.lazy((val) =>\n Array.isArray(val)\n ? yup.array().of(yup.string()).min(1).max(2)\n : yup.string()\n )\n ),\n formatOptions: yup.object(),\n import: yup.array().of(yup.string()),\n language: yup.string().oneOf(Object.keys(dialects)),\n name: yup.array().of(yup.string()),\n order: yup.string().matches(/^random:.*|random|defined$/),\n paths: yup.array().of(yup.string()),\n parallel: yup.number().integer().min(0),\n publish: yup.boolean(),\n publishQuiet: yup.boolean(),\n require: yup.array().of(yup.string()),\n requireModule: yup.array().of(yup.string()),\n retry: yup.number().integer().min(0),\n retryTagFilter: yup.string(),\n strict: yup.boolean(),\n tags: yup.string(),\n worldParameters: yup.object(),\n})\n\nexport function checkSchema(configuration: any): Partial<IConfiguration> {\n return schema.validateSync(configuration, {\n abortEarly: false,\n strict: true,\n stripUnknown: true,\n }) as Partial<IConfiguration>\n}\n"]}
1
+ {"version":3,"file":"check_schema.js","sourceRoot":"","sources":["../../src/configuration/check_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,kCAMC;AAzCD,yCAA0B;AAC1B,+CAA4C;AAG5C,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC;IAChC,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE;IACxB,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE;IACrB,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE;IACnB,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE;IACvB,MAAM,EAAE,GAAG;SACR,KAAK,EAAE;SACP,EAAE,CACD,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CACf,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAChB,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,CACjB,CACF;IACH,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE;IAC3B,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IACpC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAQ,CAAC,CAAC;IACnD,IAAI,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAClC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC;IACzD,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IACnC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE;IACtB,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IACrC,aAAa,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;IAC3C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE;IAC5B,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE;IACrB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE;IAClB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE;CAC9B,CAAC,CAAA;AAEF,SAAgB,WAAW,CAAC,aAAkB;IAC5C,OAAO,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE;QACxC,UAAU,EAAE,KAAK;QACjB,MAAM,EAAE,IAAI;QACZ,YAAY,EAAE,IAAI;KACnB,CAA4B,CAAA;AAC/B,CAAC","sourcesContent":["import * as yup from 'yup'\nimport { dialects } from '@cucumber/gherkin'\nimport { IConfiguration } from './types'\n\nconst schema = yup.object().shape({\n backtrace: yup.boolean(),\n dryRun: yup.boolean(),\n exit: yup.boolean(),\n failFast: yup.boolean(),\n format: yup\n .array()\n .of(\n yup.lazy((val) =>\n Array.isArray(val)\n ? yup.array().of(yup.string()).min(1).max(2)\n : yup.string()\n )\n ),\n formatOptions: yup.object(),\n import: yup.array().of(yup.string()),\n language: yup.string().oneOf(Object.keys(dialects)),\n name: yup.array().of(yup.string()),\n order: yup.string().matches(/^random:.*|random|defined$/),\n paths: yup.array().of(yup.string()),\n parallel: yup.number().integer().min(0),\n publish: yup.boolean(),\n require: yup.array().of(yup.string()),\n requireModule: yup.array().of(yup.string()),\n retry: yup.number().integer().min(0),\n retryTagFilter: yup.string(),\n strict: yup.boolean(),\n tags: yup.string(),\n worldParameters: yup.object(),\n})\n\nexport function checkSchema(configuration: any): Partial<IConfiguration> {\n return schema.validateSync(configuration, {\n abortEarly: false,\n strict: true,\n stripUnknown: true,\n }) as Partial<IConfiguration>\n}\n"]}
@@ -16,7 +16,6 @@ exports.DEFAULT_CONFIGURATION = {
16
16
  paths: [],
17
17
  parallel: 0,
18
18
  publish: false,
19
- publishQuiet: false,
20
19
  require: [],
21
20
  requireModule: [],
22
21
  retry: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;CACpB,CAAA","sourcesContent":["import { IConfiguration } from './types'\n\nexport const DEFAULT_CONFIGURATION: IConfiguration = {\n backtrace: false,\n dryRun: false,\n forceExit: false,\n failFast: false,\n format: [],\n formatOptions: {},\n import: [],\n language: 'en',\n loader: [],\n name: [],\n order: 'defined',\n paths: [],\n parallel: 0,\n publish: false,\n publishQuiet: false,\n require: [],\n requireModule: [],\n retry: 0,\n retryTagFilter: '',\n strict: true,\n tags: '',\n worldParameters: {},\n}\n"]}
1
+ {"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;CACpB,CAAA","sourcesContent":["import { IConfiguration } from './types'\n\nexport const DEFAULT_CONFIGURATION: IConfiguration = {\n backtrace: false,\n dryRun: false,\n forceExit: false,\n failFast: false,\n format: [],\n formatOptions: {},\n import: [],\n language: 'en',\n loader: [],\n name: [],\n order: 'defined',\n paths: [],\n parallel: 0,\n publish: false,\n require: [],\n requireModule: [],\n retry: 0,\n retryTagFilter: '',\n strict: true,\n tags: '',\n worldParameters: {},\n}\n"]}
@@ -60,7 +60,7 @@ async function loadFile(logger, cwd, file) {
60
60
  break;
61
61
  case '.cjs':
62
62
  logger.debug(`Loading configuration file "${file}" as CommonJS based on extension`);
63
- // eslint-disable-next-line @typescript-eslint/no-var-requires
63
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
64
64
  definitions = require(filePath);
65
65
  break;
66
66
  case '.mjs':
@@ -72,7 +72,7 @@ async function loadFile(logger, cwd, file) {
72
72
  const parentPackage = await readPackageJson(filePath);
73
73
  if (!parentPackage) {
74
74
  logger.debug(`Loading configuration file "${file}" as CommonJS based on absence of a parent package`);
75
- // eslint-disable-next-line @typescript-eslint/no-var-requires
75
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
76
76
  definitions = require(filePath);
77
77
  }
78
78
  else if (parentPackage.type === 'module') {
@@ -81,7 +81,7 @@ async function loadFile(logger, cwd, file) {
81
81
  }
82
82
  else {
83
83
  logger.debug(`Loading configuration file "${file}" as CommonJS based on "${parentPackage.name}" package type`);
84
- // eslint-disable-next-line @typescript-eslint/no-var-requires
84
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
85
85
  definitions = require(filePath);
86
86
  }
87
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"from_file.js","sourceRoot":"","sources":["../../src/configuration/from_file.ts"],"names":[],"mappings":";;;;;AAUA,4BA4CC;AAtDD,sDAAwB;AACxB,0DAA4B;AAC5B,yCAAqC;AACrC,uCAAwC;AACxC,gDAAuB;AAGvB,iEAA4D;AAC5D,+DAA0D;AAEnD,KAAK,UAAU,QAAQ,CAC5B,MAAe,EACf,GAAW,EACX,IAAY,EACZ,WAAqB,EAAE;IAEvB,IAAI,WAAW,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IAEnD,MAAM,iBAAiB,GAAY,WAAW,CAAC,OAAO,CAAA;IAEtD,IAAI,iBAAiB,EAAE,CAAC;QACtB,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC5C,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;YACxD,WAAW,GAAG,MAAM,+BAA+B,CACjD,WAAW,EACX,iB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,IAAI,KAAK,QAAQ,EAAE,CAAC;oBAC3C,MAAM,CAAC,KAAK,CACV,+BAA+B,IAAI,sBAAsB,aAAa,CAAC,IAAI,gBAAgB,CAC5F,CAAA;oBACD,WAAW,GAAG,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;gBAChE,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,KAAK,CACV,+BAA+B,IAAI,2BAA2B,aAAa,CAAC,IAAI,gBAAgB,CACjG,CAAA;oBACD,8DAA8D;oBAC9D,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;gBACjC,CAAC;YACH,CAAC;YACD,MAAK;QACP;YACE,MAAM,IAAI,KAAK,CAAC,6CAA6C,SAAS,GAAG,CAAC,CAAA;IAC9E,CAAC;IACD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,4BAA4B,CAAC,CAAA;IAC7E,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,QAAgB;IAC7C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAA;IACzD,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,EAAE,GAAG,EAAE,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC1E,OAAO,aAAa,EAAE,WAAW,CAAA;AACnC,CAAC","sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { pathToFileURL } from 'node:url'\nimport YAML from 'yaml'\nimport { ILogger } from '../environment'\nimport { IConfiguration } from './types'\nimport { mergeConfigurations } from './merge_configurations'\nimport { parseConfiguration } from './parse_configuration'\n\nexport async function fromFile(\n logger: ILogger,\n cwd: string,\n file: string,\n profiles: string[] = []\n): Promise<Partial<IConfiguration>> {\n let definitions = await loadFile(logger, cwd, file)\n\n const defaultDefinition: unknown = definitions.default\n\n if (defaultDefinition) {\n if (typeof defaultDefinition === 'function') {\n logger.debug('Default function found; loading profiles')\n definitions = await handleDefaultFunctionDefinition(\n definitions,\n defaultDefinition\n )\n }\n } else {\n logger.debug('No default profile defined in configuration file')\n definitions.default = {}\n }\n\n if (profiles.length < 1) {\n logger.debug('No profiles specified; using default profile')\n profiles = ['default']\n }\n\n const definedKeys = Object.keys(definitions)\n profiles.forEach((profileKey) => {\n if (!definedKeys.includes(profileKey)) {\n throw new Error(`Requested profile \"${profileKey}\" doesn't exist`)\n }\n })\n return mergeConfigurations(\n {},\n ...profiles.map((profileKey) =>\n parseConfiguration(\n logger,\n `Profile \"${profileKey}\"`,\n definitions[profileKey]\n )\n )\n )\n}\n\nasync function handleDefaultFunctionDefinition(\n definitions: Record<string, any>,\n defaultDefinition: Function\n): Promise<Record<string, any>> {\n if (Object.keys(definitions).length > 1) {\n throw new Error(\n 'Invalid profiles specified: if a default function definition is provided, no other static profiles should be specified'\n )\n }\n\n const definitionsFromDefault = await defaultDefinition()\n\n return {\n default: {},\n ...definitionsFromDefault,\n }\n}\n\nasync function loadFile(\n logger: ILogger,\n cwd: string,\n file: string\n): Promise<Record<string, any>> {\n const filePath: string = path.join(cwd, file)\n const extension = path.extname(filePath)\n let definitions\n switch (extension) {\n case '.json':\n definitions = JSON.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n case '.yaml':\n case '.yml':\n definitions = YAML.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n case '.cjs':\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on extension`\n )\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n break\n case '.mjs':\n logger.debug(\n `Loading configuration file \"${file}\" as ESM based on extension`\n )\n definitions = await import(pathToFileURL(filePath).toString())\n break\n case '.js':\n {\n const parentPackage = await readPackageJson(filePath)\n if (!parentPackage) {\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on absence of a parent package`\n )\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n } else if (parentPackage.type === 'module') {\n logger.debug(\n `Loading configuration file \"${file}\" as ESM based on \"${parentPackage.name}\" package type`\n )\n definitions = await import(pathToFileURL(filePath).toString())\n } else {\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on \"${parentPackage.name}\" package type`\n )\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n definitions = require(filePath)\n }\n }\n break\n default:\n throw new Error(`Unsupported configuration file extension \"${extension}\"`)\n }\n if (typeof definitions !== 'object') {\n throw new Error(`Configuration file ${filePath} does not export an object`)\n }\n return definitions\n}\n\nasync function readPackageJson(filePath: string) {\n const { readPackageUp } = await import('read-package-up')\n const parentPackage = await readPackageUp({ cwd: path.dirname(filePath) })\n return parentPackage?.packageJson\n}\n"]}
1
+ {"version":3,"file":"from_file.js","sourceRoot":"","sources":["../../src/configuration/from_file.ts"],"names":[],"mappings":";;;;;AAUA,4BA4CC;AAtDD,sDAAwB;AACxB,0DAA4B;AAC5B,yCAAqC;AACrC,uCAAwC;AACxC,gDAAuB;AAGvB,iEAA4D;AAC5D,+DAA0D;AAEnD,KAAK,UAAU,QAAQ,CAC5B,MAAe,EACf,GAAW,EACX,IAAY,EACZ,WAAqB,EAAE;IAEvB,IAAI,WAAW,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IAEnD,MAAM,iBAAiB,GAAY,WAAW,CAAC,OAAO,CAAA;IAEtD,IAAI,iBAAiB,EAAE,CAAC;QACtB,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;YAC5C,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAA;YACxD,WAAW,GAAG,MAAM,+BAA+B,CACjD,WAAW,EACX,iBAAiB,CAClB,CAAA;QACH,CAAC;IACH,CAAC;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AAM,CAAC,KAAK,CACV,+BAA+B,IAAI,sBAAsB,aAAa,CAAC,IAAI,gBAAgB,CAC5F,CAAA;oBACD,WAAW,GAAG,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;gBAChE,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,KAAK,CACV,+BAA+B,IAAI,2BAA2B,aAAa,CAAC,IAAI,gBAAgB,CACjG,CAAA;oBACD,iEAAiE;oBACjE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;gBACjC,CAAC;YACH,CAAC;YACD,MAAK;QACP;YACE,MAAM,IAAI,KAAK,CAAC,6CAA6C,SAAS,GAAG,CAAC,CAAA;IAC9E,CAAC;IACD,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,4BAA4B,CAAC,CAAA;IAC7E,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,QAAgB;IAC7C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAA;IACzD,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,EAAE,GAAG,EAAE,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC1E,OAAO,aAAa,EAAE,WAAW,CAAA;AACnC,CAAC","sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { promisify } from 'node:util'\nimport { pathToFileURL } from 'node:url'\nimport YAML from 'yaml'\nimport { ILogger } from '../environment'\nimport { IConfiguration } from './types'\nimport { mergeConfigurations } from './merge_configurations'\nimport { parseConfiguration } from './parse_configuration'\n\nexport async function fromFile(\n logger: ILogger,\n cwd: string,\n file: string,\n profiles: string[] = []\n): Promise<Partial<IConfiguration>> {\n let definitions = await loadFile(logger, cwd, file)\n\n const defaultDefinition: unknown = definitions.default\n\n if (defaultDefinition) {\n if (typeof defaultDefinition === 'function') {\n logger.debug('Default function found; loading profiles')\n definitions = await handleDefaultFunctionDefinition(\n definitions,\n defaultDefinition\n )\n }\n } else {\n logger.debug('No default profile defined in configuration file')\n definitions.default = {}\n }\n\n if (profiles.length < 1) {\n logger.debug('No profiles specified; using default profile')\n profiles = ['default']\n }\n\n const definedKeys = Object.keys(definitions)\n profiles.forEach((profileKey) => {\n if (!definedKeys.includes(profileKey)) {\n throw new Error(`Requested profile \"${profileKey}\" doesn't exist`)\n }\n })\n return mergeConfigurations(\n {},\n ...profiles.map((profileKey) =>\n parseConfiguration(\n logger,\n `Profile \"${profileKey}\"`,\n definitions[profileKey]\n )\n )\n )\n}\n\nasync function handleDefaultFunctionDefinition(\n definitions: Record<string, any>,\n defaultDefinition: Function\n): Promise<Record<string, any>> {\n if (Object.keys(definitions).length > 1) {\n throw new Error(\n 'Invalid profiles specified: if a default function definition is provided, no other static profiles should be specified'\n )\n }\n\n const definitionsFromDefault = await defaultDefinition()\n\n return {\n default: {},\n ...definitionsFromDefault,\n }\n}\n\nasync function loadFile(\n logger: ILogger,\n cwd: string,\n file: string\n): Promise<Record<string, any>> {\n const filePath: string = path.join(cwd, file)\n const extension = path.extname(filePath)\n let definitions\n switch (extension) {\n case '.json':\n definitions = JSON.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n case '.yaml':\n case '.yml':\n definitions = YAML.parse(\n await promisify(fs.readFile)(filePath, { encoding: 'utf-8' })\n )\n break\n case '.cjs':\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on extension`\n )\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n definitions = require(filePath)\n break\n case '.mjs':\n logger.debug(\n `Loading configuration file \"${file}\" as ESM based on extension`\n )\n definitions = await import(pathToFileURL(filePath).toString())\n break\n case '.js':\n {\n const parentPackage = await readPackageJson(filePath)\n if (!parentPackage) {\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on absence of a parent package`\n )\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n definitions = require(filePath)\n } else if (parentPackage.type === 'module') {\n logger.debug(\n `Loading configuration file \"${file}\" as ESM based on \"${parentPackage.name}\" package type`\n )\n definitions = await import(pathToFileURL(filePath).toString())\n } else {\n logger.debug(\n `Loading configuration file \"${file}\" as CommonJS based on \"${parentPackage.name}\" package type`\n )\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n definitions = require(filePath)\n }\n }\n break\n default:\n throw new Error(`Unsupported configuration file extension \"${extension}\"`)\n }\n if (typeof definitions !== 'object') {\n throw new Error(`Configuration file ${filePath} does not export an object`)\n }\n return definitions\n}\n\nasync function readPackageJson(filePath: string) {\n const { readPackageUp } = await import('read-package-up')\n const parentPackage = await readPackageUp({ cwd: path.dirname(filePath) })\n return parentPackage?.packageJson\n}\n"]}
@@ -101,11 +101,6 @@ export interface IConfiguration {
101
101
  * @default false
102
102
  */
103
103
  publish: boolean;
104
- /**
105
- * @deprecated no longer needed
106
- * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md}
107
- */
108
- publishQuiet: boolean;
109
104
  /**
110
105
  * Paths to where your support code is, for CommonJS
111
106
  * @default []
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPickleOrder } from '../filter'\n\n/**\n * User-defined configuration\n *\n * @public\n */\nexport interface IConfiguration {\n /**\n * Paths to where your feature files are\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}\n */\n paths: string[]\n /**\n * Show the full backtrace for errors\n * @default false\n */\n backtrace: boolean\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}\n */\n dryRun: boolean\n /**\n * Explicitly call `process.exit()` after the test run\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}\n * @remarks\n * This option is only used by the CLI.\n */\n forceExit: boolean\n /**\n * Stop running tests when a test fails\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}\n */\n failFast: boolean\n /**\n * Name/path and (optionally) output file path of each formatter to use\n *\n * @example\n * [\n * \"\\@cucumber/pretty-formatter\",\n * [\"html\", \"./reports/cucumber.html\"],\n * [\"./custom-formatter.js\", \"./reports/custom.txt\"]\n * ]\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}\n * @remarks\n * Each item has one or two values. The first (required) identifies the\n * formatter to be used. The second (optional) specifies where the output\n * should be written.\n */\n format: Array<string | [string, string?]>\n /**\n * Options to be provided to formatters\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n formatOptions: JsonObject\n /**\n * Paths to where your support code is\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n import: string[]\n /**\n * Default language for your feature files\n * @default \"en\"\n */\n language: string\n /**\n * Module specifier(s) for loaders to be registered ahead of loading support code\n * @default []\n */\n loader: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}\n */\n name: string[]\n /**\n * Run in the order defined, or in a random order\n * @default \"defined\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}\n */\n order: IPickleOrder\n /**\n * Run tests in parallel with the given number of worker processes\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}\n */\n parallel: number\n /**\n * Publish a report of your test run to https://reports.cucumber.io/\n * @default false\n */\n publish: boolean\n /**\n * @deprecated no longer needed\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md}\n */\n publishQuiet: boolean\n /**\n * Paths to where your support code is, for CommonJS\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n require: string[]\n /**\n * Names of transpilation modules to load, via `require()`\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}\n */\n requireModule: string[]\n /**\n * Retry failing tests up to the given number of times\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n * @default true\n */\n strict: boolean\n /**\n * Tag expression to filter which scenarios should be run\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}\n */\n tags: string\n /**\n * Parameters to be passed to your World\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPickleOrder } from '../filter'\n\n/**\n * User-defined configuration\n *\n * @public\n */\nexport interface IConfiguration {\n /**\n * Paths to where your feature files are\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}\n */\n paths: string[]\n /**\n * Show the full backtrace for errors\n * @default false\n */\n backtrace: boolean\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}\n */\n dryRun: boolean\n /**\n * Explicitly call `process.exit()` after the test run\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}\n * @remarks\n * This option is only used by the CLI.\n */\n forceExit: boolean\n /**\n * Stop running tests when a test fails\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}\n */\n failFast: boolean\n /**\n * Name/path and (optionally) output file path of each formatter to use\n *\n * @example\n * [\n * \"\\@cucumber/pretty-formatter\",\n * [\"html\", \"./reports/cucumber.html\"],\n * [\"./custom-formatter.js\", \"./reports/custom.txt\"]\n * ]\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}\n * @remarks\n * Each item has one or two values. The first (required) identifies the\n * formatter to be used. The second (optional) specifies where the output\n * should be written.\n */\n format: Array<string | [string, string?]>\n /**\n * Options to be provided to formatters\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n formatOptions: JsonObject\n /**\n * Paths to where your support code is\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n import: string[]\n /**\n * Default language for your feature files\n * @default \"en\"\n */\n language: string\n /**\n * Module specifier(s) for loaders to be registered ahead of loading support code\n * @default []\n */\n loader: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}\n */\n name: string[]\n /**\n * Run in the order defined, or in a random order\n * @default \"defined\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}\n */\n order: IPickleOrder\n /**\n * Run tests in parallel with the given number of worker processes\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}\n */\n parallel: number\n /**\n * Publish a report of your test run to https://reports.cucumber.io/\n * @default false\n */\n publish: boolean\n /**\n * Paths to where your support code is, for CommonJS\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n require: string[]\n /**\n * Names of transpilation modules to load, via `require()`\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}\n */\n requireModule: string[]\n /**\n * Retry failing tests up to the given number of times\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n * @default true\n */\n strict: boolean\n /**\n * Tag expression to filter which scenarios should be run\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}\n */\n tags: string\n /**\n * Parameters to be passed to your World\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n"]}
@@ -2,9 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateConfiguration = validateConfiguration;
4
4
  function validateConfiguration(configuration, logger) {
5
- if (configuration.publishQuiet) {
6
- logger.warn('`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
7
- }
8
5
  if (configuration.requireModule.length && !configuration.require.length) {
9
6
  logger.warn('Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code');
10
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;AAGA,sDAwBC;AAxBD,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACxE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAChE,MAAM,CAAC,IAAI,CACT,+LAA+L,CAChM,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import { ILogger } from '../environment'\nimport { IConfiguration } from './types'\n\nexport function validateConfiguration(\n configuration: IConfiguration,\n logger: ILogger\n): void {\n if (configuration.publishQuiet) {\n logger.warn(\n '`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n )\n }\n if (configuration.requireModule.length && !configuration.require.length) {\n logger.warn(\n 'Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.loader.length && !configuration.import.length) {\n logger.warn(\n 'Use of `loader` option normally means you should specify your support code paths with `import`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.retryTagFilter && !configuration.retry) {\n throw new Error(\n 'a positive `retry` count must be specified when setting `retryTagFilter`'\n )\n }\n}\n"]}
1
+ {"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;AAGA,sDAmBC;AAnBD,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACxE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAChE,MAAM,CAAC,IAAI,CACT,+LAA+L,CAChM,CAAA;IACH,CAAC;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;IACH,CAAC;AACH,CAAC","sourcesContent":["import { ILogger } from '../environment'\nimport { IConfiguration } from './types'\n\nexport function validateConfiguration(\n configuration: IConfiguration,\n logger: ILogger\n): void {\n if (configuration.requireModule.length && !configuration.require.length) {\n logger.warn(\n 'Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.loader.length && !configuration.import.length) {\n logger.warn(\n 'Use of `loader` option normally means you should specify your support code paths with `import`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\n if (configuration.retryTagFilter && !configuration.retry) {\n throw new Error(\n 'a positive `retry` count must be specified when setting `retryTagFilter`'\n )\n }\n}\n"]}
@@ -4,6 +4,7 @@ export default _default;
4
4
  export declare const documentation: {
5
5
  html: string;
6
6
  junit: string;
7
+ pretty: string;
7
8
  message: string;
8
9
  json: string;
9
10
  progress: string;
@@ -18,6 +18,7 @@ const builtin = {
18
18
  // new plugin-based formatters
19
19
  html: html_1.default,
20
20
  junit: '@cucumber/junit-xml-formatter',
21
+ pretty: '@cucumber/pretty-formatter',
21
22
  message: message_1.default,
22
23
  // legacy class-based formatters
23
24
  json: json_formatter_1.default,
@@ -34,6 +35,7 @@ exports.documentation = {
34
35
  // new plugin-based formatters
35
36
  html: 'Outputs a HTML report',
36
37
  junit: 'Produces a JUnit XML report',
38
+ pretty: 'Writes a rich report of the scenario and example execution as it happens',
37
39
  message: 'Emits Cucumber messages in newline-delimited JSON',
38
40
  // legacy class-based formatters
39
41
  json: json_formatter_1.default.documentation,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/builtin/index.ts"],"names":[],"mappings":";;;;;;AACA,uEAA6C;AAC7C,+EAAqD;AACrD,uFAA4D;AAC5D,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,wDAAwC;AACxC,kDAAkC;AAElC,MAAM,OAAO,GAAG;IACd,8BAA8B;IAC9B,IAAI,EAAE,cAAa;IACnB,KAAK,EAAE,+BAA+B;IACtC,OAAO,EAAE,iBAAgB;IACzB,gCAAgC;IAChC,IAAI,EAAE,wBAAa;IACnB,QAAQ,EAAE,4BAAiB;IAC3B,cAAc,EAAE,gCAAoB;IACpC,KAAK,EAAE,yBAAc;IACrB,QAAQ,EAAE,4BAAiB;IAC3B,OAAO,EAAE,2BAAgB;IACzB,KAAK,EAAE,yBAAc;IACrB,YAAY,EAAE,8BAAkB;CACmC,CAAA;AAErE,kBAAe,OAA2D,CAAA;AAE7D,QAAA,aAAa,GAAG;IAC3B,8BAA8B;IAC9B,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,6BAA6B;IACpC,OAAO,EAAE,mDAAmD;IAC5D,gCAAgC;IAChC,IAAI,EAAE,wBAAa,CAAC,aAAa;IACjC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,cAAc,EAAE,gCAAoB,CAAC,aAAa;IAClD,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,OAAO,EAAE,2BAAgB,CAAC,aAAa;IACvC,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,YAAY,EAAE,8BAAkB,CAAC,aAAa;CACA,CAAA","sourcesContent":["import { FormatterImplementation } from '../index'\nimport JsonFormatter from '../json_formatter'\nimport ProgressFormatter from '../progress_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport RerunFormatter from '../rerun_formatter'\nimport SnippetsFormatter from '../snippets_formatter'\nimport SummaryFormatter from '../summary_formatter'\nimport UsageFormatter from '../usage_formatter'\nimport UsageJsonFormatter from '../usage_json_formatter'\nimport messageFormatter from './message'\nimport htmlFormatter from './html'\n\nconst builtin = {\n // new plugin-based formatters\n html: htmlFormatter,\n junit: '@cucumber/junit-xml-formatter',\n message: messageFormatter,\n // legacy class-based formatters\n json: JsonFormatter,\n progress: ProgressFormatter,\n 'progress-bar': ProgressBarFormatter,\n rerun: RerunFormatter,\n snippets: SnippetsFormatter,\n summary: SummaryFormatter,\n usage: UsageFormatter,\n 'usage-json': UsageJsonFormatter,\n} as const satisfies Record<string, FormatterImplementation | string>\n\nexport default builtin as Record<string, FormatterImplementation | string>\n\nexport const documentation = {\n // new plugin-based formatters\n html: 'Outputs a HTML report',\n junit: 'Produces a JUnit XML report',\n message: 'Emits Cucumber messages in newline-delimited JSON',\n // legacy class-based formatters\n json: JsonFormatter.documentation,\n progress: ProgressFormatter.documentation,\n 'progress-bar': ProgressBarFormatter.documentation,\n rerun: RerunFormatter.documentation,\n snippets: SnippetsFormatter.documentation,\n summary: SummaryFormatter.documentation,\n usage: UsageFormatter.documentation,\n 'usage-json': UsageJsonFormatter.documentation,\n} satisfies Record<keyof typeof builtin, string>\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/builtin/index.ts"],"names":[],"mappings":";;;;;;AACA,uEAA6C;AAC7C,+EAAqD;AACrD,uFAA4D;AAC5D,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,wDAAwC;AACxC,kDAAkC;AAElC,MAAM,OAAO,GAAG;IACd,8BAA8B;IAC9B,IAAI,EAAE,cAAa;IACnB,KAAK,EAAE,+BAA+B;IACtC,MAAM,EAAE,4BAA4B;IACpC,OAAO,EAAE,iBAAgB;IACzB,gCAAgC;IAChC,IAAI,EAAE,wBAAa;IACnB,QAAQ,EAAE,4BAAiB;IAC3B,cAAc,EAAE,gCAAoB;IACpC,KAAK,EAAE,yBAAc;IACrB,QAAQ,EAAE,4BAAiB;IAC3B,OAAO,EAAE,2BAAgB;IACzB,KAAK,EAAE,yBAAc;IACrB,YAAY,EAAE,8BAAkB;CACmC,CAAA;AAErE,kBAAe,OAA2D,CAAA;AAE7D,QAAA,aAAa,GAAG;IAC3B,8BAA8B;IAC9B,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE,6BAA6B;IACpC,MAAM,EACJ,0EAA0E;IAC5E,OAAO,EAAE,mDAAmD;IAC5D,gCAAgC;IAChC,IAAI,EAAE,wBAAa,CAAC,aAAa;IACjC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,cAAc,EAAE,gCAAoB,CAAC,aAAa;IAClD,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,QAAQ,EAAE,4BAAiB,CAAC,aAAa;IACzC,OAAO,EAAE,2BAAgB,CAAC,aAAa;IACvC,KAAK,EAAE,yBAAc,CAAC,aAAa;IACnC,YAAY,EAAE,8BAAkB,CAAC,aAAa;CACA,CAAA","sourcesContent":["import { FormatterImplementation } from '../index'\nimport JsonFormatter from '../json_formatter'\nimport ProgressFormatter from '../progress_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport RerunFormatter from '../rerun_formatter'\nimport SnippetsFormatter from '../snippets_formatter'\nimport SummaryFormatter from '../summary_formatter'\nimport UsageFormatter from '../usage_formatter'\nimport UsageJsonFormatter from '../usage_json_formatter'\nimport messageFormatter from './message'\nimport htmlFormatter from './html'\n\nconst builtin = {\n // new plugin-based formatters\n html: htmlFormatter,\n junit: '@cucumber/junit-xml-formatter',\n pretty: '@cucumber/pretty-formatter',\n message: messageFormatter,\n // legacy class-based formatters\n json: JsonFormatter,\n progress: ProgressFormatter,\n 'progress-bar': ProgressBarFormatter,\n rerun: RerunFormatter,\n snippets: SnippetsFormatter,\n summary: SummaryFormatter,\n usage: UsageFormatter,\n 'usage-json': UsageJsonFormatter,\n} as const satisfies Record<string, FormatterImplementation | string>\n\nexport default builtin as Record<string, FormatterImplementation | string>\n\nexport const documentation = {\n // new plugin-based formatters\n html: 'Outputs a HTML report',\n junit: 'Produces a JUnit XML report',\n pretty:\n 'Writes a rich report of the scenario and example execution as it happens',\n message: 'Emits Cucumber messages in newline-delimited JSON',\n // legacy class-based formatters\n json: JsonFormatter.documentation,\n progress: ProgressFormatter.documentation,\n 'progress-bar': ProgressBarFormatter.documentation,\n rerun: RerunFormatter.documentation,\n snippets: SnippetsFormatter.documentation,\n summary: SummaryFormatter.documentation,\n usage: UsageFormatter.documentation,\n 'usage-json': UsageJsonFormatter.documentation,\n} satisfies Record<keyof typeof builtin, string>\n"]}
@@ -13,8 +13,8 @@ async function createStream(target, onStreamError, cwd, logger) {
13
13
  try {
14
14
  await (0, mkdirp_1.mkdirp)(directory);
15
15
  }
16
- catch (error) {
17
- logger.warn('Failed to ensure directory for formatter target exists');
16
+ catch (e) {
17
+ logger.warn('Failed to ensure directory for formatter target exists', e);
18
18
  }
19
19
  const stream = fs_1.default.createWriteStream(null, {
20
20
  fd: await fs_1.default.open(absoluteTarget, 'w'),
@@ -1 +1 @@
1
- {"version":3,"file":"create_stream.js","sourceRoot":"","sources":["../../src/formatter/create_stream.ts"],"names":[],"mappings":";;;;;AAMA,oCA4BC;AAlCD,0DAA4B;AAE5B,mCAA+B;AAC/B,+CAAsB;AAGf,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,aAAyB,EACzB,GAAW,EACX,MAAe;IAEf,MAAM,cAAc,GAAG,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAChD,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IAE9C,IAAI,CAAC;QACH,MAAM,IAAA,eAAM,EAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;IACvE,CAAC;IAED,MAAM,MAAM,GAAa,YAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE;QAClD,EAAE,EAAE,MAAM,YAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3B,aAAa,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC","sourcesContent":["import path from 'node:path'\nimport { Writable } from 'node:stream'\nimport { mkdirp } from 'mkdirp'\nimport fs from 'mz/fs'\nimport { ILogger } from '../environment'\n\nexport async function createStream(\n target: string,\n onStreamError: () => void,\n cwd: string,\n logger: ILogger\n) {\n const absoluteTarget = path.resolve(cwd, target)\n const directory = path.dirname(absoluteTarget)\n\n try {\n await mkdirp(directory)\n } catch (error) {\n logger.warn('Failed to ensure directory for formatter target exists')\n }\n\n const stream: Writable = fs.createWriteStream(null, {\n fd: await fs.open(absoluteTarget, 'w'),\n })\n\n stream.on('error', (error: Error) => {\n logger.error(error.message)\n onStreamError()\n })\n\n return {\n directory,\n stream,\n }\n}\n"]}
1
+ {"version":3,"file":"create_stream.js","sourceRoot":"","sources":["../../src/formatter/create_stream.ts"],"names":[],"mappings":";;;;;AAMA,oCA4BC;AAlCD,0DAA4B;AAE5B,mCAA+B;AAC/B,+CAAsB;AAGf,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,aAAyB,EACzB,GAAW,EACX,MAAe;IAEf,MAAM,cAAc,GAAG,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAChD,MAAM,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;IAE9C,IAAI,CAAC;QACH,MAAM,IAAA,eAAM,EAAC,SAAS,CAAC,CAAA;IACzB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,CAAC,wDAAwD,EAAE,CAAC,CAAC,CAAA;IAC1E,CAAC;IAED,MAAM,MAAM,GAAa,YAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE;QAClD,EAAE,EAAE,MAAM,YAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC;KACvC,CAAC,CAAA;IAEF,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC3B,aAAa,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,SAAS;QACT,MAAM;KACP,CAAA;AACH,CAAC","sourcesContent":["import path from 'node:path'\nimport { Writable } from 'node:stream'\nimport { mkdirp } from 'mkdirp'\nimport fs from 'mz/fs'\nimport { ILogger } from '../environment'\n\nexport async function createStream(\n target: string,\n onStreamError: () => void,\n cwd: string,\n logger: ILogger\n) {\n const absoluteTarget = path.resolve(cwd, target)\n const directory = path.dirname(absoluteTarget)\n\n try {\n await mkdirp(directory)\n } catch (e) {\n logger.warn('Failed to ensure directory for formatter target exists', e)\n }\n\n const stream: Writable = fs.createWriteStream(null, {\n fd: await fs.open(absoluteTarget, 'w'),\n })\n\n stream.on('error', (error: Error) => {\n logger.error(error.message)\n onStreamError()\n })\n\n return {\n directory,\n stream,\n }\n}\n"]}
@@ -6,7 +6,7 @@ export declare class PluginManager {
6
6
  private cleanupFns;
7
7
  constructor(environment: UsableEnvironment);
8
8
  private register;
9
- initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType, write: (buffer: string | Uint8Array) => void, directory?: string): Promise<void>;
9
+ initFormatter<OptionsType>(plugin: FormatterPlugin<OptionsType>, options: OptionsType, stream: NodeJS.WritableStream, write: (buffer: string | Uint8Array) => void, directory?: string): Promise<void>;
10
10
  initCoordinator<OptionsType>(operation: Operation, plugin: InternalPlugin<OptionsType>, options: OptionsType): Promise<void>;
11
11
  emit<K extends CoordinatorPluginEventKey>(event: K, value: CoordinatorPluginEventValues[K]): void;
12
12
  transform<K extends CoordinatorPluginTransformEventKey>(event: K, value: CoordinatorPluginEventValues[K]): Promise<CoordinatorPluginEventValues[K]>;
@@ -16,13 +16,14 @@ class PluginManager {
16
16
  async register(event, handler) {
17
17
  this.handlers[event]?.push(handler);
18
18
  }
19
- async initFormatter(plugin, options, write, directory) {
19
+ async initFormatter(plugin, options, stream, write, directory) {
20
20
  const cleanupFn = await plugin.formatter({
21
21
  on: (key, handler) => this.register(key, handler),
22
22
  options: plugin.optionsKey
23
23
  ? (options[plugin.optionsKey] ?? {})
24
24
  : options,
25
25
  logger: this.environment.logger,
26
+ stream,
26
27
  write,
27
28
  directory,
28
29
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin_manager.js","sourceRoot":"","sources":["../../src/plugin/plugin_manager.ts"],"names":[],"mappings":";;;AAgBA,MAAa,aAAa;IASK;IARrB,QAAQ,GAAoB;QAClC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;KACpB,CAAA;IACO,UAAU,GAAoB,EAAE,CAAA;IAExC,YAA6B,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,QAAQ,CACpB,KAAQ,EACR,OAAyC;QAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAoC,EACpC,OAAoB,EACpB,KAA4C,EAC5C,SAAkB;QAElB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC;YACvC,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AC;IAED,KAAK,CAAC,SAAS,CACb,KAAQ,EACR,KAAsC;QAEtC,IAAI,WAAW,GAAG,KAAK,CAAA;QACvB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;YAC3C,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;gBACpC,WAAW,GAAG,QAAQ,CAAA;YACxB,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,SAAS,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;CACF;AArFD,sCAqFC","sourcesContent":["import { UsableEnvironment } from '../environment'\nimport {\n CoordinatorPluginEventHandler,\n InternalPlugin,\n PluginCleanup,\n CoordinatorPluginEventValues,\n CoordinatorPluginEventKey,\n CoordinatorPluginTransformEventKey,\n Operation,\n FormatterPlugin,\n} from './types'\n\ntype HandlerRegistry = {\n [K in CoordinatorPluginEventKey]: Array<CoordinatorPluginEventHandler<K>>\n}\n\nexport class PluginManager {\n private handlers: HandlerRegistry = {\n message: [],\n 'paths:resolve': [],\n 'pickles:filter': [],\n 'pickles:order': [],\n }\n private cleanupFns: PluginCleanup[] = []\n\n constructor(private readonly environment: UsableEnvironment) {}\n\n private async register<K extends CoordinatorPluginEventKey>(\n event: K,\n handler: CoordinatorPluginEventHandler<K>\n ) {\n this.handlers[event]?.push(handler)\n }\n\n async initFormatter<OptionsType>(\n plugin: FormatterPlugin<OptionsType>,\n options: OptionsType,\n write: (buffer: string | Uint8Array) => void,\n directory?: string\n ) {\n const cleanupFn = await plugin.formatter({\n on: (key, handler) => this.register(key, handler),\n options: plugin.optionsKey\n ? ((options as any)[plugin.optionsKey] ?? ({} as OptionsType))\n : options,\n logger: this.environment.logger,\n write,\n directory,\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n async initCoordinator<OptionsType>(\n operation: Operation,\n plugin: InternalPlugin<OptionsType>,\n options: OptionsType\n ) {\n const cleanupFn = await plugin.coordinator({\n operation,\n on: this.register.bind(this),\n options,\n logger: this.environment.logger,\n environment: {\n cwd: this.environment.cwd,\n stderr: this.environment.stderr,\n env: { ...this.environment.env },\n },\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n emit<K extends CoordinatorPluginEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): void {\n this.handlers[event].forEach((handler) => handler(value))\n }\n\n async transform<K extends CoordinatorPluginTransformEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): Promise<CoordinatorPluginEventValues[K]> {\n let transformed = value\n for (const handler of this.handlers[event]) {\n const returned = await handler(transformed)\n if (typeof returned !== 'undefined') {\n transformed = returned\n }\n }\n return transformed\n }\n\n async cleanup(): Promise<void> {\n for (const cleanupFn of this.cleanupFns) {\n await cleanupFn()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"plugin_manager.js","sourceRoot":"","sources":["../../src/plugin/plugin_manager.ts"],"names":[],"mappings":";;;AAgBA,MAAa,aAAa;IASK;IARrB,QAAQ,GAAoB;QAClC,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;KACpB,CAAA;IACO,UAAU,GAAoB,EAAE,CAAA;IAExC,YAA6B,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;IAAG,CAAC;IAEvD,KAAK,CAAC,QAAQ,CACpB,KAAQ,EACR,OAAyC;QAEzC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CACjB,MAAoC,EACpC,OAA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AQ,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,SAAS,CACb,KAAQ,EACR,KAAsC;QAEtC,IAAI,WAAW,GAAG,KAAK,CAAA;QACvB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;YAC3C,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;gBACpC,WAAW,GAAG,QAAQ,CAAA;YACxB,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,OAAO;QACX,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,SAAS,EAAE,CAAA;QACnB,CAAC;IACH,CAAC;CACF;AAvFD,sCAuFC","sourcesContent":["import { UsableEnvironment } from '../environment'\nimport {\n CoordinatorPluginEventHandler,\n InternalPlugin,\n PluginCleanup,\n CoordinatorPluginEventValues,\n CoordinatorPluginEventKey,\n CoordinatorPluginTransformEventKey,\n Operation,\n FormatterPlugin,\n} from './types'\n\ntype HandlerRegistry = {\n [K in CoordinatorPluginEventKey]: Array<CoordinatorPluginEventHandler<K>>\n}\n\nexport class PluginManager {\n private handlers: HandlerRegistry = {\n message: [],\n 'paths:resolve': [],\n 'pickles:filter': [],\n 'pickles:order': [],\n }\n private cleanupFns: PluginCleanup[] = []\n\n constructor(private readonly environment: UsableEnvironment) {}\n\n private async register<K extends CoordinatorPluginEventKey>(\n event: K,\n handler: CoordinatorPluginEventHandler<K>\n ) {\n this.handlers[event]?.push(handler)\n }\n\n async initFormatter<OptionsType>(\n plugin: FormatterPlugin<OptionsType>,\n options: OptionsType,\n stream: NodeJS.WritableStream,\n write: (buffer: string | Uint8Array) => void,\n directory?: string\n ) {\n const cleanupFn = await plugin.formatter({\n on: (key, handler) => this.register(key, handler),\n options: plugin.optionsKey\n ? ((options as any)[plugin.optionsKey] ?? ({} as OptionsType))\n : options,\n logger: this.environment.logger,\n stream,\n write,\n directory,\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n async initCoordinator<OptionsType>(\n operation: Operation,\n plugin: InternalPlugin<OptionsType>,\n options: OptionsType\n ) {\n const cleanupFn = await plugin.coordinator({\n operation,\n on: this.register.bind(this),\n options,\n logger: this.environment.logger,\n environment: {\n cwd: this.environment.cwd,\n stderr: this.environment.stderr,\n env: { ...this.environment.env },\n },\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push(cleanupFn)\n }\n }\n\n emit<K extends CoordinatorPluginEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): void {\n this.handlers[event].forEach((handler) => handler(value))\n }\n\n async transform<K extends CoordinatorPluginTransformEventKey>(\n event: K,\n value: CoordinatorPluginEventValues[K]\n ): Promise<CoordinatorPluginEventValues[K]> {\n let transformed = value\n for (const handler of this.handlers[event]) {\n const returned = await handler(transformed)\n if (typeof returned !== 'undefined') {\n transformed = returned\n }\n }\n return transformed\n }\n\n async cleanup(): Promise<void> {\n for (const cleanupFn of this.cleanupFns) {\n await cleanupFn()\n }\n }\n}\n"]}
@@ -41,6 +41,7 @@ export interface FormatterPluginContext<OptionsType> {
41
41
  on: (key: 'message', handler: (value: Envelope) => void) => void;
42
42
  options: OptionsType;
43
43
  logger: ILogger;
44
+ stream: NodeJS.WritableStream;
44
45
  write: (buffer: string | Uint8Array) => void;
45
46
  directory?: string;
46
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Envelope } from '@cucumber/messages'\nimport { ArrayValues, Promisable } from 'type-fest'\nimport { IRunEnvironment } from '../environment'\nimport { ILogger } from '../environment'\nimport { IFilterablePickle } from '../filter'\nimport { IResolvedPaths } from '../paths'\nimport { coordinatorTransformKeys, coordinatorVoidKeys } from './events'\n\nexport type Operation = 'loadSources' | 'loadSupport' | 'runCucumber'\n\nexport type CoordinatorPluginEnvironment = Required<\n Pick<IRunEnvironment, 'cwd' | 'stderr' | 'env'>\n>\n\nexport type CoordinatorPluginVoidEventKey = ArrayValues<\n typeof coordinatorVoidKeys\n>\nexport type CoordinatorPluginTransformEventKey = ArrayValues<\n typeof coordinatorTransformKeys\n>\nexport type CoordinatorPluginEventKey =\n | CoordinatorPluginVoidEventKey\n | CoordinatorPluginTransformEventKey\n\nexport type CoordinatorPluginEventValues = {\n // void\n message: Readonly<Envelope>\n 'paths:resolve': Readonly<IResolvedPaths>\n // transform\n 'pickles:filter': Readonly<Array<IFilterablePickle>>\n 'pickles:order': Readonly<Array<IFilterablePickle>>\n}\n\nexport type CoordinatorPluginEventHandler<K extends CoordinatorPluginEventKey> =\n (\n value: CoordinatorPluginEventValues[K]\n ) => K extends CoordinatorPluginTransformEventKey\n ? Promisable<CoordinatorPluginEventValues[K]>\n : void\n\nexport interface CoordinatorPluginContext<OptionsType> {\n operation: Operation\n on: <EventKey extends CoordinatorPluginEventKey>(\n event: EventKey,\n handler: CoordinatorPluginEventHandler<EventKey>\n ) => void\n options: OptionsType\n logger: ILogger\n environment: CoordinatorPluginEnvironment\n}\n\nexport type CoordinatorPluginFunction<OptionsType> = (\n context: CoordinatorPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport type PluginCleanup = () => Promisable<void>\n\n/**\n * A plugin to implement Cucumber built-in functionality.\n *\n * Uses the same events and mechanisms as user-authored plugins, but is free to require configuration and context from\n * inside of Cucumber as its `options`, whereas user-authored plugins will be limited to `pluginOptions` from the\n * project configuration.\n */\nexport interface InternalPlugin<OptionsType = any> {\n type: 'plugin'\n coordinator: CoordinatorPluginFunction<OptionsType>\n}\n\nexport interface FormatterPluginContext<OptionsType> {\n on: (key: 'message', handler: (value: Envelope) => void) => void\n options: OptionsType\n logger: ILogger\n write: (buffer: string | Uint8Array) => void\n directory?: string\n}\n\nexport type FormatterPluginFunction<OptionsType> = (\n context: FormatterPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport interface FormatterPlugin<OptionsType = any> {\n type: 'formatter'\n formatter: FormatterPluginFunction<OptionsType>\n optionsKey?: string\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Envelope } from '@cucumber/messages'\nimport { ArrayValues, Promisable } from 'type-fest'\nimport { IRunEnvironment } from '../environment'\nimport { ILogger } from '../environment'\nimport { IFilterablePickle } from '../filter'\nimport { IResolvedPaths } from '../paths'\nimport { coordinatorTransformKeys, coordinatorVoidKeys } from './events'\n\nexport type Operation = 'loadSources' | 'loadSupport' | 'runCucumber'\n\nexport type CoordinatorPluginEnvironment = Required<\n Pick<IRunEnvironment, 'cwd' | 'stderr' | 'env'>\n>\n\nexport type CoordinatorPluginVoidEventKey = ArrayValues<\n typeof coordinatorVoidKeys\n>\nexport type CoordinatorPluginTransformEventKey = ArrayValues<\n typeof coordinatorTransformKeys\n>\nexport type CoordinatorPluginEventKey =\n | CoordinatorPluginVoidEventKey\n | CoordinatorPluginTransformEventKey\n\nexport type CoordinatorPluginEventValues = {\n // void\n message: Readonly<Envelope>\n 'paths:resolve': Readonly<IResolvedPaths>\n // transform\n 'pickles:filter': Readonly<Array<IFilterablePickle>>\n 'pickles:order': Readonly<Array<IFilterablePickle>>\n}\n\nexport type CoordinatorPluginEventHandler<K extends CoordinatorPluginEventKey> =\n (\n value: CoordinatorPluginEventValues[K]\n ) => K extends CoordinatorPluginTransformEventKey\n ? Promisable<CoordinatorPluginEventValues[K]>\n : void\n\nexport interface CoordinatorPluginContext<OptionsType> {\n operation: Operation\n on: <EventKey extends CoordinatorPluginEventKey>(\n event: EventKey,\n handler: CoordinatorPluginEventHandler<EventKey>\n ) => void\n options: OptionsType\n logger: ILogger\n environment: CoordinatorPluginEnvironment\n}\n\nexport type CoordinatorPluginFunction<OptionsType> = (\n context: CoordinatorPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport type PluginCleanup = () => Promisable<void>\n\n/**\n * A plugin to implement Cucumber built-in functionality.\n *\n * Uses the same events and mechanisms as user-authored plugins, but is free to require configuration and context from\n * inside of Cucumber as its `options`, whereas user-authored plugins will be limited to `pluginOptions` from the\n * project configuration.\n */\nexport interface InternalPlugin<OptionsType = any> {\n type: 'plugin'\n coordinator: CoordinatorPluginFunction<OptionsType>\n}\n\nexport interface FormatterPluginContext<OptionsType> {\n on: (key: 'message', handler: (value: Envelope) => void) => void\n options: OptionsType\n logger: ILogger\n stream: NodeJS.WritableStream\n write: (buffer: string | Uint8Array) => void\n directory?: string\n}\n\nexport type FormatterPluginFunction<OptionsType> = (\n context: FormatterPluginContext<OptionsType>\n) => Promisable<PluginCleanup | void>\n\nexport interface FormatterPlugin<OptionsType = any> {\n type: 'formatter'\n formatter: FormatterPluginFunction<OptionsType>\n optionsKey?: string\n}\n"]}
@@ -9,7 +9,11 @@ export interface IRunOptions {
9
9
  stepDefinition: IDefinition;
10
10
  world: any;
11
11
  }
12
- export declare function run({ defaultTimeout, filterStackTraces, hookParameter, step, stepDefinition, world, }: IRunOptions): Promise<messages.TestStepResult>;
12
+ export interface RunStepResult {
13
+ result: messages.TestStepResult;
14
+ error?: any;
15
+ }
16
+ export declare function run({ defaultTimeout, filterStackTraces, hookParameter, step, stepDefinition, world, }: IRunOptions): Promise<RunStepResult>;
13
17
  declare const _default: {
14
18
  run: typeof run;
15
19
  };
@@ -93,9 +93,12 @@ async function run({ defaultTimeout, filterStackTraces, hookParameter, step, ste
93
93
  details = (0, format_error_1.formatError)(error, filterStackTraces);
94
94
  }
95
95
  return {
96
- duration,
97
- status,
98
- ...details,
96
+ result: {
97
+ duration,
98
+ status,
99
+ ...details,
100
+ },
101
+ error,
99
102
  };
100
103
  }
101
104
  exports.default = { run };
@@ -1 +1 @@
1
- {"version":3,"file":"step_runner.js","sourceRoot":"","sources":["../../src/runtime/step_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,kBAmEC;AAzFD,6DAA8C;AAC9C,2EAAgD;AAGhD,oDAIyB;AACzB,mCAA4C;AAC5C,2CAAoC;AACpC,iDAA4C;AAWrC,KAAK,UAAU,GAAG,CAAC,EACxB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,cAAc,EACd,KAAK,GACO;IACZ,MAAM,SAAS,GAAG,IAAA,kBAAM,GAAE,CAAC,KAAK,EAAE,CAAA;IAClC,IAAI,KAAU,EAAE,MAAW,EAAE,cAA0C,CAAA;IAEvE,IAAI,CAAC;QACH,MAAM,IAAA,0BAAkB,EAAC,EAAE,KAAK,EAAE,EAAE,KAAK,IAAI,EAAE;YAC7C,cAAc,GAAG,MAAM,cAAc,CAAC,uBAAuB,CAAC;gBAC5D,aAAa;gBACb,IAAI;gBACJ,KAAK;aACN,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,KAAK,GAAG,GAAG,CAAA;IACb,CAAC;IAED,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,qBAAqB,GAAG,IAAA,8BAAc,EAC1C,cAAc,CAAC,OAAO,CAAC,OAAO,EAC9B,cAAc,CACf,CAAA;QAED,IAAI,cAAc,CAAC,gBAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACzE,MAAM,IAAI,GAAG,MAAM,IAAA,0BAAkB,EAAC,EAAE,KAAK,EAAE,EAAE,KAAK,IAAI,EAAE,CAC1D,0BAAc,CAAC,GAAG,CAAC;gBACjB,SAAS,EAAE,cAAc,CAAC,UAAU;gBACpC,EAAE,EAAE,cAAc,CAAC,IAAI;gBACvB,OAAO,EAAE,KAAK;gBACd,qBAAqB;aACtB,CAAC,CACH,CAAA;YACD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;YAClB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACtB,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAA;QACtD,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC5C,IAAI,MAAqC,CAAA;IACzC,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;IAChD,CAAC;SAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;IAChD,CAAC;SAAM,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;IAC/C,CAAC;IAED,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,IAAA,0BAAW,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;IACjD,CAAC;IAED,OAAO;QACL,QAAQ;QACR,MAAM;QACN,GAAG,OAAO;KACX,CAAA;AACH,CAAC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import * as messages from '@cucumber/messages'\nimport UserCodeRunner from '../user_code_runner'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { IDefinition, IGetInvocationDataResponse } from '../models/definition'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport { runInTestCaseScope } from './scope'\nimport { create } from './stopwatch'\nimport { formatError } from './format_error'\n\nexport interface IRunOptions {\n defaultTimeout: number\n filterStackTraces: boolean\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n stepDefinition: IDefinition\n world: any\n}\n\nexport async function run({\n defaultTimeout,\n filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<messages.TestStepResult> {\n const stopwatch = create().start()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n await runInTestCaseScope({ world }, async () => {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\n })\n } catch (err) {\n error = err\n }\n\n if (doesNotHaveValue(error)) {\n const timeoutInMilliseconds = valueOrDefault(\n stepDefinition.options.timeout,\n defaultTimeout\n )\n\n if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {\n const data = await runInTestCaseScope({ world }, async () =>\n UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\n )\n error = data.error\n result = data.result\n } else {\n error = invocationData.getInvalidCodeLengthMessage()\n }\n }\n\n const duration = stopwatch.stop().duration()\n let status: messages.TestStepResultStatus\n let details = {}\n if (result === 'skipped') {\n status = messages.TestStepResultStatus.SKIPPED\n } else if (result === 'pending') {\n status = messages.TestStepResultStatus.PENDING\n } else if (doesHaveValue(error)) {\n status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n if (doesHaveValue(error)) {\n details = formatError(error, filterStackTraces)\n }\n\n return {\n duration,\n status,\n ...details,\n }\n}\n\nexport default { run }\n"]}
1
+ {"version":3,"file":"step_runner.js","sourceRoot":"","sources":["../../src/runtime/step_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,kBAsEC;AAjGD,6DAA8C;AAC9C,2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AK,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAA;QACtD,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC5C,IAAI,MAAqC,CAAA;IACzC,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;IAChD,CAAC;SAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;IAChD,CAAC;SAAM,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;IAC/C,CAAC;IAED,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,IAAA,0BAAW,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;IACjD,CAAC;IAED,OAAO;QACL,MAAM,EAAE;YACN,QAAQ;YACR,MAAM;YACN,GAAG,OAAO;SACX;QACD,KAAK;KACN,CAAA;AACH,CAAC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import * as messages from '@cucumber/messages'\nimport UserCodeRunner from '../user_code_runner'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { IDefinition, IGetInvocationDataResponse } from '../models/definition'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport { runInTestCaseScope } from './scope'\nimport { create } from './stopwatch'\nimport { formatError } from './format_error'\n\nexport interface IRunOptions {\n defaultTimeout: number\n filterStackTraces: boolean\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n stepDefinition: IDefinition\n world: any\n}\n\nexport interface RunStepResult {\n result: messages.TestStepResult\n error?: any\n}\n\nexport async function run({\n defaultTimeout,\n filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<RunStepResult> {\n const stopwatch = create().start()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n await runInTestCaseScope({ world }, async () => {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\n })\n } catch (err) {\n error = err\n }\n\n if (doesNotHaveValue(error)) {\n const timeoutInMilliseconds = valueOrDefault(\n stepDefinition.options.timeout,\n defaultTimeout\n )\n\n if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {\n const data = await runInTestCaseScope({ world }, async () =>\n UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\n )\n error = data.error\n result = data.result\n } else {\n error = invocationData.getInvalidCodeLengthMessage()\n }\n }\n\n const duration = stopwatch.stop().duration()\n let status: messages.TestStepResultStatus\n let details = {}\n if (result === 'skipped') {\n status = messages.TestStepResultStatus.SKIPPED\n } else if (result === 'pending') {\n status = messages.TestStepResultStatus.PENDING\n } else if (doesHaveValue(error)) {\n status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n if (doesHaveValue(error)) {\n details = formatError(error, filterStackTraces)\n }\n\n return {\n result: {\n duration,\n status,\n ...details,\n },\n error,\n }\n}\n\nexport default { run }\n"]}
@@ -6,6 +6,7 @@ import { ITestCaseHookParameter, SupportCodeLibrary } from '../support_code_libr
6
6
  import TestCaseHookDefinition from '../models/test_case_hook_definition';
7
7
  import TestStepHookDefinition from '../models/test_step_hook_definition';
8
8
  import { IDefinition } from '../models/definition';
9
+ import { RunStepResult } from './step_runner';
9
10
  export interface INewTestCaseRunnerOptions {
10
11
  workerId?: string;
11
12
  eventBroadcaster: EventEmitter;
@@ -41,13 +42,13 @@ export default class TestCaseRunner {
41
42
  getBeforeStepHookDefinitions(): TestStepHookDefinition[];
42
43
  getAfterStepHookDefinitions(): TestStepHookDefinition[];
43
44
  getWorstStepResult(): messages.TestStepResult;
44
- invokeStep(step: messages.PickleStep, stepDefinition: IDefinition, hookParameter?: ITestCaseHookParameter): Promise<messages.TestStepResult>;
45
+ invokeStep(step: messages.PickleStep, stepDefinition: IDefinition, hookParameter?: ITestCaseHookParameter): Promise<RunStepResult>;
45
46
  isSkippingSteps(): boolean;
46
47
  shouldSkipHook(isBeforeHook: boolean): boolean;
47
48
  aroundTestStep(testStepId: string, runStepFn: () => Promise<messages.TestStepResult>): Promise<void>;
48
49
  run(): Promise<messages.TestStepResultStatus>;
49
50
  runAttempt(attempt: number, moreAttemptsRemaining: boolean): Promise<boolean>;
50
51
  runHook(hookDefinition: TestCaseHookDefinition, hookParameter: ITestCaseHookParameter, isBeforeHook: boolean): Promise<messages.TestStepResult>;
51
- runStepHooks(stepHooks: TestStepHookDefinition[], pickleStep: messages.PickleStep, stepResult?: messages.TestStepResult): Promise<messages.TestStepResult[]>;
52
- runStep(pickleStep: messages.PickleStep, testStep: messages.TestStep): Promise<messages.TestStepResult>;
52
+ runStepHooks(stepHooks: TestStepHookDefinition[], pickleStep: messages.PickleStep, stepResult?: RunStepResult): Promise<messages.TestStepResult[]>;
53
+ runStep(pickleStep: messages.PickleStep, testStep: messages.TestStep): Promise<RunStepResult>;
53
54
  }
@@ -185,6 +185,7 @@ class TestCaseRunner {
185
185
  this.eventBroadcaster.emit('envelope', testCaseStarted);
186
186
  // used to determine whether a hook is a Before or After
187
187
  let didWeRunStepsYet = false;
188
+ let error = false;
188
189
  for (const testStep of this.testCase.testSteps) {
189
190
  await this.aroundTestStep(testStep.id, async () => {
190
191
  if ((0, value_checker_1.doesHaveValue)(testStep.hookId)) {
@@ -195,6 +196,7 @@ class TestCaseRunner {
195
196
  };
196
197
  if (didWeRunStepsYet) {
197
198
  hookParameter.result = this.getWorstStepResult();
199
+ hookParameter.error = error;
198
200
  hookParameter.willBeRetried =
199
201
  this.getWorstStepResult().status ===
200
202
  messages.TestStepResultStatus.FAILED && moreAttemptsRemaining;
@@ -205,7 +207,8 @@ class TestCaseRunner {
205
207
  const pickleStep = this.pickle.steps.find((pickleStep) => pickleStep.id === testStep.pickleStepId);
206
208
  const testStepResult = await this.runStep(pickleStep, testStep);
207
209
  didWeRunStepsYet = true;
208
- return testStepResult;
210
+ error = testStepResult.error;
211
+ return testStepResult.result;
209
212
  }
210
213
  });
211
214
  }
@@ -228,7 +231,8 @@ class TestCaseRunner {
228
231
  duration: messages.TimeConversion.millisecondsToDuration(0),
229
232
  };
230
233
  }
231
- return await this.invokeStep(null, hookDefinition, hookParameter);
234
+ const { result } = await this.invokeStep(null, hookDefinition, hookParameter);
235
+ return result;
232
236
  }
233
237
  async runStepHooks(stepHooks, pickleStep, stepResult) {
234
238
  const stepHooksResult = [];
@@ -238,10 +242,12 @@ class TestCaseRunner {
238
242
  pickleStep,
239
243
  testCaseStartedId: this.currentTestCaseStartedId,
240
244
  testStepId: this.currentTestStepId,
241
- result: stepResult,
245
+ result: stepResult?.result,
246
+ error: stepResult?.error,
242
247
  };
243
248
  for (const stepHookDefinition of stepHooks) {
244
- stepHooksResult.push(await this.invokeStep(null, stepHookDefinition, hookParameter));
249
+ const { result } = await this.invokeStep(null, stepHookDefinition, hookParameter);
250
+ stepHooksResult.push(result);
245
251
  }
246
252
  return stepHooksResult;
247
253
  }
@@ -251,29 +257,37 @@ class TestCaseRunner {
251
257
  });
252
258
  if (stepDefinitions.length === 0) {
253
259
  return {
254
- status: messages.TestStepResultStatus.UNDEFINED,
255
- duration: messages.TimeConversion.millisecondsToDuration(0),
260
+ result: {
261
+ status: messages.TestStepResultStatus.UNDEFINED,
262
+ duration: messages.TimeConversion.millisecondsToDuration(0),
263
+ },
256
264
  };
257
265
  }
258
266
  else if (stepDefinitions.length > 1) {
259
267
  return {
260
- message: (0, helpers_1.getAmbiguousStepException)(stepDefinitions),
261
- status: messages.TestStepResultStatus.AMBIGUOUS,
262
- duration: messages.TimeConversion.millisecondsToDuration(0),
268
+ result: {
269
+ message: (0, helpers_1.getAmbiguousStepException)(stepDefinitions),
270
+ status: messages.TestStepResultStatus.AMBIGUOUS,
271
+ duration: messages.TimeConversion.millisecondsToDuration(0),
272
+ },
263
273
  };
264
274
  }
265
275
  else if (this.isSkippingSteps()) {
266
276
  return {
267
- status: messages.TestStepResultStatus.SKIPPED,
268
- duration: messages.TimeConversion.millisecondsToDuration(0),
277
+ result: {
278
+ status: messages.TestStepResultStatus.SKIPPED,
279
+ duration: messages.TimeConversion.millisecondsToDuration(0),
280
+ },
269
281
  };
270
282
  }
271
283
  let stepResult;
284
+ let error;
272
285
  let stepResults = await this.runStepHooks(this.getBeforeStepHookDefinitions(), pickleStep);
273
286
  if ((0, messages_1.getWorstTestStepResult)(stepResults).status !==
274
287
  messages.TestStepResultStatus.FAILED) {
275
288
  stepResult = await this.invokeStep(pickleStep, stepDefinitions[0]);
276
- stepResults.push(stepResult);
289
+ stepResults.push(stepResult.result);
290
+ error = stepResult.error;
277
291
  }
278
292
  const afterStepHookResults = await this.runStepHooks(this.getAfterStepHookDefinitions(), pickleStep, stepResult);
279
293
  stepResults = stepResults.concat(afterStepHookResults);
@@ -283,7 +297,10 @@ class TestCaseRunner {
283
297
  finalDuration = messages.TimeConversion.addDurations(finalDuration, result.duration);
284
298
  }
285
299
  finalStepResult.duration = finalDuration;
286
- return finalStepResult;
300
+ return {
301
+ result: finalStepResult,
302
+ error,
303
+ };
287
304
  }
288
305
  }
289
306
  exports.default = TestCaseRunner;
@@ -1 +1 @@
1
- {"version":3,"file":"test_case_runner.js","sourceRoot":"","sources":["../../src/runtime/test_case_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA8C;AAC9C,iDAAwE;AAUxE,oDAAkE;AAGlE,2CAAuC;AACvC,gEAAsC;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kB,CAAC,4BAA4B;KACnD,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AAC9C,CAAC;AAED,SAAS,kBAAkB,CACzB,EAAU,EACV,kBAAsC;IAEtC,OAAO,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAC5C,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CACrC,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport * as messages from '@cucumber/messages'\nimport { getWorstTestStepResult, IdGenerator } from '@cucumber/messages'\nimport { JsonObject } from 'type-fest'\nimport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n SupportCodeLibrary,\n} from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestStepHookDefinition from '../models/test_step_hook_definition'\nimport { IDefinition } from '../models/definition'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport StepDefinition from '../models/step_definition'\nimport { IWorldOptions } from '../support_code_library_builder/world'\nimport { timestamp } from './stopwatch'\nimport StepRunner from './step_runner'\nimport AttachmentManager from './attachment_manager'\nimport { getAmbiguousStepException } from './helpers'\n\nexport interface INewTestCaseRunnerOptions {\n workerId?: string\n eventBroadcaster: EventEmitter\n gherkinDocument: messages.GherkinDocument\n newId: IdGenerator.NewId\n pickle: messages.Pickle\n testCase: messages.TestCase\n retries: number\n skip: boolean\n filterStackTraces: boolean\n supportCodeLibrary: SupportCodeLibrary\n worldParameters: JsonObject\n}\n\nexport default class TestCaseRunner {\n private readonly workerId: string | undefined\n private readonly attachmentManager: AttachmentManager\n private currentTestCaseStartedId: string\n private currentTestStepId: string\n private readonly eventBroadcaster: EventEmitter\n private readonly gherkinDocument: messages.GherkinDocument\n private readonly newId: IdGenerator.NewId\n private readonly pickle: messages.Pickle\n private readonly testCase: messages.TestCase\n private readonly maxAttempts: number\n private readonly skip: boolean\n private readonly filterStackTraces: boolean\n private readonly supportCodeLibrary: SupportCodeLibrary\n private testStepResults: messages.TestStepResult[]\n private world: any\n private readonly worldParameters: JsonObject\n\n constructor({\n workerId,\n eventBroadcaster,\n gherkinDocument,\n newId,\n pickle,\n testCase,\n retries = 0,\n skip,\n filterStackTraces,\n supportCodeLibrary,\n worldParameters,\n }: INewTestCaseRunnerOptions) {\n this.workerId = workerId\n this.attachmentManager = new AttachmentManager(\n ({ data, media, fileName }) => {\n if (doesNotHaveValue(this.currentTestStepId)) {\n throw new Error(\n 'Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.'\n )\n }\n const attachment: messages.Envelope = {\n attachment: {\n body: data,\n contentEncoding: media.encoding,\n mediaType: media.contentType,\n fileName,\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId: this.currentTestStepId,\n },\n }\n this.eventBroadcaster.emit('envelope', attachment)\n }\n )\n this.eventBroadcaster = eventBroadcaster\n this.gherkinDocument = gherkinDocument\n this.maxAttempts = 1 + (skip ? 0 : retries)\n this.newId = newId\n this.pickle = pickle\n this.testCase = testCase\n this.skip = skip\n this.filterStackTraces = filterStackTraces\n this.supportCodeLibrary = supportCodeLibrary\n this.worldParameters = worldParameters\n this.resetTestProgressData()\n }\n\n resetTestProgressData(): void {\n this.world = new this.supportCodeLibrary.World({\n attach: this.attachmentManager.create.bind(this.attachmentManager),\n log: this.attachmentManager.log.bind(this.attachmentManager),\n link: this.attachmentManager.link.bind(this.attachmentManager),\n parameters: structuredClone(this.worldParameters),\n } satisfies IWorldOptions)\n this.testStepResults = []\n }\n\n getBeforeStepHookDefinitions(): TestStepHookDefinition[] {\n return this.supportCodeLibrary.beforeTestStepHookDefinitions.filter(\n (hookDefinition) => hookDefinition.appliesToTestCase(this.pickle)\n )\n }\n\n getAfterStepHookDefinitions(): TestStepHookDefinition[] {\n return this.supportCodeLibrary.afterTestStepHookDefinitions\n .slice(0)\n .reverse()\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(this.pickle))\n }\n\n getWorstStepResult(): messages.TestStepResult {\n if (this.testStepResults.length === 0) {\n return {\n status: this.skip\n ? messages.TestStepResultStatus.SKIPPED\n : messages.TestStepResultStatus.PASSED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n return getWorstTestStepResult(this.testStepResults)\n }\n\n async invokeStep(\n step: messages.PickleStep,\n stepDefinition: IDefinition,\n hookParameter?: ITestCaseHookParameter\n ): Promise<messages.TestStepResult> {\n return await StepRunner.run({\n defaultTimeout: this.supportCodeLibrary.defaultTimeout,\n filterStackTraces: this.filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world: this.world,\n })\n }\n\n isSkippingSteps(): boolean {\n return (\n this.getWorstStepResult().status !== messages.TestStepResultStatus.PASSED\n )\n }\n\n shouldSkipHook(isBeforeHook: boolean): boolean {\n return this.skip || (this.isSkippingSteps() && isBeforeHook)\n }\n\n async aroundTestStep(\n testStepId: string,\n runStepFn: () => Promise<messages.TestStepResult>\n ): Promise<void> {\n const testStepStarted: messages.Envelope = {\n testStepStarted: {\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId,\n timestamp: timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testStepStarted)\n this.currentTestStepId = testStepId\n const testStepResult = await runStepFn()\n this.currentTestStepId = null\n this.testStepResults.push(testStepResult)\n const testStepFinished: messages.Envelope = {\n testStepFinished: {\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId,\n testStepResult,\n timestamp: timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testStepFinished)\n }\n\n async run(): Promise<messages.TestStepResultStatus> {\n for (let attempt = 0; attempt < this.maxAttempts; attempt++) {\n const moreAttemptsRemaining = attempt + 1 < this.maxAttempts\n\n const willBeRetried = await this.runAttempt(\n attempt,\n moreAttemptsRemaining\n )\n\n if (!willBeRetried) {\n break\n }\n this.resetTestProgressData()\n }\n return this.getWorstStepResult().status\n }\n\n async runAttempt(\n attempt: number,\n moreAttemptsRemaining: boolean\n ): Promise<boolean> {\n this.currentTestCaseStartedId = this.newId()\n const testCaseStarted: messages.Envelope = {\n testCaseStarted: {\n attempt,\n testCaseId: this.testCase.id,\n id: this.currentTestCaseStartedId,\n timestamp: timestamp(),\n },\n }\n if (this.workerId) {\n testCaseStarted.testCaseStarted.workerId = this.workerId\n }\n this.eventBroadcaster.emit('envelope', testCaseStarted)\n // used to determine whether a hook is a Before or After\n let didWeRunStepsYet = false\n for (const testStep of this.testCase.testSteps) {\n await this.aroundTestStep(testStep.id, async () => {\n if (doesHaveValue(testStep.hookId)) {\n const hookParameter: ITestCaseHookParameter = {\n gherkinDocument: this.gherkinDocument,\n pickle: this.pickle,\n testCaseStartedId: this.currentTestCaseStartedId,\n }\n if (didWeRunStepsYet) {\n hookParameter.result = this.getWorstStepResult()\n hookParameter.willBeRetried =\n this.getWorstStepResult().status ===\n messages.TestStepResultStatus.FAILED && moreAttemptsRemaining\n }\n return await this.runHook(\n findHookDefinition(testStep.hookId, this.supportCodeLibrary),\n hookParameter,\n !didWeRunStepsYet\n )\n } else {\n const pickleStep = this.pickle.steps.find(\n (pickleStep) => pickleStep.id === testStep.pickleStepId\n )\n const testStepResult = await this.runStep(pickleStep, testStep)\n didWeRunStepsYet = true\n return testStepResult\n }\n })\n }\n\n const willBeRetried =\n this.getWorstStepResult().status ===\n messages.TestStepResultStatus.FAILED && moreAttemptsRemaining\n const testCaseFinished: messages.Envelope = {\n testCaseFinished: {\n testCaseStartedId: this.currentTestCaseStartedId,\n timestamp: timestamp(),\n willBeRetried,\n },\n }\n this.eventBroadcaster.emit('envelope', testCaseFinished)\n\n return willBeRetried\n }\n\n async runHook(\n hookDefinition: TestCaseHookDefinition,\n hookParameter: ITestCaseHookParameter,\n isBeforeHook: boolean\n ): Promise<messages.TestStepResult> {\n if (this.shouldSkipHook(isBeforeHook)) {\n return {\n status: messages.TestStepResultStatus.SKIPPED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n return await this.invokeStep(null, hookDefinition, hookParameter)\n }\n\n async runStepHooks(\n stepHooks: TestStepHookDefinition[],\n pickleStep: messages.PickleStep,\n stepResult?: messages.TestStepResult\n ): Promise<messages.TestStepResult[]> {\n const stepHooksResult = []\n const hookParameter: ITestStepHookParameter = {\n gherkinDocument: this.gherkinDocument,\n pickle: this.pickle,\n pickleStep,\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId: this.currentTestStepId,\n result: stepResult,\n }\n for (const stepHookDefinition of stepHooks) {\n stepHooksResult.push(\n await this.invokeStep(null, stepHookDefinition, hookParameter)\n )\n }\n return stepHooksResult\n }\n\n async runStep(\n pickleStep: messages.PickleStep,\n testStep: messages.TestStep\n ): Promise<messages.TestStepResult> {\n const stepDefinitions = testStep.stepDefinitionIds.map(\n (stepDefinitionId) => {\n return findStepDefinition(stepDefinitionId, this.supportCodeLibrary)\n }\n )\n if (stepDefinitions.length === 0) {\n return {\n status: messages.TestStepResultStatus.UNDEFINED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n } else if (stepDefinitions.length > 1) {\n return {\n message: getAmbiguousStepException(stepDefinitions),\n status: messages.TestStepResultStatus.AMBIGUOUS,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n } else if (this.isSkippingSteps()) {\n return {\n status: messages.TestStepResultStatus.SKIPPED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n\n let stepResult\n let stepResults = await this.runStepHooks(\n this.getBeforeStepHookDefinitions(),\n pickleStep\n )\n if (\n getWorstTestStepResult(stepResults).status !==\n messages.TestStepResultStatus.FAILED\n ) {\n stepResult = await this.invokeStep(pickleStep, stepDefinitions[0])\n stepResults.push(stepResult)\n }\n const afterStepHookResults = await this.runStepHooks(\n this.getAfterStepHookDefinitions(),\n pickleStep,\n stepResult\n )\n stepResults = stepResults.concat(afterStepHookResults)\n\n const finalStepResult = getWorstTestStepResult(stepResults)\n let finalDuration = messages.TimeConversion.millisecondsToDuration(0)\n for (const result of stepResults) {\n finalDuration = messages.TimeConversion.addDurations(\n finalDuration,\n result.duration\n )\n }\n finalStepResult.duration = finalDuration\n return finalStepResult\n }\n}\n\nfunction findHookDefinition(\n id: string,\n supportCodeLibrary: SupportCodeLibrary\n): TestCaseHookDefinition {\n return [\n ...supportCodeLibrary.beforeTestCaseHookDefinitions,\n ...supportCodeLibrary.afterTestCaseHookDefinitions,\n ].find((definition) => definition.id === id)\n}\n\nfunction findStepDefinition(\n id: string,\n supportCodeLibrary: SupportCodeLibrary\n): StepDefinition {\n return supportCodeLibrary.stepDefinitions.find(\n (definition) => definition.id === id\n )\n}\n"]}
1
+ {"version":3,"file":"test_case_runner.js","sourceRoot":"","sources":["../../src/runtime/test_case_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA8C;AAC9C,iDAAwE;AAUxE,oDAAkE;AAGlE,2CAAuC;AACvC,gEAAyD;AACzD,8EAAoD;AACpD,uCAAqD;AAgBrD,MAAqB,cAAc;IAChB,QAAQ,CAAoB;IAC5B,iBAAiB,CAAmB;IAC7C,wBAAwB,CAAQ;IAChC,iBAAiB,CAAQ;IAChB,gBAAgB,CAAc;IAC9B,eAAe,CAA0B;IACzC,KAAK,CAAmB;IACxB,MAAM,CAAiB;IACvB,QAAQ,CAAmB;IAC3B,WAAW,CAAQ;IACnB,IAAI,CAAS;IACb,iBAAiB,CAAS;IAC1B,kBAAkB,CAAoB;IAC/C,eAAe,CAA2B;IAC1C,KAAK,CAAK;IACD,eAAe,CAAY;IAE5C,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,IAAI,EACJ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GACW;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,iBAAiB,GAAG,IAAI,4BAAiB,CAC5C,CAAC,EAAE,IAAI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AC,eAAe,CAAC,IAAI,CAC5C,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CACrC,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport * as messages from '@cucumber/messages'\nimport { getWorstTestStepResult, IdGenerator } from '@cucumber/messages'\nimport { JsonObject } from 'type-fest'\nimport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n SupportCodeLibrary,\n} from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestStepHookDefinition from '../models/test_step_hook_definition'\nimport { IDefinition } from '../models/definition'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport StepDefinition from '../models/step_definition'\nimport { IWorldOptions } from '../support_code_library_builder/world'\nimport { timestamp } from './stopwatch'\nimport StepRunner, { RunStepResult } from './step_runner'\nimport AttachmentManager from './attachment_manager'\nimport { getAmbiguousStepException } from './helpers'\n\nexport interface INewTestCaseRunnerOptions {\n workerId?: string\n eventBroadcaster: EventEmitter\n gherkinDocument: messages.GherkinDocument\n newId: IdGenerator.NewId\n pickle: messages.Pickle\n testCase: messages.TestCase\n retries: number\n skip: boolean\n filterStackTraces: boolean\n supportCodeLibrary: SupportCodeLibrary\n worldParameters: JsonObject\n}\n\nexport default class TestCaseRunner {\n private readonly workerId: string | undefined\n private readonly attachmentManager: AttachmentManager\n private currentTestCaseStartedId: string\n private currentTestStepId: string\n private readonly eventBroadcaster: EventEmitter\n private readonly gherkinDocument: messages.GherkinDocument\n private readonly newId: IdGenerator.NewId\n private readonly pickle: messages.Pickle\n private readonly testCase: messages.TestCase\n private readonly maxAttempts: number\n private readonly skip: boolean\n private readonly filterStackTraces: boolean\n private readonly supportCodeLibrary: SupportCodeLibrary\n private testStepResults: messages.TestStepResult[]\n private world: any\n private readonly worldParameters: JsonObject\n\n constructor({\n workerId,\n eventBroadcaster,\n gherkinDocument,\n newId,\n pickle,\n testCase,\n retries = 0,\n skip,\n filterStackTraces,\n supportCodeLibrary,\n worldParameters,\n }: INewTestCaseRunnerOptions) {\n this.workerId = workerId\n this.attachmentManager = new AttachmentManager(\n ({ data, media, fileName }) => {\n if (doesNotHaveValue(this.currentTestStepId)) {\n throw new Error(\n 'Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.'\n )\n }\n const attachment: messages.Envelope = {\n attachment: {\n body: data,\n contentEncoding: media.encoding,\n mediaType: media.contentType,\n fileName,\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId: this.currentTestStepId,\n },\n }\n this.eventBroadcaster.emit('envelope', attachment)\n }\n )\n this.eventBroadcaster = eventBroadcaster\n this.gherkinDocument = gherkinDocument\n this.maxAttempts = 1 + (skip ? 0 : retries)\n this.newId = newId\n this.pickle = pickle\n this.testCase = testCase\n this.skip = skip\n this.filterStackTraces = filterStackTraces\n this.supportCodeLibrary = supportCodeLibrary\n this.worldParameters = worldParameters\n this.resetTestProgressData()\n }\n\n resetTestProgressData(): void {\n this.world = new this.supportCodeLibrary.World({\n attach: this.attachmentManager.create.bind(this.attachmentManager),\n log: this.attachmentManager.log.bind(this.attachmentManager),\n link: this.attachmentManager.link.bind(this.attachmentManager),\n parameters: structuredClone(this.worldParameters),\n } satisfies IWorldOptions)\n this.testStepResults = []\n }\n\n getBeforeStepHookDefinitions(): TestStepHookDefinition[] {\n return this.supportCodeLibrary.beforeTestStepHookDefinitions.filter(\n (hookDefinition) => hookDefinition.appliesToTestCase(this.pickle)\n )\n }\n\n getAfterStepHookDefinitions(): TestStepHookDefinition[] {\n return this.supportCodeLibrary.afterTestStepHookDefinitions\n .slice(0)\n .reverse()\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(this.pickle))\n }\n\n getWorstStepResult(): messages.TestStepResult {\n if (this.testStepResults.length === 0) {\n return {\n status: this.skip\n ? messages.TestStepResultStatus.SKIPPED\n : messages.TestStepResultStatus.PASSED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n return getWorstTestStepResult(this.testStepResults)\n }\n\n async invokeStep(\n step: messages.PickleStep,\n stepDefinition: IDefinition,\n hookParameter?: ITestCaseHookParameter\n ): Promise<RunStepResult> {\n return await StepRunner.run({\n defaultTimeout: this.supportCodeLibrary.defaultTimeout,\n filterStackTraces: this.filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world: this.world,\n })\n }\n\n isSkippingSteps(): boolean {\n return (\n this.getWorstStepResult().status !== messages.TestStepResultStatus.PASSED\n )\n }\n\n shouldSkipHook(isBeforeHook: boolean): boolean {\n return this.skip || (this.isSkippingSteps() && isBeforeHook)\n }\n\n async aroundTestStep(\n testStepId: string,\n runStepFn: () => Promise<messages.TestStepResult>\n ): Promise<void> {\n const testStepStarted: messages.Envelope = {\n testStepStarted: {\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId,\n timestamp: timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testStepStarted)\n this.currentTestStepId = testStepId\n const testStepResult = await runStepFn()\n this.currentTestStepId = null\n this.testStepResults.push(testStepResult)\n const testStepFinished: messages.Envelope = {\n testStepFinished: {\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId,\n testStepResult,\n timestamp: timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testStepFinished)\n }\n\n async run(): Promise<messages.TestStepResultStatus> {\n for (let attempt = 0; attempt < this.maxAttempts; attempt++) {\n const moreAttemptsRemaining = attempt + 1 < this.maxAttempts\n\n const willBeRetried = await this.runAttempt(\n attempt,\n moreAttemptsRemaining\n )\n\n if (!willBeRetried) {\n break\n }\n this.resetTestProgressData()\n }\n return this.getWorstStepResult().status\n }\n\n async runAttempt(\n attempt: number,\n moreAttemptsRemaining: boolean\n ): Promise<boolean> {\n this.currentTestCaseStartedId = this.newId()\n const testCaseStarted: messages.Envelope = {\n testCaseStarted: {\n attempt,\n testCaseId: this.testCase.id,\n id: this.currentTestCaseStartedId,\n timestamp: timestamp(),\n },\n }\n if (this.workerId) {\n testCaseStarted.testCaseStarted.workerId = this.workerId\n }\n this.eventBroadcaster.emit('envelope', testCaseStarted)\n // used to determine whether a hook is a Before or After\n let didWeRunStepsYet = false\n let error = false\n for (const testStep of this.testCase.testSteps) {\n await this.aroundTestStep(testStep.id, async () => {\n if (doesHaveValue(testStep.hookId)) {\n const hookParameter: ITestCaseHookParameter = {\n gherkinDocument: this.gherkinDocument,\n pickle: this.pickle,\n testCaseStartedId: this.currentTestCaseStartedId,\n }\n if (didWeRunStepsYet) {\n hookParameter.result = this.getWorstStepResult()\n hookParameter.error = error\n hookParameter.willBeRetried =\n this.getWorstStepResult().status ===\n messages.TestStepResultStatus.FAILED && moreAttemptsRemaining\n }\n return await this.runHook(\n findHookDefinition(testStep.hookId, this.supportCodeLibrary),\n hookParameter,\n !didWeRunStepsYet\n )\n } else {\n const pickleStep = this.pickle.steps.find(\n (pickleStep) => pickleStep.id === testStep.pickleStepId\n )\n const testStepResult = await this.runStep(pickleStep, testStep)\n didWeRunStepsYet = true\n error = testStepResult.error\n return testStepResult.result\n }\n })\n }\n\n const willBeRetried =\n this.getWorstStepResult().status ===\n messages.TestStepResultStatus.FAILED && moreAttemptsRemaining\n const testCaseFinished: messages.Envelope = {\n testCaseFinished: {\n testCaseStartedId: this.currentTestCaseStartedId,\n timestamp: timestamp(),\n willBeRetried,\n },\n }\n this.eventBroadcaster.emit('envelope', testCaseFinished)\n\n return willBeRetried\n }\n\n async runHook(\n hookDefinition: TestCaseHookDefinition,\n hookParameter: ITestCaseHookParameter,\n isBeforeHook: boolean\n ): Promise<messages.TestStepResult> {\n if (this.shouldSkipHook(isBeforeHook)) {\n return {\n status: messages.TestStepResultStatus.SKIPPED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n const { result } = await this.invokeStep(\n null,\n hookDefinition,\n hookParameter\n )\n return result\n }\n\n async runStepHooks(\n stepHooks: TestStepHookDefinition[],\n pickleStep: messages.PickleStep,\n stepResult?: RunStepResult\n ): Promise<messages.TestStepResult[]> {\n const stepHooksResult = []\n const hookParameter: ITestStepHookParameter = {\n gherkinDocument: this.gherkinDocument,\n pickle: this.pickle,\n pickleStep,\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId: this.currentTestStepId,\n result: stepResult?.result,\n error: stepResult?.error,\n }\n for (const stepHookDefinition of stepHooks) {\n const { result } = await this.invokeStep(\n null,\n stepHookDefinition,\n hookParameter\n )\n stepHooksResult.push(result)\n }\n return stepHooksResult\n }\n\n async runStep(\n pickleStep: messages.PickleStep,\n testStep: messages.TestStep\n ): Promise<RunStepResult> {\n const stepDefinitions = testStep.stepDefinitionIds.map(\n (stepDefinitionId) => {\n return findStepDefinition(stepDefinitionId, this.supportCodeLibrary)\n }\n )\n if (stepDefinitions.length === 0) {\n return {\n result: {\n status: messages.TestStepResultStatus.UNDEFINED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n }\n } else if (stepDefinitions.length > 1) {\n return {\n result: {\n message: getAmbiguousStepException(stepDefinitions),\n status: messages.TestStepResultStatus.AMBIGUOUS,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n }\n } else if (this.isSkippingSteps()) {\n return {\n result: {\n status: messages.TestStepResultStatus.SKIPPED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n }\n }\n\n let stepResult\n let error\n let stepResults = await this.runStepHooks(\n this.getBeforeStepHookDefinitions(),\n pickleStep\n )\n if (\n getWorstTestStepResult(stepResults).status !==\n messages.TestStepResultStatus.FAILED\n ) {\n stepResult = await this.invokeStep(pickleStep, stepDefinitions[0])\n stepResults.push(stepResult.result)\n error = stepResult.error\n }\n const afterStepHookResults = await this.runStepHooks(\n this.getAfterStepHookDefinitions(),\n pickleStep,\n stepResult\n )\n stepResults = stepResults.concat(afterStepHookResults)\n\n const finalStepResult = getWorstTestStepResult(stepResults)\n let finalDuration = messages.TimeConversion.millisecondsToDuration(0)\n for (const result of stepResults) {\n finalDuration = messages.TimeConversion.addDurations(\n finalDuration,\n result.duration\n )\n }\n finalStepResult.duration = finalDuration\n return {\n result: finalStepResult,\n error,\n }\n }\n}\n\nfunction findHookDefinition(\n id: string,\n supportCodeLibrary: SupportCodeLibrary\n): TestCaseHookDefinition {\n return [\n ...supportCodeLibrary.beforeTestCaseHookDefinitions,\n ...supportCodeLibrary.afterTestCaseHookDefinitions,\n ].find((definition) => definition.id === id)\n}\n\nfunction findStepDefinition(\n id: string,\n supportCodeLibrary: SupportCodeLibrary\n): StepDefinition {\n return supportCodeLibrary.stepDefinitions.find(\n (definition) => definition.id === id\n )\n}\n"]}
@@ -12,6 +12,7 @@ export interface ITestCaseHookParameter {
12
12
  gherkinDocument: messages.GherkinDocument;
13
13
  pickle: messages.Pickle;
14
14
  result?: messages.TestStepResult;
15
+ error?: any;
15
16
  willBeRetried?: boolean;
16
17
  testCaseStartedId: string;
17
18
  }
@@ -20,6 +21,7 @@ export interface ITestStepHookParameter {
20
21
  pickle: messages.Pickle;
21
22
  pickleStep: messages.PickleStep;
22
23
  result: messages.TestStepResult;
24
+ error?: any;
23
25
  testCaseStartedId: string;
24
26
  testStepId: string;
25
27
  }
@@ -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 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 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 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"]}
@@ -9,7 +9,7 @@ exports.default = tryRequire;
9
9
  */
10
10
  function tryRequire(path) {
11
11
  try {
12
- return require(path);
12
+ return require(path); // eslint-disable-line @typescript-eslint/no-require-imports
13
13
  }
14
14
  catch (error) {
15
15
  if (error.code === 'ERR_REQUIRE_ESM') {
@@ -1 +1 @@
1
- {"version":3,"file":"try_require.js","sourceRoot":"","sources":["../src/try_require.ts"],"names":[],"mappings":";;AAMA,6BAoBC;AA1BD;;;;;GAKG;AACH,SAAwB,UAAU,CAAC,IAAY;IAC7C,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACrC,MAAM,KAAK,CACT,2CAA2C,IAAI;oGAC6C,EAC5F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;YACrD,MAAM,KAAK,CACT,+DAA+D,IAAI;uGAC4B,EAC/F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/**\n * Provides a try guarded require call that will throw a more detailed error when\n * the ERR_REQUIRE_ESM error code is encountered.\n *\n * @param {string} path File path to require from.\n */\nexport default function tryRequire(path: string) {\n try {\n return require(path)\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n throw Error(\n `Cucumber expected a CommonJS module at '${path}' but found an ES module.\n Either change the file to CommonJS syntax or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else if (error.code === 'ERR_REQUIRE_ASYNC_MODULE') {\n throw Error(\n `Cucumber expected a CommonJS module or simple ES module at '${path}' but found an async ES module.\n Either change the file so it can be required or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else {\n throw error\n }\n }\n}\n"]}
1
+ {"version":3,"file":"try_require.js","sourceRoot":"","sources":["../src/try_require.ts"],"names":[],"mappings":";;AAMA,6BAoBC;AA1BD;;;;;GAKG;AACH,SAAwB,UAAU,CAAC,IAAY;IAC7C,IAAI,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA,CAAC,4DAA4D;IACnF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;YACrC,MAAM,KAAK,CACT,2CAA2C,IAAI;oGAC6C,EAC5F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;YACrD,MAAM,KAAK,CACT,+DAA+D,IAAI;uGAC4B,EAC/F,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;QACH,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/**\n * Provides a try guarded require call that will throw a more detailed error when\n * the ERR_REQUIRE_ESM error code is encountered.\n *\n * @param {string} path File path to require from.\n */\nexport default function tryRequire(path: string) {\n try {\n return require(path) // eslint-disable-line @typescript-eslint/no-require-imports\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n throw Error(\n `Cucumber expected a CommonJS module at '${path}' but found an ES module.\n Either change the file to CommonJS syntax or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else if (error.code === 'ERR_REQUIRE_ASYNC_MODULE') {\n throw Error(\n `Cucumber expected a CommonJS module or simple ES module at '${path}' but found an async ES module.\n Either change the file so it can be required or use the --import directive instead of --require.`,\n { cause: error }\n )\n } else {\n throw error\n }\n }\n}\n"]}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "11.3.0";
1
+ export declare const version = "12.1.0";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '11.3.0';
5
+ exports.version = '12.1.0';
6
6
  //# sourceMappingURL=version.js.map
@@ -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 = '11.3.0'\n"]}
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.0'\n"]}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "gherkin",
9
9
  "tests"
10
10
  ],
11
- "version": "11.3.0",
11
+ "version": "12.1.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>",
@@ -210,22 +210,22 @@
210
210
  },
211
211
  "types": "./lib/index.d.ts",
212
212
  "engines": {
213
- "node": "18 || 20 || 22 || >=23"
213
+ "node": "20 || 22 || >=24"
214
214
  },
215
215
  "enginesTested": {
216
- "node": "18 || 20 || 22 || 23"
216
+ "node": "20 || 22 || 24"
217
217
  },
218
218
  "dependencies": {
219
219
  "@cucumber/ci-environment": "10.0.1",
220
220
  "@cucumber/cucumber-expressions": "18.0.1",
221
- "@cucumber/gherkin": "30.0.4",
221
+ "@cucumber/gherkin": "32.2.0",
222
222
  "@cucumber/gherkin-streams": "5.0.1",
223
223
  "@cucumber/gherkin-utils": "9.2.0",
224
- "@cucumber/html-formatter": "21.10.1",
224
+ "@cucumber/html-formatter": "21.13.0",
225
225
  "@cucumber/junit-xml-formatter": "0.7.1",
226
226
  "@cucumber/message-streams": "4.0.1",
227
227
  "@cucumber/messages": "27.2.0",
228
- "@cucumber/tag-expressions": "6.1.2",
228
+ "@cucumber/tag-expressions": "6.2.0",
229
229
  "assertion-error-formatter": "^3.0.0",
230
230
  "capital-case": "^1.0.4",
231
231
  "chalk": "^4.1.2",
@@ -234,7 +234,7 @@
234
234
  "debug": "^4.3.4",
235
235
  "error-stack-parser": "^2.1.4",
236
236
  "figures": "^3.2.0",
237
- "glob": "^10.3.10",
237
+ "glob": "^11.0.0",
238
238
  "has-ansi": "^4.0.1",
239
239
  "indent-string": "^4.0.0",
240
240
  "is-installed-globally": "^0.4.0",
@@ -248,7 +248,7 @@
248
248
  "mz": "^2.7.0",
249
249
  "progress": "^2.0.3",
250
250
  "read-package-up": "^11.0.0",
251
- "semver": "7.7.1",
251
+ "semver": "7.7.2",
252
252
  "string-argv": "0.3.1",
253
253
  "supports-color": "^8.1.1",
254
254
  "type-fest": "^4.41.0",
@@ -257,14 +257,18 @@
257
257
  "yup": "1.6.1"
258
258
  },
259
259
  "devDependencies": {
260
- "@cucumber/compatibility-kit": "17.0.1",
261
- "@cucumber/query": "13.2.0",
262
- "@microsoft/api-extractor": "7.52.7",
260
+ "@cucumber/compatibility-kit": "18.0.3",
261
+ "@cucumber/pretty-formatter": "^2.0.0",
262
+ "@cucumber/query": "13.5.0",
263
+ "@eslint/compat": "^1.3.0",
264
+ "@eslint/eslintrc": "^3.3.1",
265
+ "@eslint/js": "^9.29.0",
266
+ "@microsoft/api-extractor": "7.52.8",
263
267
  "@sinonjs/fake-timers": "14.0.0",
264
268
  "@types/chai": "4.3.20",
265
269
  "@types/debug": "4.1.12",
266
270
  "@types/dirty-chai": "2.0.5",
267
- "@types/express": "5.0.1",
271
+ "@types/express": "5.0.3",
268
272
  "@types/fs-extra": "9.0.13",
269
273
  "@types/glob": "8.1.0",
270
274
  "@types/has-ansi": "5.0.2",
@@ -272,8 +276,8 @@
272
276
  "@types/lodash.mergewith": "4.6.9",
273
277
  "@types/luxon": "3.6.2",
274
278
  "@types/mocha": "10.0.10",
275
- "@types/mustache": "4.2.5",
276
- "@types/mz": "2.7.8",
279
+ "@types/mustache": "4.2.6",
280
+ "@types/mz": "2.7.9",
277
281
  "@types/node": "20.17.46",
278
282
  "@types/progress": "2.0.7",
279
283
  "@types/semver": "7.7.0",
@@ -281,29 +285,27 @@
281
285
  "@types/sinonjs__fake-timers": "8.1.5",
282
286
  "@types/stream-buffers": "3.0.7",
283
287
  "@types/tmp": "0.2.6",
284
- "@typescript-eslint/eslint-plugin": "6.21.0",
285
- "@typescript-eslint/parser": "6.21.0",
288
+ "@typescript-eslint/eslint-plugin": "^8.34.0",
289
+ "@typescript-eslint/parser": "^8.34.0",
286
290
  "chai": "4.5.0",
287
291
  "chai-exclude": "2.1.1",
288
292
  "coffeescript": "2.7.0",
289
293
  "dependency-lint": "7.1.0",
290
294
  "dirty-chai": "2.0.1",
291
- "eslint": "8.57.1",
292
- "eslint-config-prettier": "10.1.5",
293
- "eslint-plugin-import": "2.31.0",
294
- "eslint-plugin-n": "17.17.0",
295
- "eslint-plugin-standard": "5.0.0",
296
- "eslint-plugin-unicorn": "^48.0.1",
297
- "express": "^4.21.0",
295
+ "eslint": "^9.29.0",
296
+ "eslint-plugin-import": "^2.31.0",
297
+ "eslint-plugin-n": "^17.20.0",
298
+ "eslint-plugin-unicorn": "^57.0.0",
299
+ "express": "^5.0.0",
298
300
  "fs-extra": "10.1.0",
299
301
  "genversion": "3.2.0",
300
302
  "mocha": "^11.0.1",
301
303
  "mustache": "4.2.0",
302
- "nyc": "15.1.0",
303
- "prettier": "3.5.3",
304
+ "nyc": "17.1.0",
305
+ "prettier": "^3.5.3",
304
306
  "reindent-template-literals": "1.1.0",
305
- "shx": "0.3.4",
306
- "sinon": "15.2.0",
307
+ "shx": "0.4.0",
308
+ "sinon": "21.0.0",
307
309
  "sinon-chai": "3.7.0",
308
310
  "stream-to-string": "1.2.1",
309
311
  "tmp": "0.2.3",