5 comments

  • c_s_guy39 days ago
    &gt; Fast execution... despite running in a real browser, which at first might seem like it would be slow - it is actually really fast.<p>What makes it fast?
    • 8n4vidtmkvmk39 days ago
      I&#x27;d also like a definition for &quot;fast&quot;. Because my unit tests run in 100ms. Is it that fast? Or &quot;fast&quot; for a browser test
  • gwynforthewyn39 days ago
    More options in the ecosystem seems better, but I was surprised to see this in the linked vitest docs:<p>&gt; However, to run tests in CI you need to install either playwright or webdriverio. We also recommend switching to either one of them for testing locally instead of using the default preview provider since it relies on simulating events instead of using Chrome DevTools Protocol.
  • syspec39 days ago
    I used to do this with Karma test runner. The best part was how it didn&#x27;t try to capture everything, so debugging with breakpoints was really easy.<p>I like Vitest browser mode, but it&#x27;s a pain to just &quot;detach&quot; for a specific frame and run that test in isolation, with my actual breakpoints.
  • throw231232139 days ago
    Using this, can I test canvas?<p>I have a React component that renders to a canvas (see &quot;DeckGL&quot;). The component renders data that it gets from the backend. So I&#x27;d need to mock API requests, then screenshot contents of the canvas.
    • ruined38 days ago
      yes, i&#x27;ve used vitest browser mode to test canvas operations. it&#x27;s designed to use &#x27;snapshots&#x27; which capture page state, not screenshots, but that can detect visual difference on the canvas.<p>if you&#x27;re performing GL operations you&#x27;ll need to pass options to your browser driver to enable GL (for playwright chromium it&#x27;s just `--enable-gpu`)<p>unfortunately, canvas rendering is sensitive enough to platform that you may have trouble matching snapshots between developer machines and&#x2F;or CI.
  • knallfrosch38 days ago
    Has anyone debugged Vitest Browser tests? Seems broken.
    • syspec38 days ago
      Yes! Completely agree! So hard to debug. Nearly impossible to set breakpoints (they disappear in refresh).