Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
499fbe1
test: require isolated web test globals
lawrencecchen Jul 25, 2026
36c99ec
fix: isolate web test module globals
lawrencecchen Jul 25, 2026
35340bd
test: cover shared web runner isolation
lawrencecchen Jul 25, 2026
a79e402
fix: share isolated web test runner
lawrencecchen Jul 25, 2026
f1e1f41
Auto-merged main into fix/founders-welcome-test-isolation on deployment.
lawrencecchen Jul 25, 2026
fc475d3
test: bound shared runner regression
lawrencecchen Jul 25, 2026
eff14c0
test: exercise shared runner discovery
lawrencecchen Jul 25, 2026
8ad567f
Fix current Swift warning regressions
lawrencecchen Jul 25, 2026
990bf08
fix: preserve Bun recursive discovery
lawrencecchen Jul 25, 2026
a091d21
fix: sort recursive web test discovery
lawrencecchen Jul 26, 2026
9bb1151
test: compare dock duration structurally
lawrencecchen Jul 26, 2026
df39455
Merge commit '990bf083e61d4704625d05502728d6f91343a52d' into task-int…
lawrencecchen Jul 26, 2026
9d03ceb
Merge commit '9bb1151f3c0e4b09c766ce57ab120103b03df96f' into task-int…
lawrencecchen Jul 26, 2026
164852e
fix: preserve option-only test discovery
lawrencecchen Jul 26, 2026
5b1372b
Merge commit '8ad567fa96a965b4920973677dfc1f126468321e' into task-int…
lawrencecchen Jul 26, 2026
ac0ccdd
fix: preserve optional and live test modes
lawrencecchen Jul 26, 2026
c9f82e6
Merge remote-tracking branch 'origin/main' into fix-founders-isolatio…
lawrencecchen Jul 26, 2026
34775fe
test: stabilize runner checks in agent mode
lawrencecchen Jul 26, 2026
7e092af
Fix current Swift warning regressions
lawrencecchen Jul 26, 2026
33a09c7
Merge commit '7e092af21a628ac7d7e54b8a5b599281cddb8b6b' into task-int…
lawrencecchen Jul 26, 2026
b340780
test: harden web runner cleanup
lawrencecchen Jul 26, 2026
5e26dd3
fix: fail closed on discovery errors
lawrencecchen Jul 26, 2026
f97af18
Fix Ghostty render-grid test stub link
lawrencecchen Jul 26, 2026
12ec8e1
Merge exact Ghostty package-test stub repair
lawrencecchen Jul 26, 2026
30965ce
fix: honor Bun discovery configuration
lawrencecchen Jul 26, 2026
24cc58a
Merge exact version-stable web runner repair
lawrencecchen Jul 26, 2026
3ed4fa8
fix: preserve zero-test discovery semantics
lawrencecchen Jul 26, 2026
f151bd3
test: allow concurrent Bun heading order
lawrencecchen Jul 26, 2026
b4a1ab2
Merge PR 8947 web runner output-order repair
lawrencecchen Jul 26, 2026
332431c
test: fence mock-isolated Bun execution
lawrencecchen Jul 26, 2026
7afcfd0
Fix deterministic web test toolchain
lawrencecchen Jul 26, 2026
0e9a179
test: cover Bun patch isolation boundary
lawrencecchen Jul 26, 2026
7a26db9
test: rely on executed Bun version guard
lawrencecchen Jul 26, 2026
20ee080
Merge PR 8948 integration review repairs
lawrencecchen Jul 26, 2026
17bf72e
Merge current main before integration gate
lawrencecchen Jul 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,7 @@ jobs:
run: bun run typecheck

