Skip to content

Fix Vitest Test Environment and Health Monitor Runtime Errors#37

Open
daggerstuff wants to merge 4 commits intostagingfrom
fix-vitest-environment-13398122599881524459
Open

Fix Vitest Test Environment and Health Monitor Runtime Errors#37
daggerstuff wants to merge 4 commits intostagingfrom
fix-vitest-environment-13398122599881524459

Conversation

@daggerstuff
Copy link
Owner

This PR fixes several issues that were preventing the unit test suite from running:

  1. Config Pathing: Vitest config aliases were using paths relative to the root instead of the config directory.
  2. Missing Globals: Modern tests require TextEncoder, TextDecoder, and fetch which were missing in the test environment.
  3. Runtime Errors: HealthMonitor had invalid variable references in catch blocks.
  4. Environment Gap: Required environment variables like ENCRYPTION_KEY were missing during test execution.

After these changes, pnpm test:unit executes correctly.


PR created automatically by Jules for task 13398122599881524459 started by @daggerstuff

- Corrected path aliases in `config/vitest.config.ts` to use relative paths (`../src`)
- Moved CI thread configuration out of `poolOptions` for Vitest compatibility
- Fixed runtime reference errors (`_error`, `_String`) in `src/lib/services/health-monitor.ts`
- Created `vitest.setup.ts` in root with `TextEncoder`, `TextDecoder`, and `fetch` mocks
- Set default test environment variables (`ENCRYPTION_KEY`, `PUBLIC_URL`) in setup file

These changes ensure that `pnpm test:unit` can successfully load and execute the test suite.

Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pixelated Error Error Mar 5, 2026 1:49am

- Corrected path aliases and setup file references in `config/vitest.config.ts` to use proper relative paths (`../`)
- Moved CI thread configuration to top-level `test` object for Vitest version compatibility
- Fixed syntax errors in `src/lib/services/health-monitor.ts` (`_error` -> `error`, `_String` -> `String`)
- Created `vitest.setup.ts` in root with required `TextEncoder`, `TextDecoder`, and `fetch` mocks
- Resolved CodeQL CI failures by fixing malformed `qlpack.yml` and hardening workflow configuration
- Transitioned CodeQL config to use the `packs` key for better language-specific analysis control
- Removed deprecated `setup-python-dependencies` from CodeQL workflow

Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
- Resolved Vitest environment issues by correcting path aliases and setup file references in `config/vitest.config.ts`.
- Implemented `vitest.setup.ts` to provide necessary `TextEncoder`, `TextDecoder`, and `fetch` mocks for JSDOM.
- Fixed critical syntax errors in `src/lib/services/health-monitor.ts` that caused runtime crashes.
- Resolved CodeQL CI failures:
  - Fixed "Cannot deserialize" error by removing invalid `suites` block in `qlpack.yml`.
  - Fixed "package without scope" error by removing incorrect `packs` section in `codeql-config.yml`.
  - Fixed "invalid package specification" in Python jobs by implementing robust conditional query loading in the workflow.
  - Streamlined `queries` configuration to correctly load standard suites and custom JavaScript-specific queries.
- Removed deprecated `setup-python-dependencies` from the CodeQL workflow.

These changes ensure the CI pipeline completes successfully and the unit test suite correctly initializes and executes.

Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
- Synchronized `PNPM_VERSION` to `10.30.1` across all GitHub workflows to match `package.json`.
- Resolved Vitest environment issues by correcting relative path aliases and setup file references in `config/vitest.config.ts`.
- Implemented `vitest.setup.ts` with required `TextEncoder`, `TextDecoder`, and `fetch` mocks for JSDOM stability.
- Fixed critical syntax and reference errors in `src/lib/services/health-monitor.ts` (`_error` -> `error`, `_String` -> `String`).
- Resolved CodeQL CI failures:
  - Removed malformed `suites` from `qlpack.yml` and incorrect `packs` from `codeql-config.yml`.
  - Implemented robust conditional loading of custom queries in the CodeQL workflow to prevent failures in Python analysis jobs.
  - Corrected query suite specification format to avoid "invalid package specification" errors.

These changes stabilize the CI pipeline, ensure correct security analysis across languages, and allow the unit test suite to execute successfully.

Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com>
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