@allurereport/web-classic 3.7.0 → 3.8.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.
Files changed (31) hide show
  1. package/dist/multi/app-f613e593baf05db896b1.js +2 -0
  2. package/dist/multi/manifest.json +22 -22
  3. package/dist/single/{app-7d3875e449b0b8749a3e.js → app-e92ac44c4ec92cf8d329.js} +2 -2
  4. package/dist/single/manifest.json +1 -1
  5. package/package.json +5 -5
  6. package/src/utils/treeFilters.ts +19 -6
  7. package/test/utils/treeFilters.test.ts +93 -5
  8. package/dist/multi/app-0c74b6d200db97801e79.js +0 -2
  9. /package/dist/multi/{10.app-0c74b6d200db97801e79.js → 10.app-f613e593baf05db896b1.js} +0 -0
  10. /package/dist/multi/{222.app-0c74b6d200db97801e79.js → 222.app-f613e593baf05db896b1.js} +0 -0
  11. /package/dist/multi/{26.app-0c74b6d200db97801e79.js → 26.app-f613e593baf05db896b1.js} +0 -0
  12. /package/dist/multi/{302.app-0c74b6d200db97801e79.js → 302.app-f613e593baf05db896b1.js} +0 -0
  13. /package/dist/multi/{304.app-0c74b6d200db97801e79.js → 304.app-f613e593baf05db896b1.js} +0 -0
  14. /package/dist/multi/{333.app-0c74b6d200db97801e79.js → 333.app-f613e593baf05db896b1.js} +0 -0
  15. /package/dist/multi/{369.app-0c74b6d200db97801e79.js → 369.app-f613e593baf05db896b1.js} +0 -0
  16. /package/dist/multi/{389.app-0c74b6d200db97801e79.js → 389.app-f613e593baf05db896b1.js} +0 -0
  17. /package/dist/multi/{498.app-0c74b6d200db97801e79.js → 498.app-f613e593baf05db896b1.js} +0 -0
  18. /package/dist/multi/{60.app-0c74b6d200db97801e79.js → 60.app-f613e593baf05db896b1.js} +0 -0
  19. /package/dist/multi/{643.app-0c74b6d200db97801e79.js → 643.app-f613e593baf05db896b1.js} +0 -0
  20. /package/dist/multi/{671.app-0c74b6d200db97801e79.js → 671.app-f613e593baf05db896b1.js} +0 -0
  21. /package/dist/multi/{725.app-0c74b6d200db97801e79.js → 725.app-f613e593baf05db896b1.js} +0 -0
  22. /package/dist/multi/{770.app-0c74b6d200db97801e79.js → 770.app-f613e593baf05db896b1.js} +0 -0
  23. /package/dist/multi/{848.app-0c74b6d200db97801e79.js → 848.app-f613e593baf05db896b1.js} +0 -0
  24. /package/dist/multi/{853.app-0c74b6d200db97801e79.js → 853.app-f613e593baf05db896b1.js} +0 -0
  25. /package/dist/multi/{872.app-0c74b6d200db97801e79.js → 872.app-f613e593baf05db896b1.js} +0 -0
  26. /package/dist/multi/{895.app-0c74b6d200db97801e79.js → 895.app-f613e593baf05db896b1.js} +0 -0
  27. /package/dist/multi/{920.app-0c74b6d200db97801e79.js → 920.app-f613e593baf05db896b1.js} +0 -0
  28. /package/dist/multi/{979.app-0c74b6d200db97801e79.js → 979.app-f613e593baf05db896b1.js} +0 -0
  29. /package/dist/multi/{991.app-0c74b6d200db97801e79.js → 991.app-f613e593baf05db896b1.js} +0 -0
  30. /package/dist/multi/{app-0c74b6d200db97801e79.js.LICENSE.txt → app-f613e593baf05db896b1.js.LICENSE.txt} +0 -0
  31. /package/dist/single/{app-7d3875e449b0b8749a3e.js.LICENSE.txt → app-e92ac44c4ec92cf8d329.js.LICENSE.txt} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- "main.js": "app-7d3875e449b0b8749a3e.js"
