@cucumber/query 7.0.1 → 9.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.
- package/.mocharc.json +2 -2
- package/default.mk +19 -47
- package/dist/src/Query.d.ts +1 -0
- package/dist/src/Query.d.ts.map +1 -0
- package/dist/src/Query.js +57 -95
- package/dist/src/Query.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -4
- package/dist/src/index.js.map +1 -1
- package/dist/test/QueryTest.d.ts +2 -1
- package/dist/test/QueryTest.d.ts.map +1 -0
- package/dist/test/QueryTest.js +329 -455
- package/dist/test/QueryTest.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +5082 -0
- package/package.json +12 -30
- package/src/Query.ts +19 -61
- package/src/index.ts +1 -2
- package/test/QueryTest.ts +43 -113
- package/tsconfig.build.json +11 -0
- package/tsconfig.json +1 -24
- package/.built +0 -0
- package/.codegen +0 -0
- package/.deps +0 -0
- package/.eslintrc.json +0 -41
- package/.gitignore +0 -18
- package/.idea/aws.xml +0 -11
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/javascript.iml +0 -9
- package/.idea/misc.xml +0 -9
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -101
- package/.linted +0 -0
- package/.nycrc.json +0 -16
- package/.prettierrc +0 -5
- package/.tested-npm +0 -0
- package/dist/src/QueryStream.d.ts +0 -9
- package/dist/src/QueryStream.js +0 -31
- package/dist/src/QueryStream.js.map +0 -1
- package/package-lock.json +0 -3604
- package/src/QueryStream.ts +0 -18
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cucumber/query",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "Cucumber Query - query messages",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "mocha",
|
|
9
|
-
"
|
|
10
|
-
"lint-fix": "eslint --ext ts --max-warnings 0 --fix src test",
|
|
11
|
-
"coverage": "nyc --reporter=html --reporter=text mocha",
|
|
12
|
-
"build": "tsc",
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
9
|
+
"prepublishOnly": "tsc --build tsconfig.build.json"
|
|
14
10
|
},
|
|
15
11
|
"repository": {
|
|
16
12
|
"type": "git",
|
|
@@ -26,33 +22,19 @@
|
|
|
26
22
|
},
|
|
27
23
|
"homepage": "https://github.com/cucumber/cucumber#readme",
|
|
28
24
|
"devDependencies": {
|
|
29
|
-
"@cucumber/fake-cucumber": "^
|
|
30
|
-
"@cucumber/gherkin": "^
|
|
31
|
-
"@cucumber/gherkin-
|
|
32
|
-
"@
|
|
33
|
-
"@types/
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
"core-js": "^3.8.1",
|
|
37
|
-
"eslint": "^7.15.0",
|
|
38
|
-
"eslint-config-prettier": "^7.0.0",
|
|
39
|
-
"eslint-plugin-node": "^11.1.0",
|
|
40
|
-
"eslint-plugin-prettier": "^3.3.0",
|
|
41
|
-
"eslint-plugin-react": "^7.21.5",
|
|
42
|
-
"mocha": "^8.2.1",
|
|
43
|
-
"nyc": "^15.1.0",
|
|
44
|
-
"prettier": "^2.2.1",
|
|
45
|
-
"source-map-support": "^0.5.19",
|
|
46
|
-
"ts-loader": "^8.0.12",
|
|
25
|
+
"@cucumber/fake-cucumber": "^11.0.0",
|
|
26
|
+
"@cucumber/gherkin": "^18.0.0",
|
|
27
|
+
"@cucumber/gherkin-streams": "^1.0.0",
|
|
28
|
+
"@cucumber/gherkin-utils": "^4.0.0",
|
|
29
|
+
"@types/mocha": "^8.2.2",
|
|
30
|
+
"@types/node": "^14.14.37",
|
|
31
|
+
"mocha": "^8.3.2",
|
|
47
32
|
"ts-node": "^9.1.1",
|
|
48
|
-
"typescript": "^4.
|
|
33
|
+
"typescript": "^4.2.3"
|
|
49
34
|
},
|
|
50
|
-
"files": [
|
|
51
|
-
"*"
|
|
52
|
-
],
|
|
53
35
|
"dependencies": {
|
|
54
|
-
"@cucumber/messages": "^
|
|
55
|
-
"@teppeis/multimaps": "^
|
|
36
|
+
"@cucumber/messages": "^15.0.0",
|
|
37
|
+
"@teppeis/multimaps": "^2.0.0"
|
|
56
38
|
},
|
|
57
39
|
"directories": {
|
|
58
40
|
"test": "test"
|
package/src/Query.ts
CHANGED
|
@@ -18,16 +18,10 @@ export default class Query {
|
|
|
18
18
|
string,
|
|
19
19
|
messages.TestStepFinished.ITestStepResult
|
|
20
20
|
>()
|
|
21
|
-
private readonly testStepIdsByPickleStepId = new ArrayMultimap<
|
|
22
|
-
string,
|
|
23
|
-
string
|
|
24
|
-
>()
|
|
21
|
+
private readonly testStepIdsByPickleStepId = new ArrayMultimap<string, string>()
|
|
25
22
|
private readonly hooksById = new Map<string, messages.IHook>()
|
|
26
23
|
|
|
27
|
-
private readonly attachmentsByTestStepId = new ArrayMultimap<
|
|
28
|
-
string,
|
|
29
|
-
messages.IAttachment
|
|
30
|
-
>()
|
|
24
|
+
private readonly attachmentsByTestStepId = new ArrayMultimap<string, messages.IAttachment>()
|
|
31
25
|
|
|
32
26
|
private readonly stepMatchArgumentsListsByPickleStepId = new Map<
|
|
33
27
|
string,
|
|
@@ -50,25 +44,15 @@ export default class Query {
|
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
if (envelope.testStepFinished) {
|
|
53
|
-
const pickleId = this.pickleIdByTestStepId.get(
|
|
54
|
-
|
|
55
|
-
)
|
|
56
|
-
this.testStepResultByPickleId.put(
|
|
57
|
-
pickleId,
|
|
58
|
-
envelope.testStepFinished.testStepResult
|
|
59
|
-
)
|
|
47
|
+
const pickleId = this.pickleIdByTestStepId.get(envelope.testStepFinished.testStepId)
|
|
48
|
+
this.testStepResultByPickleId.put(pickleId, envelope.testStepFinished.testStepResult)
|
|
60
49
|
|
|
61
|
-
const testStep = this.testStepById.get(
|
|
62
|
-
envelope.testStepFinished.testStepId
|
|
63
|
-
)
|
|
50
|
+
const testStep = this.testStepById.get(envelope.testStepFinished.testStepId)
|
|
64
51
|
this.testStepResultsByPickleStepId.put(
|
|
65
52
|
testStep.pickleStepId,
|
|
66
53
|
envelope.testStepFinished.testStepResult
|
|
67
54
|
)
|
|
68
|
-
this.testStepResultsbyTestStepId.put(
|
|
69
|
-
testStep.id,
|
|
70
|
-
envelope.testStepFinished.testStepResult
|
|
71
|
-
)
|
|
55
|
+
this.testStepResultsbyTestStepId.put(testStep.id, envelope.testStepFinished.testStepResult)
|
|
72
56
|
}
|
|
73
57
|
|
|
74
58
|
if (envelope.hook) {
|
|
@@ -76,10 +60,7 @@ export default class Query {
|
|
|
76
60
|
}
|
|
77
61
|
|
|
78
62
|
if (envelope.attachment) {
|
|
79
|
-
this.attachmentsByTestStepId.put(
|
|
80
|
-
envelope.attachment.testStepId,
|
|
81
|
-
envelope.attachment
|
|
82
|
-
)
|
|
63
|
+
this.attachmentsByTestStepId.put(envelope.attachment.testStepId, envelope.attachment)
|
|
83
64
|
}
|
|
84
65
|
}
|
|
85
66
|
|
|
@@ -99,13 +80,8 @@ export default class Query {
|
|
|
99
80
|
]
|
|
100
81
|
}
|
|
101
82
|
return pickleStepIds.reduce(
|
|
102
|
-
(
|
|
103
|
-
testStepResults
|
|
104
|
-
pickleId
|
|
105
|
-
) => {
|
|
106
|
-
return testStepResults.concat(
|
|
107
|
-
this.testStepResultsByPickleStepId.get(pickleId)
|
|
108
|
-
)
|
|
83
|
+
(testStepResults: messages.TestStepFinished.ITestStepResult[], pickleId) => {
|
|
84
|
+
return testStepResults.concat(this.testStepResultsByPickleStepId.get(pickleId))
|
|
109
85
|
},
|
|
110
86
|
[]
|
|
111
87
|
)
|
|
@@ -127,13 +103,8 @@ export default class Query {
|
|
|
127
103
|
]
|
|
128
104
|
}
|
|
129
105
|
return pickleIds.reduce(
|
|
130
|
-
(
|
|
131
|
-
testStepResults
|
|
132
|
-
pickleId
|
|
133
|
-
) => {
|
|
134
|
-
return testStepResults.concat(
|
|
135
|
-
this.testStepResultByPickleId.get(pickleId)
|
|
136
|
-
)
|
|
106
|
+
(testStepResults: messages.TestStepFinished.ITestStepResult[], pickleId) => {
|
|
107
|
+
return testStepResults.concat(this.testStepResultByPickleId.get(pickleId))
|
|
137
108
|
},
|
|
138
109
|
[]
|
|
139
110
|
)
|
|
@@ -164,9 +135,7 @@ export default class Query {
|
|
|
164
135
|
): ReadonlyArray<messages.IAttachment> {
|
|
165
136
|
return this.getTestStepsAttachments(
|
|
166
137
|
pickleStepIds.reduce((testStepIds: string[], pickleStepId: string) => {
|
|
167
|
-
return testStepIds.concat(
|
|
168
|
-
this.testStepIdsByPickleStepId.get(pickleStepId)
|
|
169
|
-
)
|
|
138
|
+
return testStepIds.concat(this.testStepIdsByPickleStepId.get(pickleStepId))
|
|
170
139
|
}, [])
|
|
171
140
|
)
|
|
172
141
|
}
|
|
@@ -174,12 +143,9 @@ export default class Query {
|
|
|
174
143
|
public getTestStepsAttachments(
|
|
175
144
|
testStepIds: ReadonlyArray<string>
|
|
176
145
|
): ReadonlyArray<messages.IAttachment> {
|
|
177
|
-
return testStepIds.reduce(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
[]
|
|
182
|
-
)
|
|
146
|
+
return testStepIds.reduce((attachments: messages.IAttachment[], testStepId) => {
|
|
147
|
+
return attachments.concat(this.attachmentsByTestStepId.get(testStepId))
|
|
148
|
+
}, [])
|
|
183
149
|
}
|
|
184
150
|
|
|
185
151
|
/**
|
|
@@ -188,9 +154,7 @@ export default class Query {
|
|
|
188
154
|
*/
|
|
189
155
|
public getStepMatchArgumentsLists(
|
|
190
156
|
pickleStepId: string
|
|
191
|
-
):
|
|
192
|
-
| ReadonlyArray<messages.TestCase.TestStep.IStepMatchArgumentsList>
|
|
193
|
-
| undefined {
|
|
157
|
+
): ReadonlyArray<messages.TestCase.TestStep.IStepMatchArgumentsList> | undefined {
|
|
194
158
|
return this.stepMatchArgumentsListsByPickleStepId.get(pickleStepId)
|
|
195
159
|
}
|
|
196
160
|
|
|
@@ -198,9 +162,7 @@ export default class Query {
|
|
|
198
162
|
return this.hooksById.get(hookId)
|
|
199
163
|
}
|
|
200
164
|
|
|
201
|
-
public getBeforeHookSteps(
|
|
202
|
-
pickleId: string
|
|
203
|
-
): ReadonlyArray<messages.TestCase.ITestStep> {
|
|
165
|
+
public getBeforeHookSteps(pickleId: string): ReadonlyArray<messages.TestCase.ITestStep> {
|
|
204
166
|
const hookSteps: messages.TestCase.ITestStep[] = []
|
|
205
167
|
|
|
206
168
|
this.identifyHookSteps(
|
|
@@ -211,9 +173,7 @@ export default class Query {
|
|
|
211
173
|
return hookSteps
|
|
212
174
|
}
|
|
213
175
|
|
|
214
|
-
public getAfterHookSteps(
|
|
215
|
-
pickleId: string
|
|
216
|
-
): ReadonlyArray<messages.TestCase.ITestStep> {
|
|
176
|
+
public getAfterHookSteps(pickleId: string): ReadonlyArray<messages.TestCase.ITestStep> {
|
|
217
177
|
const hookSteps: messages.TestCase.ITestStep[] = []
|
|
218
178
|
|
|
219
179
|
this.identifyHookSteps(
|
|
@@ -246,9 +206,7 @@ export default class Query {
|
|
|
246
206
|
}
|
|
247
207
|
}
|
|
248
208
|
|
|
249
|
-
public getTestStepResults(
|
|
250
|
-
testStepId: string
|
|
251
|
-
): messages.TestStepFinished.ITestStepResult[] {
|
|
209
|
+
public getTestStepResults(testStepId: string): messages.TestStepFinished.ITestStepResult[] {
|
|
252
210
|
return this.testStepResultsbyTestStepId.get(testStepId)
|
|
253
211
|
}
|
|
254
212
|
}
|
package/src/index.ts
CHANGED
package/test/QueryTest.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import { GherkinStreams } from '@cucumber/gherkin'
|
|
1
|
+
import { GherkinStreams } from '@cucumber/gherkin-streams'
|
|
3
2
|
import { Query as GherkinQuery } from '@cucumber/gherkin-utils'
|
|
4
3
|
import { IdGenerator, messages } from '@cucumber/messages'
|
|
5
4
|
import { pipeline, Readable, Writable } from 'stream'
|
|
6
5
|
import assert from 'assert'
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
SupportCode,
|
|
8
|
+
withFullStackTrace,
|
|
9
|
+
makeTestPlan,
|
|
10
|
+
makeTestCase,
|
|
11
|
+
IncrementClock,
|
|
12
|
+
IncrementStopwatch,
|
|
13
|
+
} from '@cucumber/fake-cucumber'
|
|
8
14
|
|
|
9
15
|
import { promisify } from 'util'
|
|
10
|
-
import IncrementClock from '@cucumber/fake-cucumber/dist/src/IncrementClock'
|
|
11
16
|
import Query from '../src/Query'
|
|
12
|
-
import { makeTestPlan, makeTestCase } from '@cucumber/fake-cucumber'
|
|
13
|
-
import IncrementStopwatch from '@cucumber/fake-cucumber/dist/src/IncrementStopwatch'
|
|
14
17
|
|
|
15
18
|
const pipelinePromise = promisify(pipeline)
|
|
16
19
|
|
|
@@ -35,10 +38,7 @@ describe('Query', () => {
|
|
|
35
38
|
status: messages.TestStepFinished.TestStepResult.Status.PASSED,
|
|
36
39
|
}),
|
|
37
40
|
])
|
|
38
|
-
assert.strictEqual(
|
|
39
|
-
result.status,
|
|
40
|
-
messages.TestStepFinished.TestStepResult.Status.FAILED
|
|
41
|
-
)
|
|
41
|
+
assert.strictEqual(result.status, messages.TestStepFinished.TestStepResult.Status.FAILED)
|
|
42
42
|
})
|
|
43
43
|
})
|
|
44
44
|
|
|
@@ -67,9 +67,7 @@ describe('Query', () => {
|
|
|
67
67
|
const pickleStepIds = gherkinQuery.getPickleStepIds(scenario.steps[0].id)
|
|
68
68
|
assert.strictEqual(pickleStepIds.length, 1)
|
|
69
69
|
|
|
70
|
-
const testStepResults = cucumberQuery.getPickleStepTestStepResults(
|
|
71
|
-
pickleStepIds
|
|
72
|
-
)
|
|
70
|
+
const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds)
|
|
73
71
|
assert.strictEqual(testStepResults.length, 1)
|
|
74
72
|
|
|
75
73
|
assert.strictEqual(
|
|
@@ -96,14 +94,10 @@ describe('Query', () => {
|
|
|
96
94
|
)
|
|
97
95
|
|
|
98
96
|
const background = findBackground(envelopes)
|
|
99
|
-
const pickleStepIds = gherkinQuery.getPickleStepIds(
|
|
100
|
-
background.steps[0].id
|
|
101
|
-
)
|
|
97
|
+
const pickleStepIds = gherkinQuery.getPickleStepIds(background.steps[0].id)
|
|
102
98
|
assert.strictEqual(pickleStepIds.length, 2)
|
|
103
99
|
|
|
104
|
-
const testStepResults = cucumberQuery.getPickleStepTestStepResults(
|
|
105
|
-
pickleStepIds
|
|
106
|
-
)
|
|
100
|
+
const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds)
|
|
107
101
|
|
|
108
102
|
assert.deepStrictEqual(
|
|
109
103
|
testStepResults.map((r) => r.status),
|
|
@@ -130,14 +124,10 @@ describe('Query', () => {
|
|
|
130
124
|
)
|
|
131
125
|
|
|
132
126
|
const background = findBackground(envelopes)
|
|
133
|
-
const pickleStepIds = gherkinQuery.getPickleStepIds(
|
|
134
|
-
background.steps[0].id
|
|
135
|
-
)
|
|
127
|
+
const pickleStepIds = gherkinQuery.getPickleStepIds(background.steps[0].id)
|
|
136
128
|
assert.strictEqual(pickleStepIds.length, 0)
|
|
137
129
|
|
|
138
|
-
const testStepResults = cucumberQuery.getPickleStepTestStepResults(
|
|
139
|
-
pickleStepIds
|
|
140
|
-
)
|
|
130
|
+
const testStepResults = cucumberQuery.getPickleStepTestStepResults(pickleStepIds)
|
|
141
131
|
assert.strictEqual(testStepResults.length, 1)
|
|
142
132
|
|
|
143
133
|
assert.strictEqual(
|
|
@@ -227,9 +217,7 @@ describe('Query', () => {
|
|
|
227
217
|
|
|
228
218
|
assert.deepStrictEqual(
|
|
229
219
|
cucumberQuery
|
|
230
|
-
.getPickleTestStepResults(
|
|
231
|
-
gherkinQuery.getPickleIds('test.feature', exampleIds[0])
|
|
232
|
-
)
|
|
220
|
+
.getPickleTestStepResults(gherkinQuery.getPickleIds('test.feature', exampleIds[0]))
|
|
233
221
|
.map((r) => r.status),
|
|
234
222
|
[
|
|
235
223
|
messages.TestStepFinished.TestStepResult.Status.PASSED,
|
|
@@ -239,9 +227,7 @@ describe('Query', () => {
|
|
|
239
227
|
|
|
240
228
|
assert.deepStrictEqual(
|
|
241
229
|
cucumberQuery
|
|
242
|
-
.getPickleTestStepResults(
|
|
243
|
-
gherkinQuery.getPickleIds('test.feature', exampleIds[1])
|
|
244
|
-
)
|
|
230
|
+
.getPickleTestStepResults(gherkinQuery.getPickleIds('test.feature', exampleIds[1]))
|
|
245
231
|
.map((r) => r.status),
|
|
246
232
|
[
|
|
247
233
|
messages.TestStepFinished.TestStepResult.Status.PASSED,
|
|
@@ -289,23 +275,15 @@ describe('Query', () => {
|
|
|
289
275
|
|
|
290
276
|
assert.deepStrictEqual(
|
|
291
277
|
cucumberQuery
|
|
292
|
-
.getStepMatchArgumentsLists(
|
|
293
|
-
|
|
294
|
-
)
|
|
295
|
-
.map((sal) =>
|
|
296
|
-
sal.stepMatchArguments.map((arg) => arg.parameterTypeName)
|
|
297
|
-
),
|
|
278
|
+
.getStepMatchArgumentsLists(gherkinQuery.getPickleStepIds(scenario.steps[0].id)[0])
|
|
279
|
+
.map((sal) => sal.stepMatchArguments.map((arg) => arg.parameterTypeName)),
|
|
298
280
|
[[]]
|
|
299
281
|
)
|
|
300
282
|
|
|
301
283
|
assert.deepStrictEqual(
|
|
302
284
|
cucumberQuery
|
|
303
|
-
.getStepMatchArgumentsLists(
|
|
304
|
-
|
|
305
|
-
)
|
|
306
|
-
.map((sal) =>
|
|
307
|
-
sal.stepMatchArguments.map((arg) => arg.parameterTypeName)
|
|
308
|
-
),
|
|
285
|
+
.getStepMatchArgumentsLists(gherkinQuery.getPickleStepIds(scenario.steps[1].id)[0])
|
|
286
|
+
.map((sal) => sal.stepMatchArguments.map((arg) => arg.parameterTypeName)),
|
|
309
287
|
[['int', 'word']]
|
|
310
288
|
)
|
|
311
289
|
})
|
|
@@ -321,10 +299,7 @@ describe('Query', () => {
|
|
|
321
299
|
(envelope) => envelopes.push(envelope)
|
|
322
300
|
)
|
|
323
301
|
const scenarioId = findScenario(envelopes).id
|
|
324
|
-
const pickleId = gherkinQuery.getPickleIds(
|
|
325
|
-
'test.feature',
|
|
326
|
-
scenarioId
|
|
327
|
-
)[0]
|
|
302
|
+
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]
|
|
328
303
|
|
|
329
304
|
assert.deepStrictEqual(cucumberQuery.getBeforeHookSteps(pickleId), [])
|
|
330
305
|
})
|
|
@@ -340,10 +315,7 @@ describe('Query', () => {
|
|
|
340
315
|
(envelope) => envelopes.push(envelope)
|
|
341
316
|
)
|
|
342
317
|
const scenarioId = findScenario(envelopes).id
|
|
343
|
-
const pickleId = gherkinQuery.getPickleIds(
|
|
344
|
-
'test.feature',
|
|
345
|
-
scenarioId
|
|
346
|
-
)[0]
|
|
318
|
+
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]
|
|
347
319
|
|
|
348
320
|
assert.strictEqual(cucumberQuery.getBeforeHookSteps(pickleId).length, 1)
|
|
349
321
|
})
|
|
@@ -359,10 +331,7 @@ describe('Query', () => {
|
|
|
359
331
|
(envelope) => envelopes.push(envelope)
|
|
360
332
|
)
|
|
361
333
|
const scenarioId = findScenario(envelopes).id
|
|
362
|
-
const pickleId = gherkinQuery.getPickleIds(
|
|
363
|
-
'test.feature',
|
|
364
|
-
scenarioId
|
|
365
|
-
)[0]
|
|
334
|
+
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]
|
|
366
335
|
|
|
367
336
|
assert.deepStrictEqual(cucumberQuery.getBeforeHookSteps(pickleId), [])
|
|
368
337
|
})
|
|
@@ -379,10 +348,7 @@ describe('Query', () => {
|
|
|
379
348
|
(envelope) => envelopes.push(envelope)
|
|
380
349
|
)
|
|
381
350
|
const scenarioId = findScenario(envelopes).id
|
|
382
|
-
const pickleId = gherkinQuery.getPickleIds(
|
|
383
|
-
'test.feature',
|
|
384
|
-
scenarioId
|
|
385
|
-
)[0]
|
|
351
|
+
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]
|
|
386
352
|
|
|
387
353
|
assert.deepStrictEqual(cucumberQuery.getAfterHookSteps(pickleId), [])
|
|
388
354
|
})
|
|
@@ -398,10 +364,7 @@ describe('Query', () => {
|
|
|
398
364
|
(envelope) => envelopes.push(envelope)
|
|
399
365
|
)
|
|
400
366
|
const scenarioId = findScenario(envelopes).id
|
|
401
|
-
const pickleId = gherkinQuery.getPickleIds(
|
|
402
|
-
'test.feature',
|
|
403
|
-
scenarioId
|
|
404
|
-
)[0]
|
|
367
|
+
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]
|
|
405
368
|
|
|
406
369
|
assert.strictEqual(cucumberQuery.getAfterHookSteps(pickleId).length, 1)
|
|
407
370
|
})
|
|
@@ -417,10 +380,7 @@ describe('Query', () => {
|
|
|
417
380
|
(envelope) => envelopes.push(envelope)
|
|
418
381
|
)
|
|
419
382
|
const scenarioId = findScenario(envelopes).id
|
|
420
|
-
const pickleId = gherkinQuery.getPickleIds(
|
|
421
|
-
'test.feature',
|
|
422
|
-
scenarioId
|
|
423
|
-
)[0]
|
|
383
|
+
const pickleId = gherkinQuery.getPickleIds('test.feature', scenarioId)[0]
|
|
424
384
|
|
|
425
385
|
assert.deepStrictEqual(cucumberQuery.getAfterHookSteps(pickleId), [])
|
|
426
386
|
})
|
|
@@ -436,8 +396,7 @@ describe('Query', () => {
|
|
|
436
396
|
`,
|
|
437
397
|
(message) => emittedMessages.push(message)
|
|
438
398
|
)
|
|
439
|
-
const testCase = emittedMessages.find((child) => child.testCase)
|
|
440
|
-
.testCase
|
|
399
|
+
const testCase = emittedMessages.find((child) => child.testCase).testCase
|
|
441
400
|
const testStep = testCase.testSteps[0]
|
|
442
401
|
const results = cucumberQuery.getTestStepResults(testStep.id)
|
|
443
402
|
|
|
@@ -458,8 +417,7 @@ describe('Query', () => {
|
|
|
458
417
|
`,
|
|
459
418
|
(message) => emittedMessages.push(message)
|
|
460
419
|
)
|
|
461
|
-
const testCase = emittedMessages.find((child) => child.testCase)
|
|
462
|
-
.testCase
|
|
420
|
+
const testCase = emittedMessages.find((child) => child.testCase).testCase
|
|
463
421
|
const testStep = testCase.testSteps[0]
|
|
464
422
|
const results = cucumberQuery.getTestStepResults(testStep.id)
|
|
465
423
|
|
|
@@ -505,9 +463,7 @@ describe('Query', () => {
|
|
|
505
463
|
}
|
|
506
464
|
)
|
|
507
465
|
|
|
508
|
-
const attachments = cucumberQuery.getTestStepsAttachments([
|
|
509
|
-
testCases[0].testSteps[0].id,
|
|
510
|
-
])
|
|
466
|
+
const attachments = cucumberQuery.getTestStepsAttachments([testCases[0].testSteps[0].id])
|
|
511
467
|
assert.strictEqual(attachments.length, 1)
|
|
512
468
|
|
|
513
469
|
assert.strictEqual(attachments[0].body, 'Hello')
|
|
@@ -523,12 +479,7 @@ describe('Query', () => {
|
|
|
523
479
|
const clock = new IncrementClock()
|
|
524
480
|
const stopwatch = new IncrementStopwatch()
|
|
525
481
|
const makeErrorMessage = withFullStackTrace()
|
|
526
|
-
const supportCode = new SupportCode(
|
|
527
|
-
newId,
|
|
528
|
-
clock,
|
|
529
|
-
stopwatch,
|
|
530
|
-
makeErrorMessage
|
|
531
|
-
)
|
|
482
|
+
const supportCode = new SupportCode(newId, clock, stopwatch, makeErrorMessage)
|
|
532
483
|
supportCode.defineBeforeHook(null, '@beforeHook', () => {
|
|
533
484
|
// no-op
|
|
534
485
|
})
|
|
@@ -538,23 +489,15 @@ describe('Query', () => {
|
|
|
538
489
|
supportCode.defineStepDefinition(null, 'a passed step', () => {
|
|
539
490
|
// no-op
|
|
540
491
|
})
|
|
541
|
-
supportCode.defineStepDefinition(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
function () {
|
|
545
|
-
this.attach('Hello', 'text/plain')
|
|
546
|
-
}
|
|
547
|
-
)
|
|
492
|
+
supportCode.defineStepDefinition(null, 'a passed step with attachment', function () {
|
|
493
|
+
this.attach('Hello', 'text/plain')
|
|
494
|
+
})
|
|
548
495
|
supportCode.defineStepDefinition(null, 'a failed step', () => {
|
|
549
496
|
throw new Error(`This step failed.`)
|
|
550
497
|
})
|
|
551
|
-
supportCode.defineStepDefinition(
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
(cukes: number) => {
|
|
555
|
-
assert.ok(cukes)
|
|
556
|
-
}
|
|
557
|
-
)
|
|
498
|
+
supportCode.defineStepDefinition(null, 'I have {int} cukes in my {word}', (cukes: number) => {
|
|
499
|
+
assert.ok(cukes)
|
|
500
|
+
})
|
|
558
501
|
|
|
559
502
|
const queryUpdateStream = new Writable({
|
|
560
503
|
objectMode: true,
|
|
@@ -573,10 +516,7 @@ describe('Query', () => {
|
|
|
573
516
|
}
|
|
574
517
|
},
|
|
575
518
|
})
|
|
576
|
-
await pipelinePromise(
|
|
577
|
-
gherkinMessages(gherkinSource, 'test.feature', newId),
|
|
578
|
-
queryUpdateStream
|
|
579
|
-
)
|
|
519
|
+
await pipelinePromise(gherkinMessages(gherkinSource, 'test.feature', newId), queryUpdateStream)
|
|
580
520
|
|
|
581
521
|
const testPlan = makeTestPlan(gherkinQuery, supportCode, makeTestCase)
|
|
582
522
|
await testPlan.execute((envelope: messages.IEnvelope) => {
|
|
@@ -585,11 +525,7 @@ describe('Query', () => {
|
|
|
585
525
|
})
|
|
586
526
|
}
|
|
587
527
|
|
|
588
|
-
function gherkinMessages(
|
|
589
|
-
gherkinSource: string,
|
|
590
|
-
uri: string,
|
|
591
|
-
newId: IdGenerator.NewId
|
|
592
|
-
): Readable {
|
|
528
|
+
function gherkinMessages(gherkinSource: string, uri: string, newId: IdGenerator.NewId): Readable {
|
|
593
529
|
const source = messages.Envelope.fromObject({
|
|
594
530
|
source: {
|
|
595
531
|
uri,
|
|
@@ -603,20 +539,14 @@ describe('Query', () => {
|
|
|
603
539
|
function findScenario(
|
|
604
540
|
envelopes: messages.IEnvelope[]
|
|
605
541
|
): messages.GherkinDocument.Feature.IScenario {
|
|
606
|
-
const gherkinDocument = envelopes.find(
|
|
607
|
-
|
|
608
|
-
).gherkinDocument
|
|
609
|
-
return gherkinDocument.feature.children.find((child) => child.scenario)
|
|
610
|
-
.scenario
|
|
542
|
+
const gherkinDocument = envelopes.find((envelope) => envelope.gherkinDocument).gherkinDocument
|
|
543
|
+
return gherkinDocument.feature.children.find((child) => child.scenario).scenario
|
|
611
544
|
}
|
|
612
545
|
|
|
613
546
|
function findBackground(
|
|
614
547
|
envelopes: messages.IEnvelope[]
|
|
615
548
|
): messages.GherkinDocument.Feature.IBackground {
|
|
616
|
-
const gherkinDocument = envelopes.find(
|
|
617
|
-
|
|
618
|
-
).gherkinDocument
|
|
619
|
-
return gherkinDocument.feature.children.find((child) => child.background)
|
|
620
|
-
.background
|
|
549
|
+
const gherkinDocument = envelopes.find((envelope) => envelope.gherkinDocument).gherkinDocument
|
|
550
|
+
return gherkinDocument.feature.children.find((child) => child.background).background
|
|
621
551
|
}
|
|
622
552
|
})
|
package/tsconfig.json
CHANGED
|
@@ -1,26 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"declaration": true,
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"lib": [
|
|
6
|
-
"es2019",
|
|
7
|
-
"dom"
|
|
8
|
-
],
|
|
9
|
-
"sourceMap": true,
|
|
10
|
-
"allowJs": false,
|
|
11
|
-
"jsx": "react",
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"module": "commonjs",
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"noImplicitAny": true,
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"outDir": "dist",
|
|
18
|
-
"downlevelIteration": true,
|
|
19
|
-
"skipLibCheck": true
|
|
20
|
-
},
|
|
21
|
-
"include": [
|
|
22
|
-
"src/**/*",
|
|
23
|
-
"test/**/*",
|
|
24
|
-
"features/**/*"
|
|
25
|
-
]
|
|
2
|
+
"extends": "../../tsconfig.json"
|
|
26
3
|
}
|
package/.built
DELETED
|
File without changes
|
package/.codegen
DELETED
|
File without changes
|
package/.deps
DELETED
|
File without changes
|
package/.eslintrc.json
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"node": true
|
|
5
|
-
},
|
|
6
|
-
"parser": "@typescript-eslint/parser",
|
|
7
|
-
"parserOptions": {
|
|
8
|
-
"project": "tsconfig.json",
|
|
9
|
-
"sourceType": "module"
|
|
10
|
-
},
|
|
11
|
-
"plugins": [
|
|
12
|
-
"react",
|
|
13
|
-
"node",
|
|
14
|
-
"@typescript-eslint"
|
|
15
|
-
],
|
|
16
|
-
"extends": [
|
|
17
|
-
"eslint:recommended",
|
|
18
|
-
"plugin:react/recommended",
|
|
19
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
20
|
-
"plugin:@typescript-eslint/recommended",
|
|
21
|
-
"plugin:prettier/recommended"
|
|
22
|
-
],
|
|
23
|
-
"rules": {
|
|
24
|
-
"node/no-extraneous-import": "error",
|
|
25
|
-
"@typescript-eslint/ban-ts-ignore": "off",
|
|
26
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
|
27
|
-
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
28
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
29
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
30
|
-
"@typescript-eslint/interface-name-prefix": "off",
|
|
31
|
-
"@typescript-eslint/member-delimiter-style": "off",
|
|
32
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
33
|
-
"react/prop-types": "off"
|
|
34
|
-
},
|
|
35
|
-
"settings": {
|
|
36
|
-
"react": {
|
|
37
|
-
"pragma": "React",
|
|
38
|
-
"version": "detect"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
package/.gitignore
DELETED
package/.idea/aws.xml
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="accountSettings">
|
|
4
|
-
<option name="activeRegion" value="eu-west-3" />
|
|
5
|
-
<option name="recentlyUsedRegions">
|
|
6
|
-
<list>
|
|
7
|
-
<option value="eu-west-3" />
|
|
8
|
-
</list>
|
|
9
|
-
</option>
|
|
10
|
-
</component>
|
|
11
|
-
</project>
|