Skip to content

feat(testing): add Vitest config, tests, and CI workflow#16

Merged
kegren merged 1 commit intomainfrom
feat-add-vitest-tests-ci
Jan 1, 2026
Merged

feat(testing): add Vitest config, tests, and CI workflow#16
kegren merged 1 commit intomainfrom
feat-add-vitest-tests-ci

Conversation

@kegren
Copy link
Owner

@kegren kegren commented Jan 1, 2026

No description provided.

@greptile-apps
Copy link

greptile-apps bot commented Jan 1, 2026

Greptile Summary

This PR adds Vitest testing infrastructure with CI workflow automation, but contains two critical path errors that will cause tests to fail immediately. The vitest.config.ts references a non-existent setup file path, and the schema test imports from the wrong location. Once these are corrected, the testing setup follows standard practices with happy-dom environment and jest-dom matchers.

Key changes:

  • Added Vitest config with path resolution and happy-dom environment
  • Created CI workflow with lint, typecheck, and test steps
  • Added basic tests for todo schemas and utility functions
  • Updated package.json with test dependencies and new scripts
  • Added missing env vars to .env.example that are already in use

Confidence Score: 1/5

  • This PR has critical path errors that will cause tests to fail
  • Two critical syntax errors exist: incorrect setupFiles path in vitest.config.ts and wrong import path in the schema test file. These will cause immediate test failures when running bun test in CI
  • vitest.config.ts and tests/features/todo/schema.test.ts both have incorrect paths that must be fixed

Important Files Changed

Filename Overview
vitest.config.ts incorrect setupFiles path will cause tests to fail
tests/features/todo/schema.test.ts incorrect import path will cause import error
tests/lib/utils.test.ts basic tests for cn utility function look correct
.github/workflows/ci.yml CI workflow properly configured with lint, typecheck, and test steps
package.json added testing dependencies and new npm scripts for typecheck and lint

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub Actions
    participant Bun as Bun Runtime
    participant Vitest as Vitest
    participant Tests as Test Files
    
    Dev->>GH: Push to main or open PR
    GH->>Bun: Setup Bun runtime
    GH->>Bun: bun install --frozen-lockfile
    Bun->>Bun: Install dependencies (Vitest, happy-dom, jest-dom)
    GH->>Bun: bun lint
    Bun-->>GH: Biome lint results
    GH->>Bun: bun typecheck
    Bun-->>GH: TypeScript check results
    GH->>Bun: bun test
    Bun->>Vitest: Start Vitest runner
    Vitest->>Vitest: Load vitest.config.ts
    Vitest->>Vitest: Setup happy-dom environment
    Vitest->>Tests: Load tests/setup.ts (jest-dom)
    Vitest->>Tests: Run tests/lib/utils.test.ts
    Tests-->>Vitest: cn() test results
    Vitest->>Tests: Run tests/features/todo/schema.test.ts
    Tests-->>Vitest: Schema validation test results
    Vitest-->>Bun: Aggregated test results
    Bun-->>GH: Test summary
    GH-->>Dev: CI status (pass/fail)
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

plugins: [tsconfigPaths()],
test: {
environment: "happy-dom",
setupFiles: ["./src/test/setup.ts"],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: setupFiles path is incorrect - the file is at ./tests/setup.ts, not ./src/test/setup.ts

Suggested change
setupFiles: ["./src/test/setup.ts"],
setupFiles: ["./tests/setup.ts"],
Prompt To Fix With AI
This is a comment left during a code review.
Path: vitest.config.ts
Line: 8:8

Comment:
**syntax:** setupFiles path is incorrect - the file is at `./tests/setup.ts`, not `./src/test/setup.ts`

```suggestion
    setupFiles: ["./tests/setup.ts"],
```

How can I resolve this? If you propose a fix, please make it concise.

createTodoSchema,
deleteTodoSchema,
updateTodoSchema,
} from "@/features/todos/types/todo-types";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: import path is incorrect - the schemas are in @/features/todos/schema, not @/features/todos/types/todo-types

Suggested change
} from "@/features/todos/types/todo-types";
} from "@/features/todos/schema";
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/features/todo/schema.test.ts
Line: 6:6

Comment:
**syntax:** import path is incorrect - the schemas are in `@/features/todos/schema`, not `@/features/todos/types/todo-types`

```suggestion
} from "@/features/todos/schema";
```

How can I resolve this? If you propose a fix, please make it concise.

@kegren kegren merged commit 26b0081 into main Jan 1, 2026
1 of 2 checks passed
@kegren kegren deleted the feat-add-vitest-tests-ci branch January 1, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant