Skip to content

Test: Prototype shared Vite server for Node and jsdom projects - #82697

Closed
ciampo wants to merge 1 commit into
trunkfrom
codex/vitest-shared-server-cache
Closed

ciampo wants to merge 1 commit into
trunkfrom
codex/vitest-shared-server-cache

Conversation

@ciampo

@ciampo ciampo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What?

Follow up to #82687.

Prototype a nested Vitest project for the Node and jsdom suites so they inherit one configuration and share one Vite server. Browser Mode remains a separate project.

This also re-tests fsModuleCache; it is not enabled by this PR.

Why?

Node and jsdom currently build separate Vite module graphs. Vitest 5 can share a server between nested inline projects, but the first prototype rooted its referenced configuration under test/unit and discovered no integration tests.

How?

  • Add a repository-root proxy for the referenced Node/jsdom project container. This preserves the existing repository-relative include paths.
  • Move shared Vite and test options to the container, then keep the Node and jsdom projects inline so Vitest reuses one server.
  • Normalize nested project labels in routing checks and validate cleanup defaults in both configuration files.
  • Update the focused CI project selector. Browser Mode stays independent.
Benchmark notes

On the #82687 merge commit, five alternating runs used shard 1/8, four workers, seed 80855, and the same 134 files / 3,476 tests each time.

  • Separate servers: 52.4s median, 55.3s mean.
  • Shared server: 47.7s median, 59.2s mean.

The shared server improved the median by 9.0%, but two slow samples made the mean 7.0% worse. This remains a prototype rather than a stable performance claim.

A separate three-run warm-cache comparison improved both the median (42.6s vs 46.0s) and mean (43.9s vs 47.3s). However, priming took 97.0s, the single-shard cache occupied 84 MB across 5,959 files, and fsModuleCache does not support Browser Mode. It remains disabled.

Testing Instructions

  1. Run npm run test:unit:routing. Confirm it validates 1,071 Vitest files, with every test assigned exactly once.
  2. Run DEBUG=vitest:projects npm exec --no -- vitest list --config=test/unit/vitest.config.mjs --filesOnly. Confirm unit (jsdom) reuses the Vite server created for unit (node) and Browser Mode creates a separate server.
  3. Run npm run test:unit:vitest -- --project='unit (node)' test/unit/scripts/test/discover-test-files.test.js test/unit/scripts/test/test-infrastructure-policy.test.js.
  4. Run npm run test:unit:vitest -- --project='browser (chromium)'.
  5. Run npm run build and npm run typecheck.

Testing Instructions for Keyboard

Not applicable. This PR does not change UI behavior.

Screenshots or screencast

Not applicable.

Use of AI Tools

Codex was used to prototype the configuration, add tests, run benchmarks, and draft this PR. The resulting diff and verification output were reviewed before publication.

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

📦 Bundle size

Size Change: 0 B

Total Size: 8 MB

52a0d36 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 7624e29 trunk % Change
timeToFirstByte 48 ms +2.4% -2.08% 50.25 ms +5.67% -8.56% -4.48%
largestContentfulPaint 84 ms +7.14% -4.76% 86 ms +9.3% -6.98% -2.33%
lcpMinusTtfb 34.35 ms +23.29% -5.97% 34.5 ms +20.87% -9.13% -0.43%
wpBeforeTemplate 22.68 ms +3.84% -1.37% 23.37 ms +15.15% -5.61% -2.95%
wpTemplate 21.26 ms +3.06% -3.48% 21.49 ms +2.42% -4.93% -1.07%
wpTotal 44.25 ms +3.05% -1.69% 46.77 ms +6.18% -8.85% -5.39%
wpMemoryUsage 7.52 MB +0% -0% 7.48 MB +0% -0% 0.46%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric 7624e29 trunk % Change
timeToFirstByte 36.45 ms +2.61% -2.06% 36.3 ms +5.51% -1.79% 0.41%
largestContentfulPaint 88 ms +2.27% -0% 88 ms +4.55% -0% 0%
lcpMinusTtfb 52.05 ms +2.11% -1.92% 52.15 ms +0.77% -1.53% -0.19%
wpBeforeTemplate 20.58 ms +2.48% -1.51% 20.55 ms +1.85% -1.61% 0.15%
wpTemplate 12.75 ms +2.82% -2.59% 12.98 ms +2.08% -3.31% -1.77%
wpTotal 33.6 ms +2.44% -2.59% 33.38 ms +5.69% -1.38% 0.66%
wpMemoryUsage 5.51 MB +0% -0% 5.47 MB +0% -0% 0.64%
wpDbQueries 14 +0% -0% 14 +0% -0% 0%

