Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(): Add Jest coverage to the report #9836

Merged
merged 14 commits into from Apr 30, 2024
Merged

ci(): Add Jest coverage to the report #9836

merged 14 commits into from Apr 30, 2024

Conversation

asturur
Copy link
Member

@asturur asturur commented Apr 30, 2024

Description

For some reason this didn't work before, while now it seems to work fine.
This PR adds JEST coverage to our global coverage.

In Action

Copy link

codesandbox bot commented Apr 30, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Contributor

Build Stats

file / KB (diff) bundled minified
fabric 916.250 (0) 305.646 (0)

@asturur
Copy link
Member Author

asturur commented Apr 30, 2024

Jest coverage seems too much generous to me, probably some stuff is run over without actually testing

Copy link
Contributor

Total Coverage: 77.04 %

Coverage report

------------------------------------|---------|----------|---------|---------|----------------------

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 77.03 70.46 62.72 77.03
src 83.87 76.83 59.81 83.87
ClassRegistry.ts 96.55 77.77 100 96.55 30-31
Collection.ts 74.92 65.51 58.33 74.92 ...7,303-310,327-350
CommonMethods.ts 87.09 88.88 66.66 87.09 47-52,60-61
Intersection.ts 90.36 76 91.66 90.36 ...8-239,290-291,298
Observable.ts 76.02 74.07 71.42 76.02 ...6,146-148,161-162
Point.ts 82.98 96.77 41.17 82.98 ...8,335-341,348-349
Shadow.ts 83.53 50 42.85 83.53 ...3,205-206,229-242
cache.ts 87.77 83.33 75 87.77 58-59,69-77
config.ts 90.62 57.14 57.14 90.62 ...3,146-147,153-154
constants.ts 100 100 100 100
src/LayoutManager 98.57 82.02 83.33 98.57
ActiveSelectionLayoutManager.ts 100 100 100 100
LayoutManager.ts 98.27 98.18 82.35 98.27 51,331-333,343-344
constants.ts 100 100 100 100
index.ts 66.66 37.5 80 66.66 5-6
types.ts 100 100 100 100
src/LayoutManager/LayoutStrategies 90.24 66.66 100 90.24
ClipPathLayout.ts 79.72 66.66 100 79.72 39-48,65-69
FitContentLayout.ts 100 100 100 100
FixedLayout.ts 100 33.33 100 100 23
LayoutStrategy.ts 97.24 88.23 100 97.24 54,73-74
utils.ts 82.14 16.66 100 82.14 29-32,35,40-44
src/Pattern 62.03 100 10 62.03
Pattern.ts 62.03 100 10 62.03 ...4,171-199,203-211
src/brushes 60.79 100 13.33 60.79
BaseBrush.ts 75.15 100 14.28 75.15 ...5,142-146,154-160
CircleBrush.ts 44.28 100 12.5 44.28 ...86,92-122,129-139
src/canvas 79.66 74.88 64.21 79.66
Canvas.ts 79.89 64.19 84.31 79.89 ...02-1514,1520-1522
CanvasOptions.ts 100 100 100 100
SelectableCanvas.ts 91.83 85.71 84.31 91.83 ...34-1355,1361-1370
StaticCanvas.ts 61.81 70 36.36 61.81 ...04-1505,1515-1518
StaticCanvasOptions.ts 100 100 100 100
TextEditingManager.ts 79.41 72.72 72.72 79.41 ...26-32,44-45,49-50
src/canvas/DOMManagers 94.37 59.45 100 94.37
CanvasDOMManager.ts 96.77 72.72 100 96.77 44-45,112-113
StaticCanvasDOMManager.ts 93.75 70 100 93.75 32,37-40
util.ts 91.83 43.75 100 91.83 19-22,64-65,94-95
src/color 78.48 72.41 35.48 78.48
Color.ts 73.43 69.56 34.78 73.43 ...6,257-284,294-295
color_map.ts 100 100 100 100
constants.ts 100 100 66.66 100
util.ts 35.48 75 20 35.48 10-26,37-71,86-93
src/controls 71.25 62.5 61.11 71.25
Control.ts 96.02 77.27 91.66 96.02 283-288,357-365
changeWidth.ts 39.62 100 0 39.62 17-48
commonControls.ts 100 100 100 100
controlRendering.ts 63.04 12.5 50 63.04 38-85,112,135-136
drag.ts 46.87 100 0 46.87 16-32
fireEvent.ts 100 50 100 100 13
polyControl.ts 100 69.23 100 100 79,114-119
rotate.ts 40.22 100 0 40.22 19-27,40-82
scale.ts 61.53 43.47 71.42 61.53 ...1,141-215,229-235
scaleSkew.ts 69.56 50 40 69.56 ...46-53,64-72,84-92
skew.ts 41.56 100 0 41.56 ...7,219-225,237-243
util.ts 60.64 100 37.5 60.64 ...92,97-118,130-155
wrapWithFireEvent.ts 100 100 100 100
wrapWithFixedAnchor.ts 100 100 100 100
src/env 100 88.88 100 100
browser.ts 100 100 100 100
index.ts 100 85.71 100 100 47
src/filters 38.96 33.33 5.55 38.96
Canvas2dFilterBackend.ts 30.76 100 0 30.76 8-15,28-64
FilterBackend.ts 68.42 33.33 33.33 68.42 15-22,31-32,37-38
WebGLFilterBackend.ts 37.55 100 0 37.55 ...3,383-404,407-418
src/filters/GLProbes 57.14 100 0 57.14
GLProbe.ts 100 100 100 100
WebGLProbe.ts 51.02 100 0 51.02 18-29,35-44,47-48
src/gradient 60.51 90 28.57 60.51
Gradient.ts 59.37 90 28.57 59.37 ...0,299-322,331-334
constants.ts 100 100 100 100
src/gradient/parser 100 100 100 100
misc.ts 100 100 100 100
parseColorStops.ts 100 100 100 100
parseCoords.ts 100 100 100 100
src/parser 72.21 66.09 77.77 72.21
applyViewboxTransform.ts 60.91 50 100 60.91 ...4,126-127,141-174
attributes.ts 100 100 100 100
constants.ts 100 100 100 100
doesSomeParentMatch.ts 16.66 100 0 16.66 4-18
elementMatchesRule.ts 50 100 0 50 9-16
elements_parser.ts 64.22 70.58 100 64.22 ...6,127-133,145-211
getCSSRules.ts 94.28 71.42 100 94.28 23-24,60-61
getGlobalStylesForElement.ts 68.18 33.33 100 68.18 14-20
getGradientDefs.ts 72.72 50 100 72.72 23-31
getMultipleNodes.ts 100 100 100 100
getSvgRegex.ts 100 100 100 100
getTagName.ts 100 100 100 100
hasInvalidAncestor.ts 100 100 100 100
loadSVGFromString.ts 100 100 100 100
normalizeAttr.ts 100 100 100 100
normalizeValue.ts 58.57 47.82 100 58.57 ...49,51-58,60,62,65
parseAttributes.ts 89.13 66.66 100 89.13 ...43-44,65-68,86-87
parseFontDeclaration.ts 26.08 100 0 26.08 13-46
parsePointsAttribute.ts 30.3 100 0 30.3 11-33
parseSVGDocument.ts 80.41 55.55 66.66 80.41 ...44-47,63-68,73-77
parseStyleAttribute.ts 92.3 83.33 100 92.3 22-23
parseStyleObject.ts 41.17 100 0 41.17 8-17
parseStyleString.ts 100 100 100 100
parseTransformAttribute.ts 89.36 61.53 100 89.36 ...76-77,79-80,82-83
parseUseDirectives.ts 76.47 75 100 76.47 13-14,37-51,56-57,69
percent.ts 100 100 100 100
recursivelyParseGradientsXlink.ts 40 100 0 40 17-40
selectorMatches.ts 4.34 100 0 4.34 2-23
setStrokeFillOpacity.ts 65.85 50 100 65.85 22,26-38
src/shapes 76.69 67.76 56.25 76.69
ActiveSelection.ts 85.43 100 71.42 85.43 ...5,224-225,234-250
Circle.ts 74.8 100 40 74.8 ...3,214-237,245-246
Group.ts 87.1 77.1 78.37 87.1 ...1,628-634,642-651
Image.ts 60.74 32.35 37.93 60.74 ...2,822-829,840-857
Path.ts 75.11 78.94 36.84 75.11 ...0,273-274,383-386
Polygon.ts 90.9 100 50 90.9 17-18
Polyline.ts 76 59.37 50 76 ...0,390-406,418-421
Rect.ts 85.46 47.36 85.71 85.46 ...2,127-133,163-171
Textbox.ts 81.12 55.81 52.38 81.12 ...6,528-529,532-545
Triangle.ts 91.52 100 66.66 91.52 51-55
src/shapes/IText 73.7 69.84 70.14 73.7
DraggableTextDelegate.ts 43.29 46.15 64.7 43.29 ...4,279-336,346-377
IText.ts 73.43 57.89 55.17 73.43 ...9,680-682,689-693
ITextBehavior.ts 77.89 73.52 83.33 77.89 ...69,1073,1075-1077
ITextClickBehavior.ts 65.03 57.14 40 65.03 ...2,254-255,272-273
ITextKeyBehavior.ts 85.71 77.88 83.87 85.71 ...2,556,558,564-568
constants.ts 100 100 100 100
src/shapes/Object 79.81 68.58 59.21 79.81
AnimatableObject.ts 40.95 100 0 40.95 35-42,51-104
FabricObject.ts 100 100 100 100
FabricObjectSVGExportMixin.ts 81.49 40 70 81.49 ...5-236,241-242,251
InteractiveObject.ts 90.44 73.21 73.07 90.44 ...7,676-677,687,699
Object.ts 77.29 66.08 69.35 77.29 ...20-1522,1561,1600
ObjectGeometry.ts 80.28 84.78 34.21 80.28 ...3,381-385,543-544
ObjectOrigin.ts 94.09 95.23 77.77 94.09 ...9,203-208,231-236
StackedObject.ts 47.71 87.5 20 47.71 ...1,160-162,170-196
defaultValues.ts 100 100 100 100
src/shapes/Text 73.73 61.96 81.92 73.73
StyledText.ts 71.04 74.28 66.66 71.04 ...2,329-330,333-334
Text.ts 71.7 61.68 85.45 71.7 ...84-1785,1825-1892
TextSVGExportMixin.ts 78.86 53.33 84.61 78.86 ...0,276-291,332-335
constants.ts 100 100 100 100
src/util 86.15 60 82.6 86.15
applyMixins.ts 95.45 80 100 95.45 17
dom_event.ts 82.75 60 75 82.75 10-11,27-29
dom_misc.ts 87.5 66.66 100 87.5 16-17,29-30,37-38
dom_style.ts 90.9 50 100 90.9 14,16
index.ts 97.45 20 0 97.45 20,91,107
lang_string.ts 58.22 40 75 58.22 ...52-54,56-72,74-79
transform_matrix_removal.ts 85.24 75 100 85.24 51-59
typeAssertions.ts 100 100 100 100
src/util/animation 73.67 76.31 27.86 73.67
AnimationBase.ts 98.79 85.71 80 98.79 86-87
AnimationFrameProvider.ts 77.77 100 50 77.77 8-9
AnimationRegistry.ts 81.35 66.66 75 81.35 ...33-34,37-39,51-52
ArrayAnimation.ts 25.92 100 0 25.92 6-15,17-26
ColorAnimation.ts 28.37 100 0 28.37 ...24-26,31-52,54-73
ValueAnimation.ts 100 100 100 100
animate.ts 93.24 66.66 66.66 93.24 63,71-74
easing.ts 56.26 100 3.03 56.26 ...1,303-304,322-327
index.ts 0 25 0 0 1-2
types.ts 100 100 100 100
src/util/internals 60.76 53.33 60 60.76
cleanupSvgAttribute.ts 100 100 100 100
cloneDeep.ts 100 100 100 100
console.ts 77.77 50 33.33 77.77 10-11,16-17
dom_request.ts 37.73 100 0 37.73 21-53
findRight.ts 9.09 100 0 9.09 2-11
getRandomInt.ts 100 100 100 100
ifNaN.ts 100 100 100 100
index.ts 50 33.33 50 50 1-2
removeFromArray.ts 85.71 50 100 85.71 11-12
uid.ts 100 100 100 100
src/util/misc 88.61 75.25 76.05 88.61
boundingBoxFromPoints.ts 81.57 66.66 100 81.57 12-18
capValue.ts 100 100 100 100
cos.ts 95.83 87.5 100 95.83 21
dom.ts 78.57 50 40 78.57 11-12,30-36,47-49
findScaleTo.ts 79.31 100 0 79.31 12-14,26-28
groupSVGElements.ts 60 100 0 60 13-20
isTransparent.ts 100 100 100 100
matrix.ts 100 68.57 87.5 100 126-145,168-198,282
mergeClipPaths.ts 57.5 100 0 57.5 24-40
objectEnlive.ts 72.19 82.14 66.66 72.19 ...9,158-165,178-182
objectTransforms.ts 82.78 100 50 82.78 24-33,44-46,72-79
pick.ts 100 85.71 100 100 9
planeChange.ts 100 71.42 100 100 16-17,38-39
radiansDegreesConversion.ts 100 100 100 100
resolveOrigin.ts 100 50 100 100 22
rotatePoint.ts 80 100 0 80 12-14
sin.ts 92.3 75 100 92.3 21,23
svgParsing.ts 80.97 58.82 85.71 80.97 ...5,74,95,97-98,153
textStyles.ts 100 92.85 100 100 24,85
toFixed.ts 100 100 100 100
vectors.ts 94 66.66 80 94 95-100
src/util/misc/projectStroke 70.14 67.27 75 70.14
StrokeLineCapProjections.ts 60.13 66.66 71.42 60.13 ...1,100-129,134,136
StrokeLineJoinProjections.ts 63.69 70 70 63.69 ...5,258-287,300,302
StrokeProjectionsBase.ts 95.45 71.42 83.33 95.45 23,48-49
index.ts 83.95 63.15 100 83.95 ...25,39,41-46,62-64
types.ts 100 100 100 100
src/util/path 76.42 69.23 74.07 76.42
index.ts 68.62 69.23 74.07 68.62 ...01-1019,1028-1038
regex.ts 100 100 100 100
typedefs.ts 100 100 100 100
------------------------------------ --------- ---------- --------- --------- ----------------------

