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

test: enable test coverage #7789

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open

test: enable test coverage #7789

wants to merge 2 commits into from

Conversation

judofyr
Copy link
Contributor

@judofyr judofyr commented Nov 11, 2024

Description

This adds support for running tests with coverage, both locally and in CI.

What to review

Some suggestions:

  • Run the tests locally (in the form you typically run them) and see that this hasn't broken any of that.
  • Run the tests locally with coverage and see that you can get a report. It should work with just pnpm vitest run --coverage.
  • Look at the coverage report locally and maybe suggest if there are certain packages/paths which should be excluded.
  • Look at the GitHub Action and see if it makes sense. It's a bit complicated and I would appreciate suggestions for simplifications.

Testing

N/A. There's no changes in production code.

Notes for release

N/A. This is for internal development only.

@judofyr judofyr self-assigned this Nov 11, 2024
Copy link

vercel bot commented Nov 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:26pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:26pm
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:26pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:26pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 1:26pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Nov 11, 2024 1:26pm

Copy link

socket-security bot commented Nov 11, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] None 0 5.13 MB fb, mofeiz, react-bot, ...1 more
npm/[email protected] Transitive: filesystem +11 5.56 MB react-bot

🚮 Removed packages: npm/[email protected], npm/[email protected]

View full report↗︎

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Nov 11, 2024

Component Testing Report Updated Nov 11, 2024 1:23 PM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 48s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 32s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 38s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 19s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 46s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 49s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 20s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 27s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 20s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 38s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

Copy link
Contributor

github-actions bot commented Nov 11, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 34.65% 50136 / 144664
🔵 Statements 34.65% 50136 / 144664
🔵 Functions 45.64% 2435 / 5335
🔵 Branches 76.61% 8564 / 11178
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/store/_legacy/document/document-store.ts 45.37% 100% 16.66% 45.37% 37-46, 131-132, 134-141, 143-144, 150-157, 159-166, 168-169, 171-175, 177-195, 197-199
Generated in workflow #26925 for commit 795766b by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Nov 11, 2024

⚡️ Editor Performance Report

Updated Mon, 11 Nov 2024 13:25:23 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 16.7 efps (60ms) 17.5 efps (57ms) -3ms (-5.0%)
article (body) 59.3 efps (17ms) 59.9 efps (17ms) -0ms (-0.9%)
article (string inside object) 18.9 efps (53ms) 17.9 efps (56ms) +3ms (+5.7%)
article (string inside array) 15.4 efps (65ms) 15.4 efps (65ms) +0ms (-/-%)
recipe (name) 31.3 efps (32ms) 30.8 efps (33ms) +1ms (+1.6%)
recipe (description) 33.3 efps (30ms) 34.5 efps (29ms) -1ms (-3.3%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (7ms) +1ms (-/-%)
synthetic (title) 14.1 efps (71ms) 14.1 efps (71ms) +0ms (-/-%)
synthetic (string inside object) 14.3 efps (70ms) 13.9 efps (72ms) +2ms (+2.9%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 60ms 66ms 79ms 166ms 656ms 14.3s
article (body) 17ms 20ms 39ms 117ms 347ms 6.0s
article (string inside object) 53ms 55ms 58ms 181ms 268ms 8.0s
article (string inside array) 65ms 72ms 88ms 285ms 1070ms 9.7s
recipe (name) 32ms 34ms 41ms 85ms 0ms 10.0s
recipe (description) 30ms 32ms 34ms 56ms 0ms 6.0s
recipe (instructions) 6ms 8ms 9ms 24ms 0ms 3.4s
synthetic (title) 71ms 74ms 85ms 438ms 1578ms 15.6s
synthetic (string inside object) 70ms 74ms 85ms 372ms 1466ms 10.4s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 57ms 61ms 78ms 222ms 400ms 13.5s
article (body) 17ms 19ms 20ms 48ms 83ms 5.6s
article (string inside object) 56ms 59ms 75ms 130ms 321ms 8.6s
article (string inside array) 65ms 73ms 83ms 329ms 1059ms 9.6s
recipe (name) 33ms 35ms 39ms 71ms 0ms 10.7s
recipe (description) 29ms 30ms 32ms 55ms 0ms 5.8s
recipe (instructions) 7ms 8ms 9ms 10ms 0ms 3.2s
synthetic (title) 71ms 75ms 94ms 333ms 1720ms 16.0s
synthetic (string inside object) 72ms 75ms 86ms 547ms 1826ms 10.4s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

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.

1 participant