@cucumber/cucumber 10.6.0 → 10.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/api/formatters.d.ts +3 -1
  2. package/lib/api/formatters.js +36 -45
  3. package/lib/api/formatters.js.map +1 -1
  4. package/lib/api/plugins.js +3 -3
  5. package/lib/api/plugins.js.map +1 -1
  6. package/lib/api/run_cucumber.js +7 -1
  7. package/lib/api/run_cucumber.js.map +1 -1
  8. package/lib/configuration/argv_parser.js +2 -2
  9. package/lib/configuration/argv_parser.js.map +1 -1
  10. package/lib/formatter/builder.d.ts +1 -1
  11. package/lib/formatter/builder.js +6 -13
  12. package/lib/formatter/builder.js.map +1 -1
  13. package/lib/formatter/builtin/html.d.ts +6 -0
  14. package/lib/formatter/builtin/html.js +25 -0
  15. package/lib/formatter/builtin/html.js.map +1 -0
  16. package/lib/formatter/builtin/index.d.ts +3 -0
  17. package/lib/formatter/builtin/index.js +33 -0
  18. package/lib/formatter/builtin/index.js.map +1 -0
  19. package/lib/formatter/builtin/message.d.ts +6 -0
  20. package/lib/formatter/builtin/message.js +10 -0
  21. package/lib/formatter/builtin/message.js.map +1 -0
  22. package/lib/formatter/create_stream.d.ts +4 -0
  23. package/lib/formatter/create_stream.js +28 -0
  24. package/lib/formatter/create_stream.js.map +1 -0
  25. package/lib/formatter/find_class_or_plugin.d.ts +1 -0
  26. package/lib/formatter/find_class_or_plugin.js +25 -0
  27. package/lib/formatter/find_class_or_plugin.js.map +1 -0
  28. package/lib/formatter/helpers/formatters.d.ts +0 -1
  29. package/lib/formatter/helpers/formatters.js +0 -12
  30. package/lib/formatter/helpers/formatters.js.map +1 -1
  31. package/lib/formatter/import_code.d.ts +1 -0
  32. package/lib/formatter/import_code.js +27 -0
  33. package/lib/formatter/import_code.js.map +1 -0
  34. package/lib/formatter/index.d.ts +2 -0
  35. package/lib/formatter/index.js.map +1 -1
  36. package/lib/formatter/resolve_implementation.d.ts +2 -0
  37. package/lib/formatter/resolve_implementation.js +24 -0
  38. package/lib/formatter/resolve_implementation.js.map +1 -0
  39. package/lib/index.d.ts +2 -0
  40. package/lib/index.js +4 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/plugin/plugin_manager.d.ts +3 -2
  43. package/lib/plugin/plugin_manager.js +12 -2
  44. package/lib/plugin/plugin_manager.js.map +1 -1
  45. package/lib/plugin/types.d.ts +11 -0
  46. package/lib/plugin/types.js.map +1 -1
  47. package/lib/runtime/parallel/coordinator.d.ts +1 -1
  48. package/lib/runtime/parallel/coordinator.js +7 -6
  49. package/lib/runtime/parallel/coordinator.js.map +1 -1
  50. package/lib/runtime/run_test_run_hooks.js +5 -3
  51. package/lib/runtime/run_test_run_hooks.js.map +1 -1
  52. package/lib/runtime/scope/index.d.ts +2 -0
  53. package/lib/runtime/scope/index.js +19 -0
  54. package/lib/runtime/scope/index.js.map +1 -0
  55. package/lib/runtime/scope/make_proxy.d.ts +1 -0
  56. package/lib/runtime/scope/make_proxy.js +42 -0
  57. package/lib/runtime/scope/make_proxy.js.map +1 -0
  58. package/lib/runtime/scope/test_case_scope.d.ts +17 -0
  59. package/lib/runtime/scope/test_case_scope.js +29 -0
  60. package/lib/runtime/scope/test_case_scope.js.map +1 -0
  61. package/lib/runtime/scope/test_run_scope.d.ts +16 -0
  62. package/lib/runtime/scope/test_run_scope.js +28 -0
  63. package/lib/runtime/scope/test_run_scope.js.map +1 -0
  64. package/lib/runtime/step_runner.js +3 -2
  65. package/lib/runtime/step_runner.js.map +1 -1
  66. package/lib/support_code_library_builder/context.d.ts +3 -0
  67. package/lib/support_code_library_builder/context.js +3 -0
  68. package/lib/support_code_library_builder/context.js.map +1 -0
  69. package/lib/version.d.ts +1 -1
  70. package/lib/version.js +1 -1
  71. package/lib/version.js.map +1 -1
  72. package/lib/wrapper.mjs +2 -0
  73. package/package.json +3 -2
  74. package/lib/formatter/html_formatter.d.ts +0 -7
  75. package/lib/formatter/html_formatter.js +0 -31
  76. package/lib/formatter/html_formatter.js.map +0 -1
  77. package/lib/formatter/message_formatter.d.ts +0 -5
  78. package/lib/formatter/message_formatter.js +0 -15
  79. package/lib/formatter/message_formatter.js.map +0 -1
