@ohos-ports/badeball-cypress-cucumber-preprocessor 0.0.0-stage → 28.0.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +89 -2
- package/dist/add-cucumber-preprocessor-plugin.d.ts +17 -0
- package/dist/add-cucumber-preprocessor-plugin.js +111 -0
- package/dist/bin/cucumber-html-formatter.d.ts +2 -0
- package/dist/bin/cucumber-html-formatter.js +15 -0
- package/dist/bin/cucumber-json-formatter.d.ts +2 -0
- package/dist/bin/cucumber-json-formatter.js +31 -0
- package/dist/bin/cucumber-merge-messages.d.ts +2 -0
- package/dist/bin/cucumber-merge-messages.js +8 -0
- package/dist/browser-runtime.d.ts +29 -0
- package/dist/browser-runtime.js +1197 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +9 -0
- package/dist/cypress-task-definitions.d.ts +26 -0
- package/dist/cypress-task-definitions.js +12 -0
- package/dist/data_table.d.ts +11 -0
- package/dist/data_table.js +54 -0
- package/dist/entrypoint-browser.d.ts +42 -0
- package/dist/entrypoint-browser.js +288 -0
- package/dist/entrypoint-node.d.ts +34 -0
- package/dist/entrypoint-node.js +128 -0
- package/dist/helpers/assertions.d.ts +8 -0
- package/dist/helpers/assertions.js +32 -0
- package/dist/helpers/ast.d.ts +5 -0
- package/dist/helpers/ast.js +160 -0
- package/dist/helpers/cypress.d.ts +7 -0
- package/dist/helpers/cypress.js +58 -0
- package/dist/helpers/debug.d.ts +3 -0
- package/dist/helpers/debug.js +7 -0
- package/dist/helpers/dry-run.d.ts +1 -0
- package/dist/helpers/dry-run.js +20 -0
- package/dist/helpers/error.d.ts +7 -0
- package/dist/helpers/error.js +11 -0
- package/dist/helpers/expose/browser.d.ts +1 -0
- package/dist/helpers/expose/browser.js +13 -0
- package/dist/helpers/expose/cucumber.d.ts +1 -0
- package/dist/helpers/expose/cucumber.js +7 -0
- package/dist/helpers/expose/expose.d.ts +5 -0
- package/dist/helpers/expose/expose.js +39 -0
- package/dist/helpers/expose/node.d.ts +3 -0
- package/dist/helpers/expose/node.js +12 -0
- package/dist/helpers/formatters.d.ts +7 -0
- package/dist/helpers/formatters.js +100 -0
- package/dist/helpers/memoize.d.ts +1 -0
- package/dist/helpers/memoize.js +12 -0
- package/dist/helpers/merge.d.ts +7 -0
- package/dist/helpers/merge.js +65 -0
- package/dist/helpers/messages.d.ts +10 -0
- package/dist/helpers/messages.js +120 -0
- package/dist/helpers/options.d.ts +5 -0
- package/dist/helpers/options.js +21 -0
- package/dist/helpers/paths.d.ts +3 -0
- package/dist/helpers/paths.js +27 -0
- package/dist/helpers/prepare-registry.d.ts +2 -0
- package/dist/helpers/prepare-registry.js +10 -0
- package/dist/helpers/snippets.d.ts +4 -0
- package/dist/helpers/snippets.js +67 -0
- package/dist/helpers/source-map.d.ts +13 -0
- package/dist/helpers/source-map.js +91 -0
- package/dist/helpers/specs.d.ts +6 -0
- package/dist/helpers/specs.js +60 -0
- package/dist/helpers/strings.d.ts +7 -0
- package/dist/helpers/strings.js +28 -0
- package/dist/helpers/tag-parser/errors.d.ts +6 -0
- package/dist/helpers/tag-parser/errors.js +12 -0
- package/dist/helpers/tag-parser/index.d.ts +7 -0
- package/dist/helpers/tag-parser/index.js +14 -0
- package/dist/helpers/tag-parser/parser.d.ts +7 -0
- package/dist/helpers/tag-parser/parser.js +123 -0
- package/dist/helpers/tag-parser/tokenizer.d.ts +16 -0
- package/dist/helpers/tag-parser/tokenizer.js +85 -0
- package/dist/helpers/type-guards.d.ts +6 -0
- package/dist/helpers/type-guards.js +26 -0
- package/dist/plugin-event-handlers.d.ts +31 -0
- package/dist/plugin-event-handlers.js +903 -0
- package/dist/preprocessor-configuration.d.ts +183 -0
- package/dist/preprocessor-configuration.js +224 -0
- package/dist/public-member-types.d.ts +44 -0
- package/dist/public-member-types.js +2 -0
- package/dist/registry.d.ts +96 -0
- package/dist/registry.js +246 -0
- package/dist/step-definitions.d.ts +4 -0
- package/dist/step-definitions.js +97 -0
- package/dist/subpath-entrypoints/esbuild.d.ts +5 -0
- package/dist/subpath-entrypoints/esbuild.js +85 -0
- package/dist/subpath-entrypoints/pretty-reporter.d.ts +23 -0
- package/dist/subpath-entrypoints/pretty-reporter.js +14 -0
- package/dist/subpath-entrypoints/rollup.d.ts +3 -0
- package/dist/subpath-entrypoints/rollup.js +18 -0
- package/dist/subpath-entrypoints/webpack.d.ts +3 -0
- package/dist/subpath-entrypoints/webpack.js +9 -0
- package/dist/template.d.ts +1 -0
- package/dist/template.js +81 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +5 -0
- package/package.json +146 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright 2020 Jonas Amundsen
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# cypress-cucumber-preprocessor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/badeball/cypress-cucumber-preprocessor/actions/workflows/build.yml)
|
|
4
|
+
[](https://npmjs.com/package/@badeball/cypress-cucumber-preprocessor)
|
|
5
|
+
|
|
6
|
+
<div align="center">
|
|
7
|
+
|
|
8
|
+
[Quick start](docs/quick-start.md) •
|
|
9
|
+
[Documentation](docs/readme.md) •
|
|
10
|
+
[Contributing](CONTRIBUTING.md) •
|
|
11
|
+
[Sponsors](#attribution--sponsors)
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
This preprocessor aims to provide a developer experience and behavior similar to that of [Cucumber](https://cucumber.io/), to Cypress.
|
|
16
|
+
|
|
17
|
+
> :information_source: The repository has recently moved from `github.com/TheBrainFamily` to `github.com/badeball`. Read more about the transfer of ownership [here](https://github.com/badeball/cypress-cucumber-preprocessor/issues/689).
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
$ npm install @badeball/cypress-cucumber-preprocessor
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Introduction
|
|
26
|
+
|
|
27
|
+
The preprocessor (with its dependencies) parses Gherkin documents and allows you to write tests as shown below.
|
|
28
|
+
|
|
29
|
+
```cucumber
|
|
30
|
+
# cypress/e2e/duckduckgo.feature
|
|
31
|
+
Feature: duckduckgo.com
|
|
32
|
+
Scenario: visiting the frontpage
|
|
33
|
+
When I visit duckduckgo.com
|
|
34
|
+
Then I should see a search bar
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// cypress/e2e/duckduckgo.ts
|
|
39
|
+
import { When, Then } from "@badeball/cypress-cucumber-preprocessor";
|
|
40
|
+
|
|
41
|
+
When("I visit duckduckgo.com", () => {
|
|
42
|
+
cy.visit("https://www.duckduckgo.com");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
Then("I should see a search bar", () => {
|
|
46
|
+
cy.get("input[type=text]")
|
|
47
|
+
.should("have.attr", "placeholder")
|
|
48
|
+
.and(
|
|
49
|
+
"match",
|
|
50
|
+
/Search without being tracked|Search privately/,
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Building
|
|
56
|
+
|
|
57
|
+
Building can be done once using:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
$ npm run build
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Or upon file changes with:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
$ npm run watch
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
There are multiple types of tests, all ran using npm scripts:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
$ npm run test:fmt
|
|
73
|
+
$ npm run test:types
|
|
74
|
+
$ npm run test:unit
|
|
75
|
+
$ npm run test:integration # make sure to build first
|
|
76
|
+
$ npm run test # runs all of the above
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Attribution & sponsors
|
|
80
|
+
|
|
81
|
+
A special thanks goes out to [Łukasz Gandecki](https://github.com/lgandecki) for developing and maintaining the cypress-cucumber integration before me, in addition to [all other contributors](https://github.com/badeball/cypress-cucumber-preprocessor/graphs/contributors). Some of the work has partially been sponsored by [Klaveness Digital](https://www.klavenessdigital.com/). This project is currently sponsored by [TestMu AI](https://www.testmuai.com/?utm_medium=sponsor&utm_source=cypress-cucumber-preprocessor).
|
|
82
|
+
|
|
83
|
+
<br />
|
|
84
|
+
<br />
|
|
85
|
+
|
|
86
|
+
<p align="center">
|
|
87
|
+
<a href="https://www.testmuai.com/?utm_medium=sponsor&utm_source=cypress-cucumber-preprocessor"><img src="docs/testmu-logo.svg" width="300"></a>
|
|
88
|
+
</p>
|
|
89
|
+
|
|
90
|
+
<br />
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { INTERNAL_PROPERTY_NAME } from "./constants";
|
|
2
|
+
import { OnAfterStep } from "./plugin-event-handlers";
|
|
3
|
+
export type AddOptions = {
|
|
4
|
+
omitBeforeRunHandler?: boolean;
|
|
5
|
+
omitAfterRunHandler?: boolean;
|
|
6
|
+
omitBeforeSpecHandler?: boolean;
|
|
7
|
+
omitAfterSpecHandler?: boolean;
|
|
8
|
+
omitAfterScreenshotHandler?: boolean;
|
|
9
|
+
onAfterStep?: OnAfterStep;
|
|
10
|
+
};
|
|
11
|
+
type PreservedPluginConfigOptions = Cypress.PluginConfigOptions & {
|
|
12
|
+
[INTERNAL_PROPERTY_NAME]?: Partial<Cypress.PluginConfigOptions>;
|
|
13
|
+
};
|
|
14
|
+
export declare function mutateConfigObjectPreservingly<K extends keyof Cypress.PluginConfigOptions>(config: PreservedPluginConfigOptions, property: K, value: PreservedPluginConfigOptions[K]): void;
|
|
15
|
+
export declare function rebuildOriginalConfigObject(config: PreservedPluginConfigOptions): Cypress.PluginConfigOptions;
|
|
16
|
+
export declare function addCucumberPreprocessorPlugin(on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions, options?: AddOptions): Promise<Cypress.PluginConfigOptions>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
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.mutateConfigObjectPreservingly = mutateConfigObjectPreservingly;
|
|
7
|
+
exports.rebuildOriginalConfigObject = rebuildOriginalConfigObject;
|
|
8
|
+
exports.addCucumberPreprocessorPlugin = addCucumberPreprocessorPlugin;
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_util_1 = require("node:util");
|
|
11
|
+
const gherkin_1 = require("@cucumber/gherkin");
|
|
12
|
+
const messages_1 = require("@cucumber/messages");
|
|
13
|
+
const tag_expressions_1 = __importDefault(require("@cucumber/tag-expressions"));
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const cypress_task_definitions_1 = require("./cypress-task-definitions");
|
|
17
|
+
const assertions_1 = require("./helpers/assertions");
|
|
18
|
+
const debug_1 = __importDefault(require("./helpers/debug"));
|
|
19
|
+
const node_1 = require("./helpers/expose/node");
|
|
20
|
+
const memoize_1 = require("./helpers/memoize");
|
|
21
|
+
const specs_1 = require("./helpers/specs");
|
|
22
|
+
const type_guards_1 = require("./helpers/type-guards");
|
|
23
|
+
const plugin_event_handlers_1 = require("./plugin-event-handlers");
|
|
24
|
+
const preprocessor_configuration_1 = require("./preprocessor-configuration");
|
|
25
|
+
const resolve = (0, memoize_1.memoize)(preprocessor_configuration_1.resolve);
|
|
26
|
+
function mutateConfigObjectPreservingly(config, property, value) {
|
|
27
|
+
var _a;
|
|
28
|
+
const preserved = (_a = config[constants_1.INTERNAL_PROPERTY_NAME]) !== null && _a !== void 0 ? _a : (config[constants_1.INTERNAL_PROPERTY_NAME] = {});
|
|
29
|
+
preserved[property] = config[property];
|
|
30
|
+
config[property] = value;
|
|
31
|
+
}
|
|
32
|
+
function rebuildOriginalConfigObject(config) {
|
|
33
|
+
return Object.assign({}, config, config[constants_1.INTERNAL_PROPERTY_NAME]);
|
|
34
|
+
}
|
|
35
|
+
async function addCucumberPreprocessorPlugin(on, config, options = {}) {
|
|
36
|
+
const env = (0, node_1.getEnv)(config);
|
|
37
|
+
env[constants_1.INTERNAL_SUITE_PROPERTIES] = { isEventHandlersAttached: true };
|
|
38
|
+
const preprocessor = await resolve(config, env, "/");
|
|
39
|
+
if (!options.omitBeforeRunHandler) {
|
|
40
|
+
on("before:run", () => (0, plugin_event_handlers_1.beforeRunHandler)(config));
|
|
41
|
+
}
|
|
42
|
+
if (!options.omitAfterRunHandler) {
|
|
43
|
+
on("after:run", (results) => (0, plugin_event_handlers_1.afterRunHandler)(config, results));
|
|
44
|
+
}
|
|
45
|
+
if (!options.omitBeforeSpecHandler) {
|
|
46
|
+
on("before:spec", (spec) => (0, plugin_event_handlers_1.beforeSpecHandler)(config, spec));
|
|
47
|
+
}
|
|
48
|
+
if (!options.omitAfterSpecHandler) {
|
|
49
|
+
on("after:spec", (spec, results) => (0, plugin_event_handlers_1.afterSpecHandler)(config, spec, results));
|
|
50
|
+
}
|
|
51
|
+
if (!options.omitAfterScreenshotHandler) {
|
|
52
|
+
on("after:screenshot", (details) => (0, plugin_event_handlers_1.afterScreenshotHandler)(config, details));
|
|
53
|
+
}
|
|
54
|
+
on("task", {
|
|
55
|
+
[cypress_task_definitions_1.TASK_SPEC_ENVELOPES]: plugin_event_handlers_1.specEnvelopesHandler.bind(null, config),
|
|
56
|
+
[cypress_task_definitions_1.TASK_TEST_CASE_STARTED]: plugin_event_handlers_1.testCaseStartedHandler.bind(null, config),
|
|
57
|
+
[cypress_task_definitions_1.TASK_TEST_STEP_STARTED]: plugin_event_handlers_1.testStepStartedHandler.bind(null, config),
|
|
58
|
+
[cypress_task_definitions_1.TASK_TEST_STEP_FINISHED]: plugin_event_handlers_1.testStepFinishedHandler.bind(null, config, options),
|
|
59
|
+
[cypress_task_definitions_1.TASK_TEST_RUN_HOOK_STARTED]: plugin_event_handlers_1.testRunHookStartedHandler.bind(null, config),
|
|
60
|
+
[cypress_task_definitions_1.TASK_TEST_RUN_HOOK_FINISHED]: plugin_event_handlers_1.testRunHookFinishedHandler.bind(null, config),
|
|
61
|
+
[cypress_task_definitions_1.TASK_TEST_CASE_FINISHED]: plugin_event_handlers_1.testCaseFinishedHandler.bind(null, config),
|
|
62
|
+
[cypress_task_definitions_1.TASK_CREATE_STRING_ATTACHMENT]: plugin_event_handlers_1.createStringAttachmentHandler.bind(null, config),
|
|
63
|
+
[cypress_task_definitions_1.TASK_SUGGESTION]: plugin_event_handlers_1.suggestion.bind(null, config),
|
|
64
|
+
});
|
|
65
|
+
const tags = env.tags;
|
|
66
|
+
if (tags != null && preprocessor.filterSpecs) {
|
|
67
|
+
(0, debug_1.default)(`Filtering specs using expression ${(0, node_util_1.inspect)(tags)}`);
|
|
68
|
+
const node = (0, tag_expressions_1.default)(tags);
|
|
69
|
+
const testFiles = (0, specs_1.getSpecs)(config).filter((testFile) => {
|
|
70
|
+
if (!testFile.endsWith(".feature")) {
|
|
71
|
+
switch (preprocessor.filterSpecsMixedMode) {
|
|
72
|
+
case "hide":
|
|
73
|
+
return false;
|
|
74
|
+
case "show":
|
|
75
|
+
return true;
|
|
76
|
+
case "empty-set":
|
|
77
|
+
return node.evaluate([]);
|
|
78
|
+
default:
|
|
79
|
+
(0, assertions_1.assertNever)(preprocessor.filterSpecsMixedMode);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const content = node_fs_1.default.readFileSync(testFile).toString("utf-8");
|
|
83
|
+
const options = {
|
|
84
|
+
includeSource: false,
|
|
85
|
+
includeGherkinDocument: false,
|
|
86
|
+
includePickles: true,
|
|
87
|
+
newId: messages_1.IdGenerator.incrementing(),
|
|
88
|
+
};
|
|
89
|
+
const envelopes = (0, gherkin_1.generateMessages)(content, testFile, messages_1.SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_PLAIN, options);
|
|
90
|
+
const pickles = envelopes
|
|
91
|
+
.map((envelope) => envelope.pickle)
|
|
92
|
+
.filter(type_guards_1.notNull);
|
|
93
|
+
return pickles.some((pickle) => {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
return node.evaluate((_b = (_a = pickle.tags) === null || _a === void 0 ? void 0 : _a.map((tag) => tag.name).filter(type_guards_1.notNull)) !== null && _b !== void 0 ? _b : []);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
(0, debug_1.default)(`Resolved specs ${(0, node_util_1.inspect)(testFiles)}`);
|
|
99
|
+
/**
|
|
100
|
+
* The preprocessor needs the original value at a later point in order to determine the implicit
|
|
101
|
+
* integration folder correctly. Otherwise, scoping test files using tags would affect definition
|
|
102
|
+
* resolvement and yield surprising results.
|
|
103
|
+
*/
|
|
104
|
+
mutateConfigObjectPreservingly(config, "specPattern", testFiles);
|
|
105
|
+
}
|
|
106
|
+
if (preprocessor.dryRun) {
|
|
107
|
+
config.supportFile = false;
|
|
108
|
+
}
|
|
109
|
+
env.testRunStartedId = (0, uuid_1.v4)();
|
|
110
|
+
return config;
|
|
111
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const promises_1 = __importDefault(require("node:stream/promises"));
|
|
8
|
+
const message_streams_1 = require("@cucumber/message-streams");
|
|
9
|
+
const formatters_1 = require("../helpers/formatters");
|
|
10
|
+
promises_1.default
|
|
11
|
+
.pipeline(process.stdin, new message_streams_1.NdjsonToMessageStream(), (0, formatters_1.createHtmlStream)(), process.stdout)
|
|
12
|
+
.catch((err) => {
|
|
13
|
+
console.error(err.stack);
|
|
14
|
+
process.exitCode = 1;
|
|
15
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const node_stream_1 = require("node:stream");
|
|
5
|
+
const promises_1 = require("node:stream/promises");
|
|
6
|
+
const message_streams_1 = require("@cucumber/message-streams");
|
|
7
|
+
const assertions_1 = require("../helpers/assertions");
|
|
8
|
+
const formatters_1 = require("../helpers/formatters");
|
|
9
|
+
const envelopes = [];
|
|
10
|
+
(0, promises_1.pipeline)(process.stdin, new message_streams_1.NdjsonToMessageStream(), new node_stream_1.Writable({
|
|
11
|
+
objectMode: true,
|
|
12
|
+
write(envelope, _, callback) {
|
|
13
|
+
envelopes.push(envelope);
|
|
14
|
+
callback();
|
|
15
|
+
},
|
|
16
|
+
}))
|
|
17
|
+
.then(() => {
|
|
18
|
+
let jsonOutput;
|
|
19
|
+
const eventBroadcaster = (0, formatters_1.createJsonFormatter)(envelopes, (chunk) => {
|
|
20
|
+
jsonOutput = chunk;
|
|
21
|
+
});
|
|
22
|
+
for (const message of envelopes) {
|
|
23
|
+
eventBroadcaster.emit("envelope", message);
|
|
24
|
+
}
|
|
25
|
+
(0, assertions_1.assertIsString)(jsonOutput, "Expected JSON formatter to have finished, but it never returned");
|
|
26
|
+
console.log(jsonOutput);
|
|
27
|
+
})
|
|
28
|
+
.catch((err) => {
|
|
29
|
+
console.error(err.stack);
|
|
30
|
+
process.exitCode = 1;
|
|
31
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as messages from "@cucumber/messages";
|
|
2
|
+
import { StrictTimestamp } from "./helpers/messages";
|
|
3
|
+
import { ICaseHook, Registry } from "./registry";
|
|
4
|
+
interface IStep {
|
|
5
|
+
hook?: ICaseHook<Mocha.Context>;
|
|
6
|
+
pickleStep?: messages.PickleStep;
|
|
7
|
+
}
|
|
8
|
+
declare const internalPropertiesReplacementText = "Internal properties of cypress-cucumber-preprocessor omitted from report.";
|
|
9
|
+
export interface InternalSpecProperties {
|
|
10
|
+
pickle: messages.Pickle;
|
|
11
|
+
testCaseStartedId: string;
|
|
12
|
+
currentStepStartedAt?: StrictTimestamp;
|
|
13
|
+
currentStep?: IStep;
|
|
14
|
+
allSteps: IStep[];
|
|
15
|
+
remainingSteps: IStep[];
|
|
16
|
+
toJSON(): typeof internalPropertiesReplacementText;
|
|
17
|
+
}
|
|
18
|
+
export interface InternalSuiteProperties {
|
|
19
|
+
isEventHandlersAttached?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function retrieveInternalSpecProperties(): InternalSpecProperties;
|
|
22
|
+
export default function createTests(registry: Registry<Mocha.Context, unknown[]>, seed: number, source: string, gherkinDocument: messages.GherkinDocument, pickles: messages.Pickle[], isTrackingState: boolean, omitFiltered: boolean, stepDefinitionHints: {
|
|
23
|
+
stepDefinitions: string | string[];
|
|
24
|
+
stepDefinitionPatterns: string[];
|
|
25
|
+
stepDefinitionPaths: string[];
|
|
26
|
+
}, dryRun: boolean): void;
|
|
27
|
+
type Tail<T extends any[]> = T extends [infer _A, ...infer R] ? R : never;
|
|
28
|
+
export type CreateTestsOptions = Tail<Parameters<typeof createTests>>;
|
|
29
|
+
export {};
|