Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .changeset/quiet-windows-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 2 additions & 2 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ jobs:
- name: Theme contrast check
run: bun run test:theme-contrast

- name: Test suite
run: bun run test
- name: Windows platform test suite
run: bun run test:windows

compiled-headless-portability:
name: Compiled headless portability (${{ matrix.os }})
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"release:version": "bun run ./scripts/release/changeset-version.ts",
"prepare": "simple-git-hooks",
"test": "bun run ./scripts/test/run-test-suite.ts",
"test:windows": "bun run ./scripts/test/run-test-suite.ts --group=windows && bun run ./scripts/test/run-test-suite.ts --group=windows-ui",
"test:theme-contrast": "bun test packages/hunk/src/ui/themes.test.ts --test-name-pattern contrast",
"test:integration": "bun run ./scripts/test/run-test-suite.ts --group=integration",
"test:session-broker-node": "bun run ./scripts/test/test-session-broker-node.ts",
Expand Down
10 changes: 10 additions & 0 deletions scripts/test/run-test-suite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ describe("test suite sharding", () => {
group: "integration",
patterns: TEST_PATTERN_GROUPS.integration,
});
expect(resolveTestInvocation(["--group=windows", "--rerun-each=2"])).toEqual({
forwardedArgs: ["--path-ignore-patterns=**/packages/hunk/src/ui/**", "--rerun-each=2"],
group: "windows",
patterns: TEST_PATTERN_GROUPS.windows,
});
expect(resolveTestInvocation(["--group=windows-ui"])).toEqual({
forwardedArgs: [],
group: "windows-ui",
patterns: TEST_PATTERN_GROUPS["windows-ui"],
});
expect(resolveTestInvocation([]).group).toBe("default");
expect(() => resolveTestInvocation(["--group=missing"])).toThrow("Unknown test group: missing");
expect(() => resolveTestInvocation(["--group=toString"])).toThrow(
Expand Down
16 changes: 15 additions & 1 deletion scripts/test/run-test-suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,22 @@ import { availableParallelism } from "node:os";
export const TEST_PATTERN_GROUPS = {
default: ["./packages", "./scripts", "./examples", "./test/cli", "./test/session"],
integration: ["./test/pty"],
windows: ["./packages", "./scripts", "./examples", "./test/cli", "./test/session"],
"windows-ui": [
"./packages/hunk/src/ui/diff/worker/highlightWorkerClient.test.ts",
"./packages/hunk/src/ui/lib/openInEditor.test.ts",
"./packages/hunk/src/ui/lib/workspaceWriteGuard.test.ts",
],
} as const;

export const DEFAULT_TEST_PATTERNS = TEST_PATTERN_GROUPS.default;
export type TestPatternGroup = keyof typeof TEST_PATTERN_GROUPS;

const TEST_GROUP_RUNNER_ARGS: Partial<Record<TestPatternGroup, readonly string[]>> = {
// Linux covers terminal UI semantics; Windows runs its focused UI boundaries separately.
windows: ["--path-ignore-patterns=**/packages/hunk/src/ui/**"],
};

const MAX_AUTOMATIC_TEST_SHARDS = 2;
const MAX_EXPLICIT_TEST_SHARDS = 64;
const SHARD_TERMINATION_GRACE_MS = 1_000;
Expand Down Expand Up @@ -74,7 +85,10 @@ export function resolveTestInvocation(args: string[]) {
}

return {
forwardedArgs: args.filter((arg) => !arg.startsWith("--group=")),
forwardedArgs: [
...(TEST_GROUP_RUNNER_ARGS[group] ?? []),
...args.filter((arg) => !arg.startsWith("--group=")),
],
group,
patterns: TEST_PATTERN_GROUPS[group],
};
Expand Down
5 changes: 5 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ test/
| Command | Coverage |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| `bun run test` | `packages/`, `scripts/`, `examples/`, `test/cli/`, and `test/session/`, as defined by `scripts/test/run-test-suite.ts` |
| `bun run test:windows` | Windows platform, process, VCS, CLI, and packaging coverage; Linux owns the terminal UI semantic suite |
| `bun test ./test/review-conformance` | Shared review fixtures and registered consumer projections |
| `bun run test:session-broker-node` | Real Node listener/adapter conformance using the checked-in cross-runtime fixtures |
| `bun run test:integration` | PTY-backed tests under `test/pty/` |
Expand All @@ -46,3 +47,7 @@ test/
The dedicated trees are not selected directly by `bun run test`, though package tests import some
shared runtime fixtures. Run the commands that match the changed behavior; omission from the default
suite does not mean another command covers it.

The Windows suite omits the platform-neutral terminal UI semantic tree, which the Linux suite covers,
then runs the focused UI tests for worker startup, editor commands, and workspace path safety. Add new
UI tests to the `windows-ui` group when their behavior depends on Windows platform boundaries.
Loading