@lynxwall/cucumber-tsflow 5.1.3 → 6.0.2

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 (99) hide show
  1. package/README.md +546 -544
  2. package/bin/cucumber-tsflow +1 -1
  3. package/lib/behave.d.ts +1 -1
  4. package/lib/behave.js +27 -27
  5. package/lib/cli/argv-parser.d.ts +24 -24
  6. package/lib/cli/argv-parser.js +103 -103
  7. package/lib/cli/index.d.ts +22 -22
  8. package/lib/cli/index.js +101 -96
  9. package/lib/cli/load-configuration.d.ts +20 -20
  10. package/lib/cli/load-configuration.js +92 -92
  11. package/lib/cli/run.d.ts +1 -1
  12. package/lib/cli/run.js +49 -44
  13. package/lib/cucumber/binding-decorator.d.ts +10 -10
  14. package/lib/cucumber/binding-decorator.js +180 -180
  15. package/lib/cucumber/binding-registry.d.ts +82 -82
  16. package/lib/cucumber/binding-registry.js +216 -218
  17. package/lib/cucumber/hook-decorators.d.ts +46 -46
  18. package/lib/cucumber/hook-decorators.js +102 -102
  19. package/lib/cucumber/managed-scenario-context.d.ts +21 -21
  20. package/lib/cucumber/managed-scenario-context.js +96 -95
  21. package/lib/cucumber/message-collector.d.ts +81 -80
  22. package/lib/cucumber/message-collector.js +251 -241
  23. package/lib/cucumber/parallel/coordinator.d.ts +79 -78
  24. package/lib/cucumber/parallel/coordinator.js +247 -228
  25. package/lib/cucumber/parallel/run-worker.d.ts +1 -1
  26. package/lib/cucumber/parallel/run-worker.js +31 -31
  27. package/lib/cucumber/parallel/worker.d.ts +30 -31
  28. package/lib/cucumber/parallel/worker.js +104 -104
  29. package/lib/cucumber/run-cucumber.d.ts +14 -14
  30. package/lib/cucumber/run-cucumber.js +117 -117
  31. package/lib/cucumber/runtime.d.ts +25 -25
  32. package/lib/cucumber/runtime.js +39 -39
  33. package/lib/cucumber/step-definition-decorators.d.ts +24 -24
  34. package/lib/cucumber/step-definition-decorators.js +91 -91
  35. package/lib/cucumber/utils.d.ts +16 -16
  36. package/lib/cucumber/utils.js +77 -77
  37. package/lib/esnode.js +19 -19
  38. package/lib/esvue.d.ts +1 -1
  39. package/lib/esvue.js +41 -41
  40. package/lib/formatters/behave-json-formatter.d.ts +49 -49
  41. package/lib/formatters/behave-json-formatter.js +75 -75
  42. package/lib/formatters/tsflow-snippet-syntax.d.ts +9 -9
  43. package/lib/formatters/tsflow-snippet-syntax.js +90 -93
  44. package/lib/gherkin/configuration.d.ts +30 -30
  45. package/lib/gherkin/configuration.js +26 -26
  46. package/lib/gherkin/gherkin-feature.d.ts +28 -28
  47. package/lib/gherkin/gherkin-feature.js +333 -335
  48. package/lib/gherkin/gherkin-manager.d.ts +29 -29
  49. package/lib/gherkin/gherkin-manager.js +114 -113
  50. package/lib/gherkin/models.d.ts +45 -45
  51. package/lib/gherkin/models.js +2 -2
  52. package/lib/index.d.ts +4 -4
  53. package/lib/index.js +22 -22
  54. package/lib/snippet.d.ts +1 -1
  55. package/lib/snippet.js +27 -27
  56. package/lib/transpilers/esbuild-transpiler.d.ts +4 -4
  57. package/lib/transpilers/esbuild-transpiler.js +19 -21
  58. package/lib/transpilers/esbuild.d.ts +12 -12
  59. package/lib/transpilers/esbuild.js +54 -54
  60. package/lib/transpilers/vue-sfc/compiler.d.ts +7 -7
  61. package/lib/transpilers/vue-sfc/compiler.js +21 -21
  62. package/lib/transpilers/vue-sfc/index.d.ts +23 -23
  63. package/lib/transpilers/vue-sfc/index.js +47 -45
  64. package/lib/transpilers/vue-sfc/main.d.ts +8 -8
  65. package/lib/transpilers/vue-sfc/main.js +248 -248
  66. package/lib/transpilers/vue-sfc/script.d.ts +5 -5
  67. package/lib/transpilers/vue-sfc/script.js +41 -41
  68. package/lib/transpilers/vue-sfc/template.d.ts +8 -8
  69. package/lib/transpilers/vue-sfc/template.js +101 -101
  70. package/lib/transpilers/vue-sfc/types.d.ts +55 -55
  71. package/lib/transpilers/vue-sfc/types.js +2 -2
  72. package/lib/transpilers/vue-sfc/utils/descriptorCache.d.ts +13 -13
  73. package/lib/transpilers/vue-sfc/utils/descriptorCache.js +67 -67
  74. package/lib/transpilers/vue-sfc/utils/error.d.ts +3 -3
  75. package/lib/transpilers/vue-sfc/utils/error.js +22 -22
  76. package/lib/transpilers/vue-sfc/utils/query.d.ts +13 -13
  77. package/lib/transpilers/vue-sfc/utils/query.js +35 -35
  78. package/lib/tsnode.js +17 -17
  79. package/lib/tsvue.d.ts +1 -1
  80. package/lib/tsvue.js +39 -39
  81. package/lib/types/scenario-context.d.ts +16 -16
  82. package/lib/types/scenario-context.js +17 -17
  83. package/lib/types/scenario-info.d.ts +16 -16
  84. package/lib/types/scenario-info.js +23 -21
  85. package/lib/types/step-binding-flags.d.ts +53 -53
  86. package/lib/types/step-binding-flags.js +58 -58
  87. package/lib/types/step-binding.d.ts +50 -50
  88. package/lib/types/step-binding.js +17 -17
  89. package/lib/types/types.d.ts +21 -21
  90. package/lib/types/types.js +2 -2
  91. package/lib/utils/helpers.d.ts +6 -6
  92. package/lib/utils/helpers.js +17 -17
  93. package/lib/utils/logger.d.ts +3 -3
  94. package/lib/utils/logger.js +29 -29
  95. package/lib/utils/our-callsite.d.ts +27 -27
  96. package/lib/utils/our-callsite.js +73 -71
  97. package/lib/version.d.ts +1 -1
  98. package/lib/version.js +5 -5
  99. package/package.json +58 -58
