๐Ÿ“ฆ FuelLabs / fuels-ts

๐Ÿ“„ vitest.browser.config.mts ยท 77 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77import { nodePolyfills } from "vite-plugin-node-polyfills";
import type { ViteUserConfig } from "vitest/config";
import { mergeConfig, defineProject } from "vitest/config";

import sharedConfig from "./vitest.shared.config.mts";

const config: ViteUserConfig = {
  plugins: [
    nodePolyfills({
      globals: {
        process: true,
        Buffer: true,
        global: true,
      },
      include: [
        "crypto",
        "buffer",
        "fs",
        "events",
        "timers/promises",
        "util",
        "stream",
        "path",
        "fs",
        "os",
      ],
      overrides: {
        fs: "memfs",
      },
    }),
  ],
  optimizeDeps: {
    exclude: [
      "fsevents",
      "path-scurry",
      "@vitest/coverage-istanbul",
      "chromium-bidi",
    ],
    include: [
      "events",
      "timers/promises",
      "vite-plugin-node-polyfills/shims/buffer",
      "vite-plugin-node-polyfills/shims/global",
      "vite-plugin-node-polyfills/shims/process",
      "memfs",
      "path",
      "os",
      "crypto",
    ],
    entries: ["**/*.test.ts"],
  },
  test: {
    env: {
      LAUNCH_NODE_SERVER_PORT: "49342",
    },
    globalSetup: ["./vitest.global-browser-setup.ts"],
    coverage: {
      reportsDirectory: "coverage/environments/browser",
    },
    browser: {
      provider: "playwright",
      headless: true,
      enabled: true,
      // Avoids taking screenshots
      screenshotFailures: false,
      instances: [
        {
          browser: "chromium",
          headless: true,
        },
      ],
    },
  },
};

export default mergeConfig(sharedConfig, defineProject(config));