Skip to content

Conversation

loujaybee
Copy link
Collaborator

@loujaybee loujaybee commented Jul 14, 2025

Renovate Jest Demo Setup

This PR sets up a comprehensive demo environment for showcasing how to use Renovate with AI assistance to resolve dependency upgrade breaking changes, specifically targeting Jest v29 to v30 migration.

🎯 Demo Purpose

Demonstrates the workflow of:

  1. Using Renovate CLI to create dependency upgrade pull requests
  2. Identifying breaking changes in test suites
  3. Using AI assistance to resolve compatibility issues
  4. Validating fixes through automated testing

📁 New Files Added

Demo Documentation

  • demos/fixing-renovate-dependencies.md - Complete sales engineer guide with step-by-step instructions for replicating the demo

Test Infrastructure

  • backend/catalog/jest.config.js - Jest configuration for the catalog service
  • backend/catalog/src/__tests__/utils.test.ts - Standard utility function tests
  • backend/catalog/src/__tests__/deprecated-matchers.test.ts - Tests using Jest v29 deprecated matchers that will break in v30

Supporting Code

  • backend/catalog/src/utils/movieUtils.ts - Movie utility functions for testing
  • backend/catalog/src/utils/dataProcessor.ts - Data processing utilities
  • backend/catalog/src/services/catalogService.ts - Catalog service implementation

CI/CD

  • .github/workflows/catalog-tests.yml - GitHub Action that runs tests on PRs and main branch pushes

⚙️ Configuration Updates

Renovate Configuration

  • renovate.json - Configured to target Jest dependencies specifically with automatic PR recreation
  • Focuses on Jest and @types/jest packages
  • Enables recreateClosed: true for demo repeatability

Development Environment

  • .devcontainer/devcontainer.json - Added Renovate CLI feature for easy access
  • .gitignore - Added entries for debug files (jest_debug.txt, renovate_debug.txt, etc.)

🚀 How to Use This Demo

For Sales Engineers:

  1. Run Renovate CLI to create Jest upgrade PR:

    export RENOVATE_TOKEN=$GH_CLI_TOKEN
    renovate --platform=github gitpod-samples/gitpodflix-demo
  2. Observe failing tests in the created PR due to deprecated Jest matchers

  3. Use AI assistance to resolve breaking changes by:

    • Copying test failures and error messages
    • Asking AI to update deprecated matchers to v30 equivalents
    • Applying suggested fixes
  4. Validate fixes through the GitHub Action that automatically runs tests

🧪 Test Strategy

The demo includes intentionally problematic tests using deprecated Jest matchers:

  • .toBeCalled() → should be .toHaveBeenCalled()
  • .toBeCalledWith() → should be .toHaveBeenCalledWith()
  • .toReturn() → should be .toHaveReturned()
  • .toThrowError() → should be .toThrow()

These will fail when Jest is upgraded to v30, providing realistic breaking changes for the demo.

📊 Expected Demo Flow

  1. ✅ Current state: Tests pass with Jest v29
  2. 🔄 Renovate creates Jest v30 upgrade PR
  3. ❌ GitHub Action shows failing tests due to deprecated matchers
  4. 🤖 AI assistance helps identify and fix compatibility issues
  5. ✅ Tests pass after applying AI-suggested fixes
  6. 🎉 Successful dependency upgrade with AI collaboration

🎬 Demo Value Proposition

  • Real-world scenario: Actual dependency management challenges
  • AI collaboration: Shows practical AI assistance for breaking changes
  • Automated validation: CI/CD integration ensures quality
  • Repeatable process: Can be demonstrated multiple times
  • Educational: Teaches both Renovate usage and AI-assisted development

This setup provides a complete, realistic demonstration of modern development workflows combining automated dependency management with AI-powered problem solving.

loujaybee and others added 6 commits July 14, 2025 11:18
- Install Jest v29.7.0 with TypeScript support
- Create comprehensive test suite using deprecated Jest v29 matcher syntax
- Add utility functions for movie data processing and validation
- Add catalog service with database operations
- All tests pass on Jest v29 but will break when upgraded to v30
- Demonstrates the gap that ONA fills in Renovate workflows

