Skip to content

test(extension,streams): Set up browser tests #12

@rekmarks

Description

@rekmarks

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.
  • The following vitest config appeared to work:
const defaultConfig = getDefaultConfig();
delete defaultConfig.test?.environment;

export default mergeConfig(
  defaultConfig,
  defineConfig({
    test: {
      setupFiles: '../shims/dist/endoify.mjs',
      browser: {
        provider: 'playwright',
        name: 'chromium',
        enabled: true,
        headless: true,
      }
    },
  }),
);

Metadata

Metadata

Assignees

Labels

choreNot a feature, not documentation, but something we still have to do.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions