You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are eventually going to want to test in the browser, under ses, in an environment that's as close to what we'd expect in production as possible. vitest allows you to do this using its browser mode. I played around with doing this in #11, but punted until the future because I didn't want to rewrite existing JSDOM tests. Here's what I found:
For unit tests, the coverage provider has to be istanbul
We may as well switch to istanbul everywhere if possible.
Jest's ESM support sucks
([ref](jestjs/jest#9430)) and is held up on
some interminable issues related to Node VMs
([ref](nodejs/node#37648)). I was impressed
with `vite` and `vitest` following my experience implementing #8, and
after I discovered that `vitest` has a [browser mode for unit
tests](https://vitest.dev/guide/browser/#browser-mode)—which will
ultimately allow us to test under `ses` in an actual browser
environment—I was sold.
This migrates the entire repo from `jest` to `vitest`. They work very
similarly, except [`vitest` has a number of benefits over
`jest`](https://vitest.dev/guide/comparisons.html), such as not
polluting the global namespace by default. I tried running some tests
under `ses` with lockdown in the browser, and it worked perfectly.
However, it's held up on rewriting tests that rely on JSDOM, so we're
tracking that work in #12.
rekmarks
changed the title
Set up browser tests
test(extension,streams): Set up browser tests
Aug 11, 2024
Uh oh!
There was an error while loading. Please reload this page.
We are eventually going to want to test in the browser, under
ses
, in an environment that's as close to what we'd expect in production as possible.vitest
allows you to do this using its browser mode. I played around with doing this in #11, but punted until the future because I didn't want to rewrite existing JSDOM tests. Here's what I found:istanbul
istanbul
everywhere if possible.vitest
config appeared to work:The text was updated successfully, but these errors were encountered: