@cucumber/cucumber 7.2.1 → 8.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/lib/cli/argv_parser.d.ts +1 -2
- package/lib/cli/argv_parser.js +8 -12
- package/lib/cli/argv_parser.js.map +1 -1
- package/lib/cli/configuration_builder.d.ts +0 -1
- package/lib/cli/configuration_builder.js +20 -21
- package/lib/cli/configuration_builder.js.map +1 -1
- package/lib/cli/helpers.d.ts +1 -0
- package/lib/cli/helpers.js +49 -22
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +6 -6
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +1 -1
- package/lib/cli/index.js +35 -29
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/profile_loader.d.ts +3 -3
- package/lib/cli/profile_loader.js +17 -10
- package/lib/cli/profile_loader.js.map +1 -1
- package/lib/cli/publish_banner.js +1 -1
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/formatter/builder.d.ts +5 -4
- package/lib/formatter/builder.js +38 -52
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +6 -2
- package/lib/formatter/get_color_fns.js +18 -12
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +15 -17
- package/lib/formatter/helpers/event_data_collector.js +19 -12
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +41 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -6
- package/lib/formatter/helpers/gherkin_document_parser.js +24 -40
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +6 -6
- package/lib/formatter/helpers/issue_helpers.js +6 -8
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +1 -5
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.d.ts +9 -10
- package/lib/formatter/helpers/pickle_parser.js +8 -17
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -2
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.d.ts +2 -2
- package/lib/formatter/helpers/summary_helpers.js +39 -20
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +34 -15
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +5 -5
- package/lib/formatter/helpers/test_case_attempt_parser.js +30 -15
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.d.ts +3 -3
- package/lib/formatter/helpers/usage_helpers/index.js +48 -45
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.d.ts +1 -0
- package/lib/formatter/html_formatter.js +2 -1
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +1 -1
- package/lib/formatter/http_stream.js.map +1 -1
- package/lib/formatter/index.d.ts +1 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.d.ts +22 -27
- package/lib/formatter/json_formatter.js +62 -30
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/message_formatter.d.ts +1 -0
- package/lib/formatter/message_formatter.js +2 -1
- package/lib/formatter/message_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.d.ts +7 -6
- package/lib/formatter/progress_bar_formatter.js +5 -4
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.d.ts +3 -2
- package/lib/formatter/progress_formatter.js +30 -10
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.d.ts +1 -0
- package/lib/formatter/rerun_formatter.js +33 -11
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.d.ts +1 -0
- package/lib/formatter/snippets_formatter.js +22 -2
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +3 -3
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.d.ts +3 -2
- package/lib/formatter/summary_formatter.js +4 -4
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.d.ts +1 -0
- package/lib/formatter/usage_formatter.js +24 -5
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.d.ts +1 -0
- package/lib/formatter/usage_json_formatter.js +1 -0
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +15 -12
- package/lib/index.js +6 -3
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.d.ts +3 -4
- package/lib/models/data_table.js +9 -7
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/definition.d.ts +2 -2
- package/lib/models/definition.js.map +1 -1
- package/lib/models/step_definition.js +1 -2
- package/lib/models/step_definition.js.map +1 -1
- package/lib/models/test_case_hook_definition.d.ts +2 -2
- package/lib/models/test_case_hook_definition.js.map +1 -1
- package/lib/models/test_step_hook_definition.d.ts +2 -2
- package/lib/models/test_step_hook_definition.js.map +1 -1
- package/lib/pickle_filter.d.ts +9 -11
- package/lib/pickle_filter.js +9 -9
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.d.ts +13 -0
- package/lib/runtime/assemble_test_cases.js +88 -0
- package/lib/runtime/assemble_test_cases.js.map +1 -0
- package/lib/runtime/attachment_manager/index.d.ts +2 -2
- package/lib/runtime/attachment_manager/index.js +23 -4
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.d.ts +3 -2
- package/lib/runtime/helpers.js +36 -1
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +3 -4
- package/lib/runtime/index.js +27 -43
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +10 -9
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +9 -9
- package/lib/runtime/parallel/coordinator.js +62 -55
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +2 -2
- package/lib/runtime/parallel/worker.js +23 -21
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/step_runner.d.ts +3 -3
- package/lib/runtime/step_runner.js +16 -14
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.d.ts +4 -4
- package/lib/runtime/stopwatch.js +21 -2
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +51 -0
- package/lib/runtime/test_case_runner.js +253 -0
- package/lib/runtime/test_case_runner.js.map +1 -0
- package/lib/stack_trace_filter.js +4 -5
- package/lib/stack_trace_filter.js.map +1 -1
- package/lib/step_arguments.d.ts +4 -4
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/build_helpers.js +14 -10
- package/lib/support_code_library_builder/build_helpers.js.map +1 -1
- package/lib/support_code_library_builder/index.d.ts +9 -7
- package/lib/support_code_library_builder/index.js +10 -24
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +22 -23
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +14 -19
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -1
- package/lib/support_code_library_builder/world.d.ts +7 -1
- package/lib/support_code_library_builder/world.js.map +1 -1
- package/lib/time.d.ts +3 -10
- package/lib/time.js +39 -48
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +7 -14
- package/lib/user_code_runner.js.map +1 -1
- package/lib/value_checker.d.ts +2 -2
- package/lib/value_checker.js.map +1 -1
- package/lib/wrapper.mjs +38 -0
- package/package.json +73 -64
- package/CHANGELOG.md +0 -1881
- package/lib/runtime/pickle_runner.d.ts +0 -67
- package/lib/runtime/pickle_runner.js +0 -305
- package/lib/runtime/pickle_runner.js.map +0 -1
- package/lib/status.d.ts +0 -3
- package/lib/status.js +0 -5
- package/lib/status.js.map +0 -1
- package/lib/support_code_library_builder/finalize_helpers.d.ts +0 -10
- package/lib/support_code_library_builder/finalize_helpers.js +0 -26
- package/lib/support_code_library_builder/finalize_helpers.js.map +0 -1
package/lib/time.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAwC;AACxC,6DAA8C;AAE9C,IAAI,iBAAyB,CAAA;AAE7B,MAAM,OAAO,GAAQ;IACnB,WAAW;QACT,iBAAiB,GAAG,YAAY,EAAE,CAAA;IACpC,CAAC;IACD,aAAa,EAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;IACvC,IAAI;IACJ,SAAS;QACP,OAAO,YAAY,EAAE,GAAG,iBAAiB,CAAA;IAC3C,CAAC;IACD,WAAW,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,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C,CAChC,CAAA;AACH,CAAC;AAjBD,wDAiBC;AAED,kBAAe,OAAO,CAAA","sourcesContent":["import { performance } from 'perf_hooks'\nimport * as messages from '@cucumber/messages'\n\nlet previousTimestamp: number\n\nconst methods: any = {\n beginTiming() {\n previousTimestamp = getTimestamp()\n },\n clearInterval: clearInterval.bind(global),\n clearTimeout: clearTimeout.bind(global),\n Date,\n endTiming() {\n return getTimestamp() - previousTimestamp\n },\n setInterval: setInterval.bind(global),\n setTimeout: setTimeout.bind(global),\n performance,\n}\n\nif (typeof setImmediate !== 'undefined') {\n methods.setImmediate = setImmediate.bind(global)\n methods.clearImmediate = clearImmediate.bind(global)\n}\n\nfunction getTimestamp(): number {\n return methods.performance.now()\n}\n\nexport function durationBetweenTimestamps(\n startedTimestamp: messages.Timestamp,\n finishedTimestamp: messages.Timestamp\n): messages.Duration {\n const durationMillis =\n messages.TimeConversion.timestampToMillisecondsSinceEpoch(\n finishedTimestamp\n ) -\n messages.TimeConversion.timestampToMillisecondsSinceEpoch(startedTimestamp)\n return messages.TimeConversion.millisecondsToDuration(durationMillis)\n}\n\nexport async function wrapPromiseWithTimeout<T>(\n promise: Promise<T>,\n timeoutInMilliseconds: number,\n timeoutMessage: string = ''\n): Promise<T> {\n let timeoutId: NodeJS.Timeout\n if (timeoutMessage === '') {\n timeoutMessage = `Action did not complete within ${timeoutInMilliseconds} milliseconds`\n }\n const timeoutPromise = new Promise<T>((resolve, reject) => {\n timeoutId = methods.setTimeout(() => {\n reject(new Error(timeoutMessage))\n }, timeoutInMilliseconds)\n })\n return await Promise.race([promise, timeoutPromise]).finally(() =>\n methods.clearTimeout(timeoutId)\n )\n}\n\nexport default methods\n"]}
|
package/lib/user_code_runner.js
CHANGED
|
@@ -3,8 +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
|
-
const
|
|
7
|
-
const time_1 = __importDefault(require("./time"));
|
|
6
|
+
const time_1 = require("./time");
|
|
8
7
|
const uncaught_exception_manager_1 = __importDefault(require("./uncaught_exception_manager"));
|
|
9
8
|
const util_1 = __importDefault(require("util"));
|
|
10
9
|
const value_checker_1 = require("./value_checker");
|
|
@@ -53,21 +52,16 @@ const UserCodeRunner = {
|
|
|
53
52
|
uncaught_exception_manager_1.default.registerHandler(exceptionHandler);
|
|
54
53
|
});
|
|
55
54
|
racingPromises.push(uncaughtExceptionPromise);
|
|
56
|
-
let
|
|
55
|
+
let finalPromise = Promise.race(racingPromises);
|
|
57
56
|
if (timeoutInMilliseconds >= 0) {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
` within ${timeoutInMilliseconds.toString()} milliseconds`;
|
|
63
|
-
reject(new Error(timeoutMessage));
|
|
64
|
-
}, timeoutInMilliseconds);
|
|
65
|
-
});
|
|
66
|
-
racingPromises.push(timeoutPromise);
|
|
57
|
+
const timeoutMessage = 'function timed out, ensure the ' +
|
|
58
|
+
(callbackInterface ? 'callback is executed' : 'promise resolves') +
|
|
59
|
+
` within ${timeoutInMilliseconds.toString()} milliseconds`;
|
|
60
|
+
finalPromise = time_1.wrapPromiseWithTimeout(finalPromise, timeoutInMilliseconds, timeoutMessage);
|
|
67
61
|
}
|
|
68
62
|
let error, result;
|
|
69
63
|
try {
|
|
70
|
-
result = await
|
|
64
|
+
result = await finalPromise;
|
|
71
65
|
}
|
|
72
66
|
catch (e) {
|
|
73
67
|
if (e instanceof Error) {
|
|
@@ -80,7 +74,6 @@ const UserCodeRunner = {
|
|
|
80
74
|
error = new Error('Promise rejected without a reason');
|
|
81
75
|
}
|
|
82
76
|
}
|
|
83
|
-
time_1.default.clearTimeout(timeoutId);
|
|
84
77
|
uncaught_exception_manager_1.default.unregisterHandler(exceptionHandler);
|
|
85
78
|
return { error, result };
|
|
86
79
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"user_code_runner.js","sourceRoot":"","sources":["../src/user_code_runner.ts"],"names":[],"mappings":";;;;;AAAA,iCAA+C;AAC/C,8FAAmE;AACnE,gDAAuB;AACvB,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,6BAAa,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,CAAC,KAAK,CAAC,CAAA;iBACd;qBAAM;oBACL,OAAO,CAAC,MAAM,CAAC,CAAA;iBAChB;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,IAAI,QAAQ,CAAA;QACZ,IAAI;YACF,QAAQ,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;YACrD,OAAO,EAAE,KAAK,EAAE,CAAA;SACjB;QAED,MAAM,cAAc,GAAG,EAAE,CAAA;QACzB,MAAM,iBAAiB,GAAG,EAAE,CAAC,MAAM,KAAK,SAAS,CAAC,MAAM,CAAA;QACxD,MAAM,gBAAgB,GACpB,6BAAa,CAAC,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAA;QAEhE,IAAI,iBAAiB,IAAI,gBAAgB,EAAE;Y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,CAAC,CAAC,CAAA;aACvB;iBAAM;gBACL,KAAK,GAAG,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;aACvD;SACF;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 { wrapPromiseWithTimeout } from './time'\nimport UncaughtExceptionManager from './uncaught_exception_manager'\nimport util from 'util'\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.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function doesHaveValue(value:
|
|
2
|
-
export declare function doesNotHaveValue(value:
|
|
1
|
+
export declare function doesHaveValue<T>(value: T): boolean;
|
|
2
|
+
export declare function doesNotHaveValue<T>(value: T): boolean;
|
|
3
3
|
export declare function valueOrDefault<T>(value: T, defaultValue: T): T;
|
package/lib/value_checker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value_checker.js","sourceRoot":"","sources":["../src/value_checker.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"value_checker.js","sourceRoot":"","sources":["../src/value_checker.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa,CAAI,KAAQ;IACvC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;AACjC,CAAC;AAFD,sCAEC;AAED,SAAgB,gBAAgB,CAAI,KAAQ;IAC1C,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAA;AAC9C,CAAC;AAFD,4CAEC;AAED,SAAgB,cAAc,CAAI,KAAQ,EAAE,YAAe;IACzD,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAA;KACb;IACD,OAAO,YAAY,CAAA;AACrB,CAAC;AALD,wCAKC","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/wrapper.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import cucumber from './index.js'
|
|
2
|
+
|
|
3
|
+
export const Cli = cucumber.Cli
|
|
4
|
+
export const parseGherkinMessageStream = cucumber.parseGherkinMessageStream
|
|
5
|
+
export const PickleFilter = cucumber.PickleFilter
|
|
6
|
+
export const Runtime = cucumber.Runtime
|
|
7
|
+
export const supportCodeLibraryBuilder = cucumber.supportCodeLibraryBuilder
|
|
8
|
+
export const Status = cucumber.Status
|
|
9
|
+
export const DataTable = cucumber.DataTable
|
|
10
|
+
|
|
11
|
+
export const Formatter = cucumber.Formatter
|
|
12
|
+
export const FormatterBuilder = cucumber.FormatterBuilder
|
|
13
|
+
export const JsonFormatter = cucumber.JsonFormatter
|
|
14
|
+
export const ProgressFormatter = cucumber.ProgressFormatter
|
|
15
|
+
export const RerunFormatter = cucumber.RerunFormatter
|
|
16
|
+
export const SnippetsFormatter = cucumber.SnippetsFormatter
|
|
17
|
+
export const SummaryFormatter = cucumber.SummaryFormatter
|
|
18
|
+
export const UsageFormatter = cucumber.UsageFormatter
|
|
19
|
+
export const UsageJsonFormatter = cucumber.UsageJsonFormatter
|
|
20
|
+
export const formatterHelpers = cucumber.formatterHelpers
|
|
21
|
+
|
|
22
|
+
export const After = cucumber.After
|
|
23
|
+
export const AfterAll = cucumber.AfterAll
|
|
24
|
+
export const AfterStep = cucumber.AfterStep
|
|
25
|
+
export const Before = cucumber.Before
|
|
26
|
+
export const BeforeAll = cucumber.BeforeAll
|
|
27
|
+
export const BeforeStep = cucumber.BeforeStep
|
|
28
|
+
export const defineParameterType = cucumber.defineParameterType
|
|
29
|
+
export const defineStep = cucumber.defineStep
|
|
30
|
+
export const Given = cucumber.Given
|
|
31
|
+
export const setDefaultTimeout = cucumber.setDefaultTimeout
|
|
32
|
+
export const setDefinitionFunctionWrapper = cucumber.setDefinitionFunctionWrapper
|
|
33
|
+
export const setWorldConstructor = cucumber.setWorldConstructor
|
|
34
|
+
export const Then = cucumber.Then
|
|
35
|
+
export const When = cucumber.When
|
|
36
|
+
|
|
37
|
+
export const World = cucumber.World
|
|
38
|
+
|
package/package.json
CHANGED
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
"gherkin",
|
|
9
9
|
"tests"
|
|
10
10
|
],
|
|
11
|
-
"version": "
|
|
11
|
+
"version": "8.0.0-rc.1",
|
|
12
12
|
"homepage": "https://github.com/cucumber/cucumber-js",
|
|
13
13
|
"author": "Julien Biezemans <jb@jbpros.com>",
|
|
14
14
|
"contributors": [
|
|
15
15
|
"Aaron Garvey",
|
|
16
|
+
"abelalmeida <abelalmeida@u.boisestate.edu>",
|
|
16
17
|
"Adam Ark <Adam-ARK@users.noreply.github.com>",
|
|
17
18
|
"Ádám Gólya <adam.golya@lab.coop>",
|
|
18
19
|
"ahulab <alexbaluha@gmail.com>",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"Artur Neumann <artur@jankaritech.com>",
|
|
24
25
|
"Artur Pomadowski <artur.pomadowski@gmail.com>",
|
|
25
26
|
"Aslak Hellesøy <aslak.hellesoy@gmail.com>",
|
|
27
|
+
"Aurélien Reeves <aurelien.reeves@smartbear.com>",
|
|
26
28
|
"basemmerink <bas.emmerink@gmail.com>",
|
|
27
29
|
"Ben Van Treese <vantreeseba@gmail.com>",
|
|
28
30
|
"Benjamín Eidelman <beneidel+gh@gmail.com>",
|
|
@@ -65,6 +67,7 @@
|
|
|
65
67
|
"Jayson Smith <github@nes.33mail.com>",
|
|
66
68
|
"Jesse Harlin <harlinjesse@gmail.com>",
|
|
67
69
|
"João Guilherme Farias Duda <jgfd@cin.ufpe.br>",
|
|
70
|
+
"Joaquín Sorianello <joac@users.noreply.github.com>",
|
|
68
71
|
"Joey Jan <OverFlow636@users.noreply.github.com>",
|
|
69
72
|
"John Krull <astrom.flux@gmail.com>",
|
|
70
73
|
"John McLaughlin <john.mjhm@gmail.com>",
|
|
@@ -92,6 +95,7 @@
|
|
|
92
95
|
"Leonardo <mondloslp@gmail.com>",
|
|
93
96
|
"lopesc <lopesc@users.noreply.github.com>",
|
|
94
97
|
"Lucas Cimon <lucas.cimon@gmail.com>",
|
|
98
|
+
"Ludek",
|
|
95
99
|
"Lukas Degener <l.degener@tarent.de>",
|
|
96
100
|
"Łukasz Gandecki <lgandecki@css.edu>",
|
|
97
101
|
"M.P. Korstanje <mpkorstanje@users.noreply.github.com>",
|
|
@@ -138,6 +142,7 @@
|
|
|
138
142
|
"temyers <temyers@users.noreply.github.com>",
|
|
139
143
|
"Tim Perry <tim.perry@softwire.com>",
|
|
140
144
|
"Tom V <tom@toc.com>",
|
|
145
|
+
"Tomer Ben-Rachel <tomerpacific@gmail.com>",
|
|
141
146
|
"Tristan Dunn <tristanzdunn@gmail.com>",
|
|
142
147
|
"unknown <jharlin@NormanDev2.telogical.com>",
|
|
143
148
|
"Valerio Innocenti Sedili <valerio.innocenti.ext@yoox.com>",
|
|
@@ -163,35 +168,39 @@
|
|
|
163
168
|
"lib": "./lib"
|
|
164
169
|
},
|
|
165
170
|
"main": "./lib/index.js",
|
|
171
|
+
"exports": {
|
|
172
|
+
".": {
|
|
173
|
+
"import": "./lib/wrapper.mjs",
|
|
174
|
+
"require": "./lib/index.js"
|
|
175
|
+
},
|
|
176
|
+
"./lib/*": {
|
|
177
|
+
"require": "./lib/*.js"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
166
180
|
"types": "./lib/index.d.ts",
|
|
167
181
|
"engines": {
|
|
168
|
-
"node": ">=
|
|
182
|
+
"node": ">=12"
|
|
169
183
|
},
|
|
170
184
|
"dependencies": {
|
|
171
|
-
"@cucumber/create-meta": "
|
|
172
|
-
"@cucumber/cucumber-expressions": "
|
|
173
|
-
"@cucumber/gherkin": "
|
|
174
|
-
"@cucumber/gherkin-streams": "
|
|
175
|
-
"@cucumber/html-formatter": "
|
|
176
|
-
"@cucumber/messages": "
|
|
177
|
-
"@cucumber/
|
|
178
|
-
"
|
|
179
|
-
"assertion-error-formatter": "3.0.0",
|
|
180
|
-
"bluebird": "^3.7.2",
|
|
185
|
+
"@cucumber/create-meta": "6.0.1",
|
|
186
|
+
"@cucumber/cucumber-expressions": "^14.0.0",
|
|
187
|
+
"@cucumber/gherkin": "^22.0.0",
|
|
188
|
+
"@cucumber/gherkin-streams": "^4.0.0",
|
|
189
|
+
"@cucumber/html-formatter": "^17.0.0",
|
|
190
|
+
"@cucumber/messages": "^17.1.1",
|
|
191
|
+
"@cucumber/tag-expressions": "^4.1.0",
|
|
192
|
+
"assertion-error-formatter": "^3.0.0",
|
|
181
193
|
"capital-case": "^1.0.4",
|
|
182
194
|
"cli-table3": "^0.6.0",
|
|
183
195
|
"colors": "^1.4.0",
|
|
184
|
-
"commander": "^
|
|
185
|
-
"create-require": "^1.1.1",
|
|
196
|
+
"commander": "^8.0.0",
|
|
186
197
|
"duration": "^0.2.2",
|
|
187
198
|
"durations": "^3.4.2",
|
|
188
199
|
"figures": "^3.2.0",
|
|
189
200
|
"glob": "^7.1.6",
|
|
190
201
|
"indent-string": "^4.0.0",
|
|
191
|
-
"is-generator": "^1.0.3",
|
|
192
202
|
"is-stream": "^2.0.0",
|
|
193
203
|
"knuth-shuffle-seeded": "^1.0.6",
|
|
194
|
-
"lodash": "^4.17.21",
|
|
195
204
|
"mz": "^2.7.0",
|
|
196
205
|
"progress": "^2.0.3",
|
|
197
206
|
"resolve": "^1.19.0",
|
|
@@ -204,76 +213,76 @@
|
|
|
204
213
|
"verror": "^1.10.0"
|
|
205
214
|
},
|
|
206
215
|
"devDependencies": {
|
|
207
|
-
"@cucumber/compatibility-kit": "
|
|
208
|
-
"@
|
|
209
|
-
"@
|
|
210
|
-
"@
|
|
216
|
+
"@cucumber/compatibility-kit": "^9.0.0",
|
|
217
|
+
"@cucumber/message-streams": "^3.0.0",
|
|
218
|
+
"@cucumber/query": "^11.0.0",
|
|
219
|
+
"@sinonjs/fake-timers": "8.0.1",
|
|
220
|
+
"@types/chai": "4.2.22",
|
|
211
221
|
"@types/dirty-chai": "2.0.2",
|
|
212
|
-
"@types/express": "4.17.
|
|
213
|
-
"@types/fs-extra": "9.0.
|
|
214
|
-
"@types/glob": "7.1.
|
|
215
|
-
"@types/
|
|
216
|
-
"@types/
|
|
217
|
-
"@types/
|
|
218
|
-
"@types/
|
|
219
|
-
"@types/
|
|
220
|
-
"@types/
|
|
221
|
-
"@types/
|
|
222
|
-
"@types/semver": "7.3.4",
|
|
222
|
+
"@types/express": "4.17.13",
|
|
223
|
+
"@types/fs-extra": "9.0.13",
|
|
224
|
+
"@types/glob": "7.1.4",
|
|
225
|
+
"@types/mocha": "9.0.0",
|
|
226
|
+
"@types/mustache": "4.1.2",
|
|
227
|
+
"@types/mz": "2.7.4",
|
|
228
|
+
"@types/node": "14.17.20",
|
|
229
|
+
"@types/progress": "2.0.5",
|
|
230
|
+
"@types/resolve": "1.20.1",
|
|
231
|
+
"@types/semver": "7.3.8",
|
|
223
232
|
"@types/sinon-chai": "3.2.5",
|
|
224
|
-
"@types/sinonjs__fake-timers": "6.0.
|
|
225
|
-
"@types/stream-buffers": "3.0.
|
|
226
|
-
"@types/tmp": "0.2.
|
|
227
|
-
"@types/verror": "1.10.
|
|
228
|
-
"@typescript-eslint/eslint-plugin": "4.
|
|
229
|
-
"@typescript-eslint/parser": "4.
|
|
233
|
+
"@types/sinonjs__fake-timers": "6.0.4",
|
|
234
|
+
"@types/stream-buffers": "3.0.4",
|
|
235
|
+
"@types/tmp": "0.2.1",
|
|
236
|
+
"@types/verror": "1.10.5",
|
|
237
|
+
"@typescript-eslint/eslint-plugin": "4.32.0",
|
|
238
|
+
"@typescript-eslint/parser": "4.32.0",
|
|
230
239
|
"chai": "4.3.4",
|
|
231
|
-
"chai-exclude": "2.0
|
|
232
|
-
"coffeescript": "2.
|
|
233
|
-
"dependency-lint": "
|
|
240
|
+
"chai-exclude": "2.1.0",
|
|
241
|
+
"coffeescript": "2.6.0",
|
|
242
|
+
"dependency-lint": "7.1.0",
|
|
234
243
|
"dirty-chai": "2.0.1",
|
|
235
|
-
"eslint": "7.
|
|
236
|
-
"eslint-config-prettier": "8.
|
|
237
|
-
"eslint-config-standard-with-typescript": "
|
|
238
|
-
"eslint-plugin-import": "2.
|
|
244
|
+
"eslint": "7.32.0",
|
|
245
|
+
"eslint-config-prettier": "8.3.0",
|
|
246
|
+
"eslint-config-standard-with-typescript": "21.0.1",
|
|
247
|
+
"eslint-plugin-import": "2.24.2",
|
|
239
248
|
"eslint-plugin-node": "11.1.0",
|
|
240
|
-
"eslint-plugin-prettier": "
|
|
241
|
-
"eslint-plugin-promise": "
|
|
249
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
250
|
+
"eslint-plugin-promise": "5.1.0",
|
|
242
251
|
"eslint-plugin-standard": "4.1.0",
|
|
243
252
|
"express": "4.17.1",
|
|
244
|
-
"fs-extra": "
|
|
245
|
-
"mocha": "
|
|
253
|
+
"fs-extra": "10.0.0",
|
|
254
|
+
"mocha": "^9.1.3",
|
|
246
255
|
"mustache": "4.2.0",
|
|
247
|
-
"ndjson-parse": "1.0.4",
|
|
248
256
|
"nyc": "15.1.0",
|
|
249
|
-
"prettier": "2.
|
|
257
|
+
"prettier": "2.4.1",
|
|
258
|
+
"reindent-template-literals": "1.1.0",
|
|
250
259
|
"semver": "7.3.5",
|
|
251
|
-
"sinon": "
|
|
252
|
-
"sinon-chai": "3.
|
|
260
|
+
"sinon": "11.1.2",
|
|
261
|
+
"sinon-chai": "3.7.0",
|
|
253
262
|
"stream-buffers": "3.0.2",
|
|
254
263
|
"stream-to-string": "1.2.0",
|
|
255
|
-
"ts-node": "
|
|
256
|
-
"tsd": "0.
|
|
257
|
-
"typescript": "4.
|
|
264
|
+
"ts-node": "^10.3.0",
|
|
265
|
+
"tsd": "0.17.0",
|
|
266
|
+
"typescript": "^4.4.4"
|
|
258
267
|
},
|
|
259
268
|
"scripts": {
|
|
260
|
-
"build-local": "tsc
|
|
269
|
+
"build-local": "tsc --build tsconfig.node.json && cp src/importer.js lib/ && cp src/wrapper.mjs lib/",
|
|
261
270
|
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
|
|
262
271
|
"feature-test": "node ./bin/cucumber-js",
|
|
263
272
|
"html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",
|
|
264
273
|
"lint-autofix": "eslint --fix \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
|
|
265
274
|
"lint-code": "eslint \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",
|
|
266
275
|
"lint-dependencies": "dependency-lint",
|
|
267
|
-
"lint": "
|
|
268
|
-
"prelint-autofix": "
|
|
269
|
-
"prelint-code": "
|
|
270
|
-
"precck-test": "
|
|
271
|
-
"prefeature-test": "
|
|
276
|
+
"lint": "npm run lint-code && npm run lint-dependencies",
|
|
277
|
+
"prelint-autofix": "npm run build-local",
|
|
278
|
+
"prelint-code": "npm run build-local",
|
|
279
|
+
"precck-test": "npm run build-local",
|
|
280
|
+
"prefeature-test": "npm run build-local",
|
|
272
281
|
"prepublishOnly": "rm -rf lib && npm run build-local",
|
|
273
|
-
"pretest-coverage": "
|
|
274
|
-
"pretypes-test": "
|
|
282
|
+
"pretest-coverage": "npm run build-local",
|
|
283
|
+
"pretypes-test": "npm run build-local",
|
|
275
284
|
"test-coverage": "nyc --silent mocha 'src/**/*_spec.ts' 'compatibility/**/*_spec.ts' && nyc --silent --no-clean node ./bin/cucumber-js && nyc report --reporter=lcov",
|
|
276
|
-
"test": "
|
|
285
|
+
"test": "npm run lint && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
|
|
277
286
|
"types-test": "tsd",
|
|
278
287
|
"unit-test": "mocha 'src/**/*_spec.ts'",
|
|
279
288
|
"update-dependencies": "npx npm-check-updates --upgrade"
|