@cucumber/cucumber 11.2.0 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/convert_configuration.d.ts +0 -1
- package/lib/api/convert_configuration.js +1 -2
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +0 -2
- package/lib/api/formatters.js +1 -2
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/gherkin.js +1 -2
- package/lib/api/gherkin.js.map +1 -1
- package/lib/api/load_configuration.js +1 -2
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.js +1 -2
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.js +1 -2
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/plugins.js +3 -4
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.js +1 -2
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/support.js +1 -2
- package/lib/api/support.js.map +1 -1
- package/lib/api/test_helpers.js +2 -3
- package/lib/api/test_helpers.js.map +1 -1
- package/lib/assemble/assemble_test_cases.d.ts +0 -1
- package/lib/assemble/assemble_test_cases.js +1 -2
- package/lib/assemble/assemble_test_cases.js.map +1 -1
- package/lib/cli/helpers.d.ts +0 -2
- package/lib/cli/helpers.js +20 -11
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +2 -3
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +0 -1
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/install_validator.js +1 -2
- package/lib/cli/install_validator.js.map +1 -1
- package/lib/cli/run.js +1 -1
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.js +1 -2
- package/lib/cli/validate_node_engine_version.js.map +1 -1
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/check_schema.js +18 -9
- package/lib/configuration/check_schema.js.map +1 -1
- package/lib/configuration/from_file.js +1 -2
- package/lib/configuration/from_file.js.map +1 -1
- package/lib/configuration/helpers.js +1 -2
- package/lib/configuration/helpers.js.map +1 -1
- package/lib/configuration/locate_file.js +1 -2
- package/lib/configuration/locate_file.js.map +1 -1
- package/lib/configuration/merge_configurations.js +1 -2
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/parse_configuration.js +1 -2
- package/lib/configuration/parse_configuration.js.map +1 -1
- package/lib/configuration/split_format_descriptor.js +1 -2
- package/lib/configuration/split_format_descriptor.js.map +1 -1
- package/lib/configuration/validate_configuration.js +1 -2
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/environment/console_logger.d.ts +0 -1
- package/lib/environment/console_logger.js.map +1 -1
- package/lib/environment/make_environment.js +1 -2
- package/lib/environment/make_environment.js.map +1 -1
- package/lib/environment/types.d.ts +0 -1
- package/lib/filter_stack_trace.js +2 -3
- package/lib/filter_stack_trace.js.map +1 -1
- package/lib/formatter/builder.d.ts +1 -5
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/builtin/html.js +1 -4
- package/lib/formatter/builtin/html.js.map +1 -1
- package/lib/formatter/builtin/index.d.ts +1 -1
- package/lib/formatter/create_stream.d.ts +0 -1
- package/lib/formatter/create_stream.js +1 -2
- package/lib/formatter/create_stream.js.map +1 -1
- package/lib/formatter/find_class_or_plugin.js +1 -2
- package/lib/formatter/find_class_or_plugin.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +0 -2
- package/lib/formatter/get_color_fns.js +1 -1
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/duration_helpers.js +2 -3
- package/lib/formatter/helpers/duration_helpers.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +0 -1
- package/lib/formatter/helpers/event_data_collector.js +17 -7
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/gherkin_document_parser.js +4 -5
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/index.js +17 -7
- package/lib/formatter/helpers/index.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.js +6 -7
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +3 -3
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -2
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +4 -5
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -2
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +18 -9
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +18 -9
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +18 -9
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +18 -9
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/import_code.js +1 -2
- package/lib/formatter/import_code.js.map +1 -1
- package/lib/formatter/index.d.ts +0 -2
- package/lib/formatter/json_formatter.js +17 -7
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.js +17 -7
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.js +17 -7
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/resolve_implementation.js +1 -2
- package/lib/formatter/resolve_implementation.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +17 -7
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +17 -7
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.js +17 -7
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/step_definition.js.map +1 -1
- package/lib/paths/paths.js +1 -2
- package/lib/paths/paths.js.map +1 -1
- package/lib/pickle_filter.js.map +1 -1
- package/lib/plugin/plugin_manager.js +1 -1
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/publish/publish_plugin.js +46 -16
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/runtime/attachment_manager/index.d.ts +0 -2
- package/lib/runtime/attachment_manager/index.js +17 -7
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/coordinator.d.ts +0 -1
- package/lib/runtime/format_error.js +1 -2
- package/lib/runtime/format_error.js.map +1 -1
- package/lib/runtime/helpers.js +20 -11
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/make_runtime.d.ts +0 -1
- package/lib/runtime/make_runtime.js +1 -2
- package/lib/runtime/make_runtime.js.map +1 -1
- package/lib/runtime/parallel/adapter.d.ts +0 -2
- package/lib/runtime/parallel/adapter.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.js.map +1 -1
- package/lib/runtime/scope/make_proxy.js +1 -2
- package/lib/runtime/scope/make_proxy.js.map +1 -1
- package/lib/runtime/scope/test_case_scope.js +2 -2
- package/lib/runtime/scope/test_case_scope.js.map +1 -1
- package/lib/runtime/scope/test_run_scope.js +2 -2
- package/lib/runtime/scope/test_run_scope.js.map +1 -1
- package/lib/runtime/serial/adapter.d.ts +0 -1
- package/lib/runtime/serial/adapter.js.map +1 -1
- package/lib/runtime/step_runner.js +18 -9
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +0 -1
- package/lib/runtime/test_case_runner.js +17 -7
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/runtime/worker.d.ts +0 -1
- package/lib/runtime/worker.js.map +1 -1
- package/lib/step_arguments.js +1 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/build_parameter_type.js +1 -2
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +1 -2
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +1 -2
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +1 -1
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/time.d.ts +0 -2
- package/lib/time.js +19 -10
- package/lib/time.js.map +1 -1
- package/lib/try_require.js +1 -1
- package/lib/try_require.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +1 -0
- package/lib/uncaught_exception_manager.d.ts +0 -1
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.js +3 -4
- package/lib/value_checker.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 +49 -51
- package/lib/publish/http_stream.d.ts +0 -30
- package/lib/publish/http_stream.js +0 -117
- package/lib/publish/http_stream.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_stack_trace.js","sourceRoot":"","sources":["../src/filter_stack_trace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filter_stack_trace.js","sourceRoot":"","sources":["../src/filter_stack_trace.ts"],"names":[],"mappings":";;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B,CAAC,QAAQ,CAAC,CAAA;AACvC,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAI,CAAC,GAAG,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import path from 'node:path'\nimport { StackFrame } from 'error-stack-parser'\nimport { valueOrDefault } from './value_checker'\n\nconst projectRootPath = path.join(__dirname, '..')\nconst projectChildDirs = ['src', 'lib', 'node_modules']\n\nexport function isFileNameInCucumber(fileName: string): boolean {\n return projectChildDirs.some((dir) =>\n fileName.startsWith(path.join(projectRootPath, dir))\n )\n}\n\nexport function filterStackTrace(frames: StackFrame[]): StackFrame[] {\n if (isErrorInCucumber(frames)) {\n return frames\n }\n const index = frames.findIndex((x) => isFrameInCucumber(x))\n if (index === -1) {\n return frames\n }\n return frames.slice(0, index)\n}\n\nfunction isErrorInCucumber(frames: StackFrame[]): boolean {\n const filteredFrames = frames.filter((x) => !isFrameInNode(x))\n return filteredFrames.length > 0 && isFrameInCucumber(filteredFrames[0])\n}\n\nfunction isFrameInCucumber(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return isFileNameInCucumber(fileName)\n}\n\nfunction isFrameInNode(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return !fileName.includes(path.sep)\n}\n"]}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
/// <reference types="node" />
|
|
5
1
|
import { EventEmitter } from 'node:events';
|
|
6
2
|
import { Writable as WritableStream } from 'node:stream';
|
|
7
3
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
@@ -30,7 +26,7 @@ declare const FormatterBuilder: {
|
|
|
30
26
|
build(FormatterConstructor: string | typeof Formatter, options: IBuildOptions): Promise<Formatter>;
|
|
31
27
|
getConstructorByType(type: string, cwd: string): Promise<typeof Formatter>;
|
|
32
28
|
getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }: IGetStepDefinitionSnippetBuilderOptions): Promise<StepDefinitionSnippetBuilder>;
|
|
33
|
-
loadCustomClass(type:
|
|
29
|
+
loadCustomClass(type: "formatter" | "syntax", descriptor: string, cwd: string): Promise<any>;
|
|
34
30
|
loadFile(urlOrName: URL | string): Promise<any>;
|
|
35
31
|
resolveConstructor(ImportedCode: any): any;
|
|
36
32
|
};
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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,CAAC;YAC7C,oBAAoB,GAAG,MAAM,gBAAgB,CAAC,oBAAoB,CAChE,oBAAoB,EACpB,OAAO,CAAC,GAAG,CACZ,CAAA;QACH,CAAC;QACD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAC1B,OAAO,CAAC,MA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,kBAAkB,CAAC,qBAAqB;SAChE,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,IAA4B,EAC5B,UAAkB,EAClB,GAAW;QAEX,MAAM,WAAW,GAAG,gBAAgB,CAAC,kBAAkB,CACrD,MAAM,IAAA,wBAAU,EAAC,UAAU,EAAE,GAAG,CAAC,CAClC,CAAA;QACD,IAAI,IAAA,6BAAa,EAAC,WAAW,CAAC,EAAE,CAAC;YAC/B,OAAO,WAAW,CAAA;QACpB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,KAAK,UAAU,oCAAoC,CAClE,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,SAAuB;QACpC,OAAO,MAAM,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED,kBAAkB,CAAC,YAAiB;QAClC,IAAI,IAAA,gCAAgB,EAAC,YAAY,CAAC,EAAE,CAAC;YACnC,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE,CAAC;YACvC,OAAO,YAAY,CAAA;QACrB,CAAC;aAAM,IACL,OAAO,YAAY,KAAK,QAAQ;YAChC,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,EAC1C,CAAC;YACD,OAAO,YAAY,CAAC,OAAO,CAAA;QAC7B,CAAC;aAAM,IACL,OAAO,YAAY,CAAC,OAAO,KAAK,QAAQ;YACxC,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,UAAU,EAClD,CAAC;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,CAAA;QACrC,CAAC;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"]}
|
|
@@ -8,7 +8,6 @@ const node_stream_1 = require("node:stream");
|
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const html_formatter_1 = require("@cucumber/html-formatter");
|
|
11
|
-
const resolve_pkg_1 = __importDefault(require("resolve-pkg"));
|
|
12
11
|
const mime_1 = __importDefault(require("mime"));
|
|
13
12
|
const messages_1 = require("@cucumber/messages");
|
|
14
13
|
exports.default = {
|
|
@@ -18,9 +17,7 @@ exports.default = {
|
|
|
18
17
|
throw new Error('Unable to externalise attachments when formatter is not writing to a file');
|
|
19
18
|
}
|
|
20
19
|
const newId = messages_1.IdGenerator.uuid();
|
|
21
|
-
const htmlStream = new html_formatter_1.CucumberHtmlStream(
|
|
22
|
-
'/dist/main.css', (0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
|
|
23
|
-
'/dist/main.js');
|
|
20
|
+
const htmlStream = new html_formatter_1.CucumberHtmlStream();
|
|
24
21
|
const writeOperations = [];
|
|
25
22
|
on('message', (message) => {
|
|
26
23
|
if (message.attachment && options.externalAttachments) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/formatter/builtin/html.ts"],"names":[],"mappings":";;;;;AAAA,yCAAqC;AACrC,6CAAsC;AACtC,qCAAmC;AACnC,0DAA4B;AAC5B,6DAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/formatter/builtin/html.ts"],"names":[],"mappings":";;;;;AAAA,yCAAqC;AACrC,6CAAsC;AACtC,qCAAmC;AACnC,0DAA4B;AAC5B,6DAA6D;AAC7D,gDAA4B;AAC5B,iDAK2B;AAO3B,kBAAe;IACb,IAAI,EAAE,WAAW;IACjB,SAAS,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;QACzC,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAA;QACH,CAAC;QACD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;QAChC,MAAM,UAAU,GAAG,IAAI,mCAAkB,EAAE,CAAA;QAC3C,MAAM,eAAe,GAAoB,EAAE,CAAA;QAC3C,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YACxB,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CA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Y,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC5D,IAAI,SAAS,EAAE,CAAC;QACd,QAAQ,IAAI,IAAI,SAAS,EAAE,CAAA;IAC7B,CAAC;IACD,MAAM,cAAc,GAAG,IAAA,qBAAS,EAAC,mBAAS,CAAC,CACzC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAC9B,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CACnE,CAAA;IACD,MAAM,OAAO,GAAe;QAC1B,GAAG,QAAQ;QACX,eAAe,EAAE,oCAAyB,CAAC,QAAQ;QACnD,IAAI,EAAE,EAAE;QACR,GAAG,EAAE,KAAK,QAAQ,EAAE;KACrB,CAAA;IACD,OAAO;QACL,UAAU,EAAE,OAAO;QACnB,cAAc;KACf,CAAA;AACH,CAAC","sourcesContent":["import { promisify } from 'node:util'\nimport { finished } from 'node:stream'\nimport { writeFile } from 'node:fs'\nimport path from 'node:path'\nimport { CucumberHtmlStream } from '@cucumber/html-formatter'\nimport mimeTypes from 'mime'\nimport {\n Attachment,\n AttachmentContentEncoding,\n Envelope,\n IdGenerator,\n} from '@cucumber/messages'\nimport { FormatterPlugin } from '../../plugin'\n\ninterface Options {\n externalAttachments?: true\n}\n\nexport default {\n type: 'formatter',\n formatter({ on, options, write, directory }) {\n if (!directory && options.externalAttachments) {\n throw new Error(\n 'Unable to externalise attachments when formatter is not writing to a file'\n )\n }\n const newId = IdGenerator.uuid()\n const htmlStream = new CucumberHtmlStream()\n const writeOperations: Promise<void>[] = []\n on('message', (message) => {\n if (message.attachment && options.externalAttachments) {\n const { attachment, writeOperation } = externaliseAttachment(\n newId,\n message.attachment,\n directory\n )\n htmlStream.write({\n ...message,\n attachment,\n } satisfies Envelope)\n if (writeOperation) {\n writeOperations.push(writeOperation)\n }\n } else {\n htmlStream.write(message)\n }\n })\n htmlStream.on('data', (chunk) => write(chunk))\n\n return async () => {\n htmlStream.end()\n await promisify(finished)(htmlStream)\n await Promise.all(writeOperations)\n }\n },\n optionsKey: 'html',\n} satisfies FormatterPlugin<Options>\n\nconst alwaysInlinedTypes = ['text/x.cucumber.log+plain', 'text/uri-list']\n\nconst encodingsMap = {\n IDENTITY: 'utf-8',\n BASE64: 'base64',\n} as const\n\nfunction externaliseAttachment(\n newId: () => string,\n original: Attachment,\n directory: string\n) {\n if (alwaysInlinedTypes.includes(original.mediaType)) {\n return { attachment: original }\n }\n let filename = `attachment-${newId()}`\n const extension = mimeTypes.getExtension(original.mediaType)\n if (extension) {\n filename += `.${extension}`\n }\n const writeOperation = promisify(writeFile)(\n path.join(directory, filename),\n Buffer.from(original.body, encodingsMap[original.contentEncoding])\n )\n const updated: Attachment = {\n ...original,\n contentEncoding: AttachmentContentEncoding.IDENTITY,\n body: '',\n url: `./${filename}`,\n }\n return {\n attachment: updated,\n writeOperation,\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormatterImplementation } from '../index';
|
|
2
|
-
declare const _default: Record<string,
|
|
2
|
+
declare const _default: Record<string, FormatterImplementation | string>;
|
|
3
3
|
export default _default;
|
|
4
4
|
export declare const documentation: {
|
|
5
5
|
html: string;
|
|
@@ -3,7 +3,7 @@ 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
|
-
exports.createStream =
|
|
6
|
+
exports.createStream = createStream;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const mkdirp_1 = require("mkdirp");
|
|
9
9
|
const fs_1 = __importDefault(require("mz/fs"));
|
|
@@ -28,5 +28,4 @@ async function createStream(target, onStreamError, cwd, logger) {
|
|
|
28
28
|
stream,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
exports.createStream = createStream;
|
|
32
31
|
//# sourceMappingURL=create_stream.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_stream.js","sourceRoot":"","sources":["../../src/formatter/create_stream.ts"],"names":[],"mappings":"
|
|
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,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findClassOrPlugin =
|
|
3
|
+
exports.findClassOrPlugin = findClassOrPlugin;
|
|
4
4
|
const value_checker_1 = require("../value_checker");
|
|
5
5
|
function findClassOrPlugin(imported) {
|
|
6
6
|
return findRecursive(imported, 3);
|
|
7
7
|
}
|
|
8
|
-
exports.findClassOrPlugin = findClassOrPlugin;
|
|
9
8
|
function findRecursive(thing, depth) {
|
|
10
9
|
if ((0, value_checker_1.doesNotHaveValue)(thing)) {
|
|
11
10
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find_class_or_plugin.js","sourceRoot":"","sources":["../../src/formatter/find_class_or_plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"find_class_or_plugin.js","sourceRoot":"","sources":["../../src/formatter/find_class_or_plugin.ts"],"names":[],"mappings":";;AAEA,8CAEC;AAJD,oDAAmD;AAEnD,SAAgB,iBAAiB,CAAC,QAAa;IAC7C,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;AACnC,CAAC;AAED,SAAS,aAAa,CAAC,KAAU,EAAE,KAAa;IAC9C,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAChC,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAA;IACd,CAAC;IACD,KAAK,EAAE,CAAA;IACP,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC5C,CAAC;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"]}
|
|
@@ -3,6 +3,7 @@ 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
|
+
exports.default = getColorFns;
|
|
6
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
7
8
|
const supports_color_1 = require("supports-color");
|
|
8
9
|
const value_checker_1 = require("../value_checker");
|
|
@@ -44,7 +45,6 @@ function getColorFns(stream, env, enabled) {
|
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
exports.default = getColorFns;
|
|
48
48
|
function detectSupport(stream, env, enabled) {
|
|
49
49
|
const support = (0, supports_color_1.supportsColor)(stream);
|
|
50
50
|
// if we find FORCE_COLOR, we can let the supports-color library handle that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":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,eAAK,CAAC;YAC3C,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;SAC3C,CAAA;IACH,CAAC;SAAM,CAAC;QACN,OAAO;YACL,SAAS,CAAC,OAA6B;gBACrC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;YACjB,CAAC;YACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAClB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACb,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACrB,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACrB,CAAA;IACH,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CACpB,MAAgB,EAChB,GAAsB,EACtB,OAAiB;IAEjB,MAAM,OAAO,GAAc,IAAA,8BAAa,EAAC,MAAM,CAAC,CAAA;IAChD,4EAA4E;IAC5E,IAAI,aAAa,IAAI,GAAG,IAAI,IAAA,gCAAgB,EAAC,OAAO,CAAC,EAAE,CAAC;QACtD,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAClD,CAAC","sourcesContent":["import { Writable } from 'node:stream'\nimport chalk from 'chalk'\nimport { ColorInfo, supportsColor } from 'supports-color'\nimport { TestStepResultStatus } from '@cucumber/messages'\nimport { doesNotHaveValue } from '../value_checker'\n\nexport type IColorFn = (text: string) => string\n\nexport interface IColorFns {\n forStatus: (status: TestStepResultStatus) => IColorFn\n location: IColorFn\n tag: IColorFn\n diffAdded: IColorFn\n diffRemoved: IColorFn\n errorMessage: IColorFn\n errorStack: IColorFn\n}\n\nexport default function getColorFns(\n stream: Writable,\n env: NodeJS.ProcessEnv,\n enabled?: boolean\n): IColorFns {\n const support: ColorInfo = detectSupport(stream, env, enabled)\n if (support) {\n const chalkInstance = new chalk.Instance(support)\n return {\n forStatus(status: TestStepResultStatus) {\n return {\n AMBIGUOUS: chalkInstance.red.bind(chalk),\n FAILED: chalkInstance.red.bind(chalk),\n PASSED: chalkInstance.green.bind(chalk),\n PENDING: chalkInstance.yellow.bind(chalk),\n SKIPPED: chalkInstance.cyan.bind(chalk),\n UNDEFINED: chalkInstance.yellow.bind(chalk),\n UNKNOWN: chalkInstance.yellow.bind(chalk),\n }[status]\n },\n location: chalkInstance.gray.bind(chalk),\n tag: chalkInstance.cyan.bind(chalk),\n diffAdded: chalkInstance.green.bind(chalk),\n diffRemoved: chalkInstance.red.bind(chalk),\n errorMessage: chalkInstance.red.bind(chalk),\n errorStack: chalkInstance.grey.bind(chalk),\n }\n } else {\n return {\n forStatus(_status: TestStepResultStatus) {\n return (x) => x\n },\n location: (x) => x,\n tag: (x) => x,\n diffAdded: (x) => x,\n diffRemoved: (x) => x,\n errorMessage: (x) => x,\n errorStack: (x) => x,\n }\n }\n}\n\nfunction detectSupport(\n stream: Writable,\n env: NodeJS.ProcessEnv,\n enabled?: boolean\n): ColorInfo {\n const support: ColorInfo = supportsColor(stream)\n // if we find FORCE_COLOR, we can let the supports-color library handle that\n if ('FORCE_COLOR' in env || doesNotHaveValue(enabled)) {\n return support\n }\n return enabled ? support || { level: 1 } : false\n}\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.durationToNanoseconds =
|
|
4
|
-
const NANOS_IN_SECOND =
|
|
3
|
+
exports.durationToNanoseconds = durationToNanoseconds;
|
|
4
|
+
const NANOS_IN_SECOND = 1_000_000_000;
|
|
5
5
|
function durationToNanoseconds(duration) {
|
|
6
6
|
return Math.floor(duration.seconds * NANOS_IN_SECOND + duration.nanos);
|
|
7
7
|
}
|
|
8
|
-
exports.durationToNanoseconds = durationToNanoseconds;
|
|
9
8
|
//# sourceMappingURL=duration_helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duration_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/duration_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"duration_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/duration_helpers.ts"],"names":[],"mappings":";;AAIA,sDAEC;AAJD,MAAM,eAAe,GAAG,aAAa,CAAA;AAErC,SAAgB,qBAAqB,CAAC,QAAkB;IACtD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;AACxE,CAAC","sourcesContent":["import { Duration } from '@cucumber/messages'\n\nconst NANOS_IN_SECOND = 1_000_000_000\n\nexport function durationToNanoseconds(duration: Duration): number {\n return Math.floor(duration.seconds * NANOS_IN_SECOND + duration.nanos)\n}\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
const messages = __importStar(require("@cucumber/messages"));
|
|
27
37
|
const value_checker_1 = require("../../value_checker");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA8C;AAC9C,uDAAqE;AAsBrE,MAAqB,kBAAkB;IAC7B,kBAAkB,GAA6C,EAAE,CAAA;IACjE,SAAS,GAAoC,EAAE,CAAA;IAC/C,WAAW,GAAsC,EAAE,CAAA;IACnD,sBAAsB,GAAyC,EAAE,CAAA;IAChE,uBAAuB,GAAsC,EAAE,CAAA;IAExE,YAAY,gBAA8B;QACxC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAA;IACrC,CAAC;IAED,SAAS,CAAC,QAAgB;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;IACjC,CAAC;IAED,mBAAmB;QACjB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,EAAE;YACxE,O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AE,iBAAiB,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;QACpD,2FAA2F;QAC3F,IAAI,IAAA,6BAAa,EAAC,iBAAiB,CAAC,IAAI,IAAA,6BAAa,EAAC,UAAU,CAAC,EAAE,CAAC;YAClE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;YAC1E,IAAI,IAAA,gCAAgB,EAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;gBAClD,eAAe,CAAC,UAAU,CAAC,GAAG,EAAE,CAAA;YAClC,CAAC;YACD,eAAe,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,EAClB,iBAAiB,EACjB,UAAU,EACV,cAAc,GACY;QAC1B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;YACpE,cAAc,CAAA;IAClB,CAAC;IAED,mBAAmB,CAAC,EAClB,iBAAiB,EACjB,aAAa,GACa;QAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAC/B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAC3D,CAAA;QACD,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,mBAAmB;YAChE,QAAQ,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;QAC9C,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,aAAa,GAAG,aAAa,CAAA;IAC9E,CAAC;CACF;AA5GD,qCA4GC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\n\ninterface ITestCaseAttemptData {\n attempt: number\n willBeRetried: boolean\n testCaseId: string\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n willBeRetried: boolean\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n testCase: messages.TestCase\n worstTestStepResult: messages.TestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Record<string, messages.GherkinDocument> = {}\n private pickleMap: Record<string, messages.Pickle> = {}\n private testCaseMap: Record<string, messages.TestCase> = {}\n private testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.UndefinedParameterType[] = []\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.GherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.Pickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n willBeRetried: testCaseAttemptData.willBeRetried,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n private initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n willBeRetried: false,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {\n duration: { seconds: 0, nanos: 0 },\n status: messages.TestStepResultStatus.UNKNOWN,\n },\n }\n }\n\n storeAttachment(attachment: messages.Attachment): void {\n const { testCaseStartedId, testStepId } = attachment\n // TODO: we shouldn't have to check if these properties have values - they are non-nullable\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push(attachment)\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.TestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =\n testStepResult\n }\n\n storeTestCaseResult({\n testCaseStartedId,\n willBeRetried,\n }: messages.TestCaseFinished): void {\n const stepResults = Object.values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =\n messages.getWorstTestStepResult(stepResults)\n this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried\n }\n}\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getGherkinStepMap = getGherkinStepMap;
|
|
4
|
+
exports.getGherkinScenarioMap = getGherkinScenarioMap;
|
|
5
|
+
exports.getGherkinExampleRuleMap = getGherkinExampleRuleMap;
|
|
6
|
+
exports.getGherkinScenarioLocationMap = getGherkinScenarioLocationMap;
|
|
4
7
|
const value_checker_1 = require("../../value_checker");
|
|
5
8
|
function getGherkinStepMap(gherkinDocument) {
|
|
6
9
|
const result = {};
|
|
@@ -10,7 +13,6 @@ function getGherkinStepMap(gherkinDocument) {
|
|
|
10
13
|
.forEach((x) => x.steps.forEach((step) => (result[step.id] = step)));
|
|
11
14
|
return result;
|
|
12
15
|
}
|
|
13
|
-
exports.getGherkinStepMap = getGherkinStepMap;
|
|
14
16
|
function extractStepContainers(child) {
|
|
15
17
|
if ((0, value_checker_1.doesHaveValue)(child.background)) {
|
|
16
18
|
return [child.background];
|
|
@@ -39,7 +41,6 @@ function getGherkinScenarioMap(gherkinDocument) {
|
|
|
39
41
|
});
|
|
40
42
|
return result;
|
|
41
43
|
}
|
|
42
|
-
exports.getGherkinScenarioMap = getGherkinScenarioMap;
|
|
43
44
|
function getGherkinExampleRuleMap(gherkinDocument) {
|
|
44
45
|
const result = {};
|
|
45
46
|
gherkinDocument.feature.children
|
|
@@ -49,7 +50,6 @@ function getGherkinExampleRuleMap(gherkinDocument) {
|
|
|
49
50
|
.forEach((child) => (result[child.scenario.id] = x.rule)));
|
|
50
51
|
return result;
|
|
51
52
|
}
|
|
52
|
-
exports.getGherkinExampleRuleMap = getGherkinExampleRuleMap;
|
|
53
53
|
function getGherkinScenarioLocationMap(gherkinDocument) {
|
|
54
54
|
const locationMap = {};
|
|
55
55
|
const scenarioMap = getGherkinScenarioMap(gherkinDocument);
|
|
@@ -62,5 +62,4 @@ function getGherkinScenarioLocationMap(gherkinDocument) {
|
|
|
62
62
|
});
|
|
63
63
|
return locationMap;
|
|
64
64
|
}
|
|
65
|
-
exports.getGherkinScenarioLocationMap = getGherkinScenarioLocationMap;
|
|
66
65
|
//# sourceMappingURL=gherkin_document_parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;AAGA,8CAWC;AAiBD,sDAkBC;AAED,4DAYC;AAED,sEAkBC;AAlFD,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAAyC;IAEzC,MAAM,MAAM,GAAkC,EAAE,CAAA;IAChD,eAAe,CAAC,OAAO,CAAC,QAAQ;SAC7B,GAAG,CAAC,qBAAqB,CAAC;SAC1B,IAAI,EAAE;SACN,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CACnE,CAAA;IACH,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,qBAAqB,CAC5B,KAA4B;IAE5B,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QACpC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IAC3B,CAAC;SAAM,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAC3C,I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MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAC5D,CAAA;IACH,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAgB,6BAA6B,CAC3C,eAAyC;IAEzC,MAAM,WAAW,GAAsC,EAAE,CAAA;IACzD,MAAM,WAAW,GACf,qBAAqB,CAAC,eAAe,CAAC,CAAA;IACxC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACtC,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAA;QACnC,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9B,CAAC,CAAC,SAAS,CAAC,OAAO,CACjB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAC7D,CACF,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport function getGherkinStepMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Step> {\n const result: Record<string, messages.Step> = {}\n gherkinDocument.feature.children\n .map(extractStepContainers)\n .flat()\n .forEach((x) =>\n x.steps.forEach((step: messages.Step) => (result[step.id] = step))\n )\n return result\n}\n\nfunction extractStepContainers(\n child: messages.FeatureChild\n): Array<messages.Scenario | messages.Background> {\n if (doesHaveValue(child.background)) {\n return [child.background]\n } else if (doesHaveValue(child.rule)) {\n return child.rule.children.map((ruleChild) =>\n doesHaveValue(ruleChild.background)\n ? ruleChild.background\n : ruleChild.scenario\n )\n }\n return [child.scenario]\n}\n\nexport function getGherkinScenarioMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Scenario> {\n const result: Record<string, messages.Scenario> = {}\n gherkinDocument.feature.children\n .map((child: messages.FeatureChild) => {\n if (doesHaveValue(child.rule)) {\n return child.rule.children\n }\n return [child]\n })\n .flat()\n .forEach((x) => {\n if (x.scenario != null) {\n result[x.scenario.id] = x.scenario\n }\n })\n return result\n}\n\nexport function getGherkinExampleRuleMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Rule> {\n const result: Record<string, messages.Rule> = {}\n gherkinDocument.feature.children\n .filter((x) => x.rule != null)\n .forEach((x) =>\n x.rule.children\n .filter((child) => doesHaveValue(child.scenario))\n .forEach((child) => (result[child.scenario.id] = x.rule))\n )\n return result\n}\n\nexport function getGherkinScenarioLocationMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Location> {\n const locationMap: Record<string, messages.Location> = {}\n const scenarioMap: Record<string, messages.Scenario> =\n getGherkinScenarioMap(gherkinDocument)\n Object.keys(scenarioMap).forEach((id) => {\n const scenario = scenarioMap[id]\n locationMap[id] = scenario.location\n if (doesHaveValue(scenario.examples)) {\n scenario.examples.forEach((x) =>\n x.tableBody.forEach(\n (tableRow) => (locationMap[tableRow.id] = tableRow.location)\n )\n )\n }\n })\n return locationMap\n}\n"]}
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/helpers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAAkE;AAUzD,sDAAqB;AAT9B,8DAA+C;AASf,oCAAY;AAP5C,uEAAiE;AAAxD,gIAAA,oBAAoB,OAAA;AAC7B,+DAAsE;AAA7D,2IAAA,OAAO,OAAsB;AACtC,+CAAgE;AAAvD,2GAAA,WAAW,OAAA;AAAE,kHAAA,kBAAkB,OAAA;AACxC,iDAA4E;AAAnE,4GAAA,WAAW,OAAA;AAAE,0GAAA,SAAS,OAAA;AAAE,0GAAA,SAAS,OAAA;AAAE,wGAAA,OAAO,OAAA;AACnD,uDAAmD;AAA1C,kHAAA,cAAc,OAAA;AACvB,qDAAiD;AAAxC,gHAAA,aAAa,OAAA;AACtB,iDAA0C;AAAjC,yGAAA,QAAQ,OAAA","sourcesContent":["import * as GherkinDocumentParser from './gherkin_document_parser'\nimport * as PickleParser from './pickle_parser'\n\nexport { parseTestCaseAttempt } from './test_case_attempt_parser'\nexport { default as EventDataCollector } from './event_data_collector'\nexport { KeywordType, getStepKeywordType } from './keyword_type'\nexport { formatIssue, isWarning, isFailure, isIssue } from './issue_helpers'\nexport { formatLocation } from './location_helpers'\nexport { formatSummary } from './summary_helpers'\nexport { getUsage } from './usage_helpers'\nexport { GherkinDocumentParser, PickleParser }\n"]}
|
|
@@ -3,7 +3,12 @@ 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
|
-
exports.
|
|
6
|
+
exports.isFailure = isFailure;
|
|
7
|
+
exports.isWarning = isWarning;
|
|
8
|
+
exports.isIssue = isIssue;
|
|
9
|
+
exports.formatIssue = formatIssue;
|
|
10
|
+
exports.formatUndefinedParameterTypes = formatUndefinedParameterTypes;
|
|
11
|
+
exports.formatUndefinedParameterType = formatUndefinedParameterType;
|
|
7
12
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
8
13
|
const test_case_attempt_formatter_1 = require("./test_case_attempt_formatter");
|
|
9
14
|
function isFailure(result, willBeRetried = false) {
|
|
@@ -11,15 +16,12 @@ function isFailure(result, willBeRetried = false) {
|
|
|
11
16
|
result.status === 'UNDEFINED' ||
|
|
12
17
|
(result.status === 'FAILED' && !willBeRetried));
|
|
13
18
|
}
|
|
14
|
-
exports.isFailure = isFailure;
|
|
15
19
|
function isWarning(result, willBeRetried = false) {
|
|
16
20
|
return (result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried));
|
|
17
21
|
}
|
|
18
|
-
exports.isWarning = isWarning;
|
|
19
22
|
function isIssue(result) {
|
|
20
23
|
return isFailure(result) || isWarning(result);
|
|
21
24
|
}
|
|
22
|
-
exports.isIssue = isIssue;
|
|
23
25
|
function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, printAttachments = true, }) {
|
|
24
26
|
const prefix = `${number.toString()}) `;
|
|
25
27
|
const formattedTestCaseAttempt = (0, test_case_attempt_formatter_1.formatTestCaseAttempt)({
|
|
@@ -38,7 +40,6 @@ function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, suppor
|
|
|
38
40
|
});
|
|
39
41
|
return updatedLines.join('\n');
|
|
40
42
|
}
|
|
41
|
-
exports.formatIssue = formatIssue;
|
|
42
43
|
function formatUndefinedParameterTypes(undefinedParameterTypes) {
|
|
43
44
|
const output = [`Undefined parameter types:\n\n`];
|
|
44
45
|
const withLatest = {};
|
|
@@ -51,9 +52,7 @@ function formatUndefinedParameterTypes(undefinedParameterTypes) {
|
|
|
51
52
|
output.push('\n\n');
|
|
52
53
|
return output.join('');
|
|
53
54
|
}
|
|
54
|
-
exports.formatUndefinedParameterTypes = formatUndefinedParameterTypes;
|
|
55
55
|
function formatUndefinedParameterType(parameterType) {
|
|
56
56
|
return `"${parameterType.name}" e.g. \`${parameterType.expression}\``;
|
|
57
57
|
}
|
|
58
|
-
exports.formatUndefinedParameterType = formatUndefinedParameterType;
|
|
59
58
|
//# sourceMappingURL=issue_helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;AAQA,8BASC;AAED,8BAOC;AAED,0BAEC;AAWD,kCAwBC;AAED,sEAiBC;AAED,oEAIC;AA1FD,kEAAwC;AAKxC,+EAAqE;AAGrE,SAAgB,SAAS,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,CAAC,MAAM,CAAC,MAAM,KAAK,Q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,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;QAChD,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAA;IAChD,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;SACtB,GAAG,CACF,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,4BAA4B,CAAC,aAAa,CAAC,EAAE,CACtE;SACA,IAAI,CAAC,IAAI,CAAC,CACd,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAED,SAAgB,4BAA4B,CAC1C,aAA8C;IAE9C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { SupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nexport function isFailure(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'AMBIGUOUS' ||\n result.status === 'UNDEFINED' ||\n (result.status === 'FAILED' && !willBeRetried)\n )\n}\n\nexport function isWarning(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried)\n )\n}\n\nexport function isIssue(result: messages.TestStepResult): boolean {\n return isFailure(result) || isWarning(result)\n}\n\nexport interface IFormatIssueRequest {\n colorFns: IColorFns\n number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: SupportCodeLibrary\n printAttachments?: boolean\n}\n\nexport function formatIssue({\n colorFns,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n printAttachments = true,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n printAttachments,\n })\n const lines = formattedTestCaseAttempt.split('\\n')\n const updatedLines = lines.map((line, index) => {\n if (index === 0) {\n return `${prefix}${line}`\n }\n return indentString(line, prefix.length)\n })\n return updatedLines.join('\\n')\n}\n\nexport function formatUndefinedParameterTypes(\n undefinedParameterTypes: messages.UndefinedParameterType[]\n): string {\n const output = [`Undefined parameter types:\\n\\n`]\n const withLatest: Record<string, messages.UndefinedParameterType> = {}\n undefinedParameterTypes.forEach((parameterType) => {\n withLatest[parameterType.name] = parameterType\n })\n output.push(\n Object.values(withLatest)\n .map(\n (parameterType) => `- ${formatUndefinedParameterType(parameterType)}`\n )\n .join('\\n')\n )\n output.push('\\n\\n')\n return output.join('')\n}\n\nexport function formatUndefinedParameterType(\n parameterType: messages.UndefinedParameterType\n): string {\n return `\"${parameterType.name}\" e.g. \\`${parameterType.expression}\\``\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.KeywordType = void 0;
|
|
4
|
+
exports.getStepKeywordType = getStepKeywordType;
|
|
4
5
|
const gherkin_1 = require("@cucumber/gherkin");
|
|
5
6
|
const value_checker_1 = require("../../value_checker");
|
|
6
7
|
var KeywordType;
|
|
@@ -8,7 +9,7 @@ var KeywordType;
|
|
|
8
9
|
KeywordType["Precondition"] = "precondition";
|
|
9
10
|
KeywordType["Event"] = "event";
|
|
10
11
|
KeywordType["Outcome"] = "outcome";
|
|
11
|
-
})(KeywordType
|
|
12
|
+
})(KeywordType || (exports.KeywordType = KeywordType = {}));
|
|
12
13
|
function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
13
14
|
const dialect = gherkin_1.dialects[language];
|
|
14
15
|
const stepKeywords = ['given', 'when', 'then', 'and', 'but'];
|
|
@@ -28,5 +29,4 @@ function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
|
28
29
|
return KeywordType.Precondition;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
exports.getStepKeywordType = getStepKeywordType;
|
|
32
32
|
//# sourceMappingURL=keyword_type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyword_type.js","sourceRoot":"","sources":["../../../src/formatter/helpers/keyword_type.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"keyword_type.js","sourceRoot":"","sources":["../../../src/formatter/helpers/keyword_type.ts"],"names":[],"mappings":";;;AAeA,gDAsBC;AArCD,+CAAqD;AACrD,uDAAmD;AAEnD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAQD,SAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,mBAAmB,GACQ;IAC3B,MAAM,OAAO,GAAY,kBAAQ,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IACrE,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IACvE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,KAAK,CAAA;QAC1B,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,OAAO,CAAA;QAC5B,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,IAAI,IAAA,6BAAa,EAAC,mBAAmB,CAAC,EAAE,CAAC;gBACvC,OAAO,mBAAmB,CAAA;YAC5B,CAAC;QACH,cAAc;QACd;YACE,OAAO,WAAW,CAAC,YAAY,CAAA;IACnC,CAAC;AACH,CAAC","sourcesContent":["import { Dialect, dialects } from '@cucumber/gherkin'\nimport { doesHaveValue } from '../../value_checker'\n\nexport enum KeywordType {\n Precondition = 'precondition',\n Event = 'event',\n Outcome = 'outcome',\n}\n\nexport interface IGetStepKeywordTypeOptions {\n keyword: string\n language: string\n previousKeywordType?: KeywordType\n}\n\nexport function getStepKeywordType({\n keyword,\n language,\n previousKeywordType,\n}: IGetStepKeywordTypeOptions): KeywordType {\n const dialect: Dialect = dialects[language]\n const stepKeywords = ['given', 'when', 'then', 'and', 'but'] as const\n const type = stepKeywords.find((key) => dialect[key].includes(keyword))\n switch (type) {\n case 'when':\n return KeywordType.Event\n case 'then':\n return KeywordType.Outcome\n case 'and':\n case 'but':\n if (doesHaveValue(previousKeywordType)) {\n return previousKeywordType\n }\n // fallthrough\n default:\n return KeywordType.Precondition\n }\n}\n"]}
|
|
@@ -3,7 +3,7 @@ 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
|
-
exports.formatLocation =
|
|
6
|
+
exports.formatLocation = formatLocation;
|
|
7
7
|
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const value_checker_1 = require("../../value_checker");
|
|
9
9
|
function formatLocation(obj, cwd) {
|
|
@@ -13,5 +13,4 @@ function formatLocation(obj, cwd) {
|
|
|
13
13
|
}
|
|
14
14
|
return `${uri}:${obj.line.toString()}`;
|
|
15
15
|
}
|
|
16
|
-
exports.formatLocation = formatLocation;
|
|
17
16
|
//# sourceMappingURL=location_helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":";;;;;AAIA,wCAMC;AAVD,0DAA4B;AAC5B,uDAAmD;AAGnD,SAAgB,cAAc,CAAC,GAAgB,EAAE,GAAY;IAC3D,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;IACjB,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE,CAAC;QACvB,GAAG,GAAG,mBAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IAC/B,CAAC;IACD,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAA;AACxC,CAAC","sourcesContent":["import path from 'node:path'\nimport { doesHaveValue } from '../../value_checker'\nimport { ILineAndUri } from '../../types'\n\nexport function formatLocation(obj: ILineAndUri, cwd?: string): string {\n let uri = obj.uri\n if (doesHaveValue(cwd)) {\n uri = path.relative(cwd, uri)\n }\n return `${uri}:${obj.line.toString()}`\n}\n"]}
|