@asturur asturur changed the title Try jest coverage reporting ci(): Add Jest coverage to the report Apr 30, 2024
@asturur asturur marked this pull request as ready for review April 30, 2024 11:16
Copy link
Contributor

Coverage after merging add-jest-coverage into master will be

82.79%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
index.node.ts14.29%100%0%25%23, 26, 29, 41, 44, 47
src
   ClassRegistry.ts88.71%53.85%100%97.73%31, 52, 52
   Collection.ts71.39%31.15%45.16%83.91%130, 138, 153, 155–157, 159, 169–170, 180–181, 197, 215, 217, 219, 228, 243, 254, 263, 265, 270, 279, 281, 283, 286–287, 302, 304, 306, 309–310, 327–328, 328, 328–329, 333–334, 337–344, 346–348, 350, 75, 99
   CommonMethods.ts85.51%61.54%66.67%94%50, 52, 61, 9
   Intersection.ts81.42%41.30%73.33%96.14%105, 132–133, 166, 184–190, 228, 228, 237, 239, 289–291, 297, 297, 78, 80
   Observable.ts71.20%45.45%31.25%85.48%136, 145, 148, 160, 162, 165, 167, 41, 43, 68–70, 72, 76, 78, 80, 82–85, 87–91
   Point.ts84.43%61.22%41.18%92.38%104, 117, 148, 157, 179, 197, 206, 216, 225, 236–239, 259, 284–285, 294–297, 317, 328, 341, 349, 359, 95
   Shadow.ts79.76%17.39%33.33%88.37%146–147, 147–150, 152–157, 166, 183, 183, 201, 201, 203–204, 204, 206, 213, 213, 230–237, 239, 239, 241–242, 38–41
   cache.ts83.72%45.45%75%90.14%57, 59, 71–72, 74–77
   config.ts82.21%20%44.44%94.03%123, 131–132, 134–137, 139, 142–143, 147, 152, 152, 152, 152, 152, 152
   constants.ts100%100%100%100%
