diff --git a/web/src/tests/mocks/buffer-shim.ts b/web/src/tests/mocks/buffer-shim.ts new file mode 100644 index 00000000..076280d7 --- /dev/null +++ b/web/src/tests/mocks/buffer-shim.ts @@ -0,0 +1,2 @@ +import { Buffer } from 'buffer'; +export default Buffer; diff --git a/web/src/tests/mocks/global-shim.ts b/web/src/tests/mocks/global-shim.ts new file mode 100644 index 00000000..a91bc1e3 --- /dev/null +++ b/web/src/tests/mocks/global-shim.ts @@ -0,0 +1 @@ +export default globalThis; diff --git a/web/src/tests/mocks/process-shim.ts b/web/src/tests/mocks/process-shim.ts new file mode 100644 index 00000000..2e404777 --- /dev/null +++ b/web/src/tests/mocks/process-shim.ts @@ -0,0 +1 @@ +export default { env: {} }; diff --git a/web/vite.config.ts b/web/vite.config.ts index 9fc7f2fb..efe8d35e 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -10,6 +10,11 @@ export default defineConfig(() => ({ globals: true, environment: 'jsdom', setupFiles: './src/tests/setup.ts', + alias: { + 'vite-plugin-node-polyfills/shims/buffer': path.resolve(__dirname, './src/tests/mocks/buffer-shim.ts'), + 'vite-plugin-node-polyfills/shims/global': path.resolve(__dirname, './src/tests/mocks/global-shim.ts'), + 'vite-plugin-node-polyfills/shims/process': path.resolve(__dirname, './src/tests/mocks/process-shim.ts'), + }, }, server: { host: "::",