forked from Lundalogik/lime-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest-setup-browser.ts
More file actions
20 lines (19 loc) · 843 Bytes
/
vitest-setup-browser.ts
File metadata and controls
20 lines (19 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Suppress unhandled rejections from the icon Cache API.
// The CacheStorageIconCache tries to cache icon SVGs via the Cache API,
// but in the test environment the icon URLs don't resolve, causing
// "Failed to execute 'add' on 'Cache': Request failed" errors.
// The icons still render (via in-memory fallback), so these are harmless.
window.addEventListener('unhandledrejection', (event) => {
if (
event.reason instanceof TypeError &&
event.reason.message.includes("Failed to execute 'add' on 'Cache'")
) {
event.preventDefault();
}
});
// Load Stencil components for browser e2e tests.
// The dist/ directory is built by `stencil-test` before Vitest runs,
// so this path is guaranteed to exist at test time.
export const _components = await import(
'./dist/lime-elements/lime-elements.esm.js'
);