Skip to content

Update vitest, configure tests to run in chromium#55

Open
rsilivestr wants to merge 4 commits intohttptoolkit:mainfrom
rsilivestr:run-tests-in-chromium
Open

Update vitest, configure tests to run in chromium#55
rsilivestr wants to merge 4 commits intohttptoolkit:mainfrom
rsilivestr:run-tests-in-chromium

Conversation

@rsilivestr
Copy link
Copy Markdown

This PR allows to run tests without system-wide Chrome browser installation.

Resolves #54

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 26, 2026

CLA assistant check
All committers have signed the CLA.

@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 26, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedvitest@​3.2.4 ⏵ 4.1.296 +110079 +199100
Updated@​vitest/​browser@​3.2.4 ⏵ 4.1.2100 +210079 -199 +1100
Added@​vitest/​browser-playwright@​4.1.21001008699100

View full report

@pimterry
Copy link
Copy Markdown
Member

If you have a second can you sign the CLA above? Looks like you'll need to update the email used in your git commits to match your GitHub account first.

On a more practical note, this causes issues on my machine (Linux Mint) with these changes I get failures:

> react-reverse-portal@2.3.0 test
> vitest --run

Testing types with tsc and vue-tsc is an experimental feature.
Breaking changes might not follow SemVer, please pin Vitest's version when using it.

 RUN  v4.1.1 /home/tim/Dropbox/programming/http toolkit/react-reverse-portal

14:44:45 [vite] (client) Re-optimizing dependencies because lockfile has changed
 ❯  chromium  tests/svg.test.tsx (5 tests | 1 failed) 129ms
   ✓ all stories have tests 1ms
   ✓ WorksWithSVGs 11ms
   ✓ CanMoveContentAroundWithinSVGs 14ms
   × PersistDOMWhileMovingWithinSVGs 89ms
   ✓ CanPassAttributesOptionToCreateSvgPortalNode 13ms
 ❯  chromium  tests/html.test.tsx (12 tests | 1 failed) 1028ms
   ✓ all stories have tests 1ms
   ✓ RenderThingsInDifferentPlaces 11ms
   ✓ ExampleFromREADME 2ms
   ✓ PortalContainerElementAsSpanInParagraph 1ms
   ✓ SwapNodesBetweenDifferentLocations 15ms
   ✓ CanPassAttributesOptionToCreateHtmlPortalNode 14ms
   ✓ PortalContainerElementAsTr 14ms
   ✓ PersistComponentStateWhilstMoving 35ms
   ✓ CanSetPropsRemotelyWhilstMoving 37ms
   ✓ CanSwitchBetweenPortalsSafely 55ms
   ✓ RendersReliablyEvenWithFrequentChangesAndMultiplePortals  770ms
   × PersistDOMWhilstMoving 72ms

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 2 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL   chromium  tests/html.test.tsx > PersistDOMWhilstMoving
 FAIL   chromium  tests/svg.test.tsx > PersistDOMWhileMovingWithinSVGs
Error: Video failed to load: DEMUXER_ERROR_NO_SUPPORTED_STREAMS: FFmpegDemuxer: no supported streams
 ❯ HTMLVideoElement.onError tests/test-utils.ts:22:13
     20|     const onError = (e: Event) => {
     21|       cleanup();
     22|       reject(new Error(`Video failed to load: ${(e.target as HTMLVideoElement)?.error?.message || 'unknown error'}`));
       |             ^
     23|     };
     24|

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/2]⎯


 Test Files  2 failed (2)
      Tests  2 failed | 15 passed (17)
Type Errors  no errors
   Start at  14:44:45
   Duration  3.18s (transform 0ms, setup 1.21s, import 180ms, tests 1.16s, environment 0ms)

All passes fine for me on main.

Any idea why? If this is now using the bundled Chromium, I would've expected identical results in Linux CI here and on my local machine.

@rsilivestr
Copy link
Copy Markdown
Author

rsilivestr commented Mar 26, 2026

I wondered why CLA status didn't update... so this is email mismatch. Will fix it soon.

Seems like chromium binary does not include necessary codecs. Yet it works for me somehow. Have you updated playwright browsers before running tests (npx playwright install)?

@rsilivestr rsilivestr force-pushed the run-tests-in-chromium branch from 6098aea to 67cc776 Compare March 26, 2026 14:36
Removes system-level dependency on chrome browser
@rsilivestr rsilivestr force-pushed the run-tests-in-chromium branch from 67cc776 to b06a5db Compare March 26, 2026 14:42
@rsilivestr
Copy link
Copy Markdown
Author

Ran tests on Ubuntu 20.04 and Windows 10. In both cases all tests passed.

Fixes some tests failing due to missing video codecs
@rsilivestr
Copy link
Copy Markdown
Author

Okay. Figured it out. playwright@1.55.1 comes with Chromium 140.0.7339.186 (playwright build v1193) which misses necessary codecs. But since the project has no lockfile playwright@^1.55.1 resolves to latest minor version which is 1.58.2 as of now. It installs Chrome for Testing 145.0.7632.6 (playwright chromium v1208) which runs tests correctly.

Updated required playwright version. Should work now.

Also, is it a good idea to add npx playwright install chromium to presest script?

@pimterry
Copy link
Copy Markdown
Member

Also, is it a good idea to add npx playwright install chromium to presest script?

Good idea 👍

Okay. Figured it out. playwright@1.55.1 comes with Chromium 140.0.7339.186 (playwright build v1193) which misses necessary codecs. But since the project has no lockfile playwright@^1.55.1 resolves to latest minor version which is 1.58.2 as of now. It installs Chrome for Testing 145.0.7632.6 (playwright chromium v1208) which runs tests correctly.

Makes sense! Clearing node modules & reinstalling worked for me, but this is better.

Happy to merge with the pretest script

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.

Unable to run tests locally (missing Chrome system dependency)

3 participants