fix(ci): split unit/integration tests and fix landing test failures

- Separate unit tests (fast, no system deps) from integration test
  shards to prevent vi.mock db leakage across test types
- Fix hero test: update expected subtitle to match current copy
- Fix FAQ test: add missing json-ld alias in vitest config and mock
- Integration tests run in 4 parallel shards (30min timeout each)
This commit is contained in:
SnapOtter
2026-05-16 19:12:43 +08:00
parent d886cc2486
commit 1fb2802eea
4 changed files with 19 additions and 5 deletions
+13 -4
View File
@@ -42,8 +42,17 @@ jobs:
- uses: ./.github/actions/setup
- run: pnpm typecheck
test:
name: Test (${{ matrix.shard }}/4)
test-unit:
name: Unit Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: ./.github/actions/setup
- run: pnpm vitest run tests/unit/ --reporter=verbose
test-integration:
name: Integration (${{ matrix.shard }}/4)
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
@@ -65,7 +74,7 @@ jobs:
fi
- uses: ./.github/actions/setup
- run: pnpm vitest run --reporter=verbose --shard=${{ matrix.shard }}/4
- run: pnpm vitest run tests/integration/ --reporter=verbose --shard=${{ matrix.shard }}/4
pip-audit:
name: Python Dependency Audit
@@ -93,7 +102,7 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, typecheck, test]
needs: [lint, typecheck, test-unit, test-integration]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: ./.github/actions/setup
+1 -1
View File
@@ -41,7 +41,7 @@ describe("Hero", () => {
it("renders the subheadline", () => {
render(<Hero />);
expect(screen.getByText("Every image tool you need.")).toBeDefined();
expect(screen.getByText(/free, open-source image toolkit/)).toBeDefined();
});
it("renders the CTA button linking to GitHub", () => {
+4
View File
@@ -19,6 +19,10 @@ vi.mock("@/components/navbar", () => ({
Navbar: () => <nav data-testid="navbar" />,
}));
vi.mock("@/components/json-ld", () => ({
JsonLd: () => null,
}));
vi.mock("framer-motion", () => ({
motion: {
div: ({ children, ...props }: React.PropsWithChildren<Record<string, unknown>>) => (
+1
View File
@@ -81,6 +81,7 @@ export default defineConfig({
// Landing page components that don't exist in web but are imported via @/
"@/components/fade-in": path.resolve(__dirname, "apps/landing/src/components/fade-in"),
"@/components/footer": path.resolve(__dirname, "apps/landing/src/components/footer"),
"@/components/json-ld": path.resolve(__dirname, "apps/landing/src/components/json-ld"),
"@/components/navbar": path.resolve(__dirname, "apps/landing/src/components/navbar"),
"@": path.resolve(__dirname, "apps/web/src"),
"framer-motion": path.join(landingNodeModules, "framer-motion"),