2
+ "main.js": "app-e92ac44c4ec92cf8d329.js"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/web-classic",
3
- "version": "3.7.0",
3
+ "version": "3.8.0",
4
4
  "description": "The static files for Allure Classic Report",
5
5
  "keywords": [
6
6
  "allure",
@@ -27,10 +27,10 @@
27
27
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
28
28
  },
29
29
  "dependencies": {
30
- "@allurereport/charts-api": "3.7.0",
31
- "@allurereport/core-api": "3.7.0",
32
- "@allurereport/web-commons": "3.7.0",
33
- "@allurereport/web-components": "3.7.0",
30
+ "@allurereport/charts-api": "3.8.0",
31
+ "@allurereport/core-api": "3.8.0",
32
+ "@allurereport/web-commons": "3.8.0",
33
+ "@allurereport/web-components": "3.8.0",
34
34
  "@preact/signals": "^2.6.1",
35
35
  "clsx": "^2.1.1",
36
36
  "d3-shape": "^3.2.0",
@@ -54,18 +54,31 @@ const groupComparatorByTreeSortBy = (sortBy: TreeSortBy): Comparator<DefaultTree
54
54
  }
55
55
  };
56
56
 
57
+ const withDirection = <T extends { name: string }>(
58
+ cmp: Comparator<T>,
59
+ filterOptions: TreeFiltersState,
60
+ ): Comparator<T> => {
61
+ const isStatusSort = filterOptions.sortBy === "status";
62
+ const isDescending = filterOptions.direction === "desc";
63
+ const nameComparator = compareBy<T>("name", alphabetically());
64
+
65
+ // Status sort always prioritizes severity. Direction only affects name-based tie-breaking.
66
+ return andThen([
67
+ isDescending && !isStatusSort ? reverse(cmp) : cmp,
68
+ isDescending && isStatusSort ? reverse(nameComparator) : nameComparator,
69
+ ]);
70
+ };
71
+
57
72
  export const leafComparator = (filterOptions: TreeFiltersState): Comparator<TreeLeaf<ClassicTreeLeaf>> => {
58
73
  const cmp = leafComparatorByTreeSortBy(filterOptions.sortBy);
59
- const directional = filterOptions.direction === "asc" ? cmp : reverse(cmp);
60
- // apply fallback sorting by name
61
- return andThen([directional, compareBy("name", alphabetically())]);
74
+
75
+ return withDirection(cmp, filterOptions);
62
76
  };
63
77
 
64
78
  export const groupComparator = (filterOptions: TreeFiltersState): Comparator<DefaultTreeGroup> => {
65
79
  const cmp = groupComparatorByTreeSortBy(filterOptions.sortBy);
66
- const directional = filterOptions.direction === "asc" ? cmp : reverse(cmp);
67
- // apply fallback sorting by name
68
- return andThen([directional, compareBy("name", alphabetically())]);
80
+
81
+ return withDirection(cmp, filterOptions);
69
82
  };
70
83
 
