|
| 1 | +/// <reference types="@vitest/browser/providers/webdriverio" /> |
| 2 | + |
| 3 | +import path from "node:path"; |
| 4 | +import {defineConfig} from "vitest/config"; |
| 5 | +const __dirname = new URL(".", import.meta.url).pathname; |
| 6 | +import {nodePolyfills} from "vite-plugin-node-polyfills"; |
| 7 | +import topLevelAwait from "vite-plugin-top-level-await"; |
| 8 | +import {blsBrowserPlugin} from "../scripts/vite/plugins/blsBrowserPlugin.js"; |
| 9 | + |
| 10 | +export default defineConfig({ |
| 11 | + plugins: [ |
| 12 | + topLevelAwait(), |
| 13 | + blsBrowserPlugin(), |
| 14 | + nodePolyfills({ |
| 15 | + include: ["buffer", "process", "util", "string_decoder", "url", "querystring", "events"], |
| 16 | + globals: {Buffer: true, process: true}, |
| 17 | + protocolImports: true, |
| 18 | + }), |
| 19 | + ], |
| 20 | + test: { |
| 21 | + include: ["**/*.test.ts"], |
| 22 | + exclude: [ |
| 23 | + "**/*.node.test.ts", |
| 24 | + "**/node_modules/**", |
| 25 | + "**/dist/**", |
| 26 | + "**/lib/**", |
| 27 | + "**/cypress/**", |
| 28 | + "**/.{idea,git,cache,output,temp}/**", |
| 29 | + "**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*", |
| 30 | + ], |
| 31 | + setupFiles: [path.join(__dirname, "../scripts/vitest/setupFiles/customMatchers.ts")], |
| 32 | + reporters: ["default", "hanging-process"], |
| 33 | + coverage: { |
| 34 | + enabled: false, |
| 35 | + }, |
| 36 | + browser: { |
| 37 | + enabled: true, |
| 38 | + headless: true, |
| 39 | + ui: false, |
| 40 | + screenshotFailures: false, |
| 41 | + // Recommended provider is `playwright` but it's causing following error on CI |
| 42 | + // Error: Failed to connect to the browser session "af5be85a-7f29-4299-b680-b07f0cfc2520" within the timeout. |
| 43 | + // TODO: Debug the issue in later versions of playwright and vitest |
| 44 | + provider: "webdriverio", |
| 45 | + connectTimeout: 90_0000, |
| 46 | + instances: [ |
| 47 | + // TODO: Add support for webkit when available |
| 48 | + // Invalid types from webdriverio for capabilities |
| 49 | + { |
| 50 | + browser: "firefox", |
| 51 | + maxConcurrency: 1, |
| 52 | + capabilities: { |
| 53 | + browserVersion: "stable", |
| 54 | + }, |
| 55 | + } as never, |
| 56 | + // Invalid types from webdriverio for capabilities |
| 57 | + { |
| 58 | + browser: "chrome", |
| 59 | + maxConcurrency: 1, |
| 60 | + capabilities: { |
| 61 | + browserVersion: "stable", |
| 62 | + }, |
| 63 | + } as never, |
| 64 | + ], |
| 65 | + }, |
| 66 | + }, |
| 67 | + resolve: { |
| 68 | + alias: { |
| 69 | + "node:perf_hooks": path.join(__dirname, "../scripts/vitest/polyfills/perf_hooks.js"), |
| 70 | + }, |
| 71 | + }, |
| 72 | + optimizeDeps: { |
| 73 | + include: [ |
| 74 | + "vite-plugin-node-polyfills/shims/buffer", |
| 75 | + "vite-plugin-node-polyfills/shims/global", |
| 76 | + "vite-plugin-node-polyfills/shims/process", |
| 77 | + ], |
| 78 | + }, |
| 79 | +}); |
0 commit comments