mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
* fix(tests): run React tests from production shells Vitest preserves an inherited NODE_ENV, selecting React without its test APIs. Pin the environment before dependency resolution and worker startup in both test entry points. Co-authored-by: Ivan Malison <IvanMalison@gmail.com> * test(app): expect zero edits for a pure staged rename The rename patch correction on main preserves unchanged content. Keep the discard journey intact and update its obsolete added-line assertion. --------- Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: Ivan Malison <IvanMalison@gmail.com>
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { configDefaults, defineConfig } from "vitest/config";
|
|
|
|
// React's test APIs require its development build, even in a production shell.
|
|
process.env.NODE_ENV = "test";
|
|
|
|
const appDir = path.resolve(__dirname, "packages/app");
|
|
const appNodeModules = path.resolve(appDir, "node_modules");
|
|
const rootNodeModules = path.resolve(__dirname, "node_modules");
|
|
const resolvePackageEntry = (packageName: string) => {
|
|
const appPackagePath = path.resolve(appNodeModules, packageName);
|
|
return fs.existsSync(appPackagePath)
|
|
? appPackagePath
|
|
: path.resolve(rootNodeModules, packageName);
|
|
};
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
extensions: [
|
|
".web.mjs",
|
|
".web.js",
|
|
".web.mts",
|
|
".web.ts",
|
|
".web.jsx",
|
|
".web.tsx",
|
|
".mjs",
|
|
".js",
|
|
".mts",
|
|
".ts",
|
|
".jsx",
|
|
".tsx",
|
|
".json",
|
|
],
|
|
alias: [
|
|
{
|
|
find: /^@getpaseo\/relay\/e2ee$/,
|
|
replacement: path.resolve(__dirname, "packages/relay/src/e2ee.ts"),
|
|
},
|
|
{
|
|
find: /^@getpaseo\/relay$/,
|
|
replacement: path.resolve(__dirname, "packages/relay/src/index.ts"),
|
|
},
|
|
{ find: "@", replacement: path.resolve(appDir, "src") },
|
|
{ find: "@server", replacement: path.resolve(__dirname, "packages/server/src") },
|
|
{
|
|
find: "react-native",
|
|
replacement: path.resolve(rootNodeModules, "react-native-web/dist/index.js"),
|
|
},
|
|
{ find: "react", replacement: resolvePackageEntry("react") },
|
|
{ find: "react-dom", replacement: resolvePackageEntry("react-dom") },
|
|
{
|
|
find: /^@xterm\/addon-ligatures\/lib\/addon-ligatures\.mjs$/,
|
|
replacement: path.resolve(appDir, "test-stubs/xterm-addon-ligatures.ts"),
|
|
},
|
|
{
|
|
find: /^@xterm\/addon-ligatures$/,
|
|
replacement: path.resolve(appDir, "test-stubs/xterm-addon-ligatures.ts"),
|
|
},
|
|
],
|
|
},
|
|
test: {
|
|
// Fake-timer suites freeze p-throttle's clock, so a real per-second cap deadlocks them.
|
|
env: {
|
|
PASEO_GIT_MAX_PROCESSES_PER_SECOND: "10000",
|
|
},
|
|
exclude: [...configDefaults.exclude, "**/.claude/**", "**/.dev/**"],
|
|
},
|
|
});
|