- name: Web tests
# Explicit sorted file list: bun discovers test files in filesystem
# readdir order, which differs between Linux runners and local macOS,
# so an unpinned run exercises a file order no developer can
# reproduce. Sorted order makes CI failures replayable locally.
run: bun test $(ls tests/*.test.ts tests/*.test.tsx | sort)
run: bun run test

# Checks for in-app React webviews (currently the diff viewer; more cmux React
# surfaces will live alongside it).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,25 @@ struct TerminalDockKeyboardTransitionPlannerTests {

@Test("zero-duration interruption synthesizes a remaining-fraction duration")
func zeroDurationSynthesizesDuration() {
let visibleOccupancy: CGFloat = 220
let targetOccupancy: CGFloat = 34
let activeTargetOverlap: CGFloat = 336
let lastTransitionDuration: TimeInterval = 0.25
let remainingFraction =
abs(targetOccupancy - visibleOccupancy) / activeTargetOverlap
let expectedDuration =
lastTransitionDuration * TimeInterval(remainingFraction)
let plan = planner.plan(for: input(
targetOverlap: 0,
notificationDuration: 0,
visibleOccupancy: 220,
targetOccupancy: 34,
visibleOccupancy: visibleOccupancy,
targetOccupancy: targetOccupancy,
isAnimating: true,
activeTargetOverlap: 336,
lastTransitionDuration: 0.25
activeTargetOverlap: activeTargetOverlap,
lastTransitionDuration: lastTransitionDuration
))
guard case let .animate(duration) = plan else {
Issue.record("Expected a synthesized animation")
return
}

#expect(abs(duration - (0.25 * 186.0 / 336.0)) < 0.000_001)
#expect(plan == .animate(duration: expectedDuration))
}

@Test("tiny remaining distance applies directly when an old animation is active")
Expand Down
64 changes: 64 additions & 0 deletions tests/test_ci_self_hosted_guard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,68 @@ check_web_db_behavior_tests() {
echo "PASS: web DB behavior tests run through the discovery runner"
}

check_web_test_runner_wiring() {
local runner="$ROOT_DIR/web/scripts/run-tests.sh"
if [[ ! -f "$runner" ]]; then
echo "FAIL: shared web test runner is missing"
exit 1
fi

if ! grep -Fq '"test": "bash scripts/run-tests.sh"' "$ROOT_DIR/web/package.json"; then
echo "FAIL: web/package.json must expose the shared web test runner"
exit 1
fi

if ! awk '
/^ web-typecheck:/ { in_job=1; next }
in_job && /^ [^[:space:]#][^:]*:[[:space:]]*(#.*)?$/ { in_job=0 }
in_job && /- name: Web tests/ { in_step=1; next }
in_step && /^[[:space:]]*- name:/ { in_step=0 }
in_step && /^[[:space:]]*run:[[:space:]]*bun run test([[:space:]]|$)/ { saw_shared_runner=1 }
END { exit !saw_shared_runner }
' "$CI_FILE"; then
echo "FAIL: web-typecheck must use the shared local web test runner"
exit 1
fi

echo "PASS: CI and local web tests use the shared runner"
}

check_web_test_runner_behavior() {
local fixture_dir fixture_runner args_log expected_args
fixture_dir="$(mktemp -d)"
fixture_runner="$fixture_dir/web/scripts/run-tests.sh"
args_log="$fixture_dir/bun-args.log"
mkdir -p "$fixture_dir/web/scripts" "$fixture_dir/bin"
cp "$ROOT_DIR/web/scripts/run-tests.sh" "$fixture_runner"

cat > "$fixture_dir/bin/bun" <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
printf '%s\n' "$@" > "$CMUX_WEB_TEST_RUNNER_ARGS_LOG"
EOF
chmod +x "$fixture_dir/bin/bun"

if ! PATH="$fixture_dir/bin:/usr/bin:/bin" \
CMUX_WEB_TEST_RUNNER_ARGS_LOG="$args_log" \
/bin/bash "$fixture_runner"; then
rm -rf "$fixture_dir"
echo "FAIL: shared web test runner default discovery should execute"
exit 1
fi

expected_args=$'test\n--isolate'
if [[ "$(cat "$args_log")" != "$expected_args" ]]; then
echo "FAIL: shared web test runner must preserve Bun's default discovery with isolation"
cat "$args_log"
rm -rf "$fixture_dir"
exit 1
fi

rm -rf "$fixture_dir"
echo "PASS: shared web test runner delegates default discovery to Bun with isolation"
}

check_tmux_terminal_nightly_isolation() {
check_macos_runner "$TMUX_CORPUS_FILE" "terminal-nightly"

Expand Down Expand Up @@ -1027,4 +1089,6 @@ check_gui_smoke_unsupported_launch_handling
check_no_ci_xctest_skips
check_no_ci_swift_package_skips
check_web_db_behavior_tests
check_web_test_runner_wiring
check_web_test_runner_behavior
check_tmux_terminal_nightly_isolation
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"db:up": "bash scripts/db-local.sh up",
"db:url": "bash scripts/db-local.sh url",
"start": "next start",
"test": "bun test",
"test": "bash scripts/run-tests.sh",
"test:db:behavior": "bash scripts/run-db-behavior-tests.sh",
"typecheck": "tsgo --noEmit",
"lint": "eslint"
Expand Down
7 changes: 7 additions & 0 deletions web/scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

WEB_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$WEB_ROOT"

exec bun test --isolate "$@"
Comment thread
lawrencecchen marked this conversation as resolved.
Resolved
119 changes: 119 additions & 0 deletions web/tests/web-test-runner-isolation.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { expect, test } from "bun:test";
import { spawnSync } from "node:child_process";
import {
copyFileSync,
mkdirSync,
mkdtempSync,
rmSync,
writeFileSync,
} from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { fileURLToPath } from "node:url";

const webRoot = fileURLToPath(new URL("..", import.meta.url));
const runnerPath = fileURLToPath(
new URL("../scripts/run-tests.sh", import.meta.url),
);
const fixtureTestSource = `
import { test } from "bun:test";
test("fixture runs", () => {});
`;

test("shared web test runner isolates module mocks across files", () => {
Comment thread
lawrencecchen marked this conversation as resolved.
Resolved
const result = runChild(
process.execPath,
[
"run",
"test",
"--",
"--randomize",
"--seed=1",
"tests/feedback-route.test.ts",
"tests/founders-welcome-route.test.ts",
],
webRoot,
);

if (result.status !== 0) {
throw new Error(
`shared web test runner leaked module state:\n${result.output}`,
);
}
expect(result.output).toContain("tests/feedback-route.test.ts:");
expect(result.output).toContain("tests/founders-welcome-route.test.ts:");
expect(result.output).toContain("0 fail");
});

test("shared web test runner preserves recursive default discovery", () => {
const fixtureRoot = createRunnerFixture();
try {
mkdirSync(join(fixtureRoot, "tests", "nested"), { recursive: true });
writeFileSync(
join(fixtureRoot, "tests", "top-level.test.ts"),
fixtureTestSource,
);
writeFileSync(
join(fixtureRoot, "tests", "nested", "nested.test.ts"),
fixtureTestSource,
);

const result = runChild(
"/bin/bash",
["scripts/run-tests.sh"],
fixtureRoot,
);
if (result.status !== 0) {
throw new Error(
`shared web test runner skipped recursive discovery:\n${result.output}`,
);
}
expect(result.output).toContain("tests/top-level.test.ts:");
expect(result.output).toContain("tests/nested/nested.test.ts:");
} finally {
rmSync(fixtureRoot, { recursive: true, force: true });
}
});

test("shared web test runner fails when default discovery finds no tests", () => {
const fixtureRoot = createRunnerFixture();
try {
mkdirSync(join(fixtureRoot, "tests"));
const result = runChild(
"/bin/bash",
["scripts/run-tests.sh"],
fixtureRoot,
);
expect(result.status).not.toBe(0);
} finally {
rmSync(fixtureRoot, { recursive: true, force: true });
}
});

function createRunnerFixture(): string {
const fixtureRoot = mkdtempSync(join(tmpdir(), "cmux-web-test-runner-"));
mkdirSync(join(fixtureRoot, "scripts"));
copyFileSync(runnerPath, join(fixtureRoot, "scripts", "run-tests.sh"));
return fixtureRoot;
}

function runChild(
command: string,
args: string[],
cwd: string,
): { status: number | null; output: string } {
const result = spawnSync(command, args, {
cwd,
encoding: "utf8",
timeout: 30_000,
killSignal: "SIGKILL",
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
const output = [result.stdout, result.stderr].join("\n");

if (result.error) {
throw new Error(
`shared web test runner did not finish: ${result.error.message}\n${output}`,
);
}
return { status: result.status, output };
}