@@ -0,0 +1,17 @@
1
+ import { IWorld } from '../../support_code_library_builder/world';
2
+ interface TestCaseScopeStore<ParametersType = any> {
3
+ world: IWorld<ParametersType>;
4
+ }
5
+ export declare function runInTestCaseScope<ResponseType>(store: TestCaseScopeStore, callback: () => ResponseType): Promise<ResponseType>;
6
+ /**
7
+ * A proxy to the World instance for the currently-executing test case
8
+ *
9
+ * @beta
10
+ * @remarks
11
+ * Useful for getting a handle on the World when using arrow functions and thus
12
+ * being unable to rely on the value of `this`. Only callable from the body of a
13
+ * step or a `Before`, `After`, `BeforeStep` or `AfterStep` hook (will throw
14
+ * otherwise).
15
+ */
16
+ export declare const worldProxy: IWorld<any>;
17
+ export {};
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.worldProxy = exports.runInTestCaseScope = void 0;
4
+ const node_async_hooks_1 = require("node:async_hooks");
5
+ const make_proxy_1 = require("./make_proxy");
6
+ const testCaseScope = new node_async_hooks_1.AsyncLocalStorage();
7
+ async function runInTestCaseScope(store, callback) {
8
+ return testCaseScope.run(store, callback);
9
+ }
10
+ exports.runInTestCaseScope = runInTestCaseScope;
11
+ function getWorld() {
12
+ const store = testCaseScope.getStore();
13
+ if (!store) {
14
+ throw new Error('Attempted to access `world` from incorrect scope; only applicable to steps and case-level hooks');
15
+ }
16
+ return store.world;
17
+ }
18
+ /**
19
+ * A proxy to the World instance for the currently-executing test case
20
+ *
21
+ * @beta
22
+ * @remarks
23
+ * Useful for getting a handle on the World when using arrow functions and thus
24
+ * being unable to rely on the value of `this`. Only callable from the body of a
25
+ * step or a `Before`, `After`, `BeforeStep` or `AfterStep` hook (will throw
26
+ * otherwise).
27
+ */
28
+ exports.worldProxy = (0, make_proxy_1.makeProxy)(getWorld);
29
+ //# sourceMappingURL=test_case_scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_case_scope.js","sourceRoot":"","sources":["../../../src/runtime/scope/test_case_scope.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAEpD,6CAAwC;AAMxC,MAAM,aAAa,GAAG,IAAI,oCAAiB,EAAsB,CAAA;AAE1D,KAAK,UAAU,kBAAkB,CACtC,KAAyB,EACzB,QAA4B;IAE5B,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC3C,CAAC;AALD,gDAKC;AAED,SAAS,QAAQ;IACf,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAA;IACtC,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAA;KACF;IACD,OAAO,KAAK,CAAC,KAA+B,CAAA;AAC9C,CAAC;AAED;;;;;;;;;GASG;AACU,QAAA,UAAU,GAAG,IAAA,sBAAS,EAAS,QAAQ,CAAC,CAAA","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { IWorld } from '../../support_code_library_builder/world'\nimport { makeProxy } from './make_proxy'\n\ninterface TestCaseScopeStore<ParametersType = any> {\n world: IWorld<ParametersType>\n}\n\nconst testCaseScope = new AsyncLocalStorage<TestCaseScopeStore>()\n\nexport async function runInTestCaseScope<ResponseType>(\n store: TestCaseScopeStore,\n callback: () => ResponseType\n) {\n return testCaseScope.run(store, callback)\n}\n\nfunction getWorld<ParametersType = any>(): IWorld<ParametersType> {\n const store = testCaseScope.getStore()\n if (!store) {\n throw new Error(\n 'Attempted to access `world` from incorrect scope; only applicable to steps and case-level hooks'\n )\n }\n return store.world as IWorld<ParametersType>\n}\n\n/**\n * A proxy to the World instance for the currently-executing test case\n *\n * @beta\n * @remarks\n * Useful for getting a handle on the World when using arrow functions and thus\n * being unable to rely on the value of `this`. Only callable from the body of a\n * step or a `Before`, `After`, `BeforeStep` or `AfterStep` hook (will throw\n * otherwise).\n */\nexport const worldProxy = makeProxy<IWorld>(getWorld)\n"]}
@@ -0,0 +1,16 @@
1
+ import { IContext } from '../../support_code_library_builder/context';
2
+ interface TestRunScopeStore<ParametersType = any> {
3
+ context: IContext<ParametersType>;
4
+ }
5
+ export declare function runInTestRunScope<ResponseType>(store: TestRunScopeStore, callback: () => ResponseType): Promise<ResponseType>;
6
+ /**
7
+ * A proxy to the context for the currently-executing test run.
8
+ *
9
+ * @beta
10
+ * @remarks
11
+ * Useful for getting a handle on the context when using arrow functions and thus
12
+ * being unable to rely on the value of `this`. Only callable from the body of a
13
+ * `BeforeAll` or `AfterAll` hook (will throw otherwise).
14
+ */
15
+ export declare const contextProxy: IContext<any>;
16
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contextProxy = exports.runInTestRunScope = void 0;
4
+ const node_async_hooks_1 = require("node:async_hooks");
5
+ const make_proxy_1 = require("./make_proxy");
6
+ const testRunScope = new node_async_hooks_1.AsyncLocalStorage();
7
+ async function runInTestRunScope(store, callback) {
8
+ return testRunScope.run(store, callback);
9
+ }
10
+ exports.runInTestRunScope = runInTestRunScope;
11
+ function getContext() {
12
+ const store = testRunScope.getStore();
13
+ if (!store) {
14
+ throw new Error('Attempted to access `context` from incorrect scope; only applicable to run-level hooks');
15
+ }
16
+ return store.context;
17
+ }
18
+ /**
19
+ * A proxy to the context for the currently-executing test run.
20
+ *
21
+ * @beta
22
+ * @remarks
23
+ * Useful for getting a handle on the context when using arrow functions and thus
24
+ * being unable to rely on the value of `this`. Only callable from the body of a
25
+ * `BeforeAll` or `AfterAll` hook (will throw otherwise).
26
+ */
27
+ exports.contextProxy = (0, make_proxy_1.makeProxy)(getContext);
28
+ //# sourceMappingURL=test_run_scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test_run_scope.js","sourceRoot":"","sources":["../../../src/runtime/scope/test_run_scope.ts"],"names":[],"mappings":";;;AAAA,uDAAoD;AAEpD,6CAAwC;AAMxC,MAAM,YAAY,GAAG,IAAI,oCAAiB,EAAqB,CAAA;AAExD,KAAK,UAAU,iBAAiB,CACrC,KAAwB,EACxB,QAA4B;IAE5B,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC1C,CAAC;AALD,8CAKC;AAED,SAAS,UAAU;IACjB,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAA;IACrC,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAA;KACF;IACD,OAAO,KAAK,CAAC,OAAmC,CAAA;AAClD,CAAC;AAED;;;;;;;;GAQG;AACU,QAAA,YAAY,GAAG,IAAA,sBAAS,EAAW,UAAU,CAAC,CAAA","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { IContext } from '../../support_code_library_builder/context'\nimport { makeProxy } from './make_proxy'\n\ninterface TestRunScopeStore<ParametersType = any> {\n context: IContext<ParametersType>\n}\n\nconst testRunScope = new AsyncLocalStorage<TestRunScopeStore>()\n\nexport async function runInTestRunScope<ResponseType>(\n store: TestRunScopeStore,\n callback: () => ResponseType\n) {\n return testRunScope.run(store, callback)\n}\n\nfunction getContext<ParametersType = any>(): IContext<ParametersType> {\n const store = testRunScope.getStore()\n if (!store) {\n throw new Error(\n 'Attempted to access `context` from incorrect scope; only applicable to run-level hooks'\n )\n }\n return store.context as IContext<ParametersType>\n}\n\n/**\n * A proxy to the context for the currently-executing test run.\n *\n * @beta\n * @remarks\n * Useful for getting a handle on the context when using arrow functions and thus\n * being unable to rely on the value of `this`. Only callable from the body of a\n * `BeforeAll` or `AfterAll` hook (will throw otherwise).\n */\nexport const contextProxy = makeProxy<IContext>(getContext)\n"]}
@@ -30,6 +30,7 @@ exports.run = void 0;
30
30
  const messages = __importStar(require("@cucumber/messages"));