Breaking matchers included:
- toBeCalled → toHaveBeenCalled
- toBeCalledTimes → toHaveBeenCalledTimes
- toBeCalledWith → toHaveBeenCalledWith
- lastCalledWith → toHaveBeenLastCalledWith
- nthCalledWith → toHaveBeenNthCalledWith
- toReturn → toHaveReturned
- toReturnTimes → toHaveReturnedTimes
- toReturnWith → toHaveReturnedWith
- lastReturnedWith → toHaveLastReturnedWith
- nthReturnedWith → toHaveNthReturnedWith
- toThrowError → toThrow

Co-authored-by: ona-agent <[email protected]>

Co-authored-by: Ona <[email protected]>
- Add renovate.json configuration with Jest-focused settings
- Add npm run renovate script with --filter=<package> support
- Configure proper GitHub token usage via GH_CLI_TOKEN
- Add renovate debug files to .gitignore
- Enable dependency scanning for demo Step 2 completion
- Add ghcr.io/devcontainers-extra/features/renovate-cli:2 to devcontainer.json
- Ensures Renovate CLI is available in every environment startup
- Removes need for manual npm install -g renovate
- Add npm run renovate:jest command for creating Jest v30 PR only
- Merge main branch with renovate configuration
- Resolve renovate.json conflicts
- npm run renovate:jest now successfully creates Jest v30 PR
- Uses targeted config to only update Jest and @types/jest
- Removes rate limits for demo purposes
- Successfully created PR #57 for Jest v29→v30 upgrade
"setup": "./scripts/setup.sh"
"setup": "./scripts/setup.sh",
"renovate": "if [ \"$npm_config_live\" ]; then DRY_RUN_FLAG=\"\"; echo 'LIVE MODE: Will create actual pull requests'; else DRY_RUN_FLAG=\"--dry-run=full\"; echo 'DRY RUN MODE: No pull requests will be created (use --live to create PRs)'; fi && RENOVATE_TOKEN=$GH_CLI_TOKEN LOG_LEVEL=debug renovate --platform=github $DRY_RUN_FLAG gitpod-samples/gitpodflix-demo > renovate_debug.txt 2>&1 && echo 'Renovate scan complete! Check renovate_debug.txt for full output' && if [ \"$npm_config_filter\" ]; then echo 'Filtering results for:' $npm_config_filter && grep -i -A 20 -B 5 \"$npm_config_filter\" renovate_debug.txt; else echo 'Use --filter=<package> to filter results for specific dependency'; fi",
"renovate:jest": "echo 'Creating Jest v30 pull request...' && echo '{\"extends\":[],\"enabledManagers\":[\"npm\"],\"includePaths\":[\"backend/catalog/package.json\"],\"packageRules\":[{\"matchPackageNames\":[\"jest\",\"@types/jest\"],\"enabled\":true}],\"prConcurrentLimit\":0,\"prHourlyLimit\":0,\"branchConcurrentLimit\":0}' > renovate-jest-only.json && RENOVATE_TOKEN=$GH_CLI_TOKEN RENOVATE_CONFIG_FILE=renovate-jest-only.json renovate --platform=github gitpod-samples/gitpodflix-demo && rm renovate-jest-only.json"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Move commands to actual configuration file

- Remove regular renovate command, keep only renovate:jest
- Update renovate:jest to use static renovate.json configuration
- Update renovate.json to target Jest dependencies specifically
- Add demos/fixing-renovate-dependencies.md with sales engineer instructions
- Remove code comments from unit test files
- Clean up debug files and update .gitignore
@loujaybee loujaybee changed the title feat: add Jest v29 test suite with deprecated matchers for Renovate demo Add tests and renovate configuration for renovate demo Jul 14, 2025
- Remove renovate:jest npm script from package.json
- Update demo documentation to be more general about renovate CLI usage
- Include example command with GitHub token setup
- Make documentation less specific to Jest, more broadly applicable
- Runs on pull requests and main branch pushes
- Only triggers when catalog service files change
- Runs npm install and npm test for the catalog service
- Will show failing checks if unit tests fail
- Remove trailing comma after setup script
- This was causing npm install to fail in GitHub Actions
@loujaybee loujaybee marked this pull request as ready for review July 14, 2025 13:43
@loujaybee loujaybee merged commit 110c23f into main Jul 14, 2025
1 check passed
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