Skip to content

Conversation

@AaronDDM
Copy link
Collaborator

@AaronDDM AaronDDM commented Oct 1, 2025

This PR migrates the test suite from Jest to Vitest and integrates Cloudflare Workers (Miniflare) testing into the CI pipeline.

Key Changes:

  • Replaced Jest with Vitest: All Jest dependencies and configurations have been removed, and Vitest is now the primary test runner.
  • Dual Test Environments: Configured Vitest to run tests in two environments:
    • Standard Node.js (for existing SDK tests).
    • Cloudflare Workers (using Miniflare via @cloudflare/vitest-pool-workers) to ensure compatibility with Workers environments.
  • GitHub Actions Update: The pull-request.yml workflow now runs tests for both Node.js and Cloudflare Workers, ensuring comprehensive coverage across target platforms.
  • Test File Conversion: All existing test files have been converted from Jest syntax to Vitest's equivalent APIs.

This change modernizes the testing infrastructure and expands test coverage to critical Cloudflare Workers environments.

License

I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.


Open in Cursor Open in Web

This commit updates the GitHub Actions workflow to use the latest versions of actions/checkout and actions/setup-node. It also migrates the testing framework from Jest to Vitest, which includes updating relevant dependencies and configurations.

Co-authored-by: aaron.d <aaron.d@nylas.com>
@cursor
Copy link

cursor bot commented Oct 1, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

…and Cloudflare Workers testing. Updated job matrix to include test types and conditional steps for linting and testing based on the environment.
…ks, allowing all jobs to complete regardless of failures.
@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.79%. Comparing base (2bd4fc7) to head (81c25b1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #676      +/-   ##
==========================================
+ Coverage   96.42%   96.79%   +0.36%     
==========================================
  Files          37       38       +1     
  Lines         812     2342    +1530     
  Branches       72      299     +227     
==========================================
+ Hits          783     2267    +1484     
- Misses         26       73      +47     
+ Partials        3        2       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This commit updates the Vitest configuration to use Cloudflare Workers settings and improves the global fetch mock for API testing. It also removes the outdated GitHub Actions workflow and the script for converting tests to Vitest, streamlining the testing process. Additionally, the setup for Miniflare tests has been enhanced to better simulate the Cloudflare Workers environment.
@AaronDDM AaronDDM force-pushed the cursor/migrate-tests-to-vitest-and-configure-miniflare-integration-1910 branch from 5c0740d to 8708401 Compare October 2, 2025 19:11
This commit updates the Vitest configuration to exclude Node.js-specific tests incompatible with the Workers environment. It also refines the fetch wrapper to intelligently detect the environment, using native Web APIs in Workers and falling back to node-fetch in Node.js. Additionally, several test files have been updated to replace deprecated lifecycle methods with their modern counterparts, improving overall test consistency and readability.
This commit updates the fetch wrapper to utilize dynamic imports for compatibility with CommonJS (CJS) builds. It modifies the environment detection logic to use global objects directly, ensuring proper functionality in both Workers and Node.js environments. Additionally, type exports have been adjusted to provide clearer type aliases for Web API types.
…ility

This commit modifies the fetchWrapper-workers test suite to remove the conditional skipping of tests based on the environment. It enhances header checks to be case-insensitive and updates body handling to account for differences between Workers and Node.js. Additionally, the test for global Web APIs has been renamed for clarity, ensuring better compatibility and readability across environments.
This commit enhances the formatting of the fetchWrapper-workers test suite by standardizing the alignment of header checks and removing unnecessary blank lines. These changes improve the overall readability of the tests while maintaining their functionality across different environments.
This commit introduces a new 'lint' job in the GitHub Actions workflow to run lint and Prettier checks separately from the test jobs. The linting steps include setting up Node.js, installing dependencies, and executing lint checks, improving the clarity and organization of the CI process. Additionally, the previous lint checks have been removed from the test job to streamline the workflow.
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.

3 participants