Skip to content

A desktop coding agent with free access to frontier models.

TypeScript
1.7 KB
Raw Blame
import { defineConfig } from "vitest/config";
import { fileURLToPath } from "node:url";
import { shouldPrepareSuite, suiteWorkerCount } from "./runner/stack-suite.ts";

const common = {
  environment: "node",
  testTimeout: 120_000,
};
const appSource = fileURLToPath(new URL("../apps/app/src/", import.meta.url));
const appResolve = {
  alias: [{ find: /^@\//, replacement: appSource }],
};

const prepareSuite = shouldPrepareSuite(process.argv);
const attachedDen = Boolean(process.env.OMNIRUSH_EVAL_DEN_API_URL?.trim());
const managedStack = prepareSuite && !attachedDen;
const e2eWorkers = managedStack ? suiteWorkerCount(process.argv, process.env) : 1;
const namedLiveSpec = process.argv.some((argument) => argument.endsWith(".live.test.ts") || argument.endsWith("/live.test.ts"));

export default defineConfig({
  test: {
    ...common,
    projects: [
      {
        resolve: appResolve,
        test: {
          ...common,
          name: "pr",
          // Live specs are attached-system incident signals: exclude them unless explicitly named.
          include: ["specs/**/*.test.ts", "../scenarios/**/*.test.ts"],
          exclude: ["**/*.e2e.test.ts", "**/e2e.test.ts", ...(namedLiveSpec ? [] : ["**/*.live.test.ts", "**/live.test.ts"])],
        },
      },
      {
        resolve: appResolve,
        test: {
          ...common,
          name: "e2e",
          fileParallelism: managedStack,
          maxWorkers: e2eWorkers,
          testTimeout: 600_000,
          hookTimeout: 600_000,
          globalSetup: ["./runner/prepare-stack.ts"],
          setupFiles: ["./runner/stack-env.ts"],
          include: ["specs/**/*.e2e.test.ts", "../scenarios/**/e2e.test.ts"],
        },
      },
    ],
  },
});