@cucumber/query 13.1.0 → 13.3.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/.mocharc.json CHANGED
@@ -2,5 +2,6 @@
2
2
  "require": ["ts-node/register", "source-map-support/register"],
3
3
  "extension": ["ts", "tsx"],
4
4
  "recursive": true,
5
+ "spec": ["src/**/*.spec.*"],
5
6
  "timeout": 10000
6
7
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "trailingComma": "es5",
3
+ "semi": false,
4
+ "singleQuote": true,
5
+ "printWidth": 100
6
+ }
@@ -1,6 +1,6 @@
1
1
  import * as messages from '@cucumber/messages';
2
- import { Attachment, Duration, Feature, Hook, Meta, Pickle, PickleStep, Step, TestCase, TestCaseFinished, TestCaseStarted, TestRunFinished, TestRunStarted, TestStep, TestStepFinished, TestStepResult, TestStepResultStatus } from '@cucumber/messages';
3
- import { NamingStrategy } from "./Lineage";
2
+ import { Attachment, Duration, Feature, Hook, Location, Meta, Pickle, PickleStep, Step, TestCase, TestCaseFinished, TestCaseStarted, TestRunFinished, TestRunStarted, TestStep, TestStepFinished, TestStepResult, TestStepResultStatus, TestStepStarted } from '@cucumber/messages';
3
+ import { Lineage, NamingStrategy } from './Lineage';
4
4
  export default class Query {
5
5
  private readonly testStepResultByPickleId;
6
6
  private readonly testStepResultsByPickleStepId;
@@ -15,7 +15,7 @@ export default class Query {
15
15
  private meta;
16
16
  private testRunStarted;
17
17
  private testRunFinished;
18
- private readonly testCaseStarted;
18
+ private readonly testCaseStartedById;
19
19
  private readonly lineageById;
20
20
  private readonly stepById;
21
21
  private readonly pickleById;
@@ -23,6 +23,7 @@ export default class Query {
23
23
  private readonly testCaseById;
24
24
  private readonly testStepById;
25
25
  private readonly testCaseFinishedByTestCaseStartedId;
26
+ private readonly testStepStartedByTestCaseStartedId;
26
27
  private readonly testStepFinishedByTestCaseStartedId;
27
28
  private readonly attachmentsByTestCaseStartedId;
28
29
  update(envelope: messages.Envelope): void;
@@ -34,6 +35,7 @@ export default class Query {
34
35
  private updatePickle;
35
36
  private updateTestCase;
36
37
  private updateTestCaseStarted;
38
+ private updateTestStepStarted;
37
39
  private updateAttachment;
38
40
  private updateTestStepFinished;
39
41
  private updateTestCaseFinished;
@@ -77,18 +79,21 @@ export default class Query {
77
79
  findMeta(): Meta | undefined;
78
80
  findMostSevereTestStepResultBy(testCaseStarted: TestCaseStarted): TestStepResult | undefined;
79
81
  findNameOf(pickle: Pickle, namingStrategy: NamingStrategy): string;
80
- findPickleBy(testCaseStarted: TestCaseStarted): Pickle | undefined;
82
+ findLocationOf(pickle: Pickle): Location | undefined;
83
+ findPickleBy(element: TestCaseStarted | TestStepStarted): Pickle | undefined;
81
84
  findPickleStepBy(testStep: TestStep): PickleStep | undefined;
82
85
  findStepBy(pickleStep: PickleStep): Step | undefined;
83
- findTestCaseBy(testCaseStarted: TestCaseStarted): TestCase | undefined;
86
+ findTestCaseBy(element: TestCaseStarted | TestStepStarted): TestCase | undefined;
84
87
  findTestCaseDurationBy(testCaseStarted: TestCaseStarted): Duration | undefined;
88
+ findTestCaseStartedBy(testStepStarted: TestStepStarted): TestCaseStarted | undefined;
85
89
  findTestCaseFinishedBy(testCaseStarted: TestCaseStarted): TestCaseFinished | undefined;
86
90
  findTestRunDuration(): Duration | undefined;
87
91
  findTestRunFinished(): TestRunFinished | undefined;
88
92
  findTestRunStarted(): TestRunStarted | undefined;
89
- findTestStepBy(testStepFinished: TestStepFinished): TestStep | undefined;
93
+ findTestStepBy(element: TestStepStarted | TestStepFinished): TestStep | undefined;
94
+ findTestStepsStartedBy(testCaseStarted: TestCaseStarted): ReadonlyArray<TestStepStarted>;
90
95
  findTestStepsFinishedBy(testCaseStarted: TestCaseStarted): ReadonlyArray<TestStepFinished>;
91
96
  findTestStepFinishedAndTestStepBy(testCaseStarted: TestCaseStarted): ReadonlyArray<[TestStepFinished, TestStep]>;
92
- private findLineageBy;
97
+ findLineageBy(element: Pickle | TestCaseStar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O,EAAE,eAAe,GAAG,gBAAgB,GAAG,QAAQ,GAAG,SAAS;IAIjF,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,aAAa,CAAC,eAAe,CAAC;IAKxF,uBAAuB,CAC5B,eAAe,EAAE,eAAe,GAC/B,aAAa,CAAC,gBAAgB,CAAC;IAK3B,iCAAiC,CACtC,eAAe,EAAE,eAAe,GAC/B,aAAa,CAAC,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IAUvC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,OAAO,GAAG,SAAS;CAM7E"}
package/dist/src/Query.js CHANGED
@@ -15,17 +15,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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;
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
37
  };
25
38
  Object.defineProperty(exports, "__esModule", { value: true });
26
39
  const messages = __importStar(require("@cucumber/messages"));
27
40
  const messages_1 = require("@cucumber/messages");
28
41
  const multimaps_1 = require("@teppeis/multimaps");
42
+ const lodash_sortby_1 = __importDefault(require("lodash.sortby"));
29
43
  const helpers_1 = require("./helpers");
30
44
  class Query {
31
45
  constructor() {
@@ -39,7 +53,7 @@ class Query {
39
53
  this.hooksById = new Map();
40
54
  this.attachmentsByTestStepId = new multimaps_1.ArrayMultimap();
41
55
  this.stepMatchArgumentsListsByPickleStepId = new Map();
42
- this.testCaseStarted = [];
56
+ this.testCaseStartedById = new Map();
43
57
  this.lineageById = new Map();
44
58
  this.stepById = new Map();
45
59
  this.pickleById = new Map();
@@ -47,6 +61,7 @@ class Query {
47
61
  this.testCaseById = new Map();
48
62
  this.testStepById = new Map();
49
63
  this.testCaseFinishedByTestCaseStartedId = new Map();
64
+ this.testStepStartedByTestCaseStartedId = new multimaps_1.ArrayMultimap();
50
65
  this.testStepFinishedByTestCaseStartedId = new multimaps_1.ArrayMultimap();
51
66
  this.attachmentsByTestCaseStartedId = new multimaps_1.ArrayMultimap();
52
67
  }
@@ -72,6 +87,9 @@ class Query {
72
87
  if (envelope.testCaseStarted) {
73
88
  this.updateTestCaseStarted(envelope.testCaseStarted);
74
89
  }
90
+ if (envelope.testStepStarted) {
91
+ this.updateTestStepStarted(envelope.testStepStarted);
92
+ }
75
93
  if (envelope.attachment) {
76
94
  this.updateAttachment(envelope.attachment);
77
95
  }
@@ -150,20 +168,25 @@ class Query {
150
168
  });
151
169
  }
152
170
  updateTestCaseStarted(testCaseStarted) {
153
- this.testCaseStarted.push(testCaseStarted);
171
+ this.testCaseStartedById.set(testCaseStarted.id, testCaseStarted);
154
172
  /*
155
173
  when a test case attempt starts besides the first one, clear all existing results
156
174
  and attachments for that test case, so we always report on the latest attempt
157
175
  (applies to legacy pickle-oriented query methods only)
158
176
  */
159
177
  const testCase = this.testCaseById.get(testCaseStarted.testCaseId);
160
- this.testStepResultByPickleId.delete(testCase.pickleId);
161
- for (const testStep of testCase.testSteps) {
162
- this.testStepResultsByPickleStepId.delete(testStep.pickleStepId);
163
- this.testStepResultsbyTestStepId.delete(testStep.id);
164
- this.attachmentsByTestStepId.delete(testStep.id);
178
+ if (testCase) {
179
+ this.testStepResultByPickleId.delete(testCase.pickleId);
180
+ for (const testStep of testCase.testSteps) {
181
+ this.testStepResultsByPickleStepId.delete(testStep.pickleStepId);
182
+ this.testStepResultsbyTestStepId.delete(testStep.id);
183
+ this.attachmentsByTestStepId.delete(testStep.id);
184
+ }
165
185
  }
166
186
  }
187
+ updateTestStepStarted(testStepStarted) {
188
+ this.testStepStartedByTestCaseStartedId.put(testStepStarted.testCaseStartedId, testStepStarted);
189
+ }
167
190
  updateAttachment(attachment) {
168
191
  if (attachment.testStepId) {
169
192
  this.attachmentsByTestStepId.put(attachment.testStepId, attachment);
@@ -259,7 +282,12 @@ class Query {
259
282
  let pickleStepFound = false;
260
283
  for (const step of testCase.testSteps) {
261
284
  if (step.hookId) {
262
- pickleStepFound ? onAfterHookFound(step) : onBeforeHookFound(step);
285
+ if (pickleStepFound) {
286
+ onAfterHookFound(step);
287
+ }
288
+ else {
289
+ onBeforeHookFound(step);
290
+ }
263
291
  }
264
292
  else {
265
293
  pickleStepFound = true;
@@ -290,10 +318,7 @@ class Query {
290
318
  [messages_1.TestStepResultStatus.UNKNOWN]: 0,
291
319
  };
292
320
  for (const testCaseStarted of this.findAllTestCaseStarted()) {
293
- const mostSevereResult = this.findTestStepFinishedAndTestStepBy(testCaseStarted)
294
- .map(([testStepFinished]) => testStepFinished.testStepResult)
295
- .sort(helpers_1.comparatorByStatus)
296
- .at(-1);
321
+ const mostSevereResult = (0, lodash_sortby_1.default)(this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(([testStepFinished]) => testStepFinished.testStepResult), [(testStepResult) => (0, helpers_1.statusOrdinal)(testStepResult.status)]).at(-1);
297
322
  if (mostSevereResult) {
298
323
  result[mostSevereResult.status]++;
299
324
  }
@@ -305,37 +330,38 @@ class Query {
305
330
  }
306
331
  findAllPickles() {
307
332
  const pickles = [...this.pickleById.values()];
308
- return pickles.sort(helpers_1.comparatorById);
333
+ return (0, lodash_sortby_1.default)(pickles, ['id']);
309
334
  }
310
335
  findAllPickleSteps() {
311
336
  const pickleSteps = [...this.pickleStepById.values()];
312
- return pickleSteps.sort(helpers_1.comparatorById);
337
+ return (0, lodash_sortby_1.default)(pickleSteps, ['id']);
313
338
  }
314
339
  findAllTestCaseStarted() {
315
- return this.testCaseStarted.filter((testCaseStarted) => {
340
+ return (0, lodash_sortby_1.default)([...this.testCaseStartedById.values()].filter((testCaseStarted) => {
316
341
  const testCaseFinished = this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id);
317
342
  // only include if not yet finished OR won't be retried
318
343
  return !(testCaseFinished === null || testCaseFinished === void 0 ? void 0 : testCaseFinished.willBeRetried);
319
- });
344
+ }), [
345
+ (testCaseStarted) => messages_1.TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp),
346
+ 'id',
347
+ ]);
320
348
  }
321
349
  findAllTestCaseStartedGroupedByFeature() {
322
350
  const results = new Map();
323
- this.findAllTestCaseStarted()
324
- .map(testCaseStarted => [this.findLineageBy(testCaseStarted), testCaseStarted])
325
- .sort(([a], [b]) => (0, helpers_1.comparatorBy)(a.gherkinDocument, b.gherkinDocument, "uri"))
326
- .forEach(([{ feature }, testCaseStarted]) => {
351
+ (0, lodash_sortby_1.default)(this.findAllTestCaseStarted().map((testCaseStarted) => [this.findLineageBy(testCaseStarted), testCaseStarted]), [([lineage]) => lineage.gherkinDocument.uri]).forEach(([{ feature }, testCaseStarted]) => {
327
352
  var _a;
328
- results.set(feature, [...(_a = results.get(feature)) !== null && _a !== void 0 ? _a : [], testCaseStarted]);
353
+ results.set(feature, [...((_a = results.get(feature)) !== null && _a !== void 0 ? _a : []), testCaseStarted]);
329
354
  });
330
355
  return results;
331
356
  }
332
357
  findAllTestSteps() {
333
358
  const testSteps = [...this.testStepById.values()];
334
- return testSteps.sort(helpers_1.comparatorById);
359
+ return (0, lodash_sortby_1.default)(testSteps, ['id']);
335
360
  }
336
361
  findAttachmentsBy(testStepFinished) {
337
- return this.attachmentsByTestCaseStartedId.get(testStepFinished.testCaseStartedId)
338
- .filter(attachment => attachment.testStepId === testStepFinished.testStepId);
362
+ return this.attachmentsByTestCaseStartedId
363
+ .get(testStepFinished.testCaseStartedId)
364
+ .filter((attachment) => attachment.testStepId === testStepFinished.testStepId);
339
365
  }
340
366
  findFeatureBy(testCaseStarted) {
341
367
  var _a;
@@ -351,17 +377,22 @@ class Query {
351
377
  return this.meta;
352
378
  }
353
379
  findMostSevereTestStepResultBy(testCaseStarted) {
354
- return this.findTestStepFinishedAndTestStepBy(testCaseStarted)
355
- .map(([testStepFinished]) => testStepFinished.testStepResult)
356
- .sort(helpers_1.comparatorByStatus)
357
- .at(-1);
380
+ return (0, lodash_sortby_1.default)(this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(([testStepFinished]) => testStepFinished.testStepResult), [(testStepResult) => (0, helpers_1.statusOrdinal)(testStepResult.status)]).at(-1);
358
381
  }
359
382
  findNameOf(pickle, namingStrategy) {
360
383
  const lineage = this.findLineageBy(pickle);
361
384
  return lineage ? namingStrategy.reduce(lineage, pickle) : pickle.name;
362
385
  }
363
- findPickleBy(testCaseStarted) {
364
- const testCase = this.findTestCaseBy(testCaseStarted);
386
+ findLocationOf(pickle) {
387
+ var _a;
388
+ const lineage = this.findLineageBy(pickle);
389
+ if (lineage === null || lineage === void 0 ? void 0 : lineage.example) {
390
+ return lineage.example.location;
391
+ }
392
+ return (_a = lineage === null || lineage === void 0 ? void 0 : lineage.scenario) === null || _a === void 0 ? void 0 : _a.location;
393
+ }
394
+ findPickleBy(element) {
395
+ const testCase = this.findTestCaseBy(element);
365
396
  helpers_1.assert.ok(testCase, 'Expected to find TestCase from TestCaseStarted');
366
397
  return this.pickleById.get(testCase.pickleId);
367
398
  }
@@ -376,7 +407,9 @@ class Query {
376
407
  helpers_1.assert.ok(astNodeId, 'Expected PickleStep to have an astNodeId');
377
408
  return this.stepById.get(astNodeId);
378
409
  }
379
- findTestCaseBy(testCaseStarted) {
410
+ findTestCaseBy(element) {
411
+ const testCaseStarted = 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element;
412
+ helpers_1.assert.ok(testCaseStarted, 'Expected to find TestCaseStarted by TestStepStarted');
380
413
  return this.testCaseById.get(testCaseStarted.testCaseId);
381
414
  }
382
415
  findTestCaseDurationBy(testCaseStarted) {
@@ -387,6 +420,9 @@ class Query {
387
420
  return messages_1.TimeConversion.millisecondsToDuration(messages_1.TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp) -
388
421
  messages_1.TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp));
389
422
  }
423
+ findTestCaseStartedBy(testStepStarted) {
424
+ return this.testCaseStartedById.get(testStepStarted.testCaseStartedId);
425
+ }
390
426
  findTestCaseFinishedBy(testCaseStarted) {
391
427
  return this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id);
392
428
  }
@@ -403,8 +439,12 @@ class Query {
403
439
  findTestRunStarted() {
404
440
  return this.testRunStarted;
405
441
  }
406
- findTestStepBy(testStepFinished) {
407
- return this.testStepById.get(testStepFinished.testStepId);
442
+ findTestStepBy(element) {
443
+ return this.testStepById.get(element.testStepId);
444
+ }
445
+ findTestStepsStartedBy(testCaseStarted) {
446
+ // multimaps `get` implements `getOrDefault([])` behaviour internally
447
+ return [...this.testStepStartedByTestCaseStartedId.get(testCaseStarted.id)];
408
448
  }
409
449
  findTestStepsFinishedBy(testCaseStarted) {
410
450
  // multimaps `get` implements `getOrDefault([])` behaviour internally
@@ -420,7 +460,7 @@ class Query {
420
460
  });
421
461
  }
422
462
  findLineageBy(element) {
423
- const pickle = "testCaseId" in element ? this.findPickleBy(element) : element;
463
+ const pickle = 'testCaseId' in element ? this.findPickleBy(element) : element;
424
464
  const deepestAstNodeId = pickle.astNodeIds.at(-1);
425
465
  helpers_1.assert.ok(deepestAstNodeId, 'Expected Pickle to have at least one astNodeId');
426
466
  return this.lineageById.get(deepestAstNodeId);
@@ -1 +1 @@
1
- {"version":3,"file":"Query.js","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,iDAuB2B;AAC3B,kDAAgD;AAEhD,uCAAoF;AAEpF,MAAqB,KAAK;IAA1B;QACmB,6BAAwB,GAAG,IAAI,yBAAa,EAAmC,CAAA;QAC/E,kCAA6B,GAAG,IAAI,yBAAa,EAG/D,CAAA;QACc,uBAAkB,GAAG,IAAI,GAAG,EAA6B,CAAA;QACzD,yBAAoB,GAAG,IAAI,GAAG,EAAkB,CAAA;QAChD,6BAAwB,GAAG,IAAI,GAAG,EAAkB,CAAA;QACpD,gCAA2B,GAAG,IAAI,yBAAa,EAG7D,CAAA;QACc,8BAAyB,GAAG,IAAI,yBAAa,EAAkB,CAAA;QAC/D,cAAS,GAAG,IAAI,GAAG,EAAyB,CAAA;QAC5C,4BAAuB,GAAG,IAAI,yBAAa,EAA+B,CAAA;QAC1E,0CAAqC,GAAG,IAAI,GAAG,EAG7D,CAAA;QAKc,oBAAe,GAA2B,EAAE,CAAA;QAC5C,gBAAW,GAAyB,IAAI,GAAG,EAAE,CAAA;QAC7C,aAAQ,GAAsB,IAAI,GAAG,EAAE,CAAA;QACvC,eAAU,GAAwB,IAAI,GAAG,EAAE,CAAA;QAC3C,mBAAc,GAA4B,IAAI,GAAG,EAAE,CAAA;QACnD,iBAAY,GAA0B,IAAI,GAAG,EAAE,CAAA;QAC/C,iBAAY,GAA0B,IAAI,GAAG,EAAE,CAAA;QAC/C,wCAAmC,GAAkC,IAAI,GAAG,EAAE,CAAA;QAC9E,wCAAmC,GAChD,IAAI,yBAAa,EAAE,CAAA;QACN,mCAA8B,GAC3C,IAAI,yBAAa,EAAE,CAAA;IA2ezB,CAAC;IAzeQ,MAAM,CAAC,QAA2B;QACvC,IAAI,QAAQ,CAAC,IAAI,EAAE,C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CAAC,eAAgC;QAC7D,qEAAqE;QACrE,OAAO,CAAC,GAAG,IAAI,CAAC,mCAAmC,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;IAC9E,CAAC;IAEM,iCAAiC,CACpC,eAAgC;QAElC,OAAO,IAAI,CAAC,mCAAmC;aAC1C,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;aACvB,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE;YACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAA;YACtD,gBAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,+CAA+C,CAAC,CAAA;YACpE,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACR,CAAC;IAEO,aAAa,CAAC,OAAiC;QACrD,MAAM,MAAM,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAC7E,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACjD,gBAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,gDAAgD,CAAC,CAAA;QAC7E,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC/C,CAAC;CACF;AA9gBD,wBA8gBC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport {\n Attachment,\n Duration,\n Feature,\n getWorstTestStepResult,\n GherkinDocument,\n Hook,\n Meta,\n Pickle,\n PickleStep,\n Rule,\n Scenario,\n Step,\n TestCase,\n TestCaseFinished,\n TestCaseStarted,\n TestRunFinished,\n TestRunStarted,\n TestStep,\n TestStepFinished,\n TestStepResult,\n TestStepResultStatus,\n TimeConversion,\n} from '@cucumber/messages'\nimport {ArrayMultimap} from '@teppeis/multimaps'\nimport {Lineage, NamingStrategy} from \"./Lineage\";\nimport { comparatorBy, comparatorById, comparatorByStatus, assert } from './helpers'\n\nexport default class Query {\n private readonly testStepResultByPickleId = new ArrayMultimap<string, messages.TestStepResult>()\n private readonly testStepResultsByPickleStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testCaseByPickleId = new Map<string, messages.TestCase>()\n private readonly pickleIdByTestStepId = new Map<string, string>()\n private readonly pickleStepIdByTestStepId = new Map<string, string>()\n private readonly testStepResultsbyTestStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testStepIdsByPickleStepId = new ArrayMultimap<string, string>()\n private readonly hooksById = new Map<string, messages.Hook>()\n private readonly attachmentsByTestStepId = new ArrayMultimap<string, messages.Attachment>()\n private readonly stepMatchArgumentsListsByPickleStepId = new Map<\n string,\n readonly messages.StepMatchArgumentsList[]\n >()\n\n private meta: Meta\n private testRunStarted: TestRunStarted\n private testRunFinished: TestRunFinished\n private readonly testCaseStarted: Array<TestCaseStarted> = []\n private readonly lineageById: Map<string, Lineage> = new Map()\n private readonly stepById: Map<string, Step> = new Map()\n private readonly pickleById: Map<string, Pickle> = new Map()\n private readonly pickleStepById: Map<string, PickleStep> = new Map()\n private readonly testCaseById: Map<string, TestCase> = new Map()\n private readonly testStepById: Map<string, TestStep> = new Map()\n private readonly testCaseFinishedByTestCaseStartedId: Map<string, TestCaseFinished> = new Map()\n private readonly testStepFinishedByTestCaseStartedId: ArrayMultimap<string, TestStepFinished> =\n new ArrayMultimap()\n private readonly attachmentsByTestCaseStartedId: ArrayMultimap<string, Attachment> =\n new ArrayMultimap()\n\n public update(envelope: messages.Envelope) {\n if (envelope.meta) {\n this.meta = envelope.meta\n }\n if (envelope.gherkinDocument) {\n this.updateGherkinDocument(envelope.gherkinDocument)\n }\n if (envelope.pickle) {\n this.updatePickle(envelope.pickle)\n }\n if (envelope.hook) {\n this.hooksById.set(envelope.hook.id, envelope.hook)\n }\n if (envelope.testRunStarted) {\n this.testRunStarted = envelope.testRunStarted\n }\n if (envelope.testCase) {\n this.updateTestCase(envelope.testCase)\n }\n if (envelope.testCaseStarted) {\n this.updateTestCaseStarted(envelope.testCaseStarted)\n }\n if (envelope.attachment) {\n this.updateAttachment(envelope.attachment)\n }\n if (envelope.testStepFinished) {\n this.updateTestStepFinished(envelope.testStepFinished)\n }\n if (envelope.testCaseFinished) {\n this.updateTestCaseFinished(envelope.testCaseFinished)\n }\n if (envelope.testRunFinished) {\n this.testRunFinished = envelope.testRunFinished\n }\n }\n\n private updateGherkinDocument(gherkinDocument: GherkinDocument) {\n if (gherkinDocument.feature) {\n this.updateFeature(gherkinDocument.feature, {\n gherkinDocument,\n })\n }\n }\n\n private updateFeature(feature: Feature, lineage: Lineage) {\n feature.children.forEach((featureChild) => {\n if (featureChild.background) {\n this.updateSteps(featureChild.background.steps)\n }\n if (featureChild.scenario) {\n this.updateScenario(featureChild.scenario, {\n ...lineage,\n feature,\n })\n }\n if (featureChild.rule) {\n this.updateRule(featureChild.rule, {\n ...lineage,\n feature,\n })\n }\n })\n }\n\n private updateRule(rule: Rule, lineage: Lineage) {\n rule.children.forEach((ruleChild) => {\n if (ruleChild.background) {\n this.updateSteps(ruleChild.background.steps)\n }\n if (ruleChild.scenario) {\n this.updateScenario(ruleChild.scenario, {\n ...lineage,\n rule,\n })\n }\n })\n }\n\n private updateScenario(scenario: Scenario, lineage: Lineage) {\n this.lineageById.set(scenario.id, {\n ...lineage,\n scenario,\n })\n scenario.examples.forEach((examples, examplesIndex) => {\n this.lineageById.set(examples.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n })\n examples.tableBody.forEach((example, exampleIndex) => {\n this.lineageById.set(example.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n example,\n exampleIndex,\n })\n })\n })\n this.updateSteps(scenario.steps)\n }\n\n private updateSteps(steps: ReadonlyArray<Step>) {\n steps.forEach((step) => this.stepById.set(step.id, step))\n }\n\n private updatePickle(pickle: Pickle) {\n this.pickleById.set(pickle.id, pickle)\n pickle.steps.forEach((pickleStep) => this.pickleStepById.set(pickleStep.id, pickleStep))\n }\n\n private updateTestCase(testCase: TestCase) {\n this.testCaseById.set(testCase.id, testCase)\n\n this.testCaseByPickleId.set(testCase.pickleId, testCase)\n testCase.testSteps.forEach((testStep) => {\n this.testStepById.set(testStep.id, testStep)\n this.pickleIdByTestStepId.set(testStep.id, testCase.pickleId)\n this.pickleStepIdByTestStepId.set(testStep.id, testStep.pickleStepId)\n this.testStepIdsByPickleStepId.put(testStep.pickleStepId, testStep.id)\n this.stepMatchArgumentsListsByPickleStepId.set(\n testStep.pickleStepId,\n testStep.stepMatchArgumentsLists\n )\n })\n }\n\n private updateTestCaseStarted(testCaseStarted: TestCaseStarted) {\n this.testCaseStarted.push(testCaseStarted)\n\n /*\n when a test case attempt starts besides the first one, clear all existing results\n and attachments for that test case, so we always report on the latest attempt\n (applies to legacy pickle-oriented query methods only)\n */\n const testCase = this.testCaseById.get(testCaseStarted.testCaseId)\n this.testStepResultByPickleId.delete(testCase.pickleId)\n for (const testStep of testCase.testSteps) {\n this.testStepResultsByPickleStepId.delete(testStep.pickleStepId)\n this.testStepResultsbyTestStepId.delete(testStep.id)\n this.attachmentsByTestStepId.delete(testStep.id)\n }\n }\n\n private updateAttachment(attachment: Attachment) {\n if (attachment.testStepId) {\n this.attachmentsByTestStepId.put(attachment.testStepId, attachment)\n }\n if (attachment.testCaseStartedId) {\n this.attachmentsByTestCaseStartedId.put(attachment.testCaseStartedId, attachment)\n }\n }\n\n private updateTestStepFinished(testStepFinished: TestStepFinished) {\n this.testStepFinishedByTestCaseStartedId.put(\n testStepFinished.testCaseStartedId,\n testStepFinished\n )\n\n const pickleId = this.pickleIdByTestStepId.get(testStepFinished.testStepId)\n this.testStepResultByPickleId.put(pickleId, testStepFinished.testStepResult)\n const testStep = this.testStepById.get(testStepFinished.testStepId)\n this.testStepResultsByPickleStepId.put(\n testStep.pickleStepId,\n testStepFinished.testStepResult\n )\n this.testStepResultsbyTestStepId.put(testStep.id, testStepFinished.testStepResult)\n }\n\n private updateTestCaseFinished(testCaseFinished: TestCaseFinished) {\n this.testCaseFinishedByTestCaseStartedId.set(\n testCaseFinished.testCaseStartedId,\n testCaseFinished\n )\n }\n\n /**\n * Gets all the results for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepTestStepResults(\n pickleStepIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleStepIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleStepIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultsByPickleStepId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the results for multiple pickles\n * @param pickleIds\n */\n public getPickleTestStepResults(\n pickleIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultByPickleId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the attachments for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepAttachments(\n pickleStepIds: readonly string[]\n ): readonly messages.Attachment[] {\n return this.getTestStepsAttachments(\n pickleStepIds.reduce((testStepIds: string[], pickleStepId: string) => {\n return testStepIds.concat(this.testStepIdsByPickleStepId.get(pickleStepId))\n }, [])\n )\n }\n\n public getTestStepsAttachments(testStepIds: readonly string[]): readonly messages.Attachment[] {\n return testStepIds.reduce((attachments: messages.Attachment[], testStepId) => {\n return attachments.concat(this.attachmentsByTestStepId.get(testStepId))\n }, [])\n }\n\n /**\n * Get StepMatchArguments for a pickle step\n * @param pickleStepId\n */\n public getStepMatchArgumentsLists(\n pickleStepId: string\n ): readonly messages.StepMatchArgumentsList[] | undefined {\n return this.stepMatchArgumentsListsByPickleStepId.get(pickleStepId)\n }\n\n public getHook(hookId: string): messages.Hook {\n return this.hooksById.get(hookId)\n }\n\n public getBeforeHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n (hook) => hookSteps.push(hook),\n () => null\n )\n return hookSteps\n }\n\n public getAfterHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n () => null,\n (hook) => hookSteps.push(hook)\n )\n return hookSteps\n }\n\n private identifyHookSteps(\n pickleId: string,\n onBeforeHookFound: (hook: messages.TestStep) => void,\n onAfterHookFound: (hook: messages.TestStep) => void\n ): void {\n const testCase = this.testCaseByPickleId.get(pickleId)\n\n if (!testCase) {\n return\n }\n\n let pickleStepFound = false\n\n for (const step of testCase.testSteps) {\n if (step.hookId) {\n pickleStepFound ? onAfterHookFound(step) : onBeforeHookFound(step)\n } else {\n pickleStepFound = true\n }\n }\n }\n\n public getTestStepResults(testStepId: string): messages.TestStepResult[] {\n return this.testStepResultsbyTestStepId.get(testStepId)\n }\n\n public getStatusCounts(\n pickleIds: readonly string[]\n ): Partial<Record<messages.TestStepResultStatus, number>> {\n const result: Partial<Record<messages.TestStepResultStatus, number>> = {}\n for (const pickleId of pickleIds) {\n const testStepResult = getWorstTestStepResult(this.getPickleTestStepResults([pickleId]))\n const count = result[testStepResult.status] || 0\n result[testStepResult.status] = count + 1\n }\n return result\n }\n\n /* new common interface with Java starts here */\n\n public countMostSevereTestStepResultStatus(): Record<TestStepResultStatus, number> {\n const result: Record<TestStepResultStatus, number> = {\n [TestStepResultStatus.AMBIGUOUS]: 0,\n [TestStepResultStatus.FAILED]: 0,\n [TestStepResultStatus.PASSED]: 0,\n [TestStepResultStatus.PENDING]: 0,\n [TestStepResultStatus.SKIPPED]: 0,\n [TestStepResultStatus.UNDEFINED]: 0,\n [TestStepResultStatus.UNKNOWN]: 0,\n }\n for (const testCaseStarted of this.findAllTestCaseStarted()) {\n const mostSevereResult = this.findTestStepFinishedAndTestStepBy(testCaseStarted)\n .map(([testStepFinished]) => testStepFinished.testStepResult)\n .sort(comparatorByStatus)\n .at(-1)\n if (mostSevereResult) {\n result[mostSevereResult.status]++\n }\n }\n return result\n }\n\n public countTestCasesStarted(): number {\n return this.findAllTestCaseStarted().length\n }\n\n public findAllPickles(): ReadonlyArray<Pickle> {\n const pickles = [...this.pickleById.values()]\n return pickles.sort(comparatorById)\n }\n\n public findAllPickleSteps(): ReadonlyArray<PickleStep> {\n const pickleSteps = [...this.pickleStepById.values()]\n return pickleSteps.sort(comparatorById)\n }\n\n public findAllTestCaseStarted(): ReadonlyArray<TestCaseStarted> {\n return this.testCaseStarted.filter((testCaseStarted) => {\n const testCaseFinished = this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n // only include if not yet finished OR won't be retried\n return !testCaseFinished?.willBeRetried\n })\n }\n\n public findAllTestCaseStartedGroupedByFeature(): Map<Feature | undefined, ReadonlyArray<TestCaseStarted>> {\n const results = new Map();\n this.findAllTestCaseStarted()\n .map(testCaseStarted => ([this.findLineageBy(testCaseStarted), testCaseStarted] as const))\n .sort(([a], [b]) => comparatorBy(a.gherkinDocument, b.gherkinDocument, \"uri\"))\n .forEach(([{feature}, testCaseStarted]) => {\n results.set(feature, [...results.get(feature) ?? [], testCaseStarted])\n })\n return results\n }\n\n public findAllTestSteps(): ReadonlyArray<TestStep> {\n const testSteps = [...this.testStepById.values()]\n return testSteps.sort(comparatorById)\n }\n\n public findAttachmentsBy(testStepFinished: TestStepFinished): ReadonlyArray<Attachment> {\n return this.attachmentsByTestCaseStartedId.get(testStepFinished.testCaseStartedId)\n .filter(attachment => attachment.testStepId === testStepFinished.testStepId)\n }\n\n public findFeatureBy(testCaseStarted: TestCaseStarted): Feature | undefined {\n return this.findLineageBy(testCaseStarted)?.feature\n }\n\n public findHookBy(testStep: TestStep): Hook | undefined {\n if (!testStep.hookId){\n return undefined\n }\n return this.hooksById.get(testStep.hookId)\n }\n\n public findMeta(): Meta | undefined {\n return this.meta;\n }\n\n public findMostSevereTestStepResultBy(testCaseStarted: TestCaseStarted): TestStepResult | undefined {\n return this.findTestStepFinishedAndTestStepBy(testCaseStarted)\n .map(([testStepFinished]) => testStepFinished.testStepResult)\n .sort(comparatorByStatus)\n .at(-1)\n }\n\n public findNameOf(pickle: Pickle, namingStrategy: NamingStrategy): string {\n const lineage = this.findLineageBy(pickle)\n return lineage ? namingStrategy.reduce(lineage, pickle) : pickle.name\n }\n\n public findPickleBy(testCaseStarted: TestCaseStarted): Pickle | undefined {\n const testCase = this.findTestCaseBy(testCaseStarted)\n assert.ok(testCase, 'Expected to find TestCase from TestCaseStarted')\n return this.pickleById.get(testCase.pickleId)\n }\n\n public findPickleStepBy(testStep: TestStep): PickleStep | undefined {\n if (!testStep.pickleStepId){\n return undefined\n }\n return this.pickleStepById.get(testStep.pickleStepId)\n }\n\n public findStepBy(pickleStep: PickleStep): Step | undefined {\n const [astNodeId] = pickleStep.astNodeIds\n assert.ok(astNodeId, 'Expected PickleStep to have an astNodeId')\n return this.stepById.get(astNodeId)\n }\n\n public findTestCaseBy(testCaseStarted: TestCaseStarted): TestCase | undefined {\n return this.testCaseById.get(testCaseStarted.testCaseId)\n }\n\n public findTestCaseDurationBy(testCaseStarted: TestCaseStarted): Duration | undefined {\n const testCaseFinished = this.findTestCaseFinishedBy(testCaseStarted)\n if (!testCaseFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp)\n )\n }\n\n public findTestCaseFinishedBy(testCaseStarted: TestCaseStarted): TestCaseFinished | undefined {\n return this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n }\n\n public findTestRunDuration(): Duration | undefined {\n if (!this.testRunStarted || !this.testRunFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunStarted.timestamp)\n )\n }\n\n public findTestRunFinished(): TestRunFinished | undefined {\n return this.testRunFinished\n }\n\n public findTestRunStarted(): TestRunStarted | undefined {\n return this.testRunStarted\n }\n\n public findTestStepBy(testStepFinished: TestStepFinished): TestStep | undefined {\n return this.testStepById.get(testStepFinished.testStepId)\n }\n\n public findTestStepsFinishedBy(testCaseStarted: TestCaseStarted): ReadonlyArray<TestStepFinished> {\n // multimaps `get` implements `getOrDefault([])` behaviour internally\n return [...this.testStepFinishedByTestCaseStartedId.get(testCaseStarted.id)]\n }\n\n public findTestStepFinishedAndTestStepBy(\n testCaseStarted: TestCaseStarted\n ): ReadonlyArray<[TestStepFinished, TestStep]> {\n return this.testStepFinishedByTestCaseStartedId\n .get(testCaseStarted.id)\n .map((testStepFinished) => {\n const testStep = this.findTestStepBy(testStepFinished)\n assert.ok(testStep, 'Expected to find TestStep by TestStepFinished')\n return [testStepFinished, testStep]\n })\n }\n\n private findLineageBy(element: Pickle | TestCaseStarted) {\n const pickle = \"testCaseId\" in element ? this.findPickleBy(element) : element\n const deepestAstNodeId = pickle.astNodeIds.at(-1)\n assert.ok(deepestAstNodeId, 'Expected Pickle to have at least one astNodeId')\n return this.lineageById.get(deepestAstNodeId)\n }\n}\n"]}
1
+ {"version":3,"file":"Query.js","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,iDAyB2B;AAC3B,kDAAkD;AAClD,kEAAkC;AAElC,uCAAiD;AAGjD,MAAqB,KAAK;IAA1B;QACmB,6BAAwB,GAAG,IAAI,yBAAa,EAAmC,CAAA;QAC/E,kCAA6B,GAAG,IAAI,yBAAa,EAG/D,CAAA;QACc,uBAAkB,GAA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QAEhC,qEAAqE;QACrE,OAAO,CAAC,GAAG,IAAI,CAAC,mCAAmC,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;IAC9E,CAAC;IAEM,iCAAiC,CACtC,eAAgC;QAEhC,OAAO,IAAI,CAAC,mCAAmC;aAC5C,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC;aACvB,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE;YACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAA;YACtD,gBAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,+CAA+C,CAAC,CAAA;YACpE,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;IACN,CAAC;IAEM,aAAa,CAAC,OAAiC;QACpD,MAAM,MAAM,GAAG,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAC7E,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;QACjD,gBAAM,CAAC,EAAE,CAAC,gBAAgB,EAAE,gDAAgD,CAAC,CAAA;QAC7E,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC/C,CAAC;CACF;AAnkBD,wBAmkBC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport {\n Attachment,\n Duration,\n Feature,\n getWorstTestStepResult,\n GherkinDocument,\n Hook,\n Location,\n Meta,\n Pickle,\n PickleStep,\n Rule,\n Scenario,\n Step,\n TestCase,\n TestCaseFinished,\n TestCaseStarted,\n TestRunFinished,\n TestRunStarted,\n TestStep,\n TestStepFinished,\n TestStepResult,\n TestStepResultStatus,\n TestStepStarted,\n TimeConversion,\n} from '@cucumber/messages'\nimport { ArrayMultimap } from '@teppeis/multimaps'\nimport sortBy from 'lodash.sortby'\n\nimport { assert, statusOrdinal } from './helpers'\nimport { Lineage, NamingStrategy } from './Lineage'\n\nexport default class Query {\n private readonly testStepResultByPickleId = new ArrayMultimap<string, messages.TestStepResult>()\n private readonly testStepResultsByPickleStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testCaseByPickleId = new Map<string, messages.TestCase>()\n private readonly pickleIdByTestStepId = new Map<string, string>()\n private readonly pickleStepIdByTestStepId = new Map<string, string>()\n private readonly testStepResultsbyTestStepId = new ArrayMultimap<\n string,\n messages.TestStepResult\n >()\n private readonly testStepIdsByPickleStepId = new ArrayMultimap<string, string>()\n private readonly hooksById = new Map<string, messages.Hook>()\n private readonly attachmentsByTestStepId = new ArrayMultimap<string, messages.Attachment>()\n private readonly stepMatchArgumentsListsByPickleStepId = new Map<\n string,\n readonly messages.StepMatchArgumentsList[]\n >()\n\n private meta: Meta\n private testRunStarted: TestRunStarted\n private testRunFinished: TestRunFinished\n private readonly testCaseStartedById: Map<string, TestCaseStarted> = new Map()\n private readonly lineageById: Map<string, Lineage> = new Map()\n private readonly stepById: Map<string, Step> = new Map()\n private readonly pickleById: Map<string, Pickle> = new Map()\n private readonly pickleStepById: Map<string, PickleStep> = new Map()\n private readonly testCaseById: Map<string, TestCase> = new Map()\n private readonly testStepById: Map<string, TestStep> = new Map()\n private readonly testCaseFinishedByTestCaseStartedId: Map<string, TestCaseFinished> = new Map()\n private readonly testStepStartedByTestCaseStartedId: ArrayMultimap<string, TestStepStarted> =\n new ArrayMultimap()\n private readonly testStepFinishedByTestCaseStartedId: ArrayMultimap<string, TestStepFinished> =\n new ArrayMultimap()\n private readonly attachmentsByTestCaseStartedId: ArrayMultimap<string, Attachment> =\n new ArrayMultimap()\n\n public update(envelope: messages.Envelope) {\n if (envelope.meta) {\n this.meta = envelope.meta\n }\n if (envelope.gherkinDocument) {\n this.updateGherkinDocument(envelope.gherkinDocument)\n }\n if (envelope.pickle) {\n this.updatePickle(envelope.pickle)\n }\n if (envelope.hook) {\n this.hooksById.set(envelope.hook.id, envelope.hook)\n }\n if (envelope.testRunStarted) {\n this.testRunStarted = envelope.testRunStarted\n }\n if (envelope.testCase) {\n this.updateTestCase(envelope.testCase)\n }\n if (envelope.testCaseStarted) {\n this.updateTestCaseStarted(envelope.testCaseStarted)\n }\n if (envelope.testStepStarted) {\n this.updateTestStepStarted(envelope.testStepStarted)\n }\n if (envelope.attachment) {\n this.updateAttachment(envelope.attachment)\n }\n if (envelope.testStepFinished) {\n this.updateTestStepFinished(envelope.testStepFinished)\n }\n if (envelope.testCaseFinished) {\n this.updateTestCaseFinished(envelope.testCaseFinished)\n }\n if (envelope.testRunFinished) {\n this.testRunFinished = envelope.testRunFinished\n }\n }\n\n private updateGherkinDocument(gherkinDocument: GherkinDocument) {\n if (gherkinDocument.feature) {\n this.updateFeature(gherkinDocument.feature, {\n gherkinDocument,\n })\n }\n }\n\n private updateFeature(feature: Feature, lineage: Lineage) {\n feature.children.forEach((featureChild) => {\n if (featureChild.background) {\n this.updateSteps(featureChild.background.steps)\n }\n if (featureChild.scenario) {\n this.updateScenario(featureChild.scenario, {\n ...lineage,\n feature,\n })\n }\n if (featureChild.rule) {\n this.updateRule(featureChild.rule, {\n ...lineage,\n feature,\n })\n }\n })\n }\n\n private updateRule(rule: Rule, lineage: Lineage) {\n rule.children.forEach((ruleChild) => {\n if (ruleChild.background) {\n this.updateSteps(ruleChild.background.steps)\n }\n if (ruleChild.scenario) {\n this.updateScenario(ruleChild.scenario, {\n ...lineage,\n rule,\n })\n }\n })\n }\n\n private updateScenario(scenario: Scenario, lineage: Lineage) {\n this.lineageById.set(scenario.id, {\n ...lineage,\n scenario,\n })\n scenario.examples.forEach((examples, examplesIndex) => {\n this.lineageById.set(examples.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n })\n examples.tableBody.forEach((example, exampleIndex) => {\n this.lineageById.set(example.id, {\n ...lineage,\n scenario,\n examples,\n examplesIndex,\n example,\n exampleIndex,\n })\n })\n })\n this.updateSteps(scenario.steps)\n }\n\n private updateSteps(steps: ReadonlyArray<Step>) {\n steps.forEach((step) => this.stepById.set(step.id, step))\n }\n\n private updatePickle(pickle: Pickle) {\n this.pickleById.set(pickle.id, pickle)\n pickle.steps.forEach((pickleStep) => this.pickleStepById.set(pickleStep.id, pickleStep))\n }\n\n private updateTestCase(testCase: TestCase) {\n this.testCaseById.set(testCase.id, testCase)\n\n this.testCaseByPickleId.set(testCase.pickleId, testCase)\n testCase.testSteps.forEach((testStep) => {\n this.testStepById.set(testStep.id, testStep)\n this.pickleIdByTestStepId.set(testStep.id, testCase.pickleId)\n this.pickleStepIdByTestStepId.set(testStep.id, testStep.pickleStepId)\n this.testStepIdsByPickleStepId.put(testStep.pickleStepId, testStep.id)\n this.stepMatchArgumentsListsByPickleStepId.set(\n testStep.pickleStepId,\n testStep.stepMatchArgumentsLists\n )\n })\n }\n\n private updateTestCaseStarted(testCaseStarted: TestCaseStarted) {\n this.testCaseStartedById.set(testCaseStarted.id, testCaseStarted)\n\n /*\n when a test case attempt starts besides the first one, clear all existing results\n and attachments for that test case, so we always report on the latest attempt\n (applies to legacy pickle-oriented query methods only)\n */\n const testCase = this.testCaseById.get(testCaseStarted.testCaseId)\n if (testCase) {\n this.testStepResultByPickleId.delete(testCase.pickleId)\n for (const testStep of testCase.testSteps) {\n this.testStepResultsByPickleStepId.delete(testStep.pickleStepId)\n this.testStepResultsbyTestStepId.delete(testStep.id)\n this.attachmentsByTestStepId.delete(testStep.id)\n }\n }\n }\n\n private updateTestStepStarted(testStepStarted: TestStepStarted) {\n this.testStepStartedByTestCaseStartedId.put(testStepStarted.testCaseStartedId, testStepStarted)\n }\n\n private updateAttachment(attachment: Attachment) {\n if (attachment.testStepId) {\n this.attachmentsByTestStepId.put(attachment.testStepId, attachment)\n }\n if (attachment.testCaseStartedId) {\n this.attachmentsByTestCaseStartedId.put(attachment.testCaseStartedId, attachment)\n }\n }\n\n private updateTestStepFinished(testStepFinished: TestStepFinished) {\n this.testStepFinishedByTestCaseStartedId.put(\n testStepFinished.testCaseStartedId,\n testStepFinished\n )\n\n const pickleId = this.pickleIdByTestStepId.get(testStepFinished.testStepId)\n this.testStepResultByPickleId.put(pickleId, testStepFinished.testStepResult)\n const testStep = this.testStepById.get(testStepFinished.testStepId)\n this.testStepResultsByPickleStepId.put(testStep.pickleStepId, testStepFinished.testStepResult)\n this.testStepResultsbyTestStepId.put(testStep.id, testStepFinished.testStepResult)\n }\n\n private updateTestCaseFinished(testCaseFinished: TestCaseFinished) {\n this.testCaseFinishedByTestCaseStartedId.set(\n testCaseFinished.testCaseStartedId,\n testCaseFinished\n )\n }\n\n /**\n * Gets all the results for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepTestStepResults(\n pickleStepIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleStepIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleStepIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultsByPickleStepId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the results for multiple pickles\n * @param pickleIds\n */\n public getPickleTestStepResults(\n pickleIds: readonly string[]\n ): readonly messages.TestStepResult[] {\n if (pickleIds.length === 0) {\n return [\n {\n status: messages.TestStepResultStatus.UNKNOWN,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n ]\n }\n return pickleIds.reduce((testStepResults: messages.TestStepResult[], pickleId) => {\n return testStepResults.concat(this.testStepResultByPickleId.get(pickleId))\n }, [])\n }\n\n /**\n * Gets all the attachments for multiple pickle steps\n * @param pickleStepIds\n */\n public getPickleStepAttachments(\n pickleStepIds: readonly string[]\n ): readonly messages.Attachment[] {\n return this.getTestStepsAttachments(\n pickleStepIds.reduce((testStepIds: string[], pickleStepId: string) => {\n return testStepIds.concat(this.testStepIdsByPickleStepId.get(pickleStepId))\n }, [])\n )\n }\n\n public getTestStepsAttachments(testStepIds: readonly string[]): readonly messages.Attachment[] {\n return testStepIds.reduce((attachments: messages.Attachment[], testStepId) => {\n return attachments.concat(this.attachmentsByTestStepId.get(testStepId))\n }, [])\n }\n\n /**\n * Get StepMatchArguments for a pickle step\n * @param pickleStepId\n */\n public getStepMatchArgumentsLists(\n pickleStepId: string\n ): readonly messages.StepMatchArgumentsList[] | undefined {\n return this.stepMatchArgumentsListsByPickleStepId.get(pickleStepId)\n }\n\n public getHook(hookId: string): messages.Hook {\n return this.hooksById.get(hookId)\n }\n\n public getBeforeHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n (hook) => hookSteps.push(hook),\n () => null\n )\n return hookSteps\n }\n\n public getAfterHookSteps(pickleId: string): readonly messages.TestStep[] {\n const hookSteps: messages.TestStep[] = []\n\n this.identifyHookSteps(\n pickleId,\n () => null,\n (hook) => hookSteps.push(hook)\n )\n return hookSteps\n }\n\n private identifyHookSteps(\n pickleId: string,\n onBeforeHookFound: (hook: messages.TestStep) => void,\n onAfterHookFound: (hook: messages.TestStep) => void\n ): void {\n const testCase = this.testCaseByPickleId.get(pickleId)\n\n if (!testCase) {\n return\n }\n\n let pickleStepFound = false\n\n for (const step of testCase.testSteps) {\n if (step.hookId) {\n if (pickleStepFound) {\n onAfterHookFound(step)\n } else {\n onBeforeHookFound(step)\n }\n } else {\n pickleStepFound = true\n }\n }\n }\n\n public getTestStepResults(testStepId: string): messages.TestStepResult[] {\n return this.testStepResultsbyTestStepId.get(testStepId)\n }\n\n public getStatusCounts(\n pickleIds: readonly string[]\n ): Partial<Record<messages.TestStepResultStatus, number>> {\n const result: Partial<Record<messages.TestStepResultStatus, number>> = {}\n for (const pickleId of pickleIds) {\n const testStepResult = getWorstTestStepResult(this.getPickleTestStepResults([pickleId]))\n const count = result[testStepResult.status] || 0\n result[testStepResult.status] = count + 1\n }\n return result\n }\n\n /* new common interface with Java starts here */\n\n public countMostSevereTestStepResultStatus(): Record<TestStepResultStatus, number> {\n const result: Record<TestStepResultStatus, number> = {\n [TestStepResultStatus.AMBIGUOUS]: 0,\n [TestStepResultStatus.FAILED]: 0,\n [TestStepResultStatus.PASSED]: 0,\n [TestStepResultStatus.PENDING]: 0,\n [TestStepResultStatus.SKIPPED]: 0,\n [TestStepResultStatus.UNDEFINED]: 0,\n [TestStepResultStatus.UNKNOWN]: 0,\n }\n for (const testCaseStarted of this.findAllTestCaseStarted()) {\n const mostSevereResult = sortBy(\n this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(\n ([testStepFinished]) => testStepFinished.testStepResult\n ),\n [(testStepResult) => statusOrdinal(testStepResult.status)]\n ).at(-1)\n if (mostSevereResult) {\n result[mostSevereResult.status]++\n }\n }\n return result\n }\n\n public countTestCasesStarted(): number {\n return this.findAllTestCaseStarted().length\n }\n\n public findAllPickles(): ReadonlyArray<Pickle> {\n const pickles = [...this.pickleById.values()]\n return sortBy(pickles, ['id'])\n }\n\n public findAllPickleSteps(): ReadonlyArray<PickleStep> {\n const pickleSteps = [...this.pickleStepById.values()]\n return sortBy(pickleSteps, ['id'])\n }\n\n public findAllTestCaseStarted(): ReadonlyArray<TestCaseStarted> {\n return sortBy(\n [...this.testCaseStartedById.values()].filter((testCaseStarted) => {\n const testCaseFinished = this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n // only include if not yet finished OR won't be retried\n return !testCaseFinished?.willBeRetried\n }),\n [\n (testCaseStarted) =>\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp),\n 'id',\n ]\n )\n }\n\n public findAllTestCaseStartedGroupedByFeature(): Map<\n Feature | undefined,\n ReadonlyArray<TestCaseStarted>\n > {\n const results = new Map()\n sortBy(\n this.findAllTestCaseStarted().map(\n (testCaseStarted) => [this.findLineageBy(testCaseStarted), testCaseStarted] as const\n ),\n [([lineage]) => lineage.gherkinDocument.uri]\n ).forEach(([{ feature }, testCaseStarted]) => {\n results.set(feature, [...(results.get(feature) ?? []), testCaseStarted])\n })\n return results\n }\n\n public findAllTestSteps(): ReadonlyArray<TestStep> {\n const testSteps = [...this.testStepById.values()]\n return sortBy(testSteps, ['id'])\n }\n\n public findAttachmentsBy(testStepFinished: TestStepFinished): ReadonlyArray<Attachment> {\n return this.attachmentsByTestCaseStartedId\n .get(testStepFinished.testCaseStartedId)\n .filter((attachment) => attachment.testStepId === testStepFinished.testStepId)\n }\n\n public findFeatureBy(testCaseStarted: TestCaseStarted): Feature | undefined {\n return this.findLineageBy(testCaseStarted)?.feature\n }\n\n public findHookBy(testStep: TestStep): Hook | undefined {\n if (!testStep.hookId) {\n return undefined\n }\n return this.hooksById.get(testStep.hookId)\n }\n\n public findMeta(): Meta | undefined {\n return this.meta\n }\n\n public findMostSevereTestStepResultBy(\n testCaseStarted: TestCaseStarted\n ): TestStepResult | undefined {\n return sortBy(\n this.findTestStepFinishedAndTestStepBy(testCaseStarted).map(\n ([testStepFinished]) => testStepFinished.testStepResult\n ),\n [(testStepResult) => statusOrdinal(testStepResult.status)]\n ).at(-1)\n }\n\n public findNameOf(pickle: Pickle, namingStrategy: NamingStrategy): string {\n const lineage = this.findLineageBy(pickle)\n return lineage ? namingStrategy.reduce(lineage, pickle) : pickle.name\n }\n\n public findLocationOf(pickle: Pickle): Location | undefined {\n const lineage = this.findLineageBy(pickle)\n if (lineage?.example) {\n return lineage.example.location\n }\n return lineage?.scenario?.location\n }\n\n public findPickleBy(element: TestCaseStarted | TestStepStarted): Pickle | undefined {\n const testCase = this.findTestCaseBy(element)\n assert.ok(testCase, 'Expected to find TestCase from TestCaseStarted')\n return this.pickleById.get(testCase.pickleId)\n }\n\n public findPickleStepBy(testStep: TestStep): PickleStep | undefined {\n if (!testStep.pickleStepId) {\n return undefined\n }\n return this.pickleStepById.get(testStep.pickleStepId)\n }\n\n public findStepBy(pickleStep: PickleStep): Step | undefined {\n const [astNodeId] = pickleStep.astNodeIds\n assert.ok(astNodeId, 'Expected PickleStep to have an astNodeId')\n return this.stepById.get(astNodeId)\n }\n\n public findTestCaseBy(element: TestCaseStarted | TestStepStarted): TestCase | undefined {\n const testCaseStarted =\n 'testCaseStartedId' in element ? this.findTestCaseStartedBy(element) : element\n assert.ok(testCaseStarted, 'Expected to find TestCaseStarted by TestStepStarted')\n return this.testCaseById.get(testCaseStarted.testCaseId)\n }\n\n public findTestCaseDurationBy(testCaseStarted: TestCaseStarted): Duration | undefined {\n const testCaseFinished = this.findTestCaseFinishedBy(testCaseStarted)\n if (!testCaseFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(testCaseStarted.timestamp)\n )\n }\n\n public findTestCaseStartedBy(testStepStarted: TestStepStarted): TestCaseStarted | undefined {\n return this.testCaseStartedById.get(testStepStarted.testCaseStartedId)\n }\n\n public findTestCaseFinishedBy(testCaseStarted: TestCaseStarted): TestCaseFinished | undefined {\n return this.testCaseFinishedByTestCaseStartedId.get(testCaseStarted.id)\n }\n\n public findTestRunDuration(): Duration | undefined {\n if (!this.testRunStarted || !this.testRunFinished) {\n return undefined\n }\n return TimeConversion.millisecondsToDuration(\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunFinished.timestamp) -\n TimeConversion.timestampToMillisecondsSinceEpoch(this.testRunStarted.timestamp)\n )\n }\n\n public findTestRunFinished(): TestRunFinished | undefined {\n return this.testRunFinished\n }\n\n public findTestRunStarted(): TestRunStarted | undefined {\n return this.testRunStarted\n }\n\n public findTestStepBy(element: TestStepStarted | TestStepFinished): TestStep | undefined {\n return this.testStepById.get(element.testStepId)\n }\n\n public findTestStepsStartedBy(testCaseStarted: TestCaseStarted): ReadonlyArray<TestStepStarted> {\n // multimaps `get` implements `getOrDefault([])` behaviour internally\n return [...this.testStepStartedByTestCaseStartedId.get(testCaseStarted.id)]\n }\n\n public findTestStepsFinishedBy(\n testCaseStarted: TestCaseStarted\n ): ReadonlyArray<TestStepFinished> {\n // multimaps `get` implements `getOrDefault([])` behaviour internally\n return [...this.testStepFinishedByTestCaseStartedId.get(testCaseStarted.id)]\n }\n\n public findTestStepFinishedAndTestStepBy(\n testCaseStarted: TestCaseStarted\n ): ReadonlyArray<[TestStepFinished, TestStep]> {\n return this.testStepFinishedByTestCaseStartedId\n .get(testCaseStarted.id)\n .map((testStepFinished) => {\n const testStep = this.findTestStepBy(testStepFinished)\n assert.ok(testStep, 'Expected to find TestStep by TestStepFinished')\n return [testStepFinished, testStep]\n })\n }\n\n public findLineageBy(element: Pickle | TestCaseStarted): Lineage | undefined {\n const pickle = 'testCaseId' in element ? this.findPickleBy(element) : element\n const deepestAstNodeId = pickle.astNodeIds.at(-1)\n assert.ok(deepestAstNodeId, 'Expected Pickle to have at least one astNodeId')\n return this.lineageById.get(deepestAstNodeId)\n }\n}\n"]}
@@ -1,12 +1,6 @@
1
- import { TestStepResult } from '@cucumber/messages';
2
- interface WithId {
3
- id: string | number;
4
- }
5
- export declare function comparatorById(a: WithId, b: WithId): 0 | 1 | -1;
6
- export declare function comparatorBy(a: any, b: any, key: string): 0 | 1 | -1;
7
- export declare function comparatorByStatus(a: TestStepResult, b: TestStepResult): 0 | 1 | -1;
1
+ import { TestStepResultStatus } from '@cucumber/messages';
2
+ export declare function statusOrdinal(status: TestStepResultStatus): number;
8
3
  export declare const assert: {
9
4
  ok(target: unknown, message: string): void;
10
5
  };
11
- export {};
12
6
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,MAAM,oBAAoB,CAAA;AAEzE,UAAU,MAAM;IACZ,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,cAElD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,cAQvD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,cAQtE;AAcD,eAAO,MAAM,MAAM;eACJ,OAAO,WAAW,MAAM;CAKtC,CAAA"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAEzD,wBAAgB,aAAa,CAAC,MAAM,EAAE,oBAAoB,UAUzD;AAED,eAAO,MAAM,MAAM;eACN,OAAO,WAAW,MAAM;CAKpC,CAAA"}
@@ -1,32 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assert = void 0;
4
- exports.comparatorById = comparatorById;
5
- exports.comparatorBy = comparatorBy;
6
- exports.comparatorByStatus = comparatorByStatus;
4
+ exports.statusOrdinal = statusOrdinal;
7
5
  const messages_1 = require("@cucumber/messages");
8
- function comparatorById(a, b) {
9
- return comparatorBy(a, b, "id");
10
- }
11
- function comparatorBy(a, b, key) {
12
- if (a[key] < b[key]) {
13
- return -1;
14
- }
15
- if (a[key] > b[key]) {
16
- return 1;
17
- }
18
- return 0;
19
- }
20
- function comparatorByStatus(a, b) {
21
- if (ordinal(a.status) < ordinal(b.status)) {
22
- return -1;
23
- }
24
- if (ordinal(a.status) > ordinal(b.status)) {
25
- return 1;
26
- }
27
- return 0;
28
- }
29
- function ordinal(status) {
6
+ function statusOrdinal(status) {
30
7
  return [
31
8
  messages_1.TestStepResultStatus.UNKNOWN,
32
9
  messages_1.TestStepResultStatus.PASSED,
@@ -42,6 +19,6 @@ exports.assert = {
42
19
  if (!target) {
43
20
  throw new Error(message);
44
21
  }
45
- }
22
+ },
46
23
  };
47
24
  //# sourceMappingURL=helpers.js.map
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,QAAA,MAAM,GAAG;IAClB,EAAE,CAAC,MAAe,EAAE,OAAe;QAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;QAC5B,CAAC;IACL,CAAC;CACJ,CAAA","sourcesContent":["import { TestStepResult, TestStepResultStatus } from '@cucumber/messages'\n\ninterface WithId {\n id: string | number\n}\n\nexport function comparatorById(a: WithId, b: WithId) {\n return comparatorBy(a, b, \"id\")\n}\n\nexport function comparatorBy(a: any, b: any, key: string) {\n if ( a[key] < b[key] ){\n return -1;\n }\n if ( a[key] > b[key] ){\n return 1;\n }\n return 0;\n}\n\nexport function comparatorByStatus(a: TestStepResult, b: TestStepResult) {\n if (ordinal(a.status) < ordinal(b.status)) {\n return -1;\n }\n if (ordinal(a.status) > ordinal(b.status) ){\n return 1;\n }\n return 0;\n}\n\nfunction ordinal(status: TestStepResultStatus) {\n return [\n TestStepResultStatus.UNKNOWN,\n TestStepResultStatus.PASSED,\n TestStepResultStatus.SKIPPED,\n TestStepResultStatus.PENDING,\n TestStepResultStatus.UNDEFINED,\n TestStepResultStatus.AMBIGUOUS,\n TestStepResultStatus.FAILED,\n ].indexOf(status)\n}\n\nexport const assert = {\n ok(target: unknown, message: string) {\n if (!target) {\n throw new Error(message)\n }\n }\n}"]}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;AAEA,sCAUC;AAZD,iDAAyD;AAEzD,SAAgB,aAAa,CAAC,MAA4B;IACxD,OAAO;QACL,+BAAoB,CAAC,OAAO;QAC5B,+BAAoB,CAAC,MAAM;QAC3B,+BAAoB,CAAC,OAAO;QAC5B,+BAAoB,CAAC,OAAO;QAC5B,+BAAoB,CAAC,SAAS;QAC9B,+BAAoB,CAAC,SAAS;QAC9B,+BAAoB,CAAC,MAAM;KAC5B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AACnB,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,EAAE,CAAC,MAAe,EAAE,OAAe;QACjC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;CACF,CAAA","sourcesContent":["import { TestStepResultStatus } from '@cucumber/messages'\n\nexport function statusOrdinal(status: TestStepResultStatus) {\n return [\n TestStepResultStatus.UNKNOWN,\n TestStepResultStatus.PASSED,\n TestStepResultStatus.SKIPPED,\n TestStepResultStatus.PENDING,\n TestStepResultStatus.UNDEFINED,\n TestStepResultStatus.AMBIGUOUS,\n TestStepResultStatus.FAILED,\n ].indexOf(status)\n}\n\nexport const assert = {\n ok(target: unknown, message: string) {\n if (!target) {\n throw new Error(message)\n }\n },\n}\n"]}