#830·OpenCut

[BUG]

Author: LeminElyCreated Jul 1, 2026Updated Sep 8, 2026
Labelsbug

Platform

GitHub Actions runners (ubuntu-latest, windows-latest, macos-latest); also reproduced locally on Linux with bun 1.3.11 / moon 2.3.3

Browser

N/A — this is a CI / build-tooling bug, not browser-related

Current Behavior

moon ci fails on every push and pull request to main.

The test task in apps/web runs vitest run, which reuses vite.config.ts and therefore loads the Cloudflare Vite plugin (cloudflare({ viteEnvironment: { name: 'ssr' } })). That plugin configures a Worker SSR environment that is incompatible with Vitest, so Vitest throws during config resolution, before any test is collected. Because .github/workflows/bun-ci.yml runs moon ci, the whole pipeline is red.

Error:

⎯ Startup Error ⎯
Error: The following environment options are incompatible with the Cloudflare Vite plugin:
  - "ssr" environment: `resolve.external`: [ ... node builtins ... ]
To resolve this issue, avoid setting `resolve.external` in your Cloudflare Worker environments.
    at validateWorkerEnvironmentOptions (@cloudflare/vite-plugin/dist/index.mjs)
error: script "test" exited with code 1

Expected Behavior

moon ci passes. The web test task should run under an environment compatible with the app (jsdom) and succeed — including when there are no test files yet, instead of crashing the whole pipeline.

Recurrence Probability

Always

Steps To Reproduce

  1. cd apps/web
  2. bun install
  3. bun run test # this is what moon ci runs for apps/web:test
  4. Vitest crashes at startup and exits with code 1

Anything else?

Root cause: Vitest reuses vite.config.ts, which registers the Cloudflare Vite plugin; its Worker SSR environment conflicts with Vitest's own environment setup. Separately, there are no test files yet, so even without the plugin vitest run would exit non-zero ("No test files found").

Proposed fix: give Vitest a dedicated apps/web/vitest.config.ts isolated from the Cloudflare plugin, running in jsdom with passWithNoTests: true. After that, bun run test exits 0 and moon ci is green. jsdom and @testing-library/react are already devDependencies.

Minor related fix: apps/api/moon.yml declares outputs: ['dist'] but wrangler deploy --dry-run produces no dist; adding --outdir dist makes the declared output truthful.

I already have both fixes implemented and verified locally, and can open a small focused PR once a maintainer approves, per the contribution policy.