@cucumber/cucumber 11.2.0 → 12.0.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 +0 -1
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/check_schema.js +18 -10
- package/lib/configuration/check_schema.js.map +1 -1
- package/lib/configuration/default_configuration.js +0 -1
- package/lib/configuration/default_configuration.js.map +1 -1
- package/lib/configuration/from_file.js +4 -5
- 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/types.d.ts +0 -5
- package/lib/configuration/types.js.map +1 -1
- package/lib/configuration/validate_configuration.js +1 -5
- 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 +3 -4
- 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.d.ts +5 -1
- package/lib/runtime/step_runner.js +24 -12
- 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 +4 -4
- package/lib/runtime/test_case_runner.js +47 -20
- 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/types.d.ts +2 -0
- package/lib/support_code_library_builder/types.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 +2 -2
- 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 +59 -60
- 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":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mappings":";;;;;AAAA,0DAA4B;AAC5B,iCAA+C;AAC/C,8FAAmE;AACnE,mDAA+C;AAc/C,MAAM,cAAc,GAAG;IACrB,KAAK,CAAC,GAAG,CAAC,EACR,SAAS,EACT,OAAO,EACP,EAAE,EACF,qBAAqB,GACT;QACZ,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtD,SAAS,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,MAAoB,EAAE,EAAE;gBACpD,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mappings":";;;;;AAAA,0DAA4B;AAC5B,iCAA+C;AAC/C,8FAAmE;AACnE,mDAA+C;AAc/C,MAAM,cAAc,GAAG;IACrB,KAAK,CAAC,GAAG,CAAC,EACR,SAAS,EACT,OAAO,EACP,EAAE,EACF,qBAAqB,GACT;QACZ,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtD,SAAS,CAAC,IAAI,CAAC,CAAC,KAAY,EAAE,MAAoB,EAAE,EAAE;gBACpD,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;oBACzB,MAAM,CAAC,KAAK,CAAC,CAAA;gBACf,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,MAAM,CAAC,CAAA;gBACjB,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAA;QACZ,IAAI,CAAC;YACH,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAA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C,EAAE,CAAC;YAC/B,MAAM,cAAc,GAClB,iCAAiC;gBACjC,CAAC,iBAAiB,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,kBAAkB,CAAC;gBACjE,WAAW,qBAAqB,CAAC,QAAQ,EAAE,eAAe,CAAA;YAC5D,YAAY,GAAG,IAAA,6BAAsB,EACnC,YAAY,EACZ,qBAAqB,EACrB,cAAc,CACf,CAAA;QACH,CAAC;QAED,IAAI,KAAK,EAAE,MAAM,CAAA;QACjB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,YAAY,CAAA;QAC7B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;gBACvB,KAAK,GAAG,CAAC,CAAA;YACX,CAAC;iBAAM,IAAI,IAAA,6BAAa,EAAC,CAAC,CAAC,EAAE,CAAC;gBAC5B,KAAK,GAAG,mBAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACxB,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;YACxD,CAAC;QACH,CAAC;QAED,oCAAwB,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;QAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,kBAAe,cAAc,CAAA","sourcesContent":["import util from 'node:util'\nimport { wrapPromiseWithTimeout } from './time'\nimport UncaughtExceptionManager from './uncaught_exception_manager'\nimport { doesHaveValue } from './value_checker'\n\nexport interface IRunRequest {\n argsArray: any[]\n thisArg: any\n fn: Function\n timeoutInMilliseconds: number\n}\n\nexport interface IRunResponse {\n error?: any\n result?: any\n}\n\nconst UserCodeRunner = {\n async run({\n argsArray,\n thisArg,\n fn,\n timeoutInMilliseconds,\n }: IRunRequest): Promise<IRunResponse> {\n const callbackPromise = new Promise((resolve, reject) => {\n argsArray.push((error: Error, result: IRunResponse) => {\n if (doesHaveValue(error)) {\n reject(error)\n } else {\n resolve(result)\n }\n })\n })\n\n let fnReturn\n try {\n fnReturn = fn.apply(thisArg, argsArray)\n } catch (e) {\n const error = e instanceof Error ? e : util.format(e)\n return { error }\n }\n\n const racingPromises = []\n const callbackInterface = fn.length === argsArray.length\n const promiseInterface =\n doesHaveValue(fnReturn) && typeof fnReturn.then === 'function'\n\n if (callbackInterface && promiseInterface) {\n return {\n error: new Error(\n 'function uses multiple asynchronous interfaces: callback and promise\\n' +\n 'to use the callback interface: do not return a promise\\n' +\n 'to use the promise interface: remove the last argument to the function'\n ),\n }\n } else if (callbackInterface) {\n racingPromises.push(callbackPromise)\n } else if (promiseInterface) {\n racingPromises.push(fnReturn)\n } else {\n return { result: fnReturn }\n }\n\n let exceptionHandler\n const uncaughtExceptionPromise = new Promise((resolve, reject) => {\n exceptionHandler = reject\n UncaughtExceptionManager.registerHandler(exceptionHandler)\n })\n racingPromises.push(uncaughtExceptionPromise)\n\n let finalPromise = Promise.race(racingPromises)\n if (timeoutInMilliseconds >= 0) {\n const timeoutMessage =\n 'function timed out, ensure the ' +\n (callbackInterface ? 'callback is executed' : 'promise resolves') +\n ` within ${timeoutInMilliseconds.toString()} milliseconds`\n finalPromise = wrapPromiseWithTimeout(\n finalPromise,\n timeoutInMilliseconds,\n timeoutMessage\n )\n }\n\n let error, result\n try {\n result = await finalPromise\n } catch (e) {\n if (e instanceof Error) {\n error = e\n } else if (doesHaveValue(e)) {\n error = util.format(e)\n } else {\n error = new Error('Promise rejected without a reason')\n }\n }\n\n UncaughtExceptionManager.unregisterHandler(exceptionHandler)\n\n return { error, result }\n },\n}\n\nexport default UserCodeRunner\n"]}
|
package/lib/value_checker.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.doesHaveValue = doesHaveValue;
|
|
4
|
+
exports.doesNotHaveValue = doesNotHaveValue;
|
|
5
|
+
exports.valueOrDefault = valueOrDefault;
|
|
4
6
|
function doesHaveValue(value) {
|
|
5
7
|
return !doesNotHaveValue(value);
|
|
6
8
|
}
|
|
7
|
-
exports.doesHaveValue = doesHaveValue;
|
|
8
9
|
function doesNotHaveValue(value) {
|
|
9
10
|
return value === null || value === undefined;
|
|
10
11
|
}
|
|
11
|
-
exports.doesNotHaveValue = doesNotHaveValue;
|
|
12
12
|
function valueOrDefault(value, defaultValue) {
|
|
13
13
|
if (doesHaveValue(value)) {
|
|
14
14
|
return value;
|
|
15
15
|
}
|
|
16
16
|
return defaultValue;
|
|
17
17
|
}
|
|
18
|
-
exports.valueOrDefault = valueOrDefault;
|
|
19
18
|
//# sourceMappingURL=value_checker.js.map
|
package/lib/value_checker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value_checker.js","sourceRoot":"","sources":["../src/value_checker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"value_checker.js","sourceRoot":"","sources":["../src/value_checker.ts"],"names":[],"mappings":";;AAAA,sCAEC;AAED,4CAEC;AAED,wCAKC;AAbD,SAAgB,aAAa,CAAI,KAAQ;IACvC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC;AAED,SAAgB,gBAAgB,CAAI,KAAQ;IAC1C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAA;AAC9C,CAAC;AAED,SAAgB,cAAc,CAAI,KAAQ,EAAE,YAAe;IACzD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,YAAY,CAAA;AACrB,CAAC","sourcesContent":["export function doesHaveValue<T>(value: T): boolean {\n return !doesNotHaveValue(value)\n}\n\nexport function doesNotHaveValue<T>(value: T): boolean {\n return value === null || value === undefined\n}\n\nexport function valueOrDefault<T>(value: T, defaultValue: T): T {\n if (doesHaveValue(value)) {\n return value\n }\n return defaultValue\n}\n"]}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "12.0.0";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '12.0.0'\n"]}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"gherkin",
|
|
9
9
|
"tests"
|
|
10
10
|
],
|
|
11
|
-
"version": "
|
|
11
|
+
"version": "12.0.0",
|
|
12
12
|
"funding": "https://opencollective.com/cucumber",
|
|
13
13
|
"homepage": "https://github.com/cucumber/cucumber-js",
|
|
14
14
|
"author": "Julien Biezemans <jb@jbpros.com>",
|
|
@@ -210,31 +210,31 @@
|
|
|
210
210
|
},
|
|
211
211
|
"types": "./lib/index.d.ts",
|
|
212
212
|
"engines": {
|
|
213
|
-
"node": "
|
|
213
|
+
"node": "20 || 22 || >=24"
|
|
214
214
|
},
|
|
215
215
|
"enginesTested": {
|
|
216
|
-
"node": "
|
|
216
|
+
"node": "20 || 22 || 24"
|
|
217
217
|
},
|
|
218
218
|
"dependencies": {
|
|
219
219
|
"@cucumber/ci-environment": "10.0.1",
|
|
220
220
|
"@cucumber/cucumber-expressions": "18.0.1",
|
|
221
|
-
"@cucumber/gherkin": "
|
|
221
|
+
"@cucumber/gherkin": "32.1.2",
|
|
222
222
|
"@cucumber/gherkin-streams": "5.0.1",
|
|
223
|
-
"@cucumber/gherkin-utils": "9.
|
|
224
|
-
"@cucumber/html-formatter": "21.
|
|
223
|
+
"@cucumber/gherkin-utils": "9.2.0",
|
|
224
|
+
"@cucumber/html-formatter": "21.13.0",
|
|
225
225
|
"@cucumber/junit-xml-formatter": "0.7.1",
|
|
226
226
|
"@cucumber/message-streams": "4.0.1",
|
|
227
|
-
"@cucumber/messages": "27.0
|
|
228
|
-
"@cucumber/tag-expressions": "6.
|
|
227
|
+
"@cucumber/messages": "27.2.0",
|
|
228
|
+
"@cucumber/tag-expressions": "6.2.0",
|
|
229
229
|
"assertion-error-formatter": "^3.0.0",
|
|
230
230
|
"capital-case": "^1.0.4",
|
|
231
231
|
"chalk": "^4.1.2",
|
|
232
|
-
"cli-table3": "0.6.
|
|
232
|
+
"cli-table3": "0.6.5",
|
|
233
233
|
"commander": "^10.0.0",
|
|
234
234
|
"debug": "^4.3.4",
|
|
235
235
|
"error-stack-parser": "^2.1.4",
|
|
236
236
|
"figures": "^3.2.0",
|
|
237
|
-
"glob": "^
|
|
237
|
+
"glob": "^11.0.0",
|
|
238
238
|
"has-ansi": "^4.0.1",
|
|
239
239
|
"indent-string": "^4.0.0",
|
|
240
240
|
"is-installed-globally": "^0.4.0",
|
|
@@ -242,77 +242,76 @@
|
|
|
242
242
|
"knuth-shuffle-seeded": "^1.0.6",
|
|
243
243
|
"lodash.merge": "^4.6.2",
|
|
244
244
|
"lodash.mergewith": "^4.6.2",
|
|
245
|
-
"luxon": "3.
|
|
245
|
+
"luxon": "3.6.1",
|
|
246
246
|
"mime": "^3.0.0",
|
|
247
247
|
"mkdirp": "^2.1.5",
|
|
248
248
|
"mz": "^2.7.0",
|
|
249
249
|
"progress": "^2.0.3",
|
|
250
250
|
"read-package-up": "^11.0.0",
|
|
251
|
-
"
|
|
252
|
-
"semver": "7.5.3",
|
|
251
|
+
"semver": "7.7.2",
|
|
253
252
|
"string-argv": "0.3.1",
|
|
254
253
|
"supports-color": "^8.1.1",
|
|
255
|
-
"
|
|
256
|
-
"type-fest": "^4.8.3",
|
|
254
|
+
"type-fest": "^4.41.0",
|
|
257
255
|
"util-arity": "^1.1.0",
|
|
258
256
|
"yaml": "^2.2.2",
|
|
259
|
-
"yup": "1.
|
|
257
|
+
"yup": "1.6.1"
|
|
260
258
|
},
|
|
261
259
|
"devDependencies": {
|
|
262
|
-
"@cucumber/compatibility-kit": "
|
|
263
|
-
"@cucumber/query": "13.0
|
|
264
|
-
"@
|
|
265
|
-
"@
|
|
266
|
-
"@
|
|
267
|
-
"@
|
|
268
|
-
"@
|
|
269
|
-
"@types/
|
|
260
|
+
"@cucumber/compatibility-kit": "18.0.3",
|
|
261
|
+
"@cucumber/query": "13.5.0",
|
|
262
|
+
"@eslint/compat": "^1.3.0",
|
|
263
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
264
|
+
"@eslint/js": "^9.29.0",
|
|
265
|
+
"@microsoft/api-extractor": "7.52.8",
|
|
266
|
+
"@sinonjs/fake-timers": "14.0.0",
|
|
267
|
+
"@types/chai": "4.3.20",
|
|
268
|
+
"@types/debug": "4.1.12",
|
|
269
|
+
"@types/dirty-chai": "2.0.5",
|
|
270
|
+
"@types/express": "5.0.3",
|
|
270
271
|
"@types/fs-extra": "9.0.13",
|
|
271
272
|
"@types/glob": "8.1.0",
|
|
272
|
-
"@types/has-ansi": "5.0.
|
|
273
|
-
"@types/lodash.merge": "4.6.
|
|
274
|
-
"@types/lodash.mergewith": "4.6.
|
|
275
|
-
"@types/luxon": "3.2
|
|
276
|
-
"@types/mocha": "10.0.
|
|
277
|
-
"@types/mustache": "4.2.
|
|
278
|
-
"@types/mz": "2.7.
|
|
279
|
-
"@types/node": "20.
|
|
280
|
-
"@types/progress": "2.0.
|
|
281
|
-
"@types/semver": "7.
|
|
282
|
-
"@types/sinon-chai": "3.2.
|
|
283
|
-
"@types/sinonjs__fake-timers": "8.1.
|
|
284
|
-
"@types/stream-buffers": "3.0.
|
|
285
|
-
"@types/tmp": "0.2.
|
|
286
|
-
"@typescript-eslint/eslint-plugin": "
|
|
287
|
-
"@typescript-eslint/parser": "
|
|
288
|
-
"chai": "4.
|
|
289
|
-
"chai-exclude": "2.1.
|
|
273
|
+
"@types/has-ansi": "5.0.2",
|
|
274
|
+
"@types/lodash.merge": "4.6.9",
|
|
275
|
+
"@types/lodash.mergewith": "4.6.9",
|
|
276
|
+
"@types/luxon": "3.6.2",
|
|
277
|
+
"@types/mocha": "10.0.10",
|
|
278
|
+
"@types/mustache": "4.2.6",
|
|
279
|
+
"@types/mz": "2.7.9",
|
|
280
|
+
"@types/node": "20.17.46",
|
|
281
|
+
"@types/progress": "2.0.7",
|
|
282
|
+
"@types/semver": "7.7.0",
|
|
283
|
+
"@types/sinon-chai": "3.2.12",
|
|
284
|
+
"@types/sinonjs__fake-timers": "8.1.5",
|
|
285
|
+
"@types/stream-buffers": "3.0.7",
|
|
286
|
+
"@types/tmp": "0.2.6",
|
|
287
|
+
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
288
|
+
"@typescript-eslint/parser": "^8.34.0",
|
|
289
|
+
"chai": "4.5.0",
|
|
290
|
+
"chai-exclude": "2.1.1",
|
|
290
291
|
"coffeescript": "2.7.0",
|
|
291
292
|
"dependency-lint": "7.1.0",
|
|
292
293
|
"dirty-chai": "2.0.1",
|
|
293
|
-
"eslint": "
|
|
294
|
-
"eslint-
|
|
295
|
-
"eslint-plugin-
|
|
296
|
-
"eslint-plugin-
|
|
297
|
-
"
|
|
298
|
-
"eslint-plugin-unicorn": "^48.0.1",
|
|
299
|
-
"express": "^4.21.0",
|
|
294
|
+
"eslint": "^9.29.0",
|
|
295
|
+
"eslint-plugin-import": "^2.31.0",
|
|
296
|
+
"eslint-plugin-n": "^17.20.0",
|
|
297
|
+
"eslint-plugin-unicorn": "^59.0.1",
|
|
298
|
+
"express": "^5.0.0",
|
|
300
299
|
"fs-extra": "10.1.0",
|
|
301
|
-
"genversion": "3.
|
|
300
|
+
"genversion": "3.2.0",
|
|
302
301
|
"mocha": "^11.0.1",
|
|
303
302
|
"mustache": "4.2.0",
|
|
304
|
-
"nyc": "
|
|
305
|
-
"prettier": "3.
|
|
303
|
+
"nyc": "17.1.0",
|
|
304
|
+
"prettier": "^3.5.3",
|
|
306
305
|
"reindent-template-literals": "1.1.0",
|
|
307
|
-
"shx": "0.
|
|
308
|
-
"sinon": "
|
|
306
|
+
"shx": "0.4.0",
|
|
307
|
+
"sinon": "21.0.0",
|
|
309
308
|
"sinon-chai": "3.7.0",
|
|
310
|
-
"stream-to-string": "1.2.
|
|
311
|
-
"
|
|
312
|
-
"
|
|
313
|
-
"
|
|
314
|
-
"typedoc
|
|
315
|
-
"typescript": "^
|
|
309
|
+
"stream-to-string": "1.2.1",
|
|
310
|
+
"tmp": "0.2.3",
|
|
311
|
+
"ts-node": "10.9.2",
|
|
312
|
+
"tsd": "0.32.0",
|
|
313
|
+
"typedoc": "^0.28.0",
|
|
314
|
+
"typescript": "^5.8.3"
|
|
316
315
|
},
|
|
317
316
|
"overrides": {
|
|
318
317
|
"ansi-regex": "^5.0.1"
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
import { Transform } from 'node:stream';
|
|
5
|
-
import http from 'node:http';
|
|
6
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT';
|
|
7
|
-
/**
|
|
8
|
-
* This Writable writes data to a HTTP/HTTPS URL.
|
|
9
|
-
*
|
|
10
|
-
* It has special handling for https://reports.cucumber.io/
|
|
11
|
-
* which uses an API where the first request is a `GET`,
|
|
12
|
-
* and if the response is 202 with a Location header, issues
|
|
13
|
-
* a PUT request to that URL.
|
|
14
|
-
*
|
|
15
|
-
* 3xx redirects are not currently followed.
|
|
16
|
-
*/
|
|
17
|
-
export default class HttpStream extends Transform {
|
|
18
|
-
private readonly url;
|
|
19
|
-
private readonly method;
|
|
20
|
-
private readonly headers;
|
|
21
|
-
private tempFilePath;
|
|
22
|
-
private tempFile;
|
|
23
|
-
constructor(url: string, method: HttpMethod, headers: http.OutgoingHttpHeaders);
|
|
24
|
-
_write(chunk: any, encoding: BufferEncoding, callback: (err?: Error | null) => void): void;
|
|
25
|
-
_final(callback: (error?: Error | null) => void): void;
|
|
26
|
-
private pushResponseBody;
|
|
27
|
-
private emitErrorUnlessHttp2xx;
|
|
28
|
-
private sendHttpRequest;
|
|
29
|
-
}
|
|
30
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_stream_1 = require("node:stream");
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const node_http_1 = __importDefault(require("node:http"));
|
|
9
|
-
const node_https_1 = __importDefault(require("node:https"));
|
|
10
|
-
const tmp_1 = __importDefault(require("tmp"));
|
|
11
|
-
const value_checker_1 = require("../value_checker");
|
|
12
|
-
/**
|
|
13
|
-
* This Writable writes data to a HTTP/HTTPS URL.
|
|
14
|
-
*
|
|
15
|
-
* It has special handling for https://reports.cucumber.io/
|
|
16
|
-
* which uses an API where the first request is a `GET`,
|
|
17
|
-
* and if the response is 202 with a Location header, issues
|
|
18
|
-
* a PUT request to that URL.
|
|
19
|
-
*
|
|
20
|
-
* 3xx redirects are not currently followed.
|
|
21
|
-
*/
|
|
22
|
-
class HttpStream extends node_stream_1.Transform {
|
|
23
|
-
url;
|
|
24
|
-
method;
|
|
25
|
-
headers;
|
|
26
|
-
tempFilePath;
|
|
27
|
-
tempFile;
|
|
28
|
-
constructor(url, method, headers) {
|
|
29
|
-
super({
|
|
30
|
-
readableObjectMode: true,
|
|
31
|
-
});
|
|
32
|
-
this.url = url;
|
|
33
|
-
this.method = method;
|
|
34
|
-
this.headers = headers;
|
|
35
|
-
}
|
|
36
|
-
_write(chunk, encoding, callback) {
|
|
37
|
-
if (this.tempFile === undefined) {
|
|
38
|
-
tmp_1.default.file((err, name, fd) => {
|
|
39
|
-
if ((0, value_checker_1.doesHaveValue)(err))
|
|
40
|
-
return callback(err);
|
|
41
|
-
this.tempFilePath = name;
|
|
42
|
-
this.tempFile = node_fs_1.default.createWriteStream(name, { fd });
|
|
43
|
-
this.tempFile.write(chunk, encoding, callback);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
this.tempFile.write(chunk, encoding, callback);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
_final(callback) {
|
|
51
|
-
this.tempFile.end(() => {
|
|
52
|
-
this.sendHttpRequest(this.url, this.method, this.headers, (err1, res1) => {
|
|
53
|
-
if ((0, value_checker_1.doesHaveValue)(err1))
|
|
54
|
-
return callback(err1);
|
|
55
|
-
this.pushResponseBody(res1, () => {
|
|
56
|
-
this.emitErrorUnlessHttp2xx(res1, this.url, this.method);
|
|
57
|
-
if (res1.statusCode === 202 &&
|
|
58
|
-
res1.headers.location !== undefined) {
|
|
59
|
-
this.sendHttpRequest(res1.headers.location, 'PUT', {}, (err2, res2) => {
|
|
60
|
-
if ((0, value_checker_1.doesHaveValue)(err2))
|
|
61
|
-
return callback(err2);
|
|
62
|
-
this.emitErrorUnlessHttp2xx(res2, res1.headers.location, 'PUT');
|
|
63
|
-
callback();
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
callback();
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
pushResponseBody(res, done) {
|
|
74
|
-
let body = Buffer.alloc(0);
|
|
75
|
-
res.on('data', (chunk) => {
|
|
76
|
-
body = Buffer.concat([body, chunk]);
|
|
77
|
-
});
|
|
78
|
-
res.on('end', () => {
|
|
79
|
-
this.push(body.toString('utf-8'));
|
|
80
|
-
done();
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
emitErrorUnlessHttp2xx(res, url, method) {
|
|
84
|
-
if (res.statusCode >= 300)
|
|
85
|
-
this.emit('error', new Error(`Unexpected http status ${res.statusCode} from ${method} ${url}`));
|
|
86
|
-
}
|
|
87
|
-
sendHttpRequest(url, method, headers, callback) {
|
|
88
|
-
const httpx = (0, value_checker_1.doesHaveValue)(url.match(/^https:/)) ? node_https_1.default : node_http_1.default;
|
|
89
|
-
const additionalHttpHeaders = {};
|
|
90
|
-
const upload = method === 'PUT' || method === 'POST';
|
|
91
|
-
if (upload) {
|
|
92
|
-
additionalHttpHeaders['Content-Length'] = node_fs_1.default.statSync(this.tempFilePath).size;
|
|
93
|
-
}
|
|
94
|
-
const allHeaders = { ...headers, ...additionalHttpHeaders };
|
|
95
|
-
const req = httpx.request(url, {
|
|
96
|
-
method,
|
|
97
|
-
headers: allHeaders,
|
|
98
|
-
});
|
|
99
|
-
req.on('error', (err) => this.emit('error', err));
|
|
100
|
-
req.on('response', (res) => {
|
|
101
|
-
res.on('error', (err) => this.emit('error', err));
|
|
102
|
-
callback(null, res);
|
|
103
|
-
});
|
|
104
|
-
if (upload) {
|
|
105
|
-
(0, node_stream_1.pipeline)(node_fs_1.default.createReadStream(this.tempFilePath), req, (err) => {
|
|
106
|
-
if ((0, value_checker_1.doesHaveValue)(err)) {
|
|
107
|
-
this.emit('error', err);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
req.end();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
exports.default = HttpStream;
|
|
117
|
-
//# sourceMappingURL=http_stream.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http_stream.js","sourceRoot":"","sources":["../../src/publish/http_stream.ts"],"names":[],"mappings":";;;;;AAAA,6CAA2D;AAC3D,sDAAwB;AACxB,0DAA4B;AAC5B,4DAA8B;AAC9B,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AAG,CAAC,CAAC,CAAA;YACjD,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACrB,CAAC,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE;YACV,IAAA,sBAAQ,EAAC,iBAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;gBAC5D,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE;oBACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;iBACxB;YACH,CAAC,CAAC,CAAA;SACH;aAAM;YACL,GAAG,CAAC,GAAG,EAAE,CAAA;SACV;IACH,CAAC;CACF;AAlID,6BAkIC","sourcesContent":["import { pipeline, Transform, Writable } from 'node:stream'\nimport fs from 'node:fs'\nimport http from 'node:http'\nimport https from 'node:https'\nimport tmp from 'tmp'\nimport { doesHaveValue } from '../value_checker'\n\ntype HttpMethod = 'GET' | 'POST' | 'PUT'\n\n/**\n * This Writable writes data to a HTTP/HTTPS URL.\n *\n * It has special handling for https://reports.cucumber.io/\n * which uses an API where the first request is a `GET`,\n * and if the response is 202 with a Location header, issues\n * a PUT request to that URL.\n *\n * 3xx redirects are not currently followed.\n */\nexport default class HttpStream extends Transform {\n private tempFilePath: string\n private tempFile: Writable\n\n constructor(\n private readonly url: string,\n private readonly method: HttpMethod,\n private readonly headers: http.OutgoingHttpHeaders\n ) {\n super({\n readableObjectMode: true,\n })\n }\n\n _write(\n chunk: any,\n encoding: BufferEncoding,\n callback: (err?: Error | null) => void\n ): void {\n if (this.tempFile === undefined) {\n tmp.file((err, name, fd) => {\n if (doesHaveValue(err)) return callback(err)\n this.tempFilePath = name\n this.tempFile = fs.createWriteStream(name, { fd })\n this.tempFile.write(chunk, encoding, callback)\n })\n } else {\n this.tempFile.write(chunk, encoding, callback)\n }\n }\n\n _final(callback: (error?: Error | null) => void): void {\n this.tempFile.end(() => {\n this.sendHttpRequest(\n this.url,\n this.method,\n this.headers,\n (err1, res1) => {\n if (doesHaveValue(err1)) return callback(err1)\n this.pushResponseBody(res1, () => {\n this.emitErrorUnlessHttp2xx(res1, this.url, this.method)\n if (\n res1.statusCode === 202 &&\n res1.headers.location !== undefined\n ) {\n this.sendHttpRequest(\n res1.headers.location,\n 'PUT',\n {},\n (err2, res2) => {\n if (doesHaveValue(err2)) return callback(err2)\n this.emitErrorUnlessHttp2xx(\n res2,\n res1.headers.location,\n 'PUT'\n )\n callback()\n }\n )\n } else {\n callback()\n }\n })\n }\n )\n })\n }\n\n private pushResponseBody(res: http.IncomingMessage, done: () => void): void {\n let body = Buffer.alloc(0)\n res.on('data', (chunk) => {\n body = Buffer.concat([body, chunk])\n })\n res.on('end', () => {\n this.push(body.toString('utf-8'))\n done()\n })\n }\n\n private emitErrorUnlessHttp2xx(\n res: http.IncomingMessage,\n url: string,\n method: string\n ): void {\n if (res.statusCode >= 300)\n this.emit(\n 'error',\n new Error(\n `Unexpected http status ${res.statusCode} from ${method} ${url}`\n )\n )\n }\n\n private sendHttpRequest(\n url: string,\n method: HttpMethod,\n headers: http.OutgoingHttpHeaders,\n callback: (err?: Error | null, res?: http.IncomingMessage) => void\n ): void {\n const httpx = doesHaveValue(url.match(/^https:/)) ? https : http\n const additionalHttpHeaders: http.OutgoingHttpHeaders = {}\n\n const upload = method === 'PUT' || method === 'POST'\n if (upload) {\n additionalHttpHeaders['Content-Length'] = fs.statSync(\n this.tempFilePath\n ).size\n }\n\n const allHeaders = { ...headers, ...additionalHttpHeaders }\n const req = httpx.request(url, {\n method,\n headers: allHeaders,\n })\n req.on('error', (err) => this.emit('error', err))\n req.on('response', (res) => {\n res.on('error', (err) => this.emit('error', err))\n callback(null, res)\n })\n\n if (upload) {\n pipeline(fs.createReadStream(this.tempFilePath), req, (err) => {\n if (doesHaveValue(err)) {\n this.emit('error', err)\n }\n })\n } else {\n req.end()\n }\n }\n}\n"]}
|