@cucumber/cucumber 10.5.1 → 10.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/convert_configuration.js +1 -0
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +3 -1
- package/lib/api/formatters.js +36 -45
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/load_support.js +9 -2
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/plugins.js +3 -3
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.js +10 -6
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/runtime.d.ts +1 -4
- package/lib/api/runtime.js +1 -4
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/support.d.ts +2 -1
- package/lib/api/support.js +7 -1
- package/lib/api/support.js.map +1 -1
- package/lib/api/types.d.ts +7 -3
- package/lib/api/types.js.map +1 -1
- package/lib/configuration/argv_parser.js +3 -2
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/default_configuration.js +1 -0
- package/lib/configuration/default_configuration.js.map +1 -1
- package/lib/configuration/merge_configurations.js +1 -0
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/types.d.ts +5 -0
- package/lib/configuration/types.js.map +1 -1
- package/lib/configuration/validate_configuration.js +3 -0
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/formatter/builder.d.ts +1 -1
- package/lib/formatter/builder.js +6 -13
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/builtin/html.d.ts +6 -0
- package/lib/formatter/builtin/html.js +25 -0
- package/lib/formatter/builtin/html.js.map +1 -0
- package/lib/formatter/builtin/index.d.ts +3 -0
- package/lib/formatter/builtin/index.js +33 -0
- package/lib/formatter/builtin/index.js.map +1 -0
- package/lib/formatter/builtin/message.d.ts +6 -0
- package/lib/formatter/builtin/message.js +10 -0
- package/lib/formatter/builtin/message.js.map +1 -0
- package/lib/formatter/create_stream.d.ts +4 -0
- package/lib/formatter/create_stream.js +28 -0
- package/lib/formatter/create_stream.js.map +1 -0
- package/lib/formatter/find_class_or_plugin.d.ts +1 -0
- package/lib/formatter/find_class_or_plugin.js +25 -0
- package/lib/formatter/find_class_or_plugin.js.map +1 -0
- package/lib/formatter/helpers/formatters.d.ts +0 -1
- package/lib/formatter/helpers/formatters.js +0 -12
- package/lib/formatter/helpers/formatters.js.map +1 -1
- package/lib/formatter/import_code.d.ts +1 -0
- package/lib/formatter/import_code.js +27 -0
- package/lib/formatter/import_code.js.map +1 -0
- package/lib/formatter/index.d.ts +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/resolve_implementation.d.ts +2 -0
- package/lib/formatter/resolve_implementation.js +24 -0
- package/lib/formatter/resolve_implementation.js.map +1 -0
- package/lib/paths/paths.js +1 -0
- package/lib/paths/paths.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +3 -2
- package/lib/plugin/plugin_manager.js +12 -2
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +11 -0
- package/lib/plugin/types.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +4 -5
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +2 -8
- package/lib/runtime/parallel/coordinator.js +10 -42
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +1 -1
- package/lib/runtime/parallel/worker.js +12 -15
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -1
- package/lib/runtime/test_case_runner.js +6 -1
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/support_code_library_builder/index.js +1 -0
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +1 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +3 -2
- package/lib/formatter/html_formatter.d.ts +0 -7
- package/lib/formatter/html_formatter.js +0 -31
- package/lib/formatter/html_formatter.js.map +0 -1
- package/lib/formatter/message_formatter.d.ts +0 -5
- package/lib/formatter/message_formatter.js +0 -15
- package/lib/formatter/message_formatter.js.map +0 -1
|
@@ -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,iFAAwD;AACxD,wCAAoC;AAkBpC,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,EAAE;YACP,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAA;SACtB;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,UAAU,GAAW,EAAE,OAAe,EAAE;YAC7C,IAAI,GAAW,CAAA;YACf,IAAI;gBACF,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACtB;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,CAAC,GAAU,KAAK,CAAA;gBACtB,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,yBAAyB,CAAC,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC,CAAA;aACvE;YACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACjD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,sCAAsC,GAAG,EAAE,CAAC,CAAA;aACtE;YACD,OAAO,IAAA,sBAAK,EAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACzB,CAAC,CAAA;IACH,CAAC;IAED,SAAS,CAAC,KAAa,EAAE,IAAa;QACpC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,SAA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CACjB,UAAU,EACV,6FAA6F,CAC9F,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACnB,MAAM,EACJ,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;YAC3B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;SACnC;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 Formatters from '../formatter/helpers/formatters'\nimport { version } from '../version'\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 Formatters.buildFormattersDocumentationString(),\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 '--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,mEAA0C;AAkB1C,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,EAAE;YACP,OAAO,CAAC,GAA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D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YAC3B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;SACnC;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 builtin 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(builtin).reduce(\n (previous, [key, formatter]) =>\n previous + ` ${key}: ${formatter.documentation}\\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 +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,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 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,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge_configurations.js","sourceRoot":"","sources":["../../src/configuration/merge_configurations.ts"],"names":[],"mappings":";;;;;;AAAA,wEAAwC;AAGxC,MAAM,eAAe,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,eAAe;CAChB,CAAA;AACD,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;AAElD,SAAS,WAAW,CAAC,QAAe,EAAE,QAAe;IACnD,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KACrC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB,EAAE,QAAgB;IAC7D,IAAI,QAAQ,IAAI,QAAQ,EAAE;QACxB,OAAO,GAAG,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAA;KAC3E;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5C,OAAO,GAAG,CAAA;KACX;IACD,OAAO,IAAI,GAAG,GAAG,CAAA;AACnB,CAAC;AAED,SAAS,UAAU,CAAC,QAAa,EAAE,QAAa,EAAE,GAAW;IAC3D,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,OAAO,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KACvC;IACD,IAAI,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,OAAO,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;KAC/C;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAgB,mBAAmB,CACjC,MAAS,EACT,GAAG,cAAyC;IAE5C,OAAO,IAAA,0BAAS,EAAC,EAAE,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,UAAU,CAAC,CAAA;AAC7D,CAAC;AALD,kDAKC","sourcesContent":["import mergeWith from 'lodash.mergewith'\nimport { IConfiguration } from './types'\n\nconst ADDITIVE_ARRAYS = [\n 'format',\n 'import',\n 'name',\n 'paths',\n 'require',\n 'requireModule',\n]\nconst TAG_EXPRESSIONS = ['tags', 'retryTagFilter']\n\nfunction mergeArrays(objValue: any[], srcValue: any[]) {\n if (objValue && srcValue) {\n return [].concat(objValue, srcValue)\n }\n return undefined\n}\n\nfunction mergeTagExpressions(objValue: string, srcValue: string) {\n if (objValue && srcValue) {\n return `${wrapTagExpression(objValue)} and ${wrapTagExpression(srcValue)}`\n }\n return undefined\n}\n\nfunction wrapTagExpression(raw: string) {\n if (raw.startsWith('(') && raw.endsWith(')')) {\n return raw\n }\n return `(${raw})`\n}\n\nfunction customizer(objValue: any, srcValue: any, key: string): any {\n if (ADDITIVE_ARRAYS.includes(key)) {\n return mergeArrays(objValue, srcValue)\n }\n if (TAG_EXPRESSIONS.includes(key)) {\n return mergeTagExpressions(objValue, srcValue)\n }\n return undefined\n}\n\nexport function mergeConfigurations<T = Partial<IConfiguration>>(\n source: T,\n ...configurations: Partial<IConfiguration>[]\n): T {\n return mergeWith({}, source, ...configurations, customizer)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"merge_configurations.js","sourceRoot":"","sources":["../../src/configuration/merge_configurations.ts"],"names":[],"mappings":";;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AAE,MAAM,EAAE,GAAG,cAAc,EAAE,UAAU,CAAC,CAAA;AAC7D,CAAC;AALD,kDAKC","sourcesContent":["import mergeWith from 'lodash.mergewith'\nimport { IConfiguration } from './types'\n\nconst ADDITIVE_ARRAYS = [\n 'format',\n 'import',\n 'loader',\n 'name',\n 'paths',\n 'require',\n 'requireModule',\n]\nconst TAG_EXPRESSIONS = ['tags', 'retryTagFilter']\n\nfunction mergeArrays(objValue: any[], srcValue: any[]) {\n if (objValue && srcValue) {\n return [].concat(objValue, srcValue)\n }\n return undefined\n}\n\nfunction mergeTagExpressions(objValue: string, srcValue: string) {\n if (objValue && srcValue) {\n return `${wrapTagExpression(objValue)} and ${wrapTagExpression(srcValue)}`\n }\n return undefined\n}\n\nfunction wrapTagExpression(raw: string) {\n if (raw.startsWith('(') && raw.endsWith(')')) {\n return raw\n }\n return `(${raw})`\n}\n\nfunction customizer(objValue: any, srcValue: any, key: string): any {\n if (ADDITIVE_ARRAYS.includes(key)) {\n return mergeArrays(objValue, srcValue)\n }\n if (TAG_EXPRESSIONS.includes(key)) {\n return mergeTagExpressions(objValue, srcValue)\n }\n return undefined\n}\n\nexport function mergeConfigurations<T = Partial<IConfiguration>>(\n source: T,\n ...configurations: Partial<IConfiguration>[]\n): T {\n return mergeWith({}, source, ...configurations, customizer)\n}\n"]}
|
|
@@ -73,6 +73,11 @@ export interface IConfiguration {
|
|
|
73
73
|
* @default "en"
|
|
74
74
|
*/
|
|
75
75
|
language: string;
|
|
76
|
+
/**
|
|
77
|
+
* Module specifier(s) for loaders to be registered ahead of loading support code
|
|
78
|
+
* @default []
|
|
79
|
+
*/
|
|
80
|
+
loader: string[];
|
|
76
81
|
/**
|
|
77
82
|
* Regular expressions of which scenario names should match one of to be run
|
|
78
83
|
* @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 * 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 * @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"]}
|
|
@@ -8,6 +8,9 @@ function validateConfiguration(configuration, logger) {
|
|
|
8
8
|
if (configuration.requireModule.length && !configuration.require.length) {
|
|
9
9
|
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
10
|
}
|
|
11
|
+
if (configuration.loader.length && !configuration.import.length) {
|
|
12
|
+
logger.warn('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');
|
|
13
|
+
}
|
|
11
14
|
if (configuration.retryTagFilter && !configuration.retry) {
|
|
12
15
|
throw new Error('a positive `retry` count must be specified when setting `retryTagFilter`');
|
|
13
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QACvE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QACvE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE;QAC/D,MAAM,CAAC,IAAI,CACT,+LAA+L,CAChM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;AAxBD,sDAwBC","sourcesContent":["import { ILogger } from '../logger'\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"]}
|
|
@@ -27,7 +27,7 @@ export interface IBuildOptions {
|
|
|
27
27
|
supportCodeLibrary: SupportCodeLibrary;
|
|
28
28
|
}
|
|
29
29
|
declare const FormatterBuilder: {
|
|
30
|
-
build(
|
|
30
|
+
build(FormatterConstructor: string | typeof Formatter, options: IBuildOptions): Promise<Formatter>;
|
|
31
31
|
getConstructorByType(type: string, cwd: string): Promise<typeof Formatter>;
|
|
32
32
|
getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }: IGetStepDefinitionSnippetBuilderOptions): Promise<StepDefinitionSnippetBuilder>;
|
|
33
33
|
loadCustomClass(type: 'formatter' | 'syntax', descriptor: string, cwd: string): Promise<any>;
|
package/lib/formatter/builder.js
CHANGED
|
@@ -3,17 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
7
|
-
const node_url_1 = require("node:url");
|
|
8
6
|
const value_checker_1 = require("../value_checker");
|
|
9
7
|
const snippet_syntax_1 = require("./step_definition_snippet_builder/snippet_syntax");
|
|
10
8
|
const step_definition_snippet_builder_1 = __importDefault(require("./step_definition_snippet_builder"));
|
|
11
9
|
const javascript_snippet_syntax_1 = __importDefault(require("./step_definition_snippet_builder/javascript_snippet_syntax"));
|
|
12
10
|
const get_color_fns_1 = __importDefault(require("./get_color_fns"));
|
|
13
11
|
const formatters_1 = __importDefault(require("./helpers/formatters"));
|
|
12
|
+
const import_code_1 = require("./import_code");
|
|
14
13
|
const FormatterBuilder = {
|
|
15
|
-
async build(
|
|
16
|
-
|
|
14
|
+
async build(FormatterConstructor, options) {
|
|
15
|
+
if (typeof FormatterConstructor === 'string') {
|
|
16
|
+
FormatterConstructor = await FormatterBuilder.getConstructorByType(FormatterConstructor, options.cwd);
|
|
17
|
+
}
|
|
17
18
|
const colorFns = (0, get_color_fns_1.default)(options.stream, options.env, options.parsedArgvOptions.colorsEnabled);
|
|
18
19
|
const snippetBuilder = await FormatterBuilder.getStepDefinitionSnippetBuilder({
|
|
19
20
|
cwd: options.cwd,
|
|
@@ -47,15 +48,7 @@ const FormatterBuilder = {
|
|
|
47
48
|
});
|
|
48
49
|
},
|
|
49
50
|
async loadCustomClass(type, descriptor, cwd) {
|
|
50
|
-
|
|
51
|
-
if (descriptor.startsWith('.')) {
|
|
52
|
-
normalized = (0, node_url_1.pathToFileURL)(node_path_1.default.resolve(cwd, descriptor));
|
|
53
|
-
}
|
|
54
|
-
else if (descriptor.startsWith('file://')) {
|
|
55
|
-
normalized = new URL(descriptor);
|
|
56
|
-
}
|
|
57
|
-
let CustomClass = await FormatterBuilder.loadFile(normalized);
|
|
58
|
-
CustomClass = FormatterBuilder.resolveConstructor(CustomClass);
|
|
51
|
+
const CustomClass = FormatterBuilder.resolveConstructor(await (0, import_code_1.importCode)(descriptor, cwd));
|
|
59
52
|
if ((0, value_checker_1.doesHaveValue)(CustomClass)) {
|
|
60
53
|
return CustomClass;
|
|
61
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAEA,oDAAkE;AAElE,qFAAmF;AAEnF,wGAA4E;AAC5E,4HAAiG;AACjG,oEAAyC;AACzC,sEAA6C;AAC7C,+CAA0C;AA0B1C,MAAM,gBAAgB,GAAG;IACvB,KAAK,CAAC,KAAK,CACT,oBAA+C,EAC/C,OAAsB;QAEtB,IAAI,OAAO,oBAAoB,KAAK,QAAQ,EAAE;YAC5C,oBAAoB,GAAG,MAAM,gBAAgB,CAAC,oBAAoB,CAChE,oBAAoB,EACpB,OAAO,CAAC,GAAG,CACZ,CAAA;SACF;QACD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,iBAAiB,CAAC,aAAa,CACxC,CAAA;QACD,MAAM,cAAc,GAClB,MAAM,gBAAgB,CAAC,+BAA+B,CAAC;YACrD,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,gBAAgB,EAAE,OAAO,CAAC,iBAAiB,CAAC,gBAAgB;YAC5D,aAAa,EAAE,OAAO,CAAC,iBAAiB,CAAC,aAAa;YACtD,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;SAC/C,CAAC,CAAA;QACJ,OAAO,IAAI,oBAAoB,CAAC;YAC9B,QAAQ;YACR,cAAc;YACd,GAAG,OAAO;SACX,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,IAAY,EACZ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AA;IAC3C,CAAC;IAED,kBAAkB,CAAC,YAAiB;QAClC,IAAI,IAAA,gCAAgB,EAAC,YAAY,CAAC,EAAE;YAClC,OAAO,IAAI,CAAA;SACZ;QACD,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;YACtC,OAAO,YAAY,CAAA;SACpB;aAAM,IACL,OAAO,YAAY,KAAK,QAAQ;YAChC,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,EAC1C;YACA,OAAO,YAAY,CAAC,OAAO,CAAA;SAC5B;aAAM,IACL,OAAO,YAAY,CAAC,OAAO,KAAK,QAAQ;YACxC,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,UAAU,EAClD;YACA,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,CAAA;SACpC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AAED,kBAAe,gBAAgB,CAAA","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Writable as WritableStream } from 'node:stream'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\nimport EventDataCollector from './helpers/event_data_collector'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax'\nimport getColorFns from './get_color_fns'\nimport Formatters from './helpers/formatters'\nimport { importCode } from './import_code'\nimport Formatter, {\n FormatOptions,\n IFormatterCleanupFn,\n IFormatterLogFn,\n} from '.'\n\ninterface IGetStepDefinitionSnippetBuilderOptions {\n cwd: string\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n supportCodeLibrary: SupportCodeLibrary\n}\n\nexport interface IBuildOptions {\n env: NodeJS.ProcessEnv\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n log: IFormatterLogFn\n parsedArgvOptions: FormatOptions\n stream: WritableStream\n cleanup: IFormatterCleanupFn\n supportCodeLibrary: SupportCodeLibrary\n}\n\nconst FormatterBuilder = {\n async build(\n FormatterConstructor: string | typeof Formatter,\n options: IBuildOptions\n ): Promise<Formatter> {\n if (typeof FormatterConstructor === 'string') {\n FormatterConstructor = await FormatterBuilder.getConstructorByType(\n FormatterConstructor,\n options.cwd\n )\n }\n const colorFns = getColorFns(\n options.stream,\n options.env,\n options.parsedArgvOptions.colorsEnabled\n )\n const snippetBuilder =\n await FormatterBuilder.getStepDefinitionSnippetBuilder({\n cwd: options.cwd,\n snippetInterface: options.parsedArgvOptions.snippetInterface,\n snippetSyntax: options.parsedArgvOptions.snippetSyntax,\n supportCodeLibrary: options.supportCodeLibrary,\n })\n return new FormatterConstructor({\n colorFns,\n snippetBuilder,\n ...options,\n })\n },\n\n async getConstructorByType(\n type: string,\n cwd: string\n ): Promise<typeof Formatter> {\n const formatters: Record<string, typeof Formatter> =\n Formatters.getFormatters()\n\n return formatters[type]\n ? formatters[type]\n : await FormatterBuilder.loadCustomClass('formatter', type, cwd)\n },\n\n async getStepDefinitionSnippetBuilder({\n cwd,\n snippetInterface,\n snippetSyntax,\n supportCodeLibrary,\n }: IGetStepDefinitionSnippetBuilderOptions) {\n if (doesNotHaveValue(snippetInterface)) {\n snippetInterface = SnippetInterface.Synchronous\n }\n let Syntax = JavascriptSnippetSyntax\n if (doesHaveValue(snippetSyntax)) {\n Syntax = await FormatterBuilder.loadCustomClass(\n 'syntax',\n snippetSyntax,\n cwd\n )\n }\n return new StepDefinitionSnippetBuilder({\n snippetSyntax: new Syntax(snippetInterface),\n parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry,\n })\n },\n\n async loadCustomClass(\n type: 'formatter' | 'syntax',\n descriptor: string,\n cwd: string\n ) {\n const CustomClass = FormatterBuilder.resolveConstructor(\n await importCode(descriptor, cwd)\n )\n if (doesHaveValue(CustomClass)) {\n return CustomClass\n } else {\n throw new Error(\n `Custom ${type} (${descriptor}) does not export a function/class`\n )\n }\n },\n\n async loadFile(urlOrName: URL | string) {\n return await import(urlOrName.toString())\n },\n\n resolveConstructor(ImportedCode: any) {\n if (doesNotHaveValue(ImportedCode)) {\n return null\n }\n if (typeof ImportedCode === 'function') {\n return ImportedCode\n } else if (\n typeof ImportedCode === 'object' &&\n typeof ImportedCode.default === 'function'\n ) {\n return ImportedCode.default\n } else if (\n typeof ImportedCode.default === 'object' &&\n typeof ImportedCode.default.default === 'function'\n ) {\n return ImportedCode.default.default\n }\n return null\n },\n}\n\nexport default FormatterBuilder\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const node_util_1 = require("node:util");
|
|
7
|
+
const node_stream_1 = require("node:stream");
|
|
8
|
+
const html_formatter_1 = __importDefault(require("@cucumber/html-formatter"));
|
|
9
|
+
const resolve_pkg_1 = __importDefault(require("resolve-pkg"));
|
|
10
|
+
exports.default = {
|
|
11
|
+
type: 'formatter',
|
|
12
|
+
formatter({ on, write }) {
|
|
13
|
+
const htmlStream = new html_formatter_1.default((0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
|
|
14
|
+
'/dist/main.css', (0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
|
|
15
|
+
'/dist/main.js');
|
|
16
|
+
on('message', (message) => htmlStream.write(message));
|
|
17
|
+
htmlStream.on('data', (chunk) => write(chunk));
|
|
18
|
+
return async () => {
|
|
19
|
+
htmlStream.end();
|
|
20
|
+
await (0, node_util_1.promisify)(node_stream_1.finished)(htmlStream);
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
documentation: 'Outputs a HTML report',
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/formatter/builtin/html.ts"],"names":[],"mappings":";;;;;AAAA,yCAAqC;AACrC,6CAAsC;AACtC,8EAAyD;AACzD,8DAAoC;AAGpC,kBAAe;IACb,IAAI,EAAE,WAAW;IACjB,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE;QACrB,MAAM,UAAU,GAAG,IAAI,wBAAkB,CACvC,IAAA,qBAAU,EAAC,0BAA0B,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACxD,gBAAgB,EAClB,IAAA,qBAAU,EAAC,0BAA0B,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACxD,eAAe,CAClB,CAAA;QACD,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;QACrD,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;QAE9C,OAAO,KAAK,IAAI,EAAE;YAChB,UAAU,CAAC,GAAG,EAAE,CAAA;YAChB,MAAM,IAAA,qBAAS,EAAC,sBAAQ,CAAC,CAAC,UAAU,CAAC,CAAA;QACvC,CAAC,CAAA;IACH,CAAC;IACD,aAAa,EAAE,uBAAuB;CACb,CAAA","sourcesContent":["import { promisify } from 'node:util'\nimport { finished } from 'node:stream'\nimport CucumberHtmlStream from '@cucumber/html-formatter'\nimport resolvePkg from 'resolve-pkg'\nimport { FormatterPlugin } from '../../plugin'\n\nexport default {\n type: 'formatter',\n formatter({ on, write }) {\n const htmlStream = new CucumberHtmlStream(\n resolvePkg('@cucumber/html-formatter', { cwd: __dirname }) +\n '/dist/main.css',\n resolvePkg('@cucumber/html-formatter', { cwd: __dirname }) +\n '/dist/main.js'\n )\n on('message', (message) => htmlStream.write(message))\n htmlStream.on('data', (chunk) => write(chunk))\n\n return async () => {\n htmlStream.end()\n await promisify(finished)(htmlStream)\n }\n },\n documentation: 'Outputs a HTML report',\n} satisfies FormatterPlugin\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const json_formatter_1 = __importDefault(require("../json_formatter"));
|
|
7
|
+
const progress_formatter_1 = __importDefault(require("../progress_formatter"));
|
|
8
|
+
const progress_bar_formatter_1 = __importDefault(require("../progress_bar_formatter"));
|
|
9
|
+
const rerun_formatter_1 = __importDefault(require("../rerun_formatter"));
|
|
10
|
+
const snippets_formatter_1 = __importDefault(require("../snippets_formatter"));
|
|
11
|
+
const summary_formatter_1 = __importDefault(require("../summary_formatter"));
|
|
12
|
+
const usage_formatter_1 = __importDefault(require("../usage_formatter"));
|
|
13
|
+
const usage_json_formatter_1 = __importDefault(require("../usage_json_formatter"));
|
|
14
|
+
const junit_formatter_1 = __importDefault(require("../junit_formatter"));
|
|
15
|
+
const message_1 = __importDefault(require("./message"));
|
|
16
|
+
const html_1 = __importDefault(require("./html"));
|
|
17
|
+
const builtin = {
|
|
18
|
+
// new plugin-based formatters
|
|
19
|
+
html: html_1.default,
|
|
20
|
+
message: message_1.default,
|
|
21
|
+
// legacy class-based formatters
|
|
22
|
+
json: json_formatter_1.default,
|
|
23
|
+
progress: progress_formatter_1.default,
|
|
24
|
+
'progress-bar': progress_bar_formatter_1.default,
|
|
25
|
+
rerun: rerun_formatter_1.default,
|
|
26
|
+
snippets: snippets_formatter_1.default,
|
|
27
|
+
summary: summary_formatter_1.default,
|
|
28
|
+
usage: usage_formatter_1.default,
|
|
29
|
+
'usage-json': usage_json_formatter_1.default,
|
|
30
|
+
junit: junit_formatter_1.default,
|
|
31
|
+
};
|
|
32
|
+
exports.default = builtin;
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,yEAA+C;AAC/C,wDAAwC;AACxC,kDAAkC;AAElC,MAAM,OAAO,GAA4C;IACvD,8BAA8B;IAC9B,IAAI,EAAE,cAAa;IACnB,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;IAChC,KAAK,EAAE,yBAAc;CACtB,CAAA;AAED,kBAAe,OAAO,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 JunitFormatter from '../junit_formatter'\nimport messageFormatter from './message'\nimport htmlFormatter from './html'\n\nconst builtin: Record<string, FormatterImplementation> = {\n // new plugin-based formatters\n html: htmlFormatter,\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 junit: JunitFormatter,\n}\n\nexport default builtin\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
type: 'formatter',
|
|
5
|
+
formatter({ on, write }) {
|
|
6
|
+
on('message', (message) => write(JSON.stringify(message) + '\n'));
|
|
7
|
+
},
|
|
8
|
+
documentation: 'Emits Cucumber messages in NDJSON format',
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/formatter/builtin/message.ts"],"names":[],"mappings":";;AAEA,kBAAe;IACb,IAAI,EAAE,WAAW;IACjB,SAAS,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE;QACrB,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACnE,CAAC;IACD,aAAa,EAAE,0CAA0C;CAChC,CAAA","sourcesContent":["import { FormatterPlugin } from '../../plugin'\n\nexport default {\n type: 'formatter',\n formatter({ on, write }) {\n on('message', (message) => write(JSON.stringify(message) + '\\n'))\n },\n documentation: 'Emits Cucumber messages in NDJSON format',\n} satisfies FormatterPlugin\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createStream = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const mkdirp_1 = require("mkdirp");
|
|
9
|
+
const fs_1 = __importDefault(require("mz/fs"));
|
|
10
|
+
async function createStream(target, onStreamError, cwd, logger) {
|
|
11
|
+
const absoluteTarget = node_path_1.default.resolve(cwd, target);
|
|
12
|
+
try {
|
|
13
|
+
await (0, mkdirp_1.mkdirp)(node_path_1.default.dirname(absoluteTarget));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
logger.warn('Failed to ensure directory for formatter target exists');
|
|
17
|
+
}
|
|
18
|
+
const stream = fs_1.default.createWriteStream(null, {
|
|
19
|
+
fd: await fs_1.default.open(absoluteTarget, 'w'),
|
|
20
|
+
});
|
|
21
|
+
stream.on('error', (error) => {
|
|
22
|
+
logger.error(error.message);
|
|
23
|
+
onStreamError();
|
|
24
|
+
});
|
|
25
|
+
return stream;
|
|
26
|
+
}
|
|
27
|
+
exports.createStream = createStream;
|
|
28
|
+
//# sourceMappingURL=create_stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_stream.js","sourceRoot":"","sources":["../../src/formatter/create_stream.ts"],"names":[],"mappings":";;;;;;AAAA,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;IAEhD,IAAI;QACF,MAAM,IAAA,eAAM,EAAC,mBAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAA;KAC3C;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAA;KACtE;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,MAAM,CAAA;AACf,CAAC;AAxBD,oCAwBC","sourcesContent":["import path from 'node:path'\nimport { Writable } from 'node:stream'\nimport { mkdirp } from 'mkdirp'\nimport fs from 'mz/fs'\nimport { ILogger } from '../logger'\n\nexport async function createStream(\n target: string,\n onStreamError: () => void,\n cwd: string,\n logger: ILogger\n): Promise<Writable> {\n const absoluteTarget = path.resolve(cwd, target)\n\n try {\n await mkdirp(path.dirname(absoluteTarget))\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 stream\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findClassOrPlugin(imported: any): any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findClassOrPlugin = void 0;
|
|
4
|
+
const value_checker_1 = require("../value_checker");
|
|
5
|
+
function findClassOrPlugin(imported) {
|
|
6
|
+
return findRecursive(imported, 3);
|
|
7
|
+
}
|
|
8
|
+
exports.findClassOrPlugin = findClassOrPlugin;
|
|
9
|
+
function findRecursive(thing, depth) {
|
|
10
|
+
if ((0, value_checker_1.doesNotHaveValue)(thing)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (typeof thing === 'function') {
|
|
14
|
+
return thing;
|
|
15
|
+
}
|
|
16
|
+
if (typeof thing === 'object' && thing.type === 'formatter') {
|
|
17
|
+
return thing;
|
|
18
|
+
}
|
|
19
|
+
depth--;
|
|
20
|
+
if (depth > 0) {
|
|
21
|
+
return findRecursive(thing.default, depth);
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=find_class_or_plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find_class_or_plugin.js","sourceRoot":"","sources":["../../src/formatter/find_class_or_plugin.ts"],"names":[],"mappings":";;;AAAA,oDAAmD;AAEnD,SAAgB,iBAAiB,CAAC,QAAa;IAC7C,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;AACnC,CAAC;AAFD,8CAEC;AAED,SAAS,aAAa,CAAC,KAAU,EAAE,KAAa;IAC9C,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE;QAC3B,OAAO,IAAI,CAAA;KACZ;IACD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QAC/B,OAAO,KAAK,CAAA;KACb;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE;QAC3D,OAAO,KAAK,CAAA;KACb;IACD,KAAK,EAAE,CAAA;IACP,IAAI,KAAK,GAAG,CAAC,EAAE;QACb,OAAO,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;KAC3C;IACD,OAAO,IAAI,CAAA;AACb,CAAC","sourcesContent":["import { doesNotHaveValue } from '../value_checker'\n\nexport function findClassOrPlugin(imported: any) {\n return findRecursive(imported, 3)\n}\n\nfunction findRecursive(thing: any, depth: number): any {\n if (doesNotHaveValue(thing)) {\n return null\n }\n if (typeof thing === 'function') {\n return thing\n }\n if (typeof thing === 'object' && thing.type === 'formatter') {\n return thing\n }\n depth--\n if (depth > 0) {\n return findRecursive(thing.default, depth)\n }\n return null\n}\n"]}
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const json_formatter_1 = __importDefault(require("../json_formatter"));
|
|
7
|
-
const message_formatter_1 = __importDefault(require("../message_formatter"));
|
|
8
7
|
const progress_bar_formatter_1 = __importDefault(require("../progress_bar_formatter"));
|
|
9
8
|
const progress_formatter_1 = __importDefault(require("../progress_formatter"));
|
|
10
9
|
const rerun_formatter_1 = __importDefault(require("../rerun_formatter"));
|
|
@@ -12,14 +11,11 @@ const snippets_formatter_1 = __importDefault(require("../snippets_formatter"));
|
|
|
12
11
|
const summary_formatter_1 = __importDefault(require("../summary_formatter"));
|
|
13
12
|
const usage_formatter_1 = __importDefault(require("../usage_formatter"));
|
|
14
13
|
const usage_json_formatter_1 = __importDefault(require("../usage_json_formatter"));
|
|
15
|
-
const html_formatter_1 = __importDefault(require("../html_formatter"));
|
|
16
14
|
const junit_formatter_1 = __importDefault(require("../junit_formatter"));
|
|
17
15
|
const Formatters = {
|
|
18
16
|
getFormatters() {
|
|
19
17
|
return {
|
|
20
18
|
json: json_formatter_1.default,
|
|
21
|
-
message: message_formatter_1.default,
|
|
22
|
-
html: html_formatter_1.default,
|
|
23
19
|
progress: progress_formatter_1.default,
|
|
24
20
|
'progress-bar': progress_bar_formatter_1.default,
|
|
25
21
|
rerun: rerun_formatter_1.default,
|
|
@@ -30,14 +26,6 @@ const Formatters = {
|
|
|
30
26
|
junit: junit_formatter_1.default,
|
|
31
27
|
};
|
|
32
28
|
},
|
|
33
|
-
buildFormattersDocumentationString() {
|
|
34
|
-
let concatenatedFormattersDocumentation = '';
|
|
35
|
-
const formatters = this.getFormatters();
|
|
36
|
-
for (const formatterName in formatters) {
|
|
37
|
-
concatenatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\n`;
|
|
38
|
-
}
|
|
39
|
-
return concatenatedFormattersDocumentation;
|
|
40
|
-
},
|
|
41
29
|
};
|
|
42
30
|
exports.default = Formatters;
|
|
43
31
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/formatter/helpers/formatters.ts"],"names":[],"mappings":";;;;;AACA,uEAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/formatter/helpers/formatters.ts"],"names":[],"mappings":";;;;;AACA,uEAA6C;AAC7C,uFAA4D;AAC5D,+EAAqD;AACrD,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,yEAA+C;AAE/C,MAAM,UAAU,GAAG;IACjB,aAAa;QACX,OAAO;YACL,IAAI,EAAE,wBAAa;YACnB,QAAQ,EAAE,4BAAiB;YAC3B,cAAc,EAAE,gCAAoB;YACpC,KAAK,EAAE,yBAAc;YACrB,QAAQ,EAAE,4BAAiB;YAC3B,OAAO,EAAE,2BAAgB;YACzB,KAAK,EAAE,yBAAc;YACrB,YAAY,EAAE,8BAAkB;YAChC,KAAK,EAAE,yBAAc;SACtB,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import Formatter from '../.'\nimport JsonFormatter from '../json_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport ProgressFormatter from '../progress_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 JunitFormatter from '../junit_formatter'\n\nconst Formatters = {\n getFormatters(): Record<string, typeof Formatter> {\n return {\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 junit: JunitFormatter,\n }\n },\n}\n\nexport default Formatters\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function importCode(specifier: string, cwd: string): Promise<any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.importCode = void 0;
|
|
7
|
+
const node_url_1 = require("node:url");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
async function importCode(specifier, cwd) {
|
|
10
|
+
try {
|
|
11
|
+
let normalized = specifier;
|
|
12
|
+
if (specifier.startsWith('.')) {
|
|
13
|
+
normalized = (0, node_url_1.pathToFileURL)(node_path_1.default.resolve(cwd, specifier));
|
|
14
|
+
}
|
|
15
|
+
else if (specifier.startsWith('file://')) {
|
|
16
|
+
normalized = new URL(specifier);
|
|
17
|
+
}
|
|
18
|
+
return await import(normalized.toString());
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
throw new Error(`Failed to import formatter ${specifier}`, {
|
|
22
|
+
cause: e,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.importCode = importCode;
|
|
27
|
+
//# sourceMappingURL=import_code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import_code.js","sourceRoot":"","sources":["../../src/formatter/import_code.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAwC;AACxC,0DAA4B;AAErB,KAAK,UAAU,UAAU,CAAC,SAAiB,EAAE,GAAW;IAC7D,IAAI;QACF,IAAI,UAAU,GAAiB,SAAS,CAAA;QACxC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YAC7B,UAAU,GAAG,IAAA,wBAAa,EAAC,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;SACzD;aAAM,IAAI,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC1C,UAAU,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;SAChC;QACD,OAAO,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC3C;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,EAAE;YACzD,KAAK,EAAE,CAAC;SACT,CAAC,CAAA;KACH;AACH,CAAC;AAdD,gCAcC","sourcesContent":["import { pathToFileURL } from 'node:url'\nimport path from 'node:path'\n\nexport async function importCode(specifier: string, cwd: string): Promise<any> {\n try {\n let normalized: URL | string = specifier\n if (specifier.startsWith('.')) {\n normalized = pathToFileURL(path.resolve(cwd, specifier))\n } else if (specifier.startsWith('file://')) {\n normalized = new URL(specifier)\n }\n return await import(normalized.toString())\n } catch (e) {\n throw new Error(`Failed to import formatter ${specifier}`, {\n cause: e,\n })\n }\n}\n"]}
|
package/lib/formatter/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { Writable } from 'node:stream';
|
|
4
4
|
import { EventEmitter } from 'node:events';
|
|
5
5
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
6
|
+
import { FormatterPlugin } from '../plugin';
|
|
6
7
|
import { IColorFns } from './get_color_fns';
|
|
7
8
|
import { EventDataCollector } from './helpers';
|
|
8
9
|
import StepDefinitionSnippetBuilder from './step_definition_snippet_builder';
|
|
@@ -18,6 +19,7 @@ export interface FormatOptions {
|
|
|
18
19
|
printAttachments?: boolean;
|
|
19
20
|
[customKey: string]: any;
|
|
20
21
|
}
|
|
22
|
+
export type FormatterImplementation = typeof Formatter | FormatterPlugin;
|
|
21
23
|
export type IFormatterStream = Writable;
|
|
22
24
|
export type IFormatterLogFn = (buffer: string | Uint8Array) => void;
|
|
23
25
|
export type IFormatterCleanupFn = () => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatter/index.ts"],"names":[],"mappings":";;AAGA,oDAAiD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/formatter/index.ts"],"names":[],"mappings":";;AAGA,oDAAiD;AAsCjD,MAAqB,SAAS;IAClB,QAAQ,CAAW;IACnB,GAAG,CAAQ;IACX,kBAAkB,CAAoB;IACtC,GAAG,CAAiB;IACpB,cAAc,CAA8B;IAC5C,MAAM,CAAU;IAChB,kBAAkB,CAAoB;IACtC,gBAAgB,CAAS;IAClB,OAAO,CAAqB;IAC7C,MAAM,CAAU,aAAa,CAAQ;IAErC,YAAY,OAA0B;QACpC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;QACpD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;QACtB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;QAC5C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAA,8BAAc,EACpC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAC1C,IAAI,CACL,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;IACtB,CAAC;CACF;AA9BD,4BA8BC","sourcesContent":["import { Writable } from 'node:stream'\nimport { EventEmitter } from 'node:events'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { valueOrDefault } from '../value_checker'\nimport { FormatterPlugin } from '../plugin'\nimport { IColorFns } from './get_color_fns'\nimport { EventDataCollector } from './helpers'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\n\nexport interface FormatRerunOptions {\n separator?: string\n}\n\nexport interface FormatOptions {\n colorsEnabled?: boolean\n rerun?: FormatRerunOptions\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n printAttachments?: boolean\n [customKey: string]: any\n}\n\nexport type FormatterImplementation = typeof Formatter | FormatterPlugin\nexport type IFormatterStream = Writable\nexport type IFormatterLogFn = (buffer: string | Uint8Array) => void\nexport type IFormatterCleanupFn = () => Promise<any>\n\nexport interface IFormatterOptions {\n colorFns: IColorFns\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n log: IFormatterLogFn\n parsedArgvOptions: FormatOptions\n snippetBuilder: StepDefinitionSnippetBuilder\n stream: Writable\n cleanup: IFormatterCleanupFn\n supportCodeLibrary: SupportCodeLibrary\n}\n\nexport default class Formatter {\n protected colorFns: IColorFns\n protected cwd: string\n protected eventDataCollector: EventDataCollector\n protected log: IFormatterLogFn\n protected snippetBuilder: StepDefinitionSnippetBuilder\n protected stream: Writable\n protected supportCodeLibrary: SupportCodeLibrary\n protected printAttachments: boolean\n private readonly cleanup: IFormatterCleanupFn\n static readonly documentation: string\n\n constructor(options: IFormatterOptions) {\n this.colorFns = options.colorFns\n this.cwd = options.cwd\n this.eventDataCollector = options.eventDataCollector\n this.log = options.log\n this.snippetBuilder = options.snippetBuilder\n this.stream = options.stream\n this.supportCodeLibrary = options.supportCodeLibrary\n this.cleanup = options.cleanup\n this.printAttachments = valueOrDefault(\n options.parsedArgvOptions.printAttachments,\n true\n )\n }\n\n async finished(): Promise<void> {\n await this.cleanup()\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveImplementation = void 0;
|
|
7
|
+
const builtin_1 = __importDefault(require("./builtin"));
|
|
8
|
+
const import_code_1 = require("./import_code");
|
|
9
|
+
const find_class_or_plugin_1 = require("./find_class_or_plugin");
|
|
10
|
+
async function resolveImplementation(specifier, cwd) {
|
|
11
|
+
if (builtin_1.default[specifier]) {
|
|
12
|
+
return builtin_1.default[specifier];
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
const imported = await (0, import_code_1.importCode)(specifier, cwd);
|
|
16
|
+
const found = (0, find_class_or_plugin_1.findClassOrPlugin)(imported);
|
|
17
|
+
if (!found) {
|
|
18
|
+
throw new Error(`${specifier} does not export a function/class`);
|
|
19
|
+
}
|
|
20
|
+
return found;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.resolveImplementation = resolveImplementation;
|
|
24
|
+
//# sourceMappingURL=resolve_implementation.js.map
|