mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-27 19:52:49 +00:00
test(server): stub the background fetch in the no-upstream origin/main test
The test's checkout has a remote URL, which starts the background fetch, and it was the only one not stubbing runGitFetch, so it ran real git. A remote-ref event that lands during a fetch is buffered until the fetch ends, so on a loaded runner the second refresh arrived after the 1s waitFor. Under local CPU load it failed 12 of 20 runs before, 0 of 20 after.
This commit is contained in:
@@ -1006,7 +1006,13 @@ describe("WorkspaceGitService checkout observation", () => {
|
||||
branchMergeRef: null,
|
||||
upstreamStatus: null,
|
||||
}));
|
||||
const service = createService(watcher, { getCheckoutSnapshotFacts });
|
||||
// A remote URL starts the background fetch; keep it off the real git binary.
|
||||
const runGitFetch = vi.fn(async () => ({
|
||||
changes: [],
|
||||
nonRemoteRefsChanged: false,
|
||||
error: null,
|
||||
}));
|
||||
const service = createService(watcher, { getCheckoutSnapshotFacts, runGitFetch });
|
||||
const subscription = service.registerWorkspace({ cwd: REPO_CWD }, vi.fn());
|
||||
await vi.waitFor(() => {
|
||||
expect(getCheckoutSnapshotFacts).toHaveBeenCalledTimes(1);
|
||||
|
||||
Reference in New Issue
Block a user