31
31
  const user_code_runner_1 = __importDefault(require("../user_code_runner"));
32
32
  const value_checker_1 = require("../value_checker");
33
+ const scope_1 = require("./scope");
33
34
  const stopwatch_1 = require("./stopwatch");
34
35
  const format_error_1 = require("./format_error");
35
36
  async function run({ defaultTimeout, filterStackTraces, hookParameter, step, stepDefinition, world, }) {
@@ -48,12 +49,12 @@ async function run({ defaultTimeout, filterStackTraces, hookParameter, step, ste
48
49
  if ((0, value_checker_1.doesNotHaveValue)(error)) {
49
50
  const timeoutInMilliseconds = (0, value_checker_1.valueOrDefault)(stepDefinition.options.timeout, defaultTimeout);
50
51
  if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {
51
- const data = await user_code_runner_1.default.run({
52
+ const data = await (0, scope_1.runInTestCaseScope)({ world }, async () => user_code_runner_1.default.run({
52
53
  argsArray: invocationData.parameters,
53
54
  fn: stepDefinition.code,
54
55
  thisArg: world,
55
56
  timeoutInMilliseconds,
56
- });
57
+ }));
57
58
  error = data.error;
58
59
  result = data.result;
59
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"step_runner.js","sourceRoot":"","sources":["../../src/runtime/step_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,2EAAgD;AAGhD,oDAIyB;AACzB,2CAAoC;AACpC,iDAA4C;AAWrC,KAAK,UAAU,GAAG,CAAC,EACxB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,cAAc,EACd,KAAK,GACO;IACZ,MAAM,SAAS,GAAG,IAAA,kBAAM,GAAE,CAAC,KAAK,EAAE,CAAA;IAClC,IAAI,KAAU,EAAE,MAAW,EAAE,cAA0C,CAAA;IAEvE,IAAI;QACF,cAAc,GAAG,MAAM,cAAc,CAAC,uBAAuB,CAAC;YAC5D,aAAa;YACb,IAAI;YACJ,KAAK;SACN,CAAC,CAAA;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,KAAK,GAAG,GAAG,CAAA;KACZ;IAED,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE;QAC3B,MAAM,qBAAqB,GAAG,IAAA,8BAAc,EAC1C,cAAc,CAAC,OAAO,CAAC,OAAO,EAC9B,cAAc,CACf,CAAA;QAED,IAAI,cAAc,CAAC,gBAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACxE,MAAM,IAAI,GAAG,MAAM,0BAAc,CAAC,GAAG,CAAC;gBACpC,SAAS,EAAE,cAAc,CAAC,UAAU;gBACpC,EAAE,EAAE,cAAc,CAAC,IAAI;gBACvB,OAAO,EAAE,KAAK;gBACd,qBAAqB;aACtB,CAAC,CAAA;YACF,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;YAClB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;SACrB;aAAM;YACL,KAAK,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAA;SACrD;KACF;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC5C,IAAI,MAAqC,CAAA;IACzC,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;KAC/C;SAAM,IAAI,MAAM,KAAK,SAAS,EAAE;QAC/B,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;KAC/C;SAAM,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;QAC/B,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;KAC9C;SAAM;QACL,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;KAC9C;IAED,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;QACxB,OAAO,GAAG,IAAA,0BAAW,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;KAChD;IAED,OAAO;QACL,QAAQ;QACR,MAAM;QACN,GAAG,OAAO;KACX,CAAA;AACH,CAAC;AA/DD,kBA+DC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import * as messages from '@cucumber/messages'\nimport UserCodeRunner from '../user_code_runner'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { IDefinition, IGetInvocationDataResponse } from '../models/definition'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport { create } from './stopwatch'\nimport { formatError } from './format_error'\n\nexport interface IRunOptions {\n defaultTimeout: number\n filterStackTraces: boolean\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n stepDefinition: IDefinition\n world: any\n}\n\nexport async function run({\n defaultTimeout,\n filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<messages.TestStepResult> {\n const stopwatch = create().start()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\n } catch (err) {\n error = err\n }\n\n if (doesNotHaveValue(error)) {\n const timeoutInMilliseconds = valueOrDefault(\n stepDefinition.options.timeout,\n defaultTimeout\n )\n\n if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {\n const data = await UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\n error = data.error\n result = data.result\n } else {\n error = invocationData.getInvalidCodeLengthMessage()\n }\n }\n\n const duration = stopwatch.stop().duration()\n let status: messages.TestStepResultStatus\n let details = {}\n if (result === 'skipped') {\n status = messages.TestStepResultStatus.SKIPPED\n } else if (result === 'pending') {\n status = messages.TestStepResultStatus.PENDING\n } else if (doesHaveValue(error)) {\n status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n if (doesHaveValue(error)) {\n details = formatError(error, filterStackTraces)\n }\n\n return {\n duration,\n status,\n ...details,\n }\n}\n\nexport default { run }\n"]}
1
+ {"version":3,"file":"step_runner.js","sourceRoot":"","sources":["../../src/runtime/step_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,2EAAgD;AAGhD,oDAIyB;AACzB,mCAA4C;AAC5C,2CAAoC;AACpC,iDAA4C;AAWrC,KAAK,UAAU,GAAG,CAAC,EACxB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,cAAc,EACd,KAAK,GACO;IACZ,MAAM,SAAS,GAAG,IAAA,kBAAM,GAAE,CAAC,KAAK,EAAE,CAAA;IAClC,IAAI,KAAU,EAAE,MAAW,EAAE,cAA0C,CAAA;IAEvE,IAAI;QACF,cAAc,GAAG,MAAM,cAAc,CAAC,uBAAuB,CAAC;YAC5D,aAAa;YACb,IAAI;YACJ,KAAK;SACN,CAAC,CAAA;KACH;IAAC,OAAO,GAAG,EAAE;QACZ,KAAK,GAAG,GAAG,CAAA;KACZ;IAED,IAAI,IAAA,gCAAgB,EAAC,KAAK,CAAC,EAAE;QAC3B,MAAM,qBAAqB,GAAG,IAAA,8BAAc,EAC1C,cAAc,CAAC,OAAO,CAAC,OAAO,EAC9B,cAAc,CACf,CAAA;QAED,IAAI,cAAc,CAAC,gBAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACxE,MAAM,IAAI,GAAG,MAAM,IAAA,0BAAkB,EAAC,EAAE,KAAK,EAAE,EAAE,KAAK,IAAI,EAAE,CAC1D,0BAAc,CAAC,GAAG,CAAC;gBACjB,SAAS,EAAE,cAAc,CAAC,UAAU;gBACpC,EAAE,EAAE,cAAc,CAAC,IAAI;gBACvB,OAAO,EAAE,KAAK;gBACd,qBAAqB;aACtB,CAAC,CACH,CAAA;YACD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;YAClB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;SACrB;aAAM;YACL,KAAK,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAA;SACrD;KACF;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC5C,IAAI,MAAqC,CAAA;IACzC,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;KAC/C;SAAM,IAAI,MAAM,KAAK,SAAS,EAAE;QAC/B,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;KAC/C;SAAM,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;QAC/B,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;KAC9C;SAAM;QACL,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;KAC9C;IAED,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;QACxB,OAAO,GAAG,IAAA,0BAAW,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;KAChD;IAED,OAAO;QACL,QAAQ;QACR,MAAM;QACN,GAAG,OAAO;KACX,CAAA;AACH,CAAC;AAjED,kBAiEC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import * as messages from '@cucumber/messages'\nimport UserCodeRunner from '../user_code_runner'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { IDefinition, IGetInvocationDataResponse } from '../models/definition'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport { runInTestCaseScope } from './scope'\nimport { create } from './stopwatch'\nimport { formatError } from './format_error'\n\nexport interface IRunOptions {\n defaultTimeout: number\n filterStackTraces: boolean\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n stepDefinition: IDefinition\n world: any\n}\n\nexport async function run({\n defaultTimeout,\n filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<messages.TestStepResult> {\n const stopwatch = create().start()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\n } catch (err) {\n error = err\n }\n\n if (doesNotHaveValue(error)) {\n const timeoutInMilliseconds = valueOrDefault(\n stepDefinition.options.timeout,\n defaultTimeout\n )\n\n if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {\n const data = await runInTestCaseScope({ world }, async () =>\n UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\n )\n error = data.error\n result = data.result\n } else {\n error = invocationData.getInvalidCodeLengthMessage()\n }\n }\n\n const duration = stopwatch.stop().duration()\n let status: messages.TestStepResultStatus\n let details = {}\n if (result === 'skipped') {\n status = messages.TestStepResultStatus.SKIPPED\n } else if (result === 'pending') {\n status = messages.TestStepResultStatus.PENDING\n } else if (doesHaveValue(error)) {\n status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n if (doesHaveValue(error)) {\n details = formatError(error, filterStackTraces)\n }\n\n return {\n duration,\n status,\n ...details,\n }\n}\n\nexport default { run }\n"]}
@@ -0,0 +1,3 @@
1
+ export interface IContext<ParametersType = any> {
2
+ readonly parameters: ParametersType;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/support_code_library_builder/context.ts"],"names":[],"mappings":"","sourcesContent":["export interface IContext<ParametersType = any> {\n readonly parameters: ParametersType\n}\n"]}
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "10.6.0";
1
+ export declare const version = "10.8.0";
package/lib/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // Generated by genversion.
5
- exports.version = '10.6.0';
5
+ exports.version = '10.8.0';
6
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '10.6.0'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '10.8.0'\n"]}
package/lib/wrapper.mjs CHANGED
@@ -34,6 +34,8 @@ export const setWorldConstructor = cucumber.setWorldConstructor
34
34
  export const Then = cucumber.Then
35
35
  export const When = cucumber.When
36
36
  export const World = cucumber.World
37
+ export const world = cucumber.world
38
+ export const context = cucumber.context
37
39
  export const parallelCanAssignHelpers = cucumber.parallelCanAssignHelpers
38
40
 
39
41
  export const wrapPromiseWithTimeout = cucumber.wrapPromiseWithTimeout
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "gherkin",
9
9
  "tests"
10
10
  ],
11
- "version": "10.6.0",
11
+ "version": "10.8.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>",
@@ -164,6 +164,7 @@
164
164
  "Tom V <tom@toc.com>",
165
165
  "Tomer Ben-Rachel <tomerpacific@gmail.com>",
166
166
  "Tristan Dunn <tristanzdunn@gmail.com>",
167
+ "Tristan Zander <tristan.zander@ncino.com>",
167
168
  "unknown <jharlin@NormanDev2.telogical.com>",
168
169
  "Valerio Innocenti Sedili <valerio.innocenti.ext@yoox.com>",
169
170
  "Vasily Shelkov <vasilydshelkov@gmail.com>",
@@ -209,7 +210,7 @@
209
210
  "node": "18 || >=20"
210
211
  },
211
212
  "enginesTested": {
212
- "node": "18 || 20 || 21"
213
+ "node": "18 || 20 || 21 || 22"
213
214
  },
214
215
  "dependencies": {
215
216
  "@cucumber/ci-environment": "10.0.1",
@@ -1,7 +0,0 @@
1
- import Formatter, { IFormatterOptions } from '.';
2
- export default class HtmlFormatter extends Formatter {
3
- private readonly _htmlStream;
4
- static readonly documentation: string;
5
- constructor(options: IFormatterOptions);
6
- finished(): Promise<void>;
7
- }
@@ -1,31 +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_util_1 = require("node:util");
8
- const resolve_pkg_1 = __importDefault(require("resolve-pkg"));
9
- const html_formatter_1 = __importDefault(require("@cucumber/html-formatter"));
10
- const _1 = __importDefault(require("."));
11
- class HtmlFormatter extends _1.default {
12
- _htmlStream;
13
- static documentation = 'Outputs HTML report';
14
- constructor(options) {
15
- super(options);
16
- this._htmlStream = new html_formatter_1.default((0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
17
- '/dist/main.css', (0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
18
- '/dist/main.js');
19
- options.eventBroadcaster.on('envelope', (envelope) => {
20
- this._htmlStream.write(envelope);
21
- });
22
- this._htmlStream.on('data', (chunk) => this.log(chunk));
23
- }
24
- async finished() {
25
- this._htmlStream.end();
26
- await (0, node_util_1.promisify)(node_stream_1.finished)(this._htmlStream);
27
- await super.finished();
28
- }
29
- }
30
- exports.default = HtmlFormatter;
31
- //# sourceMappingURL=html_formatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"html_formatter.js","sourceRoot":"","sources":["../../src/formatter/html_formatter.ts"],"names":[],"mappings":";;;;;AAAA,6CAAsC;AACtC,yCAAqC;AAErC,8DAAoC;AACpC,8EAAyD;AACzD,yCAAgD;AAEhD,MAAqB,aAAc,SAAQ,UAAS;IACjC,WAAW,CAAoB;IACzC,MAAM,CAAU,aAAa,GAAW,qBAAqB,CAAA;IAEpE,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,WAAW,GAAG,IAAI,wBAAkB,CACvC,IAAA,qBAAU,EAAC,0BAA0B,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACxD,gBAAgB,EAClB,IAAA,qBAAU,EAAC,0BAA0B,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;YACxD,eAAe,CAClB,CAAA;QACD,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAClC,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;QACtB,MAAM,IAAA,qBAAS,EAAC,sBAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAC3C,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAA;IACxB,CAAC;;AAtBH,gCAuBC","sourcesContent":["import { finished } from 'node:stream'\nimport { promisify } from 'node:util'\nimport * as messages from '@cucumber/messages'\nimport resolvePkg from 'resolve-pkg'\nimport CucumberHtmlStream from '@cucumber/html-formatter'\nimport Formatter, { IFormatterOptions } from '.'\n\nexport default class HtmlFormatter extends Formatter {\n private readonly _htmlStream: CucumberHtmlStream\n public static readonly documentation: string = 'Outputs HTML report'\n\n constructor(options: IFormatterOptions) {\n super(options)\n this._htmlStream = new CucumberHtmlStream(\n resolvePkg('@cucumber/html-formatter', { cwd: __dirname }) +\n '/dist/main.css',\n resolvePkg('@cucumber/html-formatter', { cwd: __dirname }) +\n '/dist/main.js'\n )\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n this._htmlStream.write(envelope)\n })\n this._htmlStream.on('data', (chunk) => this.log(chunk))\n }\n\n async finished(): Promise<void> {\n this._htmlStream.end()\n await promisify(finished)(this._htmlStream)\n await super.finished()\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- import Formatter, { IFormatterOptions } from '.';
2
- export default class MessageFormatter extends Formatter {
3
- static readonly documentation: string;
4
- constructor(options: IFormatterOptions);
5
- }
@@ -1,15 +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 _1 = __importDefault(require("."));
7
- class MessageFormatter extends _1.default {
8
- static documentation = 'Outputs protobuf messages';
9
- constructor(options) {
10
- super(options);
11
- options.eventBroadcaster.on('envelope', (envelope) => this.log(JSON.stringify(envelope) + '\n'));
12
- }
13
- }
14
- exports.default = MessageFormatter;
15
- //# sourceMappingURL=message_formatter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"message_formatter.js","sourceRoot":"","sources":["../../src/formatter/message_formatter.ts"],"names":[],"mappings":";;;;;AACA,yCAAgD;AAEhD,MAAqB,gBAAiB,SAAQ,UAAS;IAC9C,MAAM,CAAU,aAAa,GAAW,2BAA2B,CAAA;IAC1E,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE,CACtE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAC1C,CAAA;IACH,CAAC;;AAPH,mCAQC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport Formatter, { IFormatterOptions } from '.'\n\nexport default class MessageFormatter extends Formatter {\n public static readonly documentation: string = 'Outputs protobuf messages'\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) =>\n this.log(JSON.stringify(envelope) + '\\n')\n )\n }\n}\n"]}