more unit testing
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m13s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 1m13s
This commit is contained in:
@@ -87,45 +87,30 @@ jobs:
|
||||
run: npm run lint # Run the linter to check for code quality issues.
|
||||
continue-on-error: true # Allows the workflow to proceed even if linting fails.
|
||||
|
||||
- name: Run Unit Tests
|
||||
# We override the production DB variables for this step only.
|
||||
# The 'global-setup.ts' will use these to connect to the test database,
|
||||
# create the schema, and seed data before tests run.
|
||||
env:
|
||||
DB_HOST: ${{ secrets.DB_HOST }}
|
||||
DB_PORT: ${{ secrets.DB_PORT }}
|
||||
DB_USER: ${{ secrets.DB_USER }}
|
||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||
DB_DATABASE: "flyer-crawler-test" # Hardcode the test database name
|
||||
DB_NAME: "flyer-crawler-test" # REQUIRED: Used by connection.ts to match the test setup
|
||||
run: npm test # Run the test suite against the temporary test database.
|
||||
# also Run the test suite to ensure code correctness.
|
||||
|
||||
- name: Run Integration Tests
|
||||
# This step runs tests that require a live backend server.
|
||||
- name: Run All Tests and Generate Merged Coverage Report
|
||||
# This single step runs both unit and integration tests, then merges their
|
||||
# coverage data into a single report. It combines the environment variables
|
||||
# needed for both test suites.
|
||||
env:
|
||||
# --- Database credentials for both test suites ---
|
||||
DB_HOST: ${{ secrets.DB_HOST }}
|
||||
DB_PORT: ${{ secrets.DB_PORT }}
|
||||
DB_USER: ${{ secrets.DB_USER }}
|
||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||
DB_DATABASE: "flyer-crawler-test"
|
||||
DB_NAME: "flyer-crawler-test"
|
||||
JWT_SECRET: "test-secret-for-ci"
|
||||
|
||||
# Auth dummies (Previous fix)
|
||||
# --- Integration test specific variables ---
|
||||
JWT_SECRET: "test-secret-for-ci"
|
||||
GOOGLE_CLIENT_ID: "dummy_client_id"
|
||||
GOOGLE_CLIENT_SECRET: "dummy_client_secret"
|
||||
GITHUB_CLIENT_ID: "dummy_github_id"
|
||||
GITHUB_CLIENT_SECRET: "dummy_github_secret"
|
||||
FRONTEND_URL: "http://localhost:3000"
|
||||
|
||||
# ✅ NEW: Provide the full backend URL for the Node.js test environment
|
||||
VITE_API_BASE_URL: "http://localhost:3001/api"
|
||||
|
||||
# ✅ NEW: Backend requires this to start
|
||||
GEMINI_API_KEY: ${{ secrets.VITE_GOOGLE_GENAI_API_KEY }}
|
||||
|
||||
run: npm run test:integration
|
||||
run: npm run test:coverage
|
||||
|
||||
- name: Archive Code Coverage Report
|
||||
# This action saves the generated HTML coverage report as a downloadable artifact.
|
||||
|
||||
Reference in New Issue
Block a user