src/LayoutManager
   ActiveSelectionLayoutManager.ts86.67%76.92%28.57%100%
   LayoutManager.ts89%65.06%53.85%99.29%269, 333, 344
   constants.ts100%100%100%100%
   index.ts48.57%37.50%80%66.67%1, 1, 1–2, 2, 2–3, 3, 3–4, 4, 4–5, 5, 5, 5–6
   types.ts100%100%100%100%
src/LayoutManager/LayoutStrategies
   ClipPathLayout.ts69.23%33.33%100%78.95%39, 41–42, 42–44, 46–48, 57, 57–58, 58, 66–69
   FitContentLayout.ts100%100%100%100%
   FixedLayout.ts85.71%20%100%100%23, 23
   LayoutStrategy.ts86.78%55.56%71.43%97.70%54, 72, 74, 88
   utils.ts62.90%7.14%100%78.72%28–32, 34–35, 39, 39–44, 47, 47, 47
src/Pattern
   Pattern.ts54.39%3.03%10%65.95%105–107, 113, 113–114, 117, 117–119, 119, 119–122, 130, 130–132, 132, 132, 132, 132, 132–138, 140–141, 143, 150, 150, 150, 150, 153–160, 160, 160–164, 174–175, 175, 175, 175–176, 176, 176–182, 182, 182, 182–183, 183, 183–188, 190–199, 204–205, 207–209, 211, 33, 37
