Replies: 1 comment 4 replies
-
|
Memory profiling for browser tests is tricky. Here are some approaches: 1. Chrome DevTools Protocol (CDP) for Chromium Enable remote debugging and connect to take heap snapshots. 2. Performance observer in tests Track memory before/after each test using performance.memory (Chromium only) to identify tests that allocate significantly more memory. 3. For the birpc is closed error: This usually means the browser crashed. Try:
4. Binary search for problematic tests: Run subsets to narrow down which tests cause issues. 5. CI memory monitoring: Add a background job to log browser process memory usage over time. The Storybook test addon context makes standard profiling harder - consider a feature request on the Storybook repo for better memory debugging support. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am currently experiencing multiple issues with browser testing. We are using Vitest to run our Storybook interaction tests thanks to the addon they made to use Vitest's browser capability.
Sadly, after adding a lot of new tests, our CI is struggling and failing on WebKit mostly, and sometimes on Firefox.
When I look at our resource charts, we see that it goes to 100% easily, and I'm wondering if that's the cause:
We are running with:
isolate: falsefileParallelism: falseThis is to be faster, as we have a lot of tests and isolation is so slow... (even more on WebKit).
The issues I think we have are:
Caused by: Error: [birpc] rpc is closed, cannot call "createTesters")To identify some tests that might be using too much memory, I wanted to do some heap profiling using
--heap-profviaexecArgv, but from what I understand, it's stopped by this condition for browsers:vitest/packages/vitest/src/node/pool.ts
Lines 111 to 114 in 372e86f
I also found a reporter for Playwright that could help with memory/test analysis for the browser (https://github.com/cenfun/monocart-reporter?tab=readme-ov-file#monocart-reporter), but as it's a Playwright reporter, we are not able to use it. 😕
I've done some search on the vitest/playwright repositories to find eventual solutions, but hard to find one that would work for both.
Do you have any suggestions on how we could check memory usage or profile the browser tests to better find tests that are having issues?
Thanks in advance! 🙂
Beta Was this translation helpful? Give feedback.
All reactions