71
84
  export const filterLeaves = (
@@ -285,7 +285,7 @@ describe("utils > treeFilters", () => {
285
285
  });
286
286
 
287
287
  it("sorts leaves by status in descending order", () => {
288
- const leaves = ["a1", "b2", "c3", "d4", "e5"];
288
+ const leaves = ["a1", "b2", "c3", "d4", "e5", "f6", "z9"];
289
289
  const leavesById = {
290
290
  a1: {
291
291
  name: "a1",
@@ -307,6 +307,14 @@ describe("utils > treeFilters", () => {
307
307
  name: "e5",
308
308
  status: "skipped",
309
309
  } as ClassicTestResult,
310
+ f6: {
311
+ name: "f6",
312
+ status: "failed",
313
+ } as ClassicTestResult,
314
+ z9: {
315
+ name: "z9",
316
+ status: "passed",
317
+ } as ClassicTestResult,
310
318
  };
311
319
  const result = filterLeaves(leaves, leavesById, {
312
320
  direction: "desc",
@@ -314,11 +322,13 @@ describe("utils > treeFilters", () => {
314
322
  });
315
323
 
316
324
  expect(result).toEqual([
317
- expect.objectContaining({ name: "d4" }),
318
- expect.objectContaining({ name: "e5" }),
319
- expect.objectContaining({ name: "a1" }),
320
- expect.objectContaining({ name: "c3" }),
325
+ expect.objectContaining({ name: "f6" }),
321
326
  expect.objectContaining({ name: "b2" }),
327
+ expect.objectContaining({ name: "c3" }),
328
+ expect.objectContaining({ name: "z9" }),
329
+ expect.objectContaining({ name: "a1" }),
330
+ expect.objectContaining({ name: "e5" }),
331
+ expect.objectContaining({ name: "d4" }),
322
332
  ]);
323
333
  });
324
334
 
@@ -445,5 +455,83 @@ describe("utils > treeFilters", () => {
445
455
  }),
446
456
  );
447
457
  });
458
+
459
+ it("keeps problem-heavy groups first when sorting by status in descending order", () => {
460
+ const group = {
461
+ leaves: [],
462
+ groups: ["passedHeavy", "failedAlpha", "brokenGroup", "failedZulu"],
463
+ };
464
+ const leavesById = {
465
+ failedAlphaTest: {
466
+ name: "failedAlphaTest",
467
+ status: "failed",
468
+ } as ClassicTestResult,
469
+ failedZuluTest: {
470
+ name: "failedZuluTest",
471
+ status: "failed",
472
+ } as ClassicTestResult,
473
+ brokenTest1: {
474
+ name: "brokenTest1",
475
+ status: "broken",
476
+ } as ClassicTestResult,
477
+ brokenTest2: {
478
+ name: "brokenTest2",
479
+ status: "broken",
480
+ } as ClassicTestResult,
481
+ passedTest1: {
482
+ name: "passedTest1",
483
+ status: "passed",
484
+ } as ClassicTestResult,
485
+ passedTest2: {
486
+ name: "passedTest2",
487
+ status: "passed",
488
+ } as ClassicTestResult,
489
+ };
490
+ const groupsById = {
491
+ passedHeavy: {
492
+ name: "passedHeavy",
493
+ leaves: ["passedTest1", "passedTest2"],
494
+ groups: [],
495
+ },
496
+ brokenGroup: {
497
+ name: "brokenGroup",
498
+ leaves: ["brokenTest1", "brokenTest2"],
499
+ groups: [],
500
+ },
501
+ failedAlpha: {
502
+ name: "failedAlpha",
503
+ leaves: ["failedAlphaTest"],
504
+ groups: [],
505
+ },
506
+ failedZulu: {
507
+ name: "failedZulu",
508
+ leaves: ["failedZuluTest"],
509
+ groups: [],
510
+ },
511
+ };
512
+ const result = createRecursiveTree({
513
+ group,
514
+ leavesById,
515
+ groupsById,
516
+ filterOptions: {
517
+ query: "",
518
+ status: "total",
519
+ filter: {
520
+ flaky: false,
521
+ retry: false,
522
+ new: false,
523
+ },
524
+ sortBy: "status",
525
+ direction: "desc",
526
+ },
527
+ });
528
+
529
+ expect(result.trees).toEqual([
530
+ expect.objectContaining({ name: "failedZulu" }),
531
+ expect.objectContaining({ name: "failedAlpha" }),
532
+ expect.objectContaining({ name: "brokenGroup" }),
533
+ expect.objectContaining({ name: "passedHeavy" }),
534
+ ]);
535
+ });
448
536
  });
449
537
  });