This document describes how to test ObjectDocs across different scenarios and environments.
ObjectDocs provides multiple test scripts to validate the complete lifecycle of documentation site creation, from initialization to production deployment.
Purpose: Comprehensive end-to-end test covering the entire ObjectDocs workflow.
What it tests:
- ✅ Project initialization (
pnpm init) - ✅ CLI installation (
@objectdocs/cli) - ✅ ObjectDocs initialization (
objectdocs init) - ✅ Content creation (MDX files, configuration)
- ✅ Development server startup and accessibility
- ✅ Production build compilation
- ✅ Production server startup and accessibility
Usage:
./test-site.shDuration: ~2-5 minutes (includes server startup tests)
Requirements:
- Node.js
- pnpm
- curl (for HTTP testing)
- Available port 7777
timeoutcommand (Linux) orgtimeout(macOS via homebrew:brew install coreutils)- Note: Test will run without timeout protection if command is not available
Output: Detailed step-by-step progress with color-coded success/failure indicators.
Purpose: Fast CI/CD-friendly test that validates build process without running servers.
What it tests:
- ✅ Project initialization
- ✅ CLI installation
- ✅ ObjectDocs initialization
- ✅ Content creation
- ✅ Build compilation
- ✅ Build output verification
Usage:
./test-quick.shDuration: ~1-2 minutes
Requirements:
- Node.js
- pnpm
Output: Minimal output focused on build success.
Purpose: Validates the example starter template structure and configuration.
What it tests:
- ✅ package.json configuration
- ✅ Content directory structure
- ✅ Configuration files (docs.site.json, meta.json)
- ✅ MDX frontmatter validity
- ✅ Dependencies installation
- ✅ Vercel configuration
- ✅ .gitignore setup
Usage:
cd examples/starter
./validate.shDuration: < 10 seconds
Requirements: None (static file validation only)
When working on ObjectDocs itself:
# In the monorepo root
pnpm install
pnpm build
# Run comprehensive test
./test-site.shFor automated testing in CI/CD pipelines:
# Quick test (recommended for CI)
./test-quick.sh
# Or full test if time permits
./test-site.shAdd to your CI configuration:
# .github/workflows/test.yml
- name: Run ObjectDocs tests
run: |
chmod +x ./test-quick.sh
./test-quick.shTo test as an end user would experience it (outside monorepo):
# Create a temporary directory
mkdir /tmp/objectdocs-standalone-test
cd /tmp/objectdocs-standalone-test
# Initialize project
pnpm init -y
# Install CLI from npm (or local tarball)
pnpm add -D @objectdocs/cli
# Configure scripts
cat > package.json << 'EOF'
{
"name": "test-site",
"scripts": {
"dev": "objectdocs dev",
"build": "objectdocs build",
"start": "objectdocs start"
},
"devDependencies": {
"@objectdocs/cli": "latest"
}
}
EOF
# Initialize ObjectDocs
pnpm objectdocs init
# Create content
mkdir -p content/docs
# ... add your content files
# Test
pnpm build
pnpm startFor pre-release testing:
# In the monorepo
cd packages/cli
pnpm pack
# Creates objectdocs-cli-X.X.X.tgz
# In a test directory
mkdir /tmp/test-tarball
cd /tmp/test-tarball
pnpm init -y
pnpm add -D ../../packages/cli/objectdocs-cli-X.X.X.tgz
# Continue with normal setupWhen preparing for a release, manually verify:
-
pnpm objectdocs initcreates.fumadocsdirectory -
pnpm devstarts development server on port 7777 - Hot reload works when editing MDX files
- Hot reload works when editing
meta.json - Hot reload works when editing
docs.site.json
-
pnpm buildcompletes without errors - Build output is created in
content/.fumadocs/.next - No TypeScript errors
- No ESLint errors (if configured)
-
pnpm startruns the production build - All pages are accessible
- Navigation works correctly
- Search functionality works (if enabled)
- Dark mode toggle works
- MDX frontmatter is parsed correctly
- Code blocks render with syntax highlighting
- Callouts and custom components render
- Internal links work
- External links work
- Images load correctly
- Branding (name, logo) appears correctly
- Navigation links appear in header
- Sidebar structure matches
meta.json - SEO meta tags are generated
Solution:
# Kill any process using port 7777
lsof -ti:7777 | xargs kill -9
# Or use a different port
PORT=8888 ./test-site.shCause: Build taking longer than 5 minutes.
Solution: Increase BUILD_TIMEOUT in test script or check for build errors:
cd /tmp/objectdocs-test-*
pnpm buildCause: CLI not finding the site package.
Solution: Ensure you've built the monorepo first:
cd /home/runner/work/objectdocs/objectdocs
pnpm install
pnpm buildCause: Port conflict or build error.
Solution: Check the server logs:
cat /tmp/dev-server.logRun tests with verbose output:
# Enable bash debug mode
bash -x ./test-site.sh
# Or add set -x to the script temporarily- ✅ CLI installation and initialization
- ✅ Content creation workflow
- ✅ Development server functionality
- ✅ Production build process
- ✅ Production server functionality
- ✅ Configuration file validation
- ✅ MDX file parsing
⚠️ Translation features (objectdocs translate)⚠️ Interactive UI components⚠️ Search functionality⚠️ Browser-based E2E tests⚠️ Multiple language support⚠️ Theme customization
When adding new features to ObjectDocs, please:
- Update test scripts if the feature affects the core workflow
- Add manual test steps to this document
- Document new configuration that should be validated
- Add edge cases to the test suite
- Create the script in the root directory
- Make it executable:
chmod +x test-name.sh - Document it in this file
- Add it to CI configuration if appropriate
All test scripts should:
- Use
set -eto exit on errors - Include color-coded output
- Clean up temporary files on exit
- Provide clear success/failure messages
- Include a summary section
- Be idempotent (can run multiple times safely)
- examples/starter/TESTING.md - Standalone testing guide
- examples/starter/validate.sh - Template validation script
- README.md - Main project documentation