From 318ae17b28f0576ade0bf91d88c94f2f6419b59f Mon Sep 17 00:00:00 2001 From: Vladimir Sheremet Date: Fri, 12 Apr 2024 10:38:17 +0200 Subject: [PATCH] docs: add browser compatibility table to browser mode Closes #5347 --- docs/guide/browser.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/guide/browser.md b/docs/guide/browser.md index 316d783c5..e19dba6cc 100644 --- a/docs/guide/browser.md +++ b/docs/guide/browser.md @@ -6,6 +6,17 @@ title: Browser Mode | Guide This page provides information about the experimental browser mode feature in the Vitest API, which allows you to run your tests in the browser natively, providing access to browser globals like window and document. This feature is currently under development, and APIs may change in the future. +## Browser Compatibility + +Vitest uses [Vite dev server](https://vitejs.dev/guide/#browser-support) to run your tests, so we only support features specified in the [`esbuild.target`](https://vitejs.dev/config/shared-options.html#esbuild) option (`esnext` by default). + +By default, Vite targets browsers which support the native [ES Modules](https://caniuse.com/es6-module), native [ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta). On top of that, we utilize [`BroadcastChannel`](https://caniuse.com/?search=BroadcastChannel) to communicate between iframes: + +- Chrome >=87 +- Firefox >=78 +- Safari >=15.4 +- Edge >=88 + ## Motivation We developed the Vitest browser mode feature to help improve testing workflows and achieve more accurate and reliable test results. This experimental addition to our testing API allows developers to run tests in a native browser environment. In this section, we'll explore the motivations behind this feature and its benefits for testing. -- 2.51.2