media-processing

Metric 7624e29 trunk % Change
mediaProcessingJpeg 413.49 ms +1.5% -2.21% 409.92 ms +0.89% -0.83% 0.87%
mediaProcessingAvif 6273.37 ms +0.17% -0.44% 6249.14 ms +0.14% -0.01% 0.39%
mediaProcessingJpegToAvif 4294.79 ms +0.19% -0.07% 4289.03 ms +0.17% -0.06% 0.13%

media-upload

Metric 7624e29 trunk % Change
jpegUploadProcessing 1441.94 ms +36.45% -0.76% 1423.09 ms +0.93% -1.15% 1.32%
pngUploadProcessing 202.78 ms +4.2% -2.15% 199.42 ms +6.23% -3.32% 1.68%
largeJpegUploadProcessing 1415.59 ms +0.27% -0.44% 1407.31 ms +0.95% -0.21% 0.59%
multipleImageUploadProcessing 1582.59 ms +30.93% -1.23% 1564.78 ms +8.62% -0.51% 1.14%

post-editor

Metric 7624e29 trunk % Change
serverResponse 527.37 ms +3.04% -4.85% 528.81 ms +2.88% -2.59% -0.27%
firstPaint 228.57 ms +17.57% -6.76% 229.24 ms +14.46% -10.91% -0.29%
domContentLoaded 1372.5 ms +1.95% -1.46% 1350.13 ms +1% -2.15% 1.66%
loaded 1373.8 ms +1.96% -1.46% 1351.4 ms +1.01% -2.14% 1.66%
firstContentfulPaint 464.3 ms +1.51% -2.47% 443.02 ms +2.9% -1.89% 4.8%
firstBlock 3813.15 ms +2.64% -1.7% 3698.03 ms +0.91% -0.72% 3.11%
type 16.78 ms +2.09% -4.65% 16.53 ms +5.57% -2.3% 1.51%
typeWithoutInspector 16.25 ms +6.83% -0.92% 19.49 ms +17.65% -10.67% -16.62%
typeWithTopToolbar 19.37 ms +9.5% -0.98% 22.38 ms +5.63% -11.71% -13.45%
typeContainer 10.41 ms +9.32% -14.41% 10.35 ms +6.47% -6.57% 0.58%
focus 83.13 ms +6.29% -1.83% 86.86 ms +25.69% -5.48% -4.29%
firstFocus 178.6 ms +0% -0% 202.41 ms +0% -0% -11.76%
selectAll 634.77 ms +5.52% -2.72% 643.75 ms +3.66% -2.08% -1.39%
listViewOpen 75.59 ms +10.25% -5.24% 76.19 ms +21.97% -4.49% -0.79%
inserterOpen 26.17 ms +14.79% -6.57% 26.62 ms +6.84% -13.75% -1.69%
inserterHover 3.69 ms +9.49% -5.15% 4.61 ms +12.58% -11.5% -19.96%
inserterSearch 8.9 ms +6.85% -1.24% 9.26 ms +16.2% -2.92% -3.89%
loadPatterns 657.64 ms +0.93% -2% 677.98 ms +2.62% -7.23% -3%
wpTotal 517.01 ms +3.05% -4.96% 518.87 ms +2.61% -2.69% -0.36%
wpMemoryUsage 13.05 MB +0% -0% 13.02 MB +0% -0% 0.28%
wpDbQueries 54 +0% -1.85% 54 +0% -1.85% 0%

site-editor

Metric 7624e29 trunk % Change
serverResponse 301.01 ms +5.45% -7.71% 314.61 ms +1.09% -1.73% -4.32%
firstPaint 173.01 ms +9.81% -15.89% 173.8 ms +10.13% -11.24% -0.45%
domContentLoaded 1045.83 ms +0.5% -1.35% 1042.78 ms +0.71% -0.76% 0.29%
loaded 1046.81 ms +0.51% -1.35% 1043.76 ms +0.7% -0.74% 0.29%
firstContentfulPaint 333.4 ms +4.27% -5.03% 330.57 ms +2.15% -2.71% 0.86%
firstBlock 3320.52 ms +0.41% -0.76% 3305.11 ms +0.32% -0.5% 0.47%
type 12.42 ms +2.5% -5.07% 11.71 ms +9.91% -4.53% 6.06%
navigate 62.46 ms +26.18% -1.02% 67.95 ms +21.78% -13.44% -8.08%
loadPatterns 979.3 ms +1.99% -9.84% 988.45 ms +10.69% -2.55% -0.93%
loadPages 1034.8 ms +2.46% -0.6% 1037.86 ms +2.05% -1.69% -0.29%
wpTotal 292.88 ms +5.63% -7.94% 306.32 ms +1.01% -1.72% -4.39%
wpMemoryUsage 12.06 MB +0% -0% 12.03 MB +0% -0% 0.3%
wpDbQueries 43.5 +1.15% -1.15% 44 +0% -0% -1.14%

