-
Notifications
You must be signed in to change notification settings - Fork 0
Add CLI lifecycle integration tests with vitest #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,252 @@ | ||||||
| /** | ||||||
| * ObjectDocs CLI Lifecycle Integration Tests | ||||||
| * | ||||||
| * Verifies the complete end-user workflow: | ||||||
| * 1. Initialize a new project repository | ||||||
| * 2. Run `objectdocs init` to scaffold the documentation site | ||||||
| * 3. Create documentation content (MDX files, meta.json, config) | ||||||
| * 4. Run `objectdocs build` to produce a production build | ||||||
| * | ||||||
| * These tests use a shared temporary directory and run sequentially | ||||||
| * to mirror the real user experience. | ||||||
| */ | ||||||
|
|
||||||
| import { describe, it, expect, beforeAll, afterAll } from 'vitest'; | ||||||
| import { execSync, execFileSync } from 'child_process'; | ||||||
|
||||||
| import { execSync, execFileSync } from 'child_process'; | |
| import { execFileSync } from 'child_process'; |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MONOREPO_ROOT is declared but never used. Please remove it to avoid confusion about whether the tests depend on monorepo paths.
| const MONOREPO_ROOT = path.resolve(__dirname, '../../..'); |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runCli defaults to a 5-minute execFileSync timeout, but the vitest config allows 10 minutes. Long npm install / next build runs could be killed by the shorter process timeout even though the test timeout hasn’t elapsed. Consider bumping the default to match the vitest timeout (or threading it through from config).
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests rely on shared state across multiple it(...) blocks. To prevent future flakiness if vitest is configured to run tests concurrently, make the suite explicitly sequential (e.g., describe.sequential(...) or equivalent vitest sequencing config).
| describe('CLI Lifecycle: init → content → build', () => { | |
| describe.sequential('CLI Lifecycle: init → content → build', () => { |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { defineConfig } from 'vitest/config'; | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| testTimeout: 600_000, // 10 minutes for integration tests | ||
| hookTimeout: 600_000, | ||
| teardownTimeout: 30_000, | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
vitest(which requires Node >=20 per the lockfile) changes the effective Node baseline for this workspace/package, butpackage.jsondoesn’t declare anengines.noderange. Consider addingengines(and aligning CI/release, which currently uses Node 18) or pinning to a Vitest version compatible with the supported Node version.