src/brushes
   BaseBrush.ts78.67%8.33%14.29%88.55%110, 114, 114–115, 122, 122, 122, 122, 124–125, 130, 135, 143, 146, 155, 155, 155, 155, 155–160, 99
   CircleBrush.ts52.10%12.50%12.50%58.25%100–108, 108–118, 122, 130–139, 55, 67, 69, 76, 76, 78–79, 79, 83, 85–86, 92–98
   PatternBrush.ts97.06%87.50%100%100%21
   PencilBrush.ts91.06%82.35%100%93.81%122–123, 152, 152–154, 176, 176, 276, 280, 285–286, 68–69, 84–85
   SprayBrush.ts0%0%0%0%107, 107, 107, 107, 107–108, 110–111, 118–119, 121, 123–127, 136, 140–141, 141, 148, 148, 148–151, 153–156, 160–161, 163, 165–168, 17, 171, 178–179, 18, 181, 183–184, 186, 193–194, 196–197, 20, 200, 200, 207, 207, 21, 211, 22, 22, 22–24, 28, 32, 39, 46, 53, 60, 67, 84–86, 94–96, 98–99
src/canvas
   Canvas.ts72.56%29.67%76.79%84.67%1004, 1008, 1012–1013, 1018, 1022, 1031–1032, 1047, 1049, 1056, 1058, 1063–1068, 1105, 1126, 1128, 1130, 1137, 1140, 117, 1203–1207, 1249, 1252, 1260, 1285–1290, 1319–1320, 1337, 1382–1401, 1401–1404, 1406–1407, 1407–1412, 1414–1415, 1417, 1421, 1423–1424, 1426–1428, 1432, 1434–1438, 1441–1446, 1449–1451, 1454, 1456, 1468, 1470, 1477, 1479–1490, 1492–1495, 1495, 1497, 1501–1502, 1505–1506, 1509–1511, 1514, 1522, 183, 318, 323, 343, 354, 369, 388, 431, 443, 559–563, 566–567, 569, 579, 582–583, 585, 588–590, 602, 609–613, 615–620, 622–626, 659, 661, 668–672, 674–679, 681, 683–684, 686–689, 691–692, 703, 747, 783–786, 789, 791, 791, 794, 796, 798, 824, 830, 839–840, 844, 853, 870, 870, 886–887, 906, 932–933, 935–936, 938, 947–953, 956, 964–970, 972, 974, 995–996, 999
   CanvasOptions.ts100%100%100%100%
   SelectableCanvas.ts82.71%48.92%78.18%93.30%1012, 1021, 1089–1093, 1139–1140, 1142–1143, 1145, 1172, 1174–1175, 1175, 1177, 1213, 1216, 1218, 1220, 1236, 1238, 1242, 1245,

@asturur asturur merged commit 6b6a5fc into master Apr 30, 2024
22 checks passed
@asturur asturur deleted the add-jest-coverage branch April 30, 2024 11:51
@ShaMan123
Copy link
Contributor

It didn't work before because jest and instanbul don't play nicely together IIRC and report bogus data.
Are you sure the report is correct?

@asturur
Copy link
Member Author

asturur commented May 3, 2024

i can't say for sure, i would need to cover a new line to be sure.
But it brought up the coverage from 80 to where it was before i moved the tests from qunit to jest.

Mixing e2e and unit and visual test is anyway giving us a very generic idea of coverage. Probably a lot of lines are covered without asserts checking for them

Consider the few JEST only tests we have are giving 77% coverage that seems a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants