Skip to content

Commit 98dd23b

Browse files
committed
fix: robust test fix + CI serialization for integration tests
- Frontend: Clear setQueryData spy after mutateAsync so the assertion only catches the poll's call, not any optimistic onMutate update. - CI: Add --no-file-parallelism to Backend CI and pr-test-gate workflows instead of baking it into vitest.config.ts so local devs can still run fast parallel tests.
1 parent 948f51c commit 98dd23b

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
- name: Run Backend Tests
9797
run: |
9898
ls -la src/generated/prisma
99-
npx vitest run --coverage --reporter=basic
99+
npx vitest run --coverage --reporter=basic --no-file-parallelism
100100
working-directory: backend
101101
env:
102102
DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/flowfi_test

.github/workflows/pr-test-gate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/flowfi_test
6666

6767
- name: Run backend tests
68-
run: npm test
68+
run: npm test -- --no-file-parallelism
6969
working-directory: backend
7070
env:
7171
DATABASE_URL: postgresql://postgres:password@127.0.0.1:5432/flowfi_test

backend/vitest.config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,5 @@ export default defineConfig({
4343
// Run each test file in its own forked process so vi.mock() doesn't leak
4444
pool: 'forks',
4545
isolate: true,
46-
// Run files sequentially so integration tests sharing the same DB
47-
// don't clobber each other's cleanup (foreign key violations).
48-
fileParallelism: false,
4946
},
5047
});

frontend/src/hooks/useIncomingStreams.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ describe("useIncomingStreams hooks", () => {
111111
} as any);
112112
});
113113

114+
// Clear any calls made during mutation (e.g. optimistic update in
115+
// onMutate) so we only assert on the poll's setQueryData call.
116+
setQueryDataSpy.mockClear();
117+
114118
// Poll should find the updated stream (withdrawn 100 > 0) and call
115119
// setQueryData after ~1 s of simulated delay.
116120
await waitFor(() => {

0 commit comments

Comments
 (0)