@cucumber/query 12.2.0 → 13.0.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/dist/src/Lineage.d.ts +30 -0
- package/dist/src/Lineage.d.ts.map +1 -0
- package/dist/src/Lineage.js +78 -0
- package/dist/src/Lineage.js.map +1 -0
- package/dist/src/Query.d.ts +46 -2
- package/dist/src/Query.d.ts.map +1 -1
- package/dist/src/Query.js +258 -32
- package/dist/src/Query.js.map +1 -1
- package/dist/src/helpers.d.ts +9 -0
- package/dist/src/helpers.d.ts.map +1 -0
- package/dist/src/helpers.js +39 -0
- package/dist/src/helpers.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +15 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +28 -20
- package/src/Lineage.ts +110 -0
- package/{test/QueryTest.ts → src/Query.spec.ts} +1 -1
- package/src/Query.ts +348 -42
- package/src/acceptance.spec.ts +164 -0
- package/src/helpers.spec.ts +15 -0
- package/src/helpers.ts +41 -0
- package/src/index.ts +2 -0
- package/tsconfig.build.json +6 -1
- package/dist/package.json +0 -69
- package/dist/test/QueryTest.d.ts +0 -2
- package/dist/test/QueryTest.d.ts.map +0 -1
- package/dist/test/QueryTest.js +0 -447
- package/dist/test/QueryTest.js.map +0 -1
package/dist/package.json
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cucumber/query",
|
|
3
|
-
"version": "12.2.0",
|
|
4
|
-
"description": "Cucumber Query - query messages",
|
|
5
|
-
"main": "dist/src/index.js",
|
|
6
|
-
"types": "dist/src/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc --build tsconfig.build.json",
|
|
9
|
-
"clean": "rm -rf dist",
|
|
10
|
-
"eslint-fix": "eslint --ext ts,tsx --max-warnings 0 --fix",
|
|
11
|
-
"eslint": "eslint --ext ts,tsx --max-warnings 0",
|
|
12
|
-
"test": "mocha",
|
|
13
|
-
"prepublishOnly": "tsc --build tsconfig.build.json"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git://github.com/cucumber/query.git"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"cucumber"
|
|
21
|
-
],
|
|
22
|
-
"author": "Cucumber Limited <cukes@googlegroups.com>",
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"bugs": {
|
|
25
|
-
"url": "https://github.com/cucumber/query/issues"
|
|
26
|
-
},
|
|
27
|
-
"homepage": "https://github.com/cucumber/query#readme",
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"@cucumber/compatibility-kit": "^15.0.0",
|
|
30
|
-
"@cucumber/fake-cucumber": "^16.0.0",
|
|
31
|
-
"@cucumber/gherkin": "^28.0.0",
|
|
32
|
-
"@cucumber/gherkin-streams": "^5.0.1",
|
|
33
|
-
"@cucumber/gherkin-utils": "^8.0.1",
|
|
34
|
-
"@types/mocha": "10.0.7",
|
|
35
|
-
"@types/node": "20.14.8",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "7.13.1",
|
|
37
|
-
"@typescript-eslint/parser": "7.13.1",
|
|
38
|
-
"ajv": "8.16.0",
|
|
39
|
-
"ajv-cli": "5.0.0",
|
|
40
|
-
"eslint": "8.57.0",
|
|
41
|
-
"eslint-config-prettier": "9.1.0",
|
|
42
|
-
"eslint-plugin-import": "2.29.1",
|
|
43
|
-
"eslint-plugin-node": "11.1.0",
|
|
44
|
-
"eslint-plugin-prettier": "5.1.3",
|
|
45
|
-
"eslint-plugin-react": "7.34.3",
|
|
46
|
-
"eslint-plugin-react-hooks": "4.6.2",
|
|
47
|
-
"eslint-plugin-simple-import-sort": "12.1.0",
|
|
48
|
-
"mocha": "10.4.0",
|
|
49
|
-
"prettier": "3.3.2",
|
|
50
|
-
"pretty-quick": "4.0.0",
|
|
51
|
-
"rimraf": "^5.0.0",
|
|
52
|
-
"ts-node": "10.9.2",
|
|
53
|
-
"tsconfig-paths": "4.2.0",
|
|
54
|
-
"typescript": "5.5.2"
|
|
55
|
-
},
|
|
56
|
-
"dependencies": {
|
|
57
|
-
"@cucumber/messages": "^24.0.0",
|
|
58
|
-
"@teppeis/multimaps": "3.0.0"
|
|
59
|
-
},
|
|
60
|
-
"directories": {
|
|
61
|
-
"test": "test"
|
|
62
|
-
},
|
|
63
|
-
"prettier": {
|
|
64
|
-
"trailingComma": "es5",
|
|
65
|
-
"semi": false,
|
|
66
|
-
"singleQuote": true,
|
|
67
|
-
"printWidth": 100
|
|
68
|
-
}
|
|
69
|
-
}
|
package/dist/test/QueryTest.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryTest.d.ts","sourceRoot":"","sources":["../../test/QueryTest.ts"],"names":[],"mappings":""}
|
package/dist/test/QueryTest.js
DELETED
|
@@ -1,447 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const gherkin_streams_1 = require("@cucumber/gherkin-streams");
|
|
39
|
-
const gherkin_utils_1 = require("@cucumber/gherkin-utils");
|
|
40
|
-
const messages = __importStar(require("@cucumber/messages"));
|
|
41
|
-
const stream_1 = require("stream");
|
|
42
|
-
const assert_1 = __importDefault(require("assert"));
|
|
43
|
-
const fake_cucumber_1 = require("@cucumber/fake-cucumber");
|
|
44
|
-
const util_1 = require("util");
|
|
45
|
-
const Query_1 = __importDefault(require("../src/Query"));
|
|
46
|
-
const pipelinePromise = (0, util_1.promisify)(stream_1.pipeline);
|
|
47
|
-
describe('Query', () => {
|
|
48
|
-
let gherkinQuery;
|
|
49
|
-
let cucumberQuery;
|
|
50
|
-
beforeEach(() => {
|
|
51
|
-
gherkinQuery = new gherkin_utils_1.Query();
|
|
52
|
-
cucumberQuery = new Query_1.default();
|
|
53
|
-
});
|
|
54
|
-
describe('#getPickleStepTestStepResults(pickleStepIds)', () => {
|
|
55
|
-
it('returns a single UNKNOWN when the list is empty', () => {
|
|
56
|
-
const results = cucumberQuery.getPickleTestStepResults([]);
|
|
57
|
-
assert_1.default.deepStrictEqual(results.map((r) => r.status), ['UNKNOWN']);
|
|
58
|
-
});
|
|
59
|
-
it('looks up results for scenario steps', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
const envelopes = [];
|
|
61
|
-
yield execute(`Feature: hello
|
|
62
|
-
Scenario: ok
|
|
63
|
-
Given a passed step
|
|
64
|
-
`, (envelope) => envelopes.push(envelope));
|
|
65
|
-
const scenario = findScenario(envelopes);
|
|
66
|
-
const pickleStepIds = gherkinQuery.getPickleStepIds(scenario.steps[0].id);
|
|
67
|
-
assert_1.default.strictEqual(pickleStepIds.length, 1);
|
|
68
|
-
const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds);
|
|
69
|
-
assert_1.default.strictEqual(testStepResults.length, 1);
|
|
70
|
-
assert_1.default.strictEqual(testStepResults[0].status, 'PASSED');
|
|
71
|
-
}));
|
|
72
|
-
it('looks up results for background steps', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
-
const envelopes = [];
|
|
74
|
-
yield execute(`Feature: hello
|
|
75
|
-
Background:
|
|
76
|
-
Given a passed step
|
|
77
|
-
|
|
78
|
-
Scenario: ok
|
|
79
|
-
Given a passed step
|
|
80
|
-
|
|
81
|
-
Scenario: ko
|
|
82
|
-
Given a failed step
|
|
83
|
-
`, (envelope) => envelopes.push(envelope));
|
|
84
|
-
const background = findBackground(envelopes);
|
|
85
|
-
const pickleStepIds = gherkinQuery.getPickleStepIds(background.steps[0].id);
|
|
86
|
-
assert_1.default.strictEqual(pickleStepIds.length, 2);
|
|
87
|
-
const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds);
|
|
88
|
-
assert_1.default.deepStrictEqual(testStepResults.map((r) => r.status), ['PASSED', 'PASSED']);
|
|
89
|
-
}));
|
|
90
|
-
it('looks up results for background steps when scenarios are empty', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
|
-
const envelopes = [];
|
|
92
|
-
yield execute(`Feature: hello
|
|
93
|
-
Background:
|
|
94
|
-
Given a passed step
|
|
95
|
-
|
|
96
|
-
Scenario: ok
|
|
97
|
-
|
|
98
|
-
Scenario: ok too
|
|
99
|
-
`, (envelope) => envelopes.push(envelope));
|
|
100
|
-
const background = findBackground(envelopes);
|
|
101
|
-
const pickleStepIds = gherkinQuery.getPickleStepIds(background.steps[0].id);
|
|
102
|
-
assert_1.default.strictEqual(pickleStepIds.length, 0);
|
|
103
|
-
const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds);
|
|
104
|
-
assert_1.default.strictEqual(testStepResults.length, 1);
|
|
105
|
-
assert_1.default.strictEqual(testStepResults[0].status, 'UNKNOWN');
|
|
106
|
-
}));
|
|
107
|
-
});
|
|
108
|
-
describe('#getPickleTestStepResults(pickleIds)', () => {
|
|
109
|
-
it('looks up results for scenarios', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
110
|
-
const envelopes = [];
|
|
111
|
-
yield execute(`Feature: hello
|
|
112
|
-
Scenario: ko
|
|
113
|
-
Given a passed step
|
|
114
|
-
Given a failed step
|
|
115
|
-
`, (envelope) => envelopes.push(envelope));
|
|
116
|
-
const scenario = findScenario(envelopes);
|
|
117
|
-
const pickleIds = gherkinQuery.getPickleIds('test.feature', scenario.id);
|
|
118
|
-
assert_1.default.strictEqual(pickleIds.length, 1);
|
|
119
|
-
const testStepResults = cucumberQuery.getPickleTestStepResults(pickleIds);
|
|
120
|
-
assert_1.default.deepStrictEqual(testStepResults.map((r) => r.status), ['PASSED', 'FAILED']);
|
|
121
|
-
}));
|
|
122
|
-
it('looks up results for scenario outlines', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
123
|
-
const envelopes = [];
|
|
124
|
-
yield execute(`Feature: hello
|
|
125
|
-
Scenario: hi <status1> and <status2>
|
|
126
|
-
Given a <status1> step
|
|
127
|
-
And a <status2> step
|
|
128
|
-
|
|
129
|
-
Examples:
|
|
130
|
-
| status1 | status2 |
|
|
131
|
-
| passed | passed |
|
|
132
|
-
| passed | failed |
|
|
133
|
-
`, (envelope) => envelopes.push(envelope));
|
|
134
|
-
const scenario = findScenario(envelopes);
|
|
135
|
-
const pickleIds = gherkinQuery.getPickleIds('test.feature', scenario.id);
|
|
136
|
-
assert_1.default.strictEqual(pickleIds.length, 2);
|
|
137
|
-
assert_1.default.deepStrictEqual(cucumberQuery.getPickleTestStepResults(pickleIds).map((r) => r.status), ['PASSED', 'PASSED', 'PASSED', 'FAILED']);
|
|
138
|
-
}));
|
|
139
|
-
it('looks up results for examples rows outlines', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
-
const envelopes = [];
|
|
141
|
-
yield execute(`Feature: hello
|
|
142
|
-
Scenario: hi <status1> and <status2>
|
|
143
|
-
Given a <status1> step
|
|
144
|
-
And a <status2> step
|
|
145
|
-
|
|
146
|
-
Examples:
|
|
147
|
-
| status1 | status2 |
|
|
148
|
-
| passed | passed |
|
|
149
|
-
| passed | failed |
|
|
150
|
-
`, (envelope) => envelopes.push(envelope));
|
|
151
|
-
const scenario = findScenario(envelopes);
|
|
152
|
-
const exampleIds = scenario.examples[0].tableBody.map((row) => row.id);
|
|
153
|
-
assert_1.default.deepStrictEqual(cucumberQuery
|
|
154
|
-
.getPickleTestStepResults(gherkinQuery.getPickleIds('test.feature', exampleIds[0]))
|
|
155
|
-
.map((r) => r.status), ['PASSED', 'PASSED']);
|
|
156
|
-
assert_1.default.deepStrictEqual(cucumberQuery
|
|
157
|
-
.getPickleTestStepResults(gherkinQuery.getPickleIds('test.feature', exampleIds[1]))
|
|
158
|
-
.map((r) => r.status), ['PASSED', 'FAILED']);
|
|
159
|
-
}));
|
|
160
|
-
});
|
|
161
|
-
describe('#getPickleStepAttachments(pickleIds)', () => {
|
|
162
|
-
it('looks up attachments', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
163
|
-
const envelopes = [];
|
|
164
|
-
yield execute(`Feature: hello
|
|
165
|
-
Scenario: ok
|
|
166
|
-
Given a passed step with attachment
|
|
167
|
-
`, (envelope) => envelopes.push(envelope));
|
|
168
|
-
const scenario = findScenario(envelopes);
|
|
169
|
-
const pickleStepIds = gherkinQuery.getPickleStepIds(scenario.steps[0].id);
|
|
170
|
-
assert_1.default.strictEqual(pickleStepIds.length, 1);
|
|
171
|
-
const attachments = cucumberQuery.getPickleStepAttachments(pickleStepIds);
|
|
172
|
-
assert_1.default.strictEqual(attachments.length, 1);
|
|
173
|
-
assert_1.default.strictEqual(attachments[0].body, 'Hello');
|
|
174
|
-
}));
|
|
175
|
-
});
|
|
176
|
-
describe('#getStepMatchArguments(uri, lineNumber)', () => {
|
|
177
|
-
it("looks up result for step's uri and line", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
178
|
-
const envelopes = [];
|
|
179
|
-
yield execute(`Feature: hello
|
|
180
|
-
Scenario: ok
|
|
181
|
-
Given a passed step
|
|
182
|
-
And I have 567 cukes in my belly
|
|
183
|
-
`, (envelope) => envelopes.push(envelope));
|
|
184
|
-
const scenario = findScenario(envelopes);
|
|
185
|
-
assert_1.default.deepStrictEqual(cucumberQuery
|
|
186
|
-
.getStepMatchArgumentsLists(gherkinQuery.getPickleStepIds(scenario.steps[0].id)[0])
|
|
187
|
-
.map((sal) => sal.stepMatchArguments.map((arg) => arg.parameterTypeName)), [[]]);
|
|
188
|
-
assert_1.default.deepStrictEqual(cucumberQuery
|
|
189
|
-
.getStepMatchArgumentsLists(gherkinQuery.getPickleStepIds(scenario.steps[1].id)[0])
|
|
190
|
-
.map((sal) => sal.stepMatchArguments.map((arg) => arg.parameterTypeName)), [['int', 'word']]);
|
|
191
|
-
}));
|
|
192
|
-
describe('#getBeforeHookSteps(pickleId: string)', () => {
|
|
193
|
-
it('returns an empty list when there is no hooks', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
194
|
-
const envelopes = [];
|
|
195
|
-
yield execute(`Feature: hello
|
|
196
|
-
Scenario: hi
|
|
197
|
-
Given a passed step
|
|
198
|
-
`, (envelope) => envelopes.push(envelope));
|
|
199
|
-
const scenarioId = findScenario(envelopes).id;
|
|
200
|
-
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0];
|
|
201
|
-
assert_1.default.deepStrictEqual(cucumberQuery.getBeforeHookSteps(pickleId), []);
|
|
202
|
-
}));
|
|
203
|
-
it('returns one before hook step', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
204
|
-
const envelopes = [];
|
|
205
|
-
yield execute(`Feature: hello
|
|
206
|
-
@beforeHook
|
|
207
|
-
Scenario: hi
|
|
208
|
-
Given a passed step
|
|
209
|
-
`, (envelope) => envelopes.push(envelope));
|
|
210
|
-
const scenarioId = findScenario(envelopes).id;
|
|
211
|
-
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0];
|
|
212
|
-
assert_1.default.strictEqual(cucumberQuery.getBeforeHookSteps(pickleId).length, 1);
|
|
213
|
-
}));
|
|
214
|
-
it('does not return after hook steps', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
215
|
-
const envelopes = [];
|
|
216
|
-
yield execute(`Feature: hello
|
|
217
|
-
@afterHook
|
|
218
|
-
Scenario: hi
|
|
219
|
-
Given a passed step
|
|
220
|
-
`, (envelope) => envelopes.push(envelope));
|
|
221
|
-
const scenarioId = findScenario(envelopes).id;
|
|
222
|
-
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0];
|
|
223
|
-
assert_1.default.deepStrictEqual(cucumberQuery.getBeforeHookSteps(pickleId), []);
|
|
224
|
-
}));
|
|
225
|
-
});
|
|
226
|
-
describe('#getAfterHookSteps(pickleId: string)', () => {
|
|
227
|
-
it('returns an empty list when there is no hooks', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
228
|
-
const envelopes = [];
|
|
229
|
-
yield execute(`Feature: hello
|
|
230
|
-
Scenario: hi
|
|
231
|
-
Given a passed step
|
|
232
|
-
`, (envelope) => envelopes.push(envelope));
|
|
233
|
-
const scenarioId = findScenario(envelopes).id;
|
|
234
|
-
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0];
|
|
235
|
-
assert_1.default.deepStrictEqual(cucumberQuery.getAfterHookSteps(pickleId), []);
|
|
236
|
-
}));
|
|
237
|
-
it('returns one after hook step', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
238
|
-
const envelopes = [];
|
|
239
|
-
yield execute(`Feature: hello
|
|
240
|
-
@afterHook
|
|
241
|
-
Scenario: hi
|
|
242
|
-
Given a passed step
|
|
243
|
-
`, (envelope) => envelopes.push(envelope));
|
|
244
|
-
const scenarioId = findScenario(envelopes).id;
|
|
245
|
-
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0];
|
|
246
|
-
assert_1.default.strictEqual(cucumberQuery.getAfterHookSteps(pickleId).length, 1);
|
|
247
|
-
}));
|
|
248
|
-
it('does not return before hook steps', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
249
|
-
const envelopes = [];
|
|
250
|
-
yield execute(`Feature: hello
|
|
251
|
-
@beforeHook
|
|
252
|
-
Scenario: hi
|
|
253
|
-
Given a passed step
|
|
254
|
-
`, (envelope) => envelopes.push(envelope));
|
|
255
|
-
const scenarioId = findScenario(envelopes).id;
|
|
256
|
-
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0];
|
|
257
|
-
assert_1.default.deepStrictEqual(cucumberQuery.getAfterHookSteps(pickleId), []);
|
|
258
|
-
}));
|
|
259
|
-
});
|
|
260
|
-
describe('#getTestStepResult', () => {
|
|
261
|
-
it('returns one test step result', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
262
|
-
const emittedMessages = [];
|
|
263
|
-
yield execute(`Feature: hello
|
|
264
|
-
Scenario: hi
|
|
265
|
-
Given a passed step
|
|
266
|
-
`, (message) => emittedMessages.push(message));
|
|
267
|
-
const testCase = emittedMessages.find((child) => child.testCase).testCase;
|
|
268
|
-
const testStep = testCase.testSteps[0];
|
|
269
|
-
const results = cucumberQuery.getTestStepResults(testStep.id);
|
|
270
|
-
assert_1.default.deepStrictEqual(results.length, 1);
|
|
271
|
-
assert_1.default.deepStrictEqual(results[0].status, 'PASSED');
|
|
272
|
-
}));
|
|
273
|
-
it('returns a result for hook step', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
274
|
-
const emittedMessages = [];
|
|
275
|
-
yield execute(`Feature: hello
|
|
276
|
-
@beforeHook
|
|
277
|
-
Scenario: hi
|
|
278
|
-
Given a passed step
|
|
279
|
-
`, (message) => emittedMessages.push(message));
|
|
280
|
-
const testCase = emittedMessages.find((child) => child.testCase).testCase;
|
|
281
|
-
const testStep = testCase.testSteps[0];
|
|
282
|
-
const results = cucumberQuery.getTestStepResults(testStep.id);
|
|
283
|
-
assert_1.default.deepStrictEqual(results.length, 1);
|
|
284
|
-
assert_1.default.deepStrictEqual(results[0].status, 'PASSED');
|
|
285
|
-
}));
|
|
286
|
-
it('returns the result from the last attempt only where retry has been used', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
287
|
-
const emittedMessages = [];
|
|
288
|
-
yield execute(`Feature: hello
|
|
289
|
-
Scenario: hi
|
|
290
|
-
Given a step that passes the second time
|
|
291
|
-
`, (message) => emittedMessages.push(message), { allowedRetries: 1 });
|
|
292
|
-
const testCase = emittedMessages.find((child) => child.testCase).testCase;
|
|
293
|
-
const testStep = testCase.testSteps[0];
|
|
294
|
-
const results = cucumberQuery.getTestStepResults(testStep.id);
|
|
295
|
-
assert_1.default.deepStrictEqual(results.length, 1);
|
|
296
|
-
assert_1.default.deepStrictEqual(results[0].status, 'PASSED');
|
|
297
|
-
}));
|
|
298
|
-
});
|
|
299
|
-
describe('#getHook(HookId)', () => {
|
|
300
|
-
it('returns undefined if the id does not match any hook', () => {
|
|
301
|
-
assert_1.default.strictEqual(cucumberQuery.getHook('tralala'), undefined);
|
|
302
|
-
});
|
|
303
|
-
it('returns the matching hook', () => {
|
|
304
|
-
const hook = {
|
|
305
|
-
id: 'tralala',
|
|
306
|
-
sourceReference: {},
|
|
307
|
-
};
|
|
308
|
-
const envelope = {
|
|
309
|
-
hook,
|
|
310
|
-
};
|
|
311
|
-
cucumberQuery.update(envelope);
|
|
312
|
-
assert_1.default.deepStrictEqual(cucumberQuery.getHook('tralala'), hook);
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
describe('#getAttachmentByTestStepId', () => {
|
|
316
|
-
it('looks up attachments', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
317
|
-
const testCases = [];
|
|
318
|
-
yield execute(`Feature: hello
|
|
319
|
-
Scenario: ok
|
|
320
|
-
Given a passed step with attachment
|
|
321
|
-
`, (envelope) => {
|
|
322
|
-
if (envelope.testCase) {
|
|
323
|
-
testCases.push(envelope.testCase);
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
const attachments = cucumberQuery.getTestStepsAttachments([testCases[0].testSteps[0].id]);
|
|
327
|
-
assert_1.default.strictEqual(attachments.length, 1);
|
|
328
|
-
assert_1.default.strictEqual(attachments[0].body, 'Hello');
|
|
329
|
-
}));
|
|
330
|
-
it('returns attachments from the last attempt only where retry has been used', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
331
|
-
const testCases = [];
|
|
332
|
-
yield execute(`Feature: hello
|
|
333
|
-
Scenario: ok
|
|
334
|
-
Given a passed step with attachment
|
|
335
|
-
And a step that passes the second time
|
|
336
|
-
`, (envelope) => {
|
|
337
|
-
if (envelope.testCase) {
|
|
338
|
-
testCases.push(envelope.testCase);
|
|
339
|
-
}
|
|
340
|
-
}, { allowedRetries: 1 });
|
|
341
|
-
const attachments = cucumberQuery.getTestStepsAttachments([testCases[0].testSteps[0].id]);
|
|
342
|
-
assert_1.default.strictEqual(attachments.length, 1);
|
|
343
|
-
assert_1.default.strictEqual(attachments[0].body, 'Hello');
|
|
344
|
-
}));
|
|
345
|
-
});
|
|
346
|
-
describe('#getStatusCounts', () => {
|
|
347
|
-
it('returns the number of pickles for each status', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
348
|
-
yield execute(`Feature: hello
|
|
349
|
-
Scenario: ok
|
|
350
|
-
Given a passed step
|
|
351
|
-
`, () => undefined);
|
|
352
|
-
yield execute(`Feature: hello
|
|
353
|
-
Scenario: ok
|
|
354
|
-
Given a passed step
|
|
355
|
-
`, () => undefined);
|
|
356
|
-
yield execute(`Feature: hello
|
|
357
|
-
Scenario: ok
|
|
358
|
-
Given a failed step
|
|
359
|
-
`, () => undefined);
|
|
360
|
-
yield execute(`Feature: hello
|
|
361
|
-
Scenario: ok
|
|
362
|
-
Given an undefined step
|
|
363
|
-
`, () => undefined);
|
|
364
|
-
const statuses = cucumberQuery.getStatusCounts(gherkinQuery.getPickles().map((pickle) => pickle.id));
|
|
365
|
-
const expectedStatuses = {
|
|
366
|
-
PASSED: 2,
|
|
367
|
-
FAILED: 1,
|
|
368
|
-
UNDEFINED: 1,
|
|
369
|
-
};
|
|
370
|
-
assert_1.default.deepStrictEqual(statuses, expectedStatuses);
|
|
371
|
-
}));
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
function execute(gherkinSource_1) {
|
|
375
|
-
return __awaiter(this, arguments, void 0, function* (gherkinSource, messagesHandler = () => null, runOptions = { allowedRetries: 0 }) {
|
|
376
|
-
const newId = messages.IdGenerator.uuid();
|
|
377
|
-
const clock = new fake_cucumber_1.IncrementClock();
|
|
378
|
-
const stopwatch = new fake_cucumber_1.IncrementStopwatch();
|
|
379
|
-
const makeErrorMessage = (0, fake_cucumber_1.withFullStackTrace)();
|
|
380
|
-
const supportCode = new fake_cucumber_1.SupportCode(newId, clock, stopwatch, makeErrorMessage);
|
|
381
|
-
supportCode.defineBeforeHook(null, '@beforeHook', () => {
|
|
382
|
-
// no-op
|
|
383
|
-
});
|
|
384
|
-
supportCode.defineAfterHook(null, '@afterHook', () => {
|
|
385
|
-
// no-op
|
|
386
|
-
});
|
|
387
|
-
supportCode.defineStepDefinition(null, 'a passed step', () => {
|
|
388
|
-
// no-op
|
|
389
|
-
});
|
|
390
|
-
supportCode.defineStepDefinition(null, 'a passed step with attachment', function () {
|
|
391
|
-
this.attach('Hello', 'text/plain');
|
|
392
|
-
});
|
|
393
|
-
supportCode.defineStepDefinition(null, 'a failed step', () => {
|
|
394
|
-
throw new Error(`This step failed.`);
|
|
395
|
-
});
|
|
396
|
-
supportCode.defineStepDefinition(null, 'I have {int} cukes in my {word}', (cukes) => {
|
|
397
|
-
assert_1.default.ok(cukes);
|
|
398
|
-
});
|
|
399
|
-
let passesSecondTime = 0;
|
|
400
|
-
supportCode.defineStepDefinition(null, 'a step that passes the second time', () => {
|
|
401
|
-
passesSecondTime++;
|
|
402
|
-
if (passesSecondTime < 2) {
|
|
403
|
-
throw new Error(`This step failed.`);
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
const queryUpdateStream = new stream_1.Writable({
|
|
407
|
-
objectMode: true,
|
|
408
|
-
write(envelope, encoding, callback) {
|
|
409
|
-
try {
|
|
410
|
-
messagesHandler(envelope);
|
|
411
|
-
gherkinQuery.update(envelope);
|
|
412
|
-
cucumberQuery.update(envelope);
|
|
413
|
-
callback();
|
|
414
|
-
}
|
|
415
|
-
catch (err) {
|
|
416
|
-
callback(err);
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
});
|
|
420
|
-
yield pipelinePromise(gherkinMessages(gherkinSource, 'test.feature', newId), queryUpdateStream);
|
|
421
|
-
const testPlan = (0, fake_cucumber_1.makeTestPlan)(gherkinQuery, supportCode, runOptions, fake_cucumber_1.makeTestCase);
|
|
422
|
-
yield testPlan.execute((envelope) => {
|
|
423
|
-
messagesHandler(envelope);
|
|
424
|
-
cucumberQuery.update(envelope);
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
function gherkinMessages(gherkinSource, uri, newId) {
|
|
429
|
-
const source = {
|
|
430
|
-
source: {
|
|
431
|
-
uri,
|
|
432
|
-
data: gherkinSource,
|
|
433
|
-
mediaType: messages.SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_PLAIN,
|
|
434
|
-
},
|
|
435
|
-
};
|
|
436
|
-
return gherkin_streams_1.GherkinStreams.fromSources([source], { newId });
|
|
437
|
-
}
|
|
438
|
-
function findScenario(envelopes) {
|
|
439
|
-
const gherkinDocument = envelopes.find((envelope) => envelope.gherkinDocument).gherkinDocument;
|
|
440
|
-
return gherkinDocument.feature.children.find((child) => child.scenario).scenario;
|
|
441
|
-
}
|
|
442
|
-
function findBackground(envelopes) {
|
|
443
|
-
const gherkinDocument = envelopes.find((envelope) => envelope.gherkinDocument).gherkinDocument;
|
|
444
|
-
return gherkinDocument.feature.children.find((child) => child.background).background;
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
//# sourceMappingURL=QueryTest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QueryTest.js","sourceRoot":"","sources":["../../test/QueryTest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA0D;AAC1D,2DAA+D;AAC/D,6DAA8C;AAC9C,mCAAqD;AACrD,oDAA2B;AAC3B,2DAQgC;AAEhC,+BAAgC;AAChC,yDAAgC;AAEhC,MAAM,eAAe,GAAG,IAAA,gBAAS,EAAC,iBAAQ,CAAC,CAAA;AAE3C,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,IAAI,YAA0B,CAAA;IAC9B,IAAI,aAAoB,CAAA;IACxB,UAAU,CAAC,GAAG,EAAE;QACd,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAA;QACjC,aAAa,GAAG,IAAI,eAAK,EAAE,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,8CAA8C,EAAE,GAAG,EAAE;QAC5D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D,CAAC;IAED,SAAS,YAAY,CAAC,SAA8B;QAClD,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,eAAe,CAAA;QAC9F,OAAO,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAA;IAClF,CAAC;IAED,SAAS,cAAc,CAAC,SAA8B;QACpD,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,eAAe,CAAA;QAC9F,OAAO,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,UAAU,CAAA;IACtF,CAAC;AACH,CAAC,CAAC,CAAA","sourcesContent":["import { GherkinStreams } from '@cucumber/gherkin-streams'\nimport { Query as GherkinQuery } from '@cucumber/gherkin-utils'\nimport * as messages from '@cucumber/messages'\nimport { pipeline, Readable, Writable } from 'stream'\nimport assert from 'assert'\nimport {\n SupportCode,\n withFullStackTrace,\n makeTestPlan,\n makeTestCase,\n IncrementClock,\n IncrementStopwatch,\n RunOptions,\n} from '@cucumber/fake-cucumber'\n\nimport { promisify } from 'util'\nimport Query from '../src/Query'\n\nconst pipelinePromise = promisify(pipeline)\n\ndescribe('Query', () => {\n let gherkinQuery: GherkinQuery\n let cucumberQuery: Query\n beforeEach(() => {\n gherkinQuery = new GherkinQuery()\n cucumberQuery = new Query()\n })\n\n describe('#getPickleStepTestStepResults(pickleStepIds)', () => {\n it('returns a single UNKNOWN when the list is empty', () => {\n const results = cucumberQuery.getPickleTestStepResults([])\n assert.deepStrictEqual(\n results.map((r) => r.status),\n ['UNKNOWN']\n )\n })\n\n it('looks up results for scenario steps', async () => {\n const envelopes: messages.Envelope[] = []\n\n await execute(\n `Feature: hello\n Scenario: ok\n Given a passed step\n`,\n (envelope) => envelopes.push(envelope)\n )\n\n const scenario = findScenario(envelopes)\n\n const pickleStepIds = gherkinQuery.getPickleStepIds(scenario.steps[0].id)\n assert.strictEqual(pickleStepIds.length, 1)\n\n const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds)\n assert.strictEqual(testStepResults.length, 1)\n\n assert.strictEqual(testStepResults[0].status, 'PASSED')\n })\n\n it('looks up results for background steps', async () => {\n const envelopes: messages.Envelope[] = []\n\n await execute(\n `Feature: hello\n Background:\n Given a passed step\n\n Scenario: ok\n Given a passed step\n\n Scenario: ko\n Given a failed step\n`,\n (envelope) => envelopes.push(envelope)\n )\n\n const background = findBackground(envelopes)\n const pickleStepIds = gherkinQuery.getPickleStepIds(background.steps[0].id)\n assert.strictEqual(pickleStepIds.length, 2)\n\n const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds)\n\n assert.deepStrictEqual(\n testStepResults.map((r) => r.status),\n ['PASSED', 'PASSED']\n )\n })\n\n it('looks up results for background steps when scenarios are empty', async () => {\n const envelopes: messages.Envelope[] = []\n\n await execute(\n `Feature: hello\n Background:\n Given a passed step\n\n Scenario: ok\n\n Scenario: ok too\n`,\n (envelope) => envelopes.push(envelope)\n )\n\n const background = findBackground(envelopes)\n const pickleStepIds = gherkinQuery.getPickleStepIds(background.steps[0].id)\n assert.strictEqual(pickleStepIds.length, 0)\n\n const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds)\n assert.strictEqual(testStepResults.length, 1)\n\n assert.strictEqual(testStepResults[0].status, 'UNKNOWN')\n })\n })\n\n describe('#getPickleTestStepResults(pickleIds)', () => {\n it('looks up results for scenarios', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n Scenario: ko\n Given a passed step\n Given a failed step\n`,\n (envelope) => envelopes.push(envelope)\n )\n\n const scenario = findScenario(envelopes)\n const pickleIds = gherkinQuery.getPickleIds('test.feature', scenario.id)\n assert.strictEqual(pickleIds.length, 1)\n\n const testStepResults = cucumberQuery.getPickleTestStepResults(pickleIds)\n\n assert.deepStrictEqual(\n testStepResults.map((r) => r.status),\n ['PASSED', 'FAILED']\n )\n })\n\n it('looks up results for scenario outlines', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n Scenario: hi <status1> and <status2>\n Given a <status1> step\n And a <status2> step\n\n Examples:\n | status1 | status2 |\n | passed | passed |\n | passed | failed |\n`,\n (envelope) => envelopes.push(envelope)\n )\n\n const scenario = findScenario(envelopes)\n const pickleIds = gherkinQuery.getPickleIds('test.feature', scenario.id)\n assert.strictEqual(pickleIds.length, 2)\n\n assert.deepStrictEqual(\n cucumberQuery.getPickleTestStepResults(pickleIds).map((r) => r.status),\n ['PASSED', 'PASSED', 'PASSED', 'FAILED']\n )\n })\n\n it('looks up results for examples rows outlines', async () => {\n const envelopes: messages.Envelope[] = []\n\n await execute(\n `Feature: hello\n Scenario: hi <status1> and <status2>\n Given a <status1> step\n And a <status2> step\n\n Examples:\n | status1 | status2 |\n | passed | passed |\n | passed | failed |\n`,\n (envelope) => envelopes.push(envelope)\n )\n\n const scenario = findScenario(envelopes)\n const exampleIds = scenario.examples[0].tableBody.map((row) => row.id)\n\n assert.deepStrictEqual(\n cucumberQuery\n .getPickleTestStepResults(gherkinQuery.getPickleIds('test.feature', exampleIds[0]))\n .map((r) => r.status),\n ['PASSED', 'PASSED']\n )\n\n assert.deepStrictEqual(\n cucumberQuery\n .getPickleTestStepResults(gherkinQuery.getPickleIds('test.feature', exampleIds[1]))\n .map((r) => r.status),\n ['PASSED', 'FAILED']\n )\n })\n })\n\n describe('#getPickleStepAttachments(pickleIds)', () => {\n it('looks up attachments', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n Scenario: ok\n Given a passed step with attachment\n `,\n (envelope) => envelopes.push(envelope)\n )\n\n const scenario = findScenario(envelopes)\n const pickleStepIds = gherkinQuery.getPickleStepIds(scenario.steps[0].id)\n assert.strictEqual(pickleStepIds.length, 1)\n\n const attachments = cucumberQuery.getPickleStepAttachments(pickleStepIds)\n assert.strictEqual(attachments.length, 1)\n\n assert.strictEqual(attachments[0].body, 'Hello')\n })\n })\n\n describe('#getStepMatchArguments(uri, lineNumber)', () => {\n it(\"looks up result for step's uri and line\", async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n Scenario: ok\n Given a passed step\n And I have 567 cukes in my belly\n `,\n (envelope) => envelopes.push(envelope)\n )\n\n const scenario = findScenario(envelopes)\n\n assert.deepStrictEqual(\n cucumberQuery\n .getStepMatchArgumentsLists(gherkinQuery.getPickleStepIds(scenario.steps[0].id)[0])\n .map((sal) => sal.stepMatchArguments.map((arg) => arg.parameterTypeName)),\n [[]]\n )\n\n assert.deepStrictEqual(\n cucumberQuery\n .getStepMatchArgumentsLists(gherkinQuery.getPickleStepIds(scenario.steps[1].id)[0])\n .map((sal) => sal.stepMatchArguments.map((arg) => arg.parameterTypeName)),\n [['int', 'word']]\n )\n })\n\n describe('#getBeforeHookSteps(pickleId: string)', () => {\n it('returns an empty list when there is no hooks', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n Scenario: hi\n Given a passed step\n `,\n (envelope) => envelopes.push(envelope)\n )\n const scenarioId = findScenario(envelopes).id\n const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]\n\n assert.deepStrictEqual(cucumberQuery.getBeforeHookSteps(pickleId), [])\n })\n\n it('returns one before hook step', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n @beforeHook\n Scenario: hi\n Given a passed step\n `,\n (envelope) => envelopes.push(envelope)\n )\n const scenarioId = findScenario(envelopes).id\n const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]\n\n assert.strictEqual(cucumberQuery.getBeforeHookSteps(pickleId).length, 1)\n })\n\n it('does not return after hook steps', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n @afterHook\n Scenario: hi\n Given a passed step\n `,\n (envelope) => envelopes.push(envelope)\n )\n const scenarioId = findScenario(envelopes).id\n const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]\n\n assert.deepStrictEqual(cucumberQuery.getBeforeHookSteps(pickleId), [])\n })\n })\n\n describe('#getAfterHookSteps(pickleId: string)', () => {\n it('returns an empty list when there is no hooks', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n Scenario: hi\n Given a passed step\n `,\n (envelope) => envelopes.push(envelope)\n )\n const scenarioId = findScenario(envelopes).id\n const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]\n\n assert.deepStrictEqual(cucumberQuery.getAfterHookSteps(pickleId), [])\n })\n\n it('returns one after hook step', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n @afterHook\n Scenario: hi\n Given a passed step\n `,\n (envelope) => envelopes.push(envelope)\n )\n const scenarioId = findScenario(envelopes).id\n const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]\n\n assert.strictEqual(cucumberQuery.getAfterHookSteps(pickleId).length, 1)\n })\n\n it('does not return before hook steps', async () => {\n const envelopes: messages.Envelope[] = []\n await execute(\n `Feature: hello\n @beforeHook\n Scenario: hi\n Given a passed step\n `,\n (envelope) => envelopes.push(envelope)\n )\n const scenarioId = findScenario(envelopes).id\n const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]\n\n assert.deepStrictEqual(cucumberQuery.getAfterHookSteps(pickleId), [])\n })\n })\n\n describe('#getTestStepResult', () => {\n it('returns one test step result', async () => {\n const emittedMessages: Array<messages.Envelope> = []\n await execute(\n `Feature: hello\n Scenario: hi\n Given a passed step\n `,\n (message) => emittedMessages.push(message)\n )\n const testCase = emittedMessages.find((child) => child.testCase).testCase\n const testStep = testCase.testSteps[0]\n const results = cucumberQuery.getTestStepResults(testStep.id)\n\n assert.deepStrictEqual(results.length, 1)\n assert.deepStrictEqual(results[0].status, 'PASSED')\n })\n\n it('returns a result for hook step', async () => {\n const emittedMessages: Array<messages.Envelope> = []\n await execute(\n `Feature: hello\n @beforeHook\n Scenario: hi\n Given a passed step\n `,\n (message) => emittedMessages.push(message)\n )\n const testCase = emittedMessages.find((child) => child.testCase).testCase\n const testStep = testCase.testSteps[0]\n const results = cucumberQuery.getTestStepResults(testStep.id)\n\n assert.deepStrictEqual(results.length, 1)\n assert.deepStrictEqual(results[0].status, 'PASSED')\n })\n\n it('returns the result from the last attempt only where retry has been used', async () => {\n const emittedMessages: Array<messages.Envelope> = []\n await execute(\n `Feature: hello\nScenario: hi\n Given a step that passes the second time\n`,\n (message) => emittedMessages.push(message),\n { allowedRetries: 1 }\n )\n const testCase = emittedMessages.find((child) => child.testCase).testCase\n const testStep = testCase.testSteps[0]\n const results = cucumberQuery.getTestStepResults(testStep.id)\n\n assert.deepStrictEqual(results.length, 1)\n assert.deepStrictEqual(results[0].status, 'PASSED')\n })\n })\n\n describe('#getHook(HookId)', () => {\n it('returns undefined if the id does not match any hook', () => {\n assert.strictEqual(cucumberQuery.getHook('tralala'), undefined)\n })\n\n it('returns the matching hook', () => {\n const hook: messages.Hook = {\n id: 'tralala',\n sourceReference: {},\n }\n const envelope: messages.Envelope = {\n hook,\n }\n\n cucumberQuery.update(envelope)\n\n assert.deepStrictEqual(cucumberQuery.getHook('tralala'), hook)\n })\n })\n\n describe('#getAttachmentByTestStepId', () => {\n it('looks up attachments', async () => {\n const testCases: messages.TestCase[] = []\n await execute(\n `Feature: hello\n Scenario: ok\n Given a passed step with attachment\n `,\n (envelope) => {\n if (envelope.testCase) {\n testCases.push(envelope.testCase)\n }\n }\n )\n\n const attachments = cucumberQuery.getTestStepsAttachments([testCases[0].testSteps[0].id])\n assert.strictEqual(attachments.length, 1)\n\n assert.strictEqual(attachments[0].body, 'Hello')\n })\n\n it('returns attachments from the last attempt only where retry has been used', async () => {\n const testCases: messages.TestCase[] = []\n await execute(\n `Feature: hello\n Scenario: ok\n Given a passed step with attachment\n And a step that passes the second time\n `,\n (envelope) => {\n if (envelope.testCase) {\n testCases.push(envelope.testCase)\n }\n },\n { allowedRetries: 1 }\n )\n\n const attachments = cucumberQuery.getTestStepsAttachments([testCases[0].testSteps[0].id])\n assert.strictEqual(attachments.length, 1)\n\n assert.strictEqual(attachments[0].body, 'Hello')\n })\n })\n\n describe('#getStatusCounts', () => {\n it('returns the number of pickles for each status', async () => {\n await execute(\n `Feature: hello\n Scenario: ok\n Given a passed step\n `,\n () => undefined\n )\n\n await execute(\n `Feature: hello\n Scenario: ok\n Given a passed step\n `,\n () => undefined\n )\n\n await execute(\n `Feature: hello\n Scenario: ok\n Given a failed step\n `,\n () => undefined\n )\n\n await execute(\n `Feature: hello\n Scenario: ok\n Given an undefined step\n `,\n () => undefined\n )\n\n const statuses = cucumberQuery.getStatusCounts(\n gherkinQuery.getPickles().map((pickle) => pickle.id)\n )\n\n const expectedStatuses: Partial<Record<messages.TestStepResultStatus, number>> = {\n PASSED: 2,\n FAILED: 1,\n UNDEFINED: 1,\n }\n assert.deepStrictEqual(statuses, expectedStatuses)\n })\n })\n })\n\n async function execute(\n gherkinSource: string,\n messagesHandler: (envelope: messages.Envelope) => void = () => null,\n runOptions: RunOptions = { allowedRetries: 0 }\n ): Promise<void> {\n const newId = messages.IdGenerator.uuid()\n const clock = new IncrementClock()\n const stopwatch = new IncrementStopwatch()\n const makeErrorMessage = withFullStackTrace()\n const supportCode = new SupportCode(newId, clock, stopwatch, makeErrorMessage)\n supportCode.defineBeforeHook(null, '@beforeHook', () => {\n // no-op\n })\n supportCode.defineAfterHook(null, '@afterHook', () => {\n // no-op\n })\n supportCode.defineStepDefinition(null, 'a passed step', () => {\n // no-op\n })\n supportCode.defineStepDefinition(null, 'a passed step with attachment', function () {\n this.attach('Hello', 'text/plain')\n })\n supportCode.defineStepDefinition(null, 'a failed step', () => {\n throw new Error(`This step failed.`)\n })\n supportCode.defineStepDefinition(null, 'I have {int} cukes in my {word}', (cukes: number) => {\n assert.ok(cukes)\n })\n let passesSecondTime = 0\n supportCode.defineStepDefinition(null, 'a step that passes the second time', () => {\n passesSecondTime++\n if (passesSecondTime < 2) {\n throw new Error(`This step failed.`)\n }\n })\n\n const queryUpdateStream = new Writable({\n objectMode: true,\n write(\n envelope: messages.Envelope,\n encoding: string,\n callback: (error?: Error | null) => void\n ): void {\n try {\n messagesHandler(envelope)\n gherkinQuery.update(envelope)\n cucumberQuery.update(envelope)\n callback()\n } catch (err) {\n callback(err)\n }\n },\n })\n await pipelinePromise(gherkinMessages(gherkinSource, 'test.feature', newId), queryUpdateStream)\n\n const testPlan = makeTestPlan(gherkinQuery, supportCode, runOptions, makeTestCase)\n await testPlan.execute((envelope: messages.Envelope) => {\n messagesHandler(envelope)\n cucumberQuery.update(envelope)\n })\n }\n\n function gherkinMessages(\n gherkinSource: string,\n uri: string,\n newId: messages.IdGenerator.NewId\n ): Readable {\n const source: messages.Envelope = {\n source: {\n uri,\n data: gherkinSource,\n mediaType: messages.SourceMediaType.TEXT_X_CUCUMBER_GHERKIN_PLAIN,\n },\n }\n return GherkinStreams.fromSources([source], { newId })\n }\n\n function findScenario(envelopes: messages.Envelope[]): messages.Scenario {\n const gherkinDocument = envelopes.find((envelope) => envelope.gherkinDocument).gherkinDocument\n return gherkinDocument.feature.children.find((child) => child.scenario).scenario\n }\n\n function findBackground(envelopes: messages.Envelope[]): messages.Background {\n const gherkinDocument = envelopes.find((envelope) => envelope.gherkinDocument).gherkinDocument\n return gherkinDocument.feature.children.find((child) => child.background).background\n }\n})\n"]}
|