Turn document

Fix Forgejo CI terminal test mock alias

The final CI-only failure was a Next.js module-shape mismatch in the terminal test. I added the missing next/navigation.js alias so Forgejo can resolve the same named exports the full Bun test run expects.

Updated: 2026-05-30 01:48 EDT Beads: islandflow-3l6 Validation: targeted terminal test + full Bun suite passed

New Changes as of 2026-05-30 01:48 EDT

This update is the last missing piece after the earlier Bun PATH and redirect-mock fixes. Forgejo was still loading next/navigation.js directly in the terminal test, so Bun threw before the test body could run.

Summary of changes

Why this change was made

The previous mock covered next/navigation, but the full CI run resolved the explicit .js entry point. Without the alias, Bun reported a missing named export and aborted the test file.

Code diff

mock.module("next/navigation.js", () => ({
  default: {
    redirect,
    usePathname: () => "/options"
  },
  redirect,
  usePathname: () => "/options"
}));

Related issues or PRs

islandflow-3l6

Summary

The remaining Forgejo failure was inside the web test suite, not the install or typecheck stages. The terminal test needed to mock the Next.js navigation module under both import paths, so the final change keeps the CI runner from tripping over a named export mismatch.

Changes Made

Context

The repository already had the Bun executable path fix and the routes mock alias fix in place. The last failure surfaced only in the full CI-shaped test run, where Bun resolved the terminal module through next/navigation.js rather than the shorter specifier used in the local test path.

Important Implementation Details

Relevant Diff Snippets

Rendered with @pierre/diffs/ssr from the current working tree. It shows the new next/navigation.js alias in the terminal test.

apps/web/app/terminal.test.ts
+8
8 unmodified lines
9
10
11
12
13
14
8 unmodified lines
redirect,
usePathname: () => "/options"
}));
const {
NAV_ITEMS,
8 unmodified lines
9
10
11
12
13
14
15
16
17
18
19
20
21
22
8 unmodified lines
redirect,
usePathname: () => "/options"
}));
mock.module("next/navigation.js", () => ({
default: {
redirect,
usePathname: () => "/options"
},
redirect,
usePathname: () => "/options"
}));
const {
NAV_ITEMS,

Expected Impact for End-Users

Forgejo should stop failing on the terminal test's CI-only module resolution mismatch, which reduces false negative pipeline runs and makes it easier to trust the branch when the suite passes.

Validation

Issues, Limitations, and Mitigations

This fix is intentionally narrow. If another CI-only Next.js import path shows up later, the same pattern should be applied to the affected test file instead of broadening the mock surface globally. That keeps the failure signal honest and the test harness easy to reason about.

Follow-up Work