Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates the testing framework from Jest to Vitest, involving updates to dependencies, test scripts, and mock implementations across the codebase. Feedback includes identifying a missing @vitest/coverage-v8 dependency required for coverage reports, suggesting that coverage be explicitly enabled in the configuration to maintain parity with the previous setup, and recommending the use of expect.fail in test utilities to ensure clearer error messages when expected failures do not occur.
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
…kers Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
…t outside try/catch Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
10fb31f to
d9be6a5
Compare
There was a problem hiding this comment.
Pull request overview
Migrates the repository’s test tooling from Jest/ts-jest to Vitest, updating configuration and adapting the existing test suite (plus adding a worker-level integration test suite for the example Cloudflare Worker).
Changes:
- Replaced
jest.config.tswith a rootvitest.config.ts(aliases, includes, coverage settings). - Updated test files to use
vi.*APIs and adjusted TS test typings (Vitest globals). - Added a Vitest-based test setup for
examples/js-workerand wired it into CI.
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
vitest.config.ts |
Adds root Vitest configuration (aliasing, test glob, coverage settings). |
packages/js-ofrep-worker/tsconfig.spec.json |
Switches test typings from Jest to Vitest globals. |
packages/js-ofrep-worker/test/r2Path.spec.ts |
Migrates mocks/spies/restores from jest.* to vi.*. |
packages/js-ofrep-worker/test/ofrep-contract.spec.ts |
Migrates fake timers from jest.* to vi.*. |
packages/js-ofrep-worker/test/invalid-config-test-utils.ts |
Reworks invalid-config assertion helper to avoid Jest-only fail() usage. |
packages/js-ofrep-worker/package.json |
Updates package test script to run Vitest with the root config. |
package.json |
Replaces root jest script/deps with vitest, adds test:worker script and coverage plugin dep. |
jest.config.ts |
Removes Jest configuration. |
examples/js-worker/vitest.config.mts |
Adds Vitest config using Cloudflare’s workers pool plugin. |
examples/js-worker/test/worker.spec.ts |
Adds integration tests for the example worker’s endpoints and behavior. |
examples/js-worker/test/tsconfig.json |
Adds test TS config for the example worker test directory. |
examples/js-worker/test/env.d.ts |
Adds Cloudflare workers env typing augmentation for tests. |
examples/js-worker/package.json |
Adds vitest run test script and Cloudflare pool dev dependency. |
.github/workflows/ci.yml |
Runs the new example worker test suite in CI (npm run test:worker). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
/gemini review |
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
There was a problem hiding this comment.
Code Review
This pull request migrates the project's testing framework from Jest to Vitest. The changes include replacing Jest configurations and dependencies with Vitest equivalents, updating test scripts in various package.json files, and refactoring test utilities and specs to use Vitest's vi utility instead of jest. Additionally, a comprehensive test suite and specific Vitest configuration were added for the js-worker example. Feedback suggests improving consistency in workspace script naming and generalizing the test inclusion pattern in the root Vitest configuration to better support the monorepo structure.
…attern Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Signed-off-by: Jonathan Norris <jonathan.norris@dynatrace.com>
Summary
jest.config.ts, addvitest.config.tswith equivalent alias, coverage, and glob configjest.fn()/jest.spyOn()/jest.useFakeTimers()calls tovi.*equivalents in 3 test filesMotivation
Vitest is faster, has native TypeScript/ESM support (no ts-jest/ts-node needed), and reduces the devDependency footprint. The test API is nearly identical to Jest with
globals: true, so the migration is minimal.