Files
paseo/packages/app/vitest.config.ts
T

42 lines
1.5 KiB
TypeScript

import { defineConfig, configDefaults } from "vitest/config";
import path from "path";
const appNodeModules = path.resolve(__dirname, "node_modules");
const rootNodeModules = path.resolve(__dirname, "../../node_modules");
export default defineConfig({
test: {
environment: "node",
exclude: [...configDefaults.exclude, "e2e/**"],
/**
* Expo pulls in native tooling (xcode, etc.) that executes files relying on `process.send`.
* Vitest's default worker pool uses worker_threads, which intentionally stub that API and
* immediately throw `Unexpected call to process.send`. Running the suite in forked processes
* keeps `process.send` intact so the app tests can boot before hitting the intentional failures.
*/
pool: "forks",
server: {
deps: {
fallbackCJS: true,
inline: [
"zustand",
"@tanstack/react-query",
"react-native-web",
],
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
"@server": path.resolve(__dirname, "../server/src"),
// Point to the ESM build so Vite can transform its imports and apply the
// react alias below (the CJS build uses require('react') which bypasses
// Vite alias resolution).
"react-native": path.resolve(rootNodeModules, "react-native-web/dist/index.js"),
react: path.resolve(appNodeModules, "react"),
"react-dom": path.resolve(appNodeModules, "react-dom"),
},
},
});