feature(test): add tests using Antigravity and Gemini 3 Pro#20
feature(test): add tests using Antigravity and Gemini 3 Pro#20
Conversation
|
@copilot Write a better description. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a comprehensive test suite using Vitest 3.2.4 for the git-rewrite-commits project. The changes include configuration setup, unit tests for provider classes (OpenAI and Ollama), integration tests for the main GitCommitRewriter class, and end-to-end CLI tests. Note that despite the PR title mentioning "Antigravity IDE" and "Gemini 3 Pro", these technologies are not referenced anywhere in the actual code changes - the PR simply adds standard Vitest-based testing infrastructure.
Key changes:
- Added Vitest configuration and test script to enable test execution
- Implemented comprehensive test coverage for OpenAI and Ollama providers with mocked dependencies
- Added tests for the main GitCommitRewriter class functionality including commit quality assessment and staged change generation
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Adds Vitest configuration with Node environment and test file glob pattern |
| tests/providers/openai.test.ts | Unit tests for OpenAIProvider with mocked OpenAI SDK |
| tests/providers/ollama.test.ts | Unit tests for OllamaProvider with mocked fetch calls |
| tests/index.test.ts | Integration tests for GitCommitRewriter class functionality |
| tests/cli.e2e.test.ts | End-to-end tests for CLI commands and git repository integration |
| src/providers/index.ts | Changes export to export type for AIProvider interface and removes trailing whitespace |
| package.json | Adds vitest dependency and test script, reorders dependencies alphabetically |
| package-lock.json | Updates lockfile with vitest and related dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| try { | ||
| await runCli('--provider openai', process.cwd(), { ...process.env, OPENAI_API_KEY: '' }); | ||
| // Should fail | ||
| expect(true).toBe(false); |
There was a problem hiding this comment.
Using expect(true).toBe(false) as a way to fail the test is unclear and could be confusing. Consider using expect.fail() or throw new Error('Expected to throw') to make the intent more explicit.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| "tsx": "^4.6.2", | ||
| "typescript": "^5.3.2", | ||
| "tsx": "^4.6.2" | ||
| "vitest": "^3.2.4" |
There was a problem hiding this comment.
Vitest 3.2.4 requires Node.js ^20.19.0 || >=22.12.0 (via its vite 7.x dependency), but this package specifies "node": ">=16.0.0" in its engines field (line 40). This version incompatibility will cause installation or runtime failures. Consider using an older version of vitest that supports Node.js 16+ (such as vitest 1.x or 2.x), or update the minimum Node.js requirement.
| "vitest": "^3.2.4" | |
| "vitest": "^2.4.5" |
| @@ -0,0 +1,85 @@ | |||
| import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; | |||
There was a problem hiding this comment.
Unused import afterEach.
| import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; | |
| import { describe, it, expect, vi, beforeEach } from 'vitest'; |
|
|
||
| describe('GitCommitRewriter', () => { | ||
| const mockExecSync = vi.mocked(execSync); | ||
| const mockFs = vi.mocked(fs); |
There was a problem hiding this comment.
Unused variable mockFs.
| const mockFs = vi.mocked(fs); |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Added tests using Google's new Antigravity IDE with Gemini 3 Pro model.