@@ -1,31 +1,30 @@
1
- import { ICoordinatorReport, IWorkerCommand, IWorkerCommandInitialize, IWorkerCommandRun } from '@cucumber/cucumber/lib/runtime/parallel/command_types';
2
- declare type IExitFunction = (exitCode: number, error?: Error, message?: string) => void;
3
- declare type IMessageSender = (command: ICoordinatorReport) => void;
4
- /**
5
- * Modified from cucumber.js to instantiate and initialize
6
- * a message collector needed for test bindings.
7
- */
8
- export default class Worker {
9
- private readonly cwd;
10
- private readonly exit;
11
- private readonly id;
12
- private readonly eventBroadcaster;
13
- private filterStacktraces;
14
- private readonly newId;
15
- private readonly sendMessage;
16
- private readonly stackTraceFilter;
17
- private supportCodeLibrary?;
18
- private worldParameters;
19
- private runTestRunHooks?;
20
- constructor({ cwd, exit, id, sendMessage }: {
21
- cwd: string;
22
- exit: IExitFunction;
23
- id: string;
24
- sendMessage: IMessageSender;
25
- });
26
- initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options }: IWorkerCommandInitialize): Promise<void>;
27
- finalize(): Promise<void>;
28
- receiveMessage(message: IWorkerCommand): Promise<void>;
29
- runTestCase({ gherkinDocument, pickle, testCase, elapsed, retries, skip }: IWorkerCommandRun): Promise<void>;
30
- }
31
- export {};
1
+ import { ICoordinatorReport, IWorkerCommand, IWorkerCommandInitialize, IWorkerCommandRun } from '@cucumber/cucumber/lib/runtime/parallel/command_types';
2
+ type IExitFunction = (exitCode: number, error?: Error, message?: string) => void;
3
+ type IMessageSender = (command: ICoordinatorReport) => void;
4
+ /**
5
+ * Modified from cucumber.js to instantiate and initialize
6
+ * a message collector needed for test bindings.
7
+ */
8
+ export default class Worker {
9
+ private readonly cwd;
10
+ private readonly exit;
11
+ private readonly id;
12
+ private readonly eventBroadcaster;
13
+ private filterStacktraces;
14
+ private readonly newId;
15
+ private readonly sendMessage;
16
+ private supportCodeLibrary?;
17
+ private worldParameters;
18
+ private runTestRunHooks?;
19
+ constructor({ cwd, exit, id, sendMessage }: {
20
+ cwd: string;
21
+ exit: IExitFunction;
22
+ id: string;
23
+ sendMessage: IMessageSender;
24
+ });
25
+ initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options }: IWorkerCommandInitialize): Promise<void>;
26
+ finalize(): Promise<void>;
27
+ receiveMessage(message: IWorkerCommand): Promise<void>;
28
+ runTestCase({ gherkinDocument, pickle, testCase, elapsed, retries, skip }: IWorkerCommandRun): Promise<void>;
29
+ }
30
+ export {};
@@ -1,104 +1,104 @@
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 messages_1 = require("@cucumber/messages");
7
- const durations_1 = require("durations");
8
- const events_1 = require("events");
9
- const url_1 = require("url");
10
- const stack_trace_filter_1 = __importDefault(require("@cucumber/cucumber/lib/stack_trace_filter"));
11
- const index_1 = __importDefault(require("@cucumber/cucumber/lib/support_code_library_builder/index"));
12
- const run_test_run_hooks_1 = require("@cucumber/cucumber/lib/runtime/run_test_run_hooks");
13
- const stopwatch_1 = require("@cucumber/cucumber/lib/runtime/stopwatch");
14
- const test_case_runner_1 = __importDefault(require("@cucumber/cucumber/lib/runtime/test_case_runner"));
15
- const message_collector_1 = __importDefault(require("../message-collector"));
16
- // eslint-disable-next-line @typescript-eslint/no-var-requires
17
- const { importer } = require('@cucumber/cucumber/lib/importer');
18
- const { uuid } = messages_1.IdGenerator;
19
- /**
20
- * Modified from cucumber.js to instantiate and initialize
21
- * a message collector needed for test bindings.
22
- */
23
- class Worker {
24
- constructor({ cwd, exit, id, sendMessage }) {
25
- this.filterStacktraces = false;
26
- this.id = id;
27
- this.newId = uuid();
28
- this.cwd = cwd;
29
- this.exit = exit;
30
- this.sendMessage = sendMessage;
31
- this.eventBroadcaster = new events_1.EventEmitter();
32
- this.stackTraceFilter = new stack_trace_filter_1.default();
33
- this.eventBroadcaster.on('envelope', (envelope) => {
34
- this.sendMessage({
35
- jsonEnvelope: JSON.stringify(envelope)
36
- });
37
- });
38
- // create an instance of the messageCollector, bind it to the event broadcaster
39
- // and then make it global for use in the binding-decorator.
40
- const messageCollector = new message_collector_1.default();
41
- this.eventBroadcaster.on('envelope', messageCollector.parseEnvelope.bind(messageCollector));
42
- global.messageCollector = messageCollector;
43
- }
44
- async initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options }) {
45
- index_1.default.reset(this.cwd, this.newId);
46
- requireModules.map(module => require(module));
47
- requirePaths.map(module => require(module));
48
- for (const path of importPaths) {
49
- await importer((0, url_1.pathToFileURL)(path));
50
- }
51
- this.supportCodeLibrary = index_1.default.finalize(supportCodeIds);
52
- this.worldParameters = options.worldParameters;
53
- this.filterStacktraces = filterStacktraces;
54
- if (this.filterStacktraces) {
55
- this.stackTraceFilter.filter();
56
- }
57
- this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(options.dryRun, this.supportCodeLibrary.defaultTimeout, (name, location) => `${name} hook errored on worker ${this.id}, process exiting: ${location}`);
58
- await this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');
59
- this.sendMessage({ ready: true });
60
- }
61
- async finalize() {
62
- if (this.supportCodeLibrary && this.runTestRunHooks) {
63
- await this.runTestRunHooks(this.supportCodeLibrary.afterTestRunHookDefinitions, 'an AfterAll');
64
- }
65
- if (this.filterStacktraces) {
66
- this.stackTraceFilter.unfilter();
67
- }
68
- this.exit(0);
69
- }
70
- async receiveMessage(message) {
71
- if (message.initialize) {
72
- await this.initialize(message.initialize);
73
- }
74
- else if (message.finalize) {
75
- await this.finalize();
76
- }
77
- else if (message.run) {
78
- await this.runTestCase(message.run);
79
- }
80
- }
81
- async runTestCase({ gherkinDocument, pickle, testCase, elapsed, retries, skip }) {
82
- const stopwatch = new stopwatch_1.RealTestRunStopwatch();
83
- stopwatch.from((0, durations_1.duration)(elapsed));
84
- // Add the pickle and testCase to the messageCollector that's
85
- // initialized in the constructor
86
- global.messageCollector.addPickleAndTestCase(pickle, testCase);
87
- const testCaseRunner = new test_case_runner_1.default({
88
- eventBroadcaster: this.eventBroadcaster,
89
- stopwatch,
90
- gherkinDocument,
91
- newId: this.newId,
92
- pickle,
93
- testCase,
94
- retries,
95
- skip,
96
- supportCodeLibrary: this.supportCodeLibrary,
97
- worldParameters: this.worldParameters
98
- });
99
- await testCaseRunner.run();
100
- this.sendMessage({ ready: true });
101
- }
102
- }
103
- exports.default = Worker;
104
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi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BQU87WUFDUCxJQUFJO1lBQ0osa0JBQWtCLEVBQUUsSUFBSSxDQUFDLGtCQUF5QztZQUNsRSxlQUFlLEVBQUUsSUFBSSxDQUFDLGVBQWU7U0FDckMsQ0FBQyxDQUFDO1FBQ0gsTUFBTSxjQUFjLENBQUMsR0FBRyxFQUFFLENBQUM7UUFDM0IsSUFBSSxDQUFDLFdBQVcsQ0FBQyxFQUFFLEtBQUssRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDO0lBQ25DLENBQUM7Q0FDRDtBQW5IRCx5QkFtSEMifQ==
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 messages_1 = require("@cucumber/messages");
7
+ const events_1 = require("events");
8
+ const url_1 = require("url");
9
+ const index_1 = __importDefault(require("@cucumber/cucumber/lib/support_code_library_builder/index"));
10
+ const run_test_run_hooks_1 = require("@cucumber/cucumber/lib/runtime/run_test_run_hooks");
11
+ const stopwatch_1 = require("@cucumber/cucumber/lib/runtime/stopwatch");
12
+ const test_case_runner_1 = __importDefault(require("@cucumber/cucumber/lib/runtime/test_case_runner"));
13
+ const message_collector_1 = __importDefault(require("../message-collector"));
14
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
15
+ const { importer } = require('@cucumber/cucumber/lib/importer');
16
+ const { uuid } = messages_1.IdGenerator;
17
+ /**
18
+ * Modified from cucumber.js to instantiate and initialize
19
+ * a message collector needed for test bindings.
20
+ */
21
+ class Worker {
22
+ cwd;
23
+ exit;
24
+ id;
25
+ eventBroadcaster;
26
+ filterStacktraces = false;
27
+ newId;
28
+ sendMessage;
29
+ supportCodeLibrary;
30
+ worldParameters;
31
+ runTestRunHooks;
32
+ constructor({ cwd, exit, id, sendMessage }) {
33
+ this.id = id;
34
+ this.newId = uuid();
35
+ this.cwd = cwd;
36
+ this.exit = exit;
37
+ this.sendMessage = sendMessage;
38
+ this.eventBroadcaster = new events_1.EventEmitter();
39
+ this.eventBroadcaster.on('envelope', (envelope) => {
40
+ this.sendMessage({
41
+ jsonEnvelope: JSON.stringify(envelope)
42
+ });
43
+ });
44
+ // create an instance of the messageCollector, bind it to the event broadcaster
45
+ // and then make it global for use in the binding-decorator.
46
+ const messageCollector = new message_collector_1.default();
47
+ this.eventBroadcaster.on('envelope', messageCollector.parseEnvelope.bind(messageCollector));
48
+ global.messageCollector = messageCollector;
49
+ }
50
+ async initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options }) {
51
+ index_1.default.reset(this.cwd, this.newId);
52
+ requireModules.map(module => require(module));
53
+ requirePaths.map(module => require(module));
54
+ for (const path of importPaths) {
55
+ await importer((0, url_1.pathToFileURL)(path));
56
+ }
57
+ this.supportCodeLibrary = index_1.default.finalize(supportCodeIds);
58
+ this.worldParameters = options.worldParameters;
59
+ this.filterStacktraces = filterStacktraces;
60
+ this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(options.dryRun, this.supportCodeLibrary.defaultTimeout, (name, location) => `${name} hook errored on worker ${this.id}, process exiting: ${location}`);
61
+ await this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');
62
+ this.sendMessage({ ready: true });
63
+ }
64
+ async finalize() {
65
+ if (this.supportCodeLibrary && this.runTestRunHooks) {
66
+ await this.runTestRunHooks(this.supportCodeLibrary.afterTestRunHookDefinitions, 'an AfterAll');
67
+ }
68
+ this.exit(0);
69
+ }
70
+ async receiveMessage(message) {
71
+ if (message.initialize) {
72
+ await this.initialize(message.initialize);
73
+ }
74
+ else if (message.finalize) {
75
+ await this.finalize();
76
+ }
77
+ else if (message.run) {
78
+ await this.runTestCase(message.run);
79
+ }
80
+ }
81
+ async runTestCase({ gherkinDocument, pickle, testCase, elapsed, retries, skip }) {
82
+ // Add the pickle and testCase to the messageCollector that's
83
+ // initialized in the constructor
84
+ global.messageCollector.addPickleAndTestCase(pickle, testCase);
85
+ const stopwatch = (0, stopwatch_1.create)(elapsed);
86
+ const testCaseRunner = new test_case_runner_1.default({
87
+ eventBroadcaster: this.eventBroadcaster,
88
+ stopwatch,
89
+ gherkinDocument,
90
+ newId: this.newId,
91
+ pickle,
92
+ testCase,
93
+ retries,
94
+ skip,
95
+ filterStackTraces: this.filterStacktraces,
96
+ supportCodeLibrary: this.supportCodeLibrary,
97
+ worldParameters: this.worldParameters
98
+ });
99
+ await testCaseRunner.run();
100
+ this.sendMessage({ ready: true });
101
+ }
102
+ }
103
+ exports.default = Worker;
104
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2N1Y3VtYmVyL3BhcmFsbGVsL3dvcmtlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUNBLGlEQUFpRDtBQUNqRCxtQ0FBc0M7QUFDdEMsNkJBQW9DO0FBQ3BDLHNHQUFrRztBQUVsRywwRkFBMEc7QUFDMUcsd0VBQWtFO0FBQ2xFLHVHQUE2RTtBQU83RSw2RUFBb0Q7QUFFcEQsOERBQThEO0FBQzlELE1BQU0sRUFBRSxRQUFRLEVBQUUsR0FBRyxPQUFPLENBQUMsaUNBQWlDLENBQUMsQ0FBQztBQUNoRSxNQUFNLEVBQUUsSUFBSSxFQUFFLEdBQUcsc0JBQVcsQ0FBQztBQUs3Qjs7O0dBR0c7QUFDSCxNQUFxQixNQUFNO0lBQ1QsR0FBRyxDQUFTO0lBQ1osSUFBSSxDQUFnQjtJQUVwQixFQUFFLENBQVM7SUFDWCxnQkFBZ0IsQ0FBZTtJQUN4QyxpQkFBaUIsR0FBWSxLQUFLLENBQUM7SUFDMUIsS0FBSyxDQUFvQjtJQUN6QixXQUFXLENBQWlCO0lBQ3JDLGtCQUFrQixDQUF1QjtJQUN6QyxlQUFlLENBQU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ENBQUM7UUFDbEMsTUFBTSxjQUFjLEdBQUcsSUFBSSwwQkFBYyxDQUFDO1lBQ3pDLGdCQUFnQixFQUFFLElBQUksQ0FBQyxnQkFBZ0I7WUFDdkMsU0FBUztZQUNULGVBQWU7WUFDZixLQUFLLEVBQUUsSUFBSSxDQUFDLEtBQUs7WUFDakIsTUFBTTtZQUNOLFFBQVE7WUFDUixPQUFPO1lBQ1AsSUFBSTtZQUNKLGlCQUFpQixFQUFFLElBQUksQ0FBQyxpQkFBaUI7WUFDekMsa0JBQWtCLEVBQUUsSUFBSSxDQUFDLGtCQUF5QztZQUNsRSxlQUFlLEVBQUUsSUFBSSxDQUFDLGVBQWU7U0FDckMsQ0FBQyxDQUFDO1FBQ0gsTUFBTSxjQUFjLENBQUMsR0FBRyxFQUFFLENBQUM7UUFDM0IsSUFBSSxDQUFDLFdBQVcsQ0FBQyxFQUFFLEtBQUssRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDO0lBQ25DLENBQUM7Q0FDRDtBQTNHRCx5QkEyR0MifQ==
@@ -1,14 +1,14 @@
1
- import { Envelope } from '@cucumber/messages';
2
- import { IRunOptions, IRunEnvironment, IRunResult } from '@cucumber/cucumber/lib/api/types';
3
- /**
4
- * Execute a Cucumber test run.
5
- *
6
- * Extended from cucumber.js so that we can use our own implementation
7
- * of makeRuntime
8
- *
9
- * @public
10
- * @param configuration - Configuration loaded from `loadConfiguration`.
11
- * @param environment - Project environment.
12
- * @param onMessage - Callback fired each time Cucumber emits a message.
13
- */
14
- export declare function runCucumber(configuration: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;
1
+ import { Envelope } from '@cucumber/messages';
2
+ import { IRunOptions, IRunEnvironment, IRunResult } from '@cucumber/cucumber/lib/api/types';
3
+ /**
4
+ * Execute a Cucumber test run.
5
+ *
6
+ * Extended from cucumber.js so that we can use our own implementation
7
+ * of makeRuntime
8
+ *
9
+ * @public
10
+ * @param configuration - Configuration loaded from `loadConfiguration`.
11
+ * @param environment - Project environment.
12
+ * @param onMessage - Callback fired each time Cucumber emits a message.
13
+ */
14
+ export declare function runCucumber(configuration: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;
@@ -1,118 +1,118 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.runCucumber = void 0;
7
- const messages_1 = require("@cucumber/messages");
8
- const events_1 = require("events");
9
- const helpers_1 = require("@cucumber/cucumber/lib/cli/helpers");
10
- const paths_1 = require("@cucumber/cucumber/lib/api/paths");
11
- const runtime_1 = require("./runtime");
12
- const formatters_1 = require("@cucumber/cucumber/lib/api/formatters");
13
- const support_1 = require("@cucumber/cucumber/lib/api/support");
14
- const environment_1 = require("@cucumber/cucumber/lib/api/environment");
15
- const gherkin_1 = require("@cucumber/cucumber/lib/api/gherkin");
16
- const message_collector_1 = __importDefault(require("./message-collector"));
17
- const console_logger_1 = require("@cucumber/cucumber/lib/api/console_logger");
18
- /**
19
- * Execute a Cucumber test run.
20
- *
21
- * Extended from cucumber.js so that we can use our own implementation
22
- * of makeRuntime
23
- *
24
- * @public
25
- * @param configuration - Configuration loaded from `loadConfiguration`.
26
- * @param environment - Project environment.
27
- * @param onMessage - Callback fired each time Cucumber emits a message.
28
- */
29
- async function runCucumber(configuration, environment = {}, onMessage) {
30
- const { cwd, stdout, stderr, env, debug } = (0, environment_1.mergeEnvironment)(environment);
31
- const logger = new console_logger_1.ConsoleLogger(stderr, debug);
32
- const newId = messages_1.IdGenerator.uuid();
33
- const supportCoordinates = 'World' in configuration.support ? configuration.support.originalCoordinates : configuration.support;
34
- const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } = await (0, paths_1.resolvePaths)(logger, cwd, configuration.sources, supportCoordinates);
35
- const supportCodeLibrary = 'World' in configuration.support
36
- ? configuration.support
37
- : await (0, support_1.getSupportCodeLibrary)({
38
- cwd,
39
- newId,
40
- requirePaths,
41
- importPaths,
42
- requireModules: supportCoordinates.requireModules
43
- });
44
- const eventBroadcaster = new events_1.EventEmitter();
45
- if (onMessage) {
46
- eventBroadcaster.on('envelope', onMessage);
47
- }
48
- // create a global instance of the message collector and bind it
49
- // to the event broadcaster. This is used by cucumber and for tests
50
- // that are not running in parallel.
51
- global.messageCollector = new message_collector_1.default();
52
- eventBroadcaster.on('envelope', global.messageCollector.parseEnvelope.bind(global.messageCollector));
53
- let formatterStreamError = false;
54
- const cleanup = await (0, formatters_1.initializeFormatters)({
55
- env,
56
- cwd,
57
- stdout,
58
- stderr,
59
- logger,
60
- onStreamError: () => (formatterStreamError = true),
61
- eventBroadcaster,
62
- eventDataCollector: global.messageCollector,
63
- configuration: configuration.formats,
64
- supportCodeLibrary
65
- });
66
- await (0, helpers_1.emitMetaMessage)(eventBroadcaster, env);
67
- let pickleIds = [];
68
- let parseErrors = [];
69
- if (featurePaths.length > 0) {
70
- const gherkinResult = await (0, gherkin_1.getFilteredPicklesAndErrors)({
71
- newId,
72
- cwd,
73
- logger,
74
- unexpandedFeaturePaths,
75
- featurePaths,
76
- coordinates: configuration.sources,
77
- onEnvelope: envelope => eventBroadcaster.emit('envelope', envelope)
78
- });
79
- pickleIds = gherkinResult.filteredPickles.map(({ pickle }) => pickle.id);
80
- parseErrors = gherkinResult.parseErrors;
81
- }
82
- if (parseErrors.length) {
83
- parseErrors.forEach(parseError => {
84
- logger.error(`Parse error in "${parseError.source.uri}" ${parseError.message}`);
85
- });
86
- await cleanup();
87
- return {
88
- success: false,
89
- support: supportCodeLibrary
90
- };
91
- }
92
- (0, helpers_1.emitSupportCodeMessages)({
93
- eventBroadcaster,
94
- supportCodeLibrary,
95
- newId
96
- });
97
- const runtime = (0, runtime_1.makeRuntime)({
98
- cwd,
99
- logger,
100
- eventBroadcaster,
101
- eventDataCollector: global.messageCollector,
102
- pickleIds,
103
- newId,
104
- supportCodeLibrary,
105
- requireModules: supportCoordinates.requireModules,
106
- requirePaths,
107
- importPaths,
108
- options: configuration.runtime
109
- });
110
- const success = await runtime.start();
111
- await cleanup();
112
- return {
113
- success: success && !formatterStreamError,
114
- support: supportCodeLibrary
115
- };
116
- }
117
- exports.runCucumber = runCucumber;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runCucumber = void 0;
7
+ const messages_1 = require("@cucumber/messages");
8
+ const events_1 = require("events");
9
+ const helpers_1 = require("@cucumber/cucumber/lib/cli/helpers");
10
+ const paths_1 = require("@cucumber/cucumber/lib/api/paths");
11
+ const runtime_1 = require("./runtime");
12
+ const formatters_1 = require("@cucumber/cucumber/lib/api/formatters");
13
+ const support_1 = require("@cucumber/cucumber/lib/api/support");
14
+ const environment_1 = require("@cucumber/cucumber/lib/api/environment");
15
+ const gherkin_1 = require("@cucumber/cucumber/lib/api/gherkin");
16
+ const message_collector_1 = __importDefault(require("./message-collector"));
17
+ const console_logger_1 = require("@cucumber/cucumber/lib/api/console_logger");
18
+ /**
19
+ * Execute a Cucumber test run.
20
+ *
21
+ * Extended from cucumber.js so that we can use our own implementation
22
+ * of makeRuntime
23
+ *
24
+ * @public
25
+ * @param configuration - Configuration loaded from `loadConfiguration`.
26
+ * @param environment - Project environment.
27
+ * @param onMessage - Callback fired each time Cucumber emits a message.
28
+ */
29
+ async function runCucumber(configuration, environment = {}, onMessage) {
30
+ const { cwd, stdout, stderr, env, debug } = (0, environment_1.mergeEnvironment)(environment);
31
+ const logger = new console_logger_1.ConsoleLogger(stderr, debug);
32
+ const newId = messages_1.IdGenerator.uuid();
33
+ const supportCoordinates = 'World' in configuration.support ? configuration.support.originalCoordinates : configuration.support;
34
+ const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } = await (0, paths_1.resolvePaths)(logger, cwd, configuration.sources, supportCoordinates);
35
+ const supportCodeLibrary = 'World' in configuration.support
36
+ ? configuration.support
37
+ : await (0, support_1.getSupportCodeLibrary)({
38
+ cwd,
39
+ newId,
40
+ requirePaths,
41
+ importPaths,
42
+ requireModules: supportCoordinates.requireModules
43
+ });
44
+ const eventBroadcaster = new events_1.EventEmitter();
45
+ if (onMessage) {
46
+ eventBroadcaster.on('envelope', onMessage);
47
+ }
48
+ // create a global instance of the message collector and bind it
49
+ // to the event broadcaster. This is used by cucumber and for tests
50
+ // that are not running in parallel.
51
+ global.messageCollector = new message_collector_1.default();
52
+ eventBroadcaster.on('envelope', global.messageCollector.parseEnvelope.bind(global.messageCollector));
53
+ let formatterStreamError = false;
54
+ const cleanup = await (0, formatters_1.initializeFormatters)({
55
+ env,
56
+ cwd,
57
+ stdout,
58
+ stderr,
59
+ logger,
60
+ onStreamError: () => (formatterStreamError = true),
61
+ eventBroadcaster,
62
+ eventDataCollector: global.messageCollector,
63
+ configuration: configuration.formats,
64
+ supportCodeLibrary
65
+ });
66
+ await (0, helpers_1.emitMetaMessage)(eventBroadcaster, env);
67
+ let pickleIds = [];
68
+ let parseErrors = [];
69
+ if (featurePaths.length > 0) {
70
+ const gherkinResult = await (0, gherkin_1.getFilteredPicklesAndErrors)({
71
+ newId,
72
+ cwd,
73
+ logger,
74
+ unexpandedFeaturePaths,
75
+ featurePaths,
76
+ coordinates: configuration.sources,
77
+ onEnvelope: envelope => eventBroadcaster.emit('envelope', envelope)
78
+ });
79
+ pickleIds = gherkinResult.filteredPickles.map(({ pickle }) => pickle.id);
80
+ parseErrors = gherkinResult.parseErrors;
81
+ }
82
+ if (parseErrors.length) {
83
+ parseErrors.forEach(parseError => {
84
+ logger.error(`Parse error in "${parseError.source.uri}" ${parseError.message}`);
85
+ });
86
+ await cleanup();
87
+ return {
88
+ success: false,
89
+ support: supportCodeLibrary
90
+ };
91
+ }
92
+ (0, helpers_1.emitSupportCodeMessages)({
93
+ eventBroadcaster,
94
+ supportCodeLibrary,
95
+ newId
96
+ });
97
+ const runtime = (0, runtime_1.makeRuntime)({
98
+ cwd,
99
+ logger,
100
+ eventBroadcaster,
101
+ eventDataCollector: global.messageCollector,
102
+ pickleIds,
103
+ newId,
104
+ supportCodeLibrary,
105
+ requireModules: supportCoordinates.requireModules,
106
+ requirePaths,
107
+ importPaths,
108
+ options: configuration.runtime
109
+ });
110
+ const success = await runtime.start();
111
+ await cleanup();
112
+ return {
113
+ success: success && !formatterStreamError,
114
+ support: supportCodeLibrary
115
+ };
116
+ }
117
+ exports.runCucumber = runCucumber;
118
118
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVuLWN1Y3VtYmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2N1Y3VtYmVyL3J1bi1jdWN1bWJlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxpREFBdUU7QUFDdkUsbUNBQXNDO0FBRXRDLGdFQUE4RjtBQUU5Riw0REFBZ0U7QUFDaEUsdUNBQXdDO0FBQ3hDLHNFQUE2RTtBQUM3RSxnRUFBMkU7QUFDM0Usd0VBQTBFO0FBQzFFLGdFQUFpRjtBQUNqRiw0RUFBbUQ7QUFFbkQsOEVBQTBFO0FBQzFFOzs7Ozs7Ozs7O0dBVUc7QUFDSSxLQUFLLFVBQVUsV0FBVyxDQUNoQyxhQUEwQixFQUMxQixjQUErQixFQUFFLEVBQ2pDLFNBQXVDO0lBRXZDLE1BQU0sRUFBRSxHQUFHLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxHQUFHLEVBQUUsS0FBSyxFQUFFLEdBQUcsSUFBQSw4QkFBZ0IsRUFBQyxXQUFXLENBQUMsQ0FBQztJQUMxRSxNQUFNLE1BQU0sR0FBWSxJQUFJLDhCQUFhLENBQUMsTUFBTSxFQUFFLEtBQUssQ0FBQyxDQUFDO0lBRXpELE1BQU0sS0FBSyxHQU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EVBQUUsT0FBTyxJQUFJLENBQUMsb0JBQW9CO1FBQ3pDLE9BQU8sRUFBRSxrQkFBa0I7S0FDM0IsQ0FBQztBQUNILENBQUM7QUE1R0Qsa0NBNEdDIn0=
@@ -1,25 +1,25 @@
1
- /// <reference types="node" />
2
- import { IRuntime } from '@cucumber/cucumber/lib/runtime/index';
3
- import { EventEmitter } from 'events';
4
- import { EventDataCollector } from '@cucumber/cucumber/lib/formatter/helpers';
5
- import { IdGenerator } from '@cucumber/messages';
6
- import { ISupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
7
- import { IRunOptionsRuntime } from '@cucumber/cucumber/lib/api/types';
8
- import { ILogger } from '@cucumber/cucumber/lib/logger';
9
- /**
10
- * Extending this function from cucumber.js to use our own implementation
11
- * of the Coordinator.
12
- */
13
- export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options } }: {
14
- cwd: string;
15
- logger: ILogger;
16
- eventBroadcaster: EventEmitter;
17
- eventDataCollector: EventDataCollector;
18
- newId: IdGenerator.NewId;
19
- pickleIds: string[];
20
- supportCodeLibrary: ISupportCodeLibrary;
21
- requireModules: string[];
22
- requirePaths: string[];
23
- importPaths: string[];
24
- options: IRunOptionsRuntime;
25
- }): IRuntime;
1
+ /// <reference types="node" />
2
+ import { IRuntime } from '@cucumber/cucumber/lib/runtime/index';
3
+ import { EventEmitter } from 'events';
4
+ import { EventDataCollector } from '@cucumber/cucumber/lib/formatter/helpers';
5
+ import { IdGenerator } from '@cucumber/messages';
6
+ import { ISupportCodeLibrary } from '@cucumber/cucumber/lib/support_code_library_builder/types';
7
+ import { IRunOptionsRuntime } from '@cucumber/cucumber/lib/api/types';
8
+ import { ILogger } from '@cucumber/cucumber/lib/logger';
9
+ /**
10
+ * Extending this function from cucumber.js to use our own implementation
11
+ * of the Coordinator.
12
+ */
13
+ export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options } }: {
14
+ cwd: string;
15
+ logger: ILogger;
16
+ eventBroadcaster: EventEmitter;
17
+ eventDataCollector: EventDataCollector;
18
+ newId: IdGenerator.NewId;
19
+ pickleIds: string[];
20
+ supportCodeLibrary: ISupportCodeLibrary;
21
+ requireModules: string[];
22
+ requirePaths: string[];
23
+ importPaths: string[];
24
+ options: IRunOptionsRuntime;
25
+ }): IRuntime;