52a0d36 Run

🏁 Flaky tests

Show the failures

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

refuses the drop and uploads nothing in /test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js, passed after 1 failed attempt.
Error: expect(received).toHaveLength(expected)

Expected length: 0
Received length: 2
Received array:  [{"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=97"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/97", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-97", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-09-09T17:07:13", "date_gmt": "2026-09-09T17:07:13", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK-1.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK-1.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "10x10_e2e_test_image_z9T8jK-1.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK-1.png"}, "id": 97, "link": "http://localhost:8889/10x10_e2e_test_image_z9t8jk-2/", "media_details": {"file": "2026/09/10x10_e2e_test_image_z9T8jK-1.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-09-09T17:07:13", "modified_gmt": "2026-09-09T17:07:13", "ping_status": "closed", "post": null, "slug": "10x10_e2e_test_image_z9t8jk-2", "source_url": "http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK-1.png", "status": "inherit", "template": "", "title": {"rendered": "10x10_e2e_test_image_z9T8jK"}, "type": "attachment"}, {"_links": {"about": [{"href": "http://localhost:8889/wp-json/wp/v2/types/attachment"}], "author": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/users/1"}], "collection": [{"href": "http://localhost:8889/wp-json/wp/v2/media"}], "replies": [{"embeddable": true, "href": "http://localhost:8889/wp-json/wp/v2/comments?post=93"}], "self": [{"href": "http://localhost:8889/wp-json/wp/v2/media/93", "targetHints": {"allow": ["GET", "POST", "PUT", "PATCH", "DELETE"]}}]}, "alt_text": "", "author": 1, "caption": {"rendered": ""}, "class_list": ["post-93", "attachment", "type-attachment", "status-inherit", "hentry", "entry"], "comment_status": "open", "date": "2026-09-09T17:06:53", "date_gmt": "2026-09-09T17:06:53", "description": {"rendered": "<p class=\"attachment\"><a href='http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK.png'><img loading=\"lazy\" decoding=\"async\" width=\"10\" height=\"10\" src=\"http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK.png\" class=\"attachment-medium size-medium\" alt=\"\" style=\"width:100%;height:100%;max-width:10px;\" /></a></p>
"}, "featured_media": 0, "filename": "10x10_e2e_test_image_z9T8jK.png", "filesize": 80, "guid": {"rendered": "http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK.png"}, "id": 93, "link": "http://localhost:8889/10x10_e2e_test_image_z9t8jk/", "media_details": {"file": "2026/09/10x10_e2e_test_image_z9T8jK.png", "filesize": 80, "height": 10, "image_meta": {"alt": "", "aperture": "0", "camera": "", "caption": "", "copyright": "", "created_timestamp": "0", "credit": "", "focal_length": "0", "iso": "0", "keywords": [], "orientation": "0", "shutter_speed": "0", "title": ""}, "sizes": {}, "width": 10}, "media_type": "image", "meta": [], "mime_type": "image/png", "modified": "2026-09-09T17:06:53", "modified_gmt": "2026-09-09T17:06:53", "ping_status": "closed", "post": null, "slug": "10x10_e2e_test_image_z9t8jk", "source_url": "http://localhost:8889/wp-content/uploads/2026/09/10x10_e2e_test_image_z9T8jK.png", "status": "inherit", "template": "", "title": {"rendered": "10x10_e2e_test_image_z9T8jK"}, "type": "attachment"}]
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/single-file-placeholder-drop.spec.js:71:45

52a0d36 Run

@ciampo

ciampo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@WordPress/gutenberg-components @manzoorwanijk this PR was mostly a test to see if certain Vitest flags would result in faster test run, but it looks like they're mostly inconclusive

@ciampo ciampo closed this